public static TypeMappingDescriptor<Project> MapProject(TypeMappingDescriptor<Project> m) => m .Properties(props => props .String(s => s .Name(p => p.Name) .NotAnalyzed() .Fields(fs => fs .String(ss => ss.Name("standard").Analyzer("standard")) .Completion(cm => cm.Name("suggest")) ) ) .Date(d => d.Name(p => p.StartedOn)) .String(d => d .Name(p => p.State) .NotAnalyzed() .Fields(fs => fs .String(st => st.Name("offsets").IndexOptions(IndexOptions.Offsets)) ) ) .Nested<Tag>(mo => mo .Name(p => p.Tags) .Properties(TagProperties) ) .Object<Developer>(o => o .Name(p => p.LeadDeveloper) .Properties(DeveloperProperties) ) .GeoPoint(g => g.Name(p => p.Location)) .Completion(cm => cm .Name(p => p.Suggest) .Payloads() .Context(cnt => cnt .Category("color", cat => cat .Default("red") ) ) ) );
public TypeMappingDescriptor <Customer> GetMapper() { TypeMappingDescriptor <Customer> mapper = new TypeMappingDescriptor <Customer>(); return(mapper.Properties(ps => ps.Text(t => t.Name(n => n.Email).Fields(ff => ff.Text(tt => tt.Name("emailanalyzer").Analyzer("custom_email_analyzer")))))); }
public override TypeMappingDescriptor <PersistentEvent> ConfigureIndexMapping(TypeMappingDescriptor <PersistentEvent> map) { var mapping = map .Dynamic(false) .DynamicTemplates(dt => dt .DynamicTemplate("idx_bool", t => t.Match("*-b").Mapping(m => m.Boolean(s => s))) .DynamicTemplate("idx_date", t => t.Match("*-d").Mapping(m => m.Date(s => s))) .DynamicTemplate("idx_number", t => t.Match("*-n").Mapping(m => m.Number(s => s.Type(NumberType.Double)))) .DynamicTemplate("idx_reference", t => t.Match("*-r").Mapping(m => m.Keyword(s => s.IgnoreAbove(256)))) .DynamicTemplate("idx_string", t => t.Match("*-s").Mapping(m => m.Keyword(s => s.IgnoreAbove(1024))))) .Properties(p => p .SetupDefaults() .Keyword(f => f.Name(e => e.Id)) .Keyword(f => f.Name(e => e.OrganizationId)) .FieldAlias(a => a.Name(Alias.OrganizationId).Path(f => f.OrganizationId)) .Keyword(f => f.Name(e => e.ProjectId)) .FieldAlias(a => a.Name(Alias.ProjectId).Path(f => f.ProjectId)) .Keyword(f => f.Name(e => e.StackId)) .FieldAlias(a => a.Name(Alias.StackId).Path(f => f.StackId)) .Keyword(f => f.Name(e => e.ReferenceId)) .FieldAlias(a => a.Name(Alias.ReferenceId).Path(f => f.ReferenceId)) .Text(f => f.Name(e => e.Type).Analyzer(LOWER_KEYWORD_ANALYZER).AddKeywordField()) .Text(f => f.Name(e => e.Source).Analyzer(LOWER_KEYWORD_ANALYZER).AddKeywordField()) .Date(f => f.Name(e => e.Date)) .Text(f => f.Name(e => e.Message)) .Text(f => f.Name(e => e.Tags).Analyzer(LOWER_KEYWORD_ANALYZER).Boost(1.2).AddKeywordField()) .FieldAlias(a => a.Name(Alias.Tags).Path(f => f.Tags)) .GeoPoint(f => f.Name(e => e.Geo)) .Scalar(f => f.Value) .Scalar(f => f.Count) .Boolean(f => f.Name(e => e.IsFirstOccurrence)) .FieldAlias(a => a.Name(Alias.IsFirstOccurrence).Path(f => f.IsFirstOccurrence)) .Boolean(f => f.Name(e => e.IsFixed)) .FieldAlias(a => a.Name(Alias.IsFixed).Path(f => f.IsFixed)) .Boolean(f => f.Name(e => e.IsHidden)) .FieldAlias(a => a.Name(Alias.IsHidden).Path(f => f.IsHidden)) .Object <object>(f => f.Name(e => e.Idx).Dynamic()) .Object <DataDictionary>(f => f.Name(e => e.Data).Properties(p2 => p2 .AddVersionMapping() .AddLevelMapping() .AddSubmissionMethodMapping() .AddSubmissionClientMapping() .AddLocationMapping() .AddRequestInfoMapping() .AddErrorMapping() .AddSimpleErrorMapping() .AddEnvironmentInfoMapping() .AddUserDescriptionMapping() .AddUserInfoMapping())) .AddCopyToMappings() .AddDataDictionaryAliases() ); if (Options != null && Options.EnableMapperSizePlugin) { return(mapping.SizeField(s => s.Enabled())); } return(mapping); }
protected override TypeMappingDescriptor <CategoryDocument> BuildTypeMapDescriptor(CultureInfo cultureInfo, TypeMappingDescriptor <CategoryDocument> descriptor) { return(base.BuildTypeMapDescriptor(cultureInfo, descriptor)); }
public virtual TypeMappingDescriptor <T> BuildMapping(TypeMappingDescriptor <T> map) { return(map.Properties(p => p.SetupDefaults())); }
private static TypeMappingDescriptor <Group> GroupMapper(TypeMappingDescriptor <Group> mapper) => mapper.AutoMap();
private static ITypeMapping SetupMapping(TypeMappingDescriptor <Doc> typeMapping) { return(typeMapping.Properties(SetupProperties)); }
private static TypeMappingDescriptor <SearchableItem <T> > SearchableItemMapper <T>(TypeMappingDescriptor <SearchableItem <T> > map) where T : class => map .AllField(x => x.Enabled(false)) .Properties(ps => ps .Object <T>(x => x.Name(p => p.Data).Enabled(false).IncludeInAll(false)) .Text(t => t.Name(p => p.Text)) .Text(t => t.Name(p => p.BoostedText).Boost(2)) .Keyword(k => k.Name(p => p.Type)) .Nested <Attributes <int> >(n => n .Name(p => p.IntFilters) .Properties(pps => pps .Keyword(x => x.Name(p => p.Name)) .Number(x => x.Name(p => p.Value)) ) ) .Nested <Attributes <string> >(n => n .Name(p => p.StringFilters) .Properties(pps => pps .Keyword(x => x.Name(p => p.Name)) .Keyword(x => x.Name(p => p.Value) .Fields(f => f.Text(t => t.Name("lowercase").Analyzer(LowercaseKeywordAnalyserName)))) ) ) .Nested <Attributes <DateTime> >(n => n .Name(p => p.DateFilters) .Properties(pps => pps .Keyword(x => x.Name(p => p.Name)) .Keyword(x => x.Name(p => p.Value)) ) ) .Nested <Attributes <bool> >(n => n .Name(p => p.BooleanFilters) .Properties(pps => pps .Keyword(x => x.Name(p => p.Name)) .Boolean(x => x.Name(p => p.Value)) ) ) .Nested <Attributes <decimal> >(n => n .Name(p => p.DecimalFilters) .Properties(pps => pps .Keyword(x => x.Name(p => p.Name)) .Number(x => x.Name(p => p.Value)) ) ) );