private static PutMappingDescriptor <TechnicalProduct> MapTechnicalProduct(PutMappingDescriptor <TechnicalProduct> m, string indexName) { return(m .Index(indexName) .Type("technicalProducts") .DateDetection() .NumericDetection() .DynamicDateFormats(new[] { "dateOptionalTime", "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z" }) .Dynamic(false) .IdField(i => i .Index("not_analyzed") .Store() ) .Properties(o => o .String(i => i .Name(x => x.Name) .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) .String(i => i .Name(x => x.Brand) .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) )); }
public void CreateIndex() { if (indexQuery.IsExists(Constants.SlambyProcessesIndex)) { return; } var client = elasticClientFactory.GetClient(); var descriptor = new CreateIndexDescriptor(Constants.SlambyProcessesIndex); descriptor .Settings(s => s. NumberOfReplicas(0) .NumberOfShards(1)) .Mappings(m => m .Map <ProcessElastic>(mm => mm.AutoMap().Dynamic(false)) ); var createResp = client.CreateIndex(descriptor); ResponseValidator(createResp); var propDesc = new PropertiesDescriptor <ProcessElastic>(); propDesc.Object <object>(s => s.Name(ProcessElastic.InitObjectMappingName).Dynamic(true)); var putMappingDesc = new PutMappingDescriptor <ProcessElastic>() .Index(Constants.SlambyProcessesIndex) .Dynamic(DynamicMapping.Strict) .Properties(p => propDesc); var mapResp = client.Map <DocumentElastic>(p => putMappingDesc); ResponseValidator(mapResp); }
private static PutMappingDescriptor<TechnicalProduct> MapTechnicalProduct(PutMappingDescriptor<TechnicalProduct> m, string indexName) { return m .Index(indexName) .Type("technicalProducts") .DateDetection() .NumericDetection() .DynamicDateFormats(new[] { "dateOptionalTime", "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z" }) .Dynamic(false) .IdField(i => i .SetIndex("not_analyzed") .SetStored() ) .Properties(o => o .String(i => i .Name(x => x.Name) .Index(FieldIndexOption.analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) .String(i => i .Name(x => x.Brand) .Index(FieldIndexOption.analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) ); }
public override PutMappingDescriptor <Stack> BuildMapping(PutMappingDescriptor <Stack> map) { const string SET_FIXED_SCRIPT = @"ctx._source['fixed'] = !!ctx._source['date_fixed']"; return(map .Type(Name) .Dynamic(DynamicMappingOption.Ignore) .Transform(t => t.Script(SET_FIXED_SCRIPT).Language(ScriptLang.Groovy)) .IncludeInAll(false) .Properties(p => p .SetupDefaults() .String(f => f.Name(s => s.OrganizationId).IndexName(Fields.OrganizationId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(s => s.ProjectId).IndexName(Fields.ProjectId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(s => s.SignatureHash).IndexName(Fields.SignatureHash).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Type).IndexName(Fields.Type).Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(s => s.FirstOccurrence).IndexName(Fields.FirstOccurrence)) .Date(f => f.Name(s => s.LastOccurrence).IndexName(Fields.LastOccurrence)) .String(f => f.Name(s => s.Title).IndexName(Fields.Title).Index(FieldIndexOption.Analyzed).IncludeInAll().Boost(1.1)) .String(f => f.Name(s => s.Description).IndexName(Fields.Description).Index(FieldIndexOption.Analyzed).IncludeInAll()) .String(f => f.Name(s => s.Tags).IndexName(Fields.Tags).Index(FieldIndexOption.Analyzed).IncludeInAll().Boost(1.2)) .String(f => f.Name(s => s.References).IndexName(Fields.References).Index(FieldIndexOption.Analyzed).IncludeInAll()) .Date(f => f.Name(s => s.DateFixed).IndexName(Fields.DateFixed)) .Boolean(f => f.Name(Fields.IsFixed)) .Boolean(f => f.Name(s => s.IsHidden).IndexName(Fields.IsHidden)) .Boolean(f => f.Name(s => s.IsRegressed).IndexName(Fields.IsRegressed)) .Boolean(f => f.Name(s => s.OccurrencesAreCritical).IndexName(Fields.OccurrencesAreCritical)) .Number(f => f.Name(s => s.TotalOccurrences).IndexName(Fields.TotalOccurrences)) )); }
public override PutMappingDescriptor <Child> BuildMapping(PutMappingDescriptor <Child> map) { return(base.BuildMapping(map .SetParent <Parent>() .Properties(p => p .String(c => c.Name(f => f.ParentId).Index(FieldIndexOption.NotAnalyzed)) ))); }
private PutMappingDescriptor <T> MapSuppressedEmailCompletionFields <T>(PutMappingDescriptor <T> pmd) where T : SuppressedEmail { return(pmd .Properties(props => props .String(s => s.Name("email").Index(FieldIndexOption.NotAnalyzed).Store(true).IndexAnalyzer("duplicateCheckAnalyzer").SearchAnalyzer("duplicateCheckAnalyzer"))) .TimestampField(t => t .Enabled(true))); }
public override PutMappingDescriptor <Identity> BuildMapping(PutMappingDescriptor <Identity> map) { return(map .Type(Name) .Dynamic(false) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName(Fields.Id).Index(FieldIndexOption.NotAnalyzed)) )); }
public Nest.RootObjectMapping GetRootMapping() { PutMappingDescriptor <GenericJsonItem> putMappingRequest = new PutMappingDescriptor <GenericJsonItem>(ElasticClientWrapper.ConnectionSettings); putMappingRequest.MapFromAttributes(); putMappingRequest.TimestampField(t => t.Enabled().Path("date")); putMappingRequest.Type(Type.Name); return(((IPutMappingRequest)putMappingRequest).Mapping); }
public override PutMappingDescriptor <Application> BuildMapping(PutMappingDescriptor <Application> map) { return(map .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .SetupDefaults() .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) )); }
private PutMappingDescriptor<Application> GetApplicationMap(PutMappingDescriptor<Application> map){ return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) ); }
public void PutMappingAlsoAdheresToMaxRecursion() { var descriptor = new PutMappingDescriptor <A>().AutoMap(); var expected = new { properties = new { child = new { properties = new { }, type = "object" } } }; Expect(expected).WhenSerializing((IPutMappingRequest)descriptor); var withMaxRecursionDescriptor = new PutMappingDescriptor <A>().AutoMap(3); var expectedWithMaxRecursion = new { properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { } } } } } } } } } }; Expect(expectedWithMaxRecursion).WhenSerializing((IPutMappingRequest)withMaxRecursionDescriptor); }
private PutMappingDescriptor <Application> GetApplicationMap(PutMappingDescriptor <Application> map) { return(map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) )); }
public override PutMappingDescriptor <LogEvent> BuildMapping(PutMappingDescriptor <LogEvent> map) { return(map .Type(Name) .Dynamic(false) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName(Fields.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyId).IndexName(Fields.CompanyId).Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(e => e.CreatedUtc).IndexName(Fields.CreatedUtc)) )); }
public override PutMappingDescriptor <Organization> BuildMapping(PutMappingDescriptor <Organization> map) { return(base.BuildMapping(map) .Dynamic(false) .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(u => u.Name).Index(FieldIndexOption.Analyzed).IndexName("name").IncludeInAll()) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) .Object <Invite>(f => f.Name(o => o.Invites.First()).RootPath().Properties(ip => ip .String(fu => fu.Name(i => i.Token).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.InviteToken)))) )); }
private PutMappingDescriptor <ElasticsearchLocation> GetLocationsMapping(IConnectionSettingsValues connectionSettings) { var mapping = new PutMappingDescriptor <ElasticsearchLocation>(connectionSettings) .MapFromAttributes() .TimestampField(t => t.Enabled(true)) .Properties(p => p .String(s => s .Name(l => l.HierarchyPath) .Index(FieldIndexOption.NotAnalyzed)) .MultiField(mf => mf .Name(l => l.Country) .Fields(fs => fs .String(s => s.Name(l => l.Country).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.Country.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .MultiField(mf => mf .Name(l => l.Division1) .Fields(fs => fs .String(s => s.Name(l => l.Division1).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.Division1.Suffix("shingle")).Analyzer("location_analyzer")) .String(s => s.Name(l => l.Division1.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .MultiField(mf => mf .Name(l => l.Division2) .Fields(fs => fs .String(s => s.Name(l => l.Division2).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.Division2.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .MultiField(mf => mf .Name(l => l.Division3) .Fields(fs => fs .String(s => s.Name(l => l.Division3).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.Division3.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .MultiField(mf => mf .Name(l => l.Division4) .Fields(fs => fs .String(s => s.Name(l => l.Division4).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.Division4.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .MultiField(mf => mf .Name(l => l.City) .Fields(fs => fs .String(s => s.Name(l => l.City.Suffix("lowercase")).Analyzer("lowercase")) .String(s => s.Name(l => l.City.Suffix("shingle")).Analyzer("location_analyzer")) .String(s => s.Name(l => l.City).Index(FieldIndexOption.Analyzed)) .String(s => s.Name(l => l.City.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))) .Completion(c => c .Name(l => l.Suggest) .IndexAnalyzer("suggestion_analyzer") .SearchAnalyzer("suggestion_analyzer") .Payloads(true) .Context(ct => ct.Category("country_ctx", ctx => ctx.Default("none").Path(path => path.CountryCtx)) ) .MaxInputLength(50))); return(mapping); }
protected void ModifyMetadataCore(PutMappingDescriptor <TType> descriptor) { var additionalMetadata = ModifyMetadata(); descriptor.Meta(m => { foreach (var metadata in CoreMetadata.Union(additionalMetadata)) { m.Add(metadata.Key, metadata.Value); } return(m); }); }
public override PutMappingDescriptor <WebHook> BuildMapping(PutMappingDescriptor <WebHook> map) { return(map .Type(Name) .Dynamic() .Properties(p => p .SetupDefaults() .String(f => f.Name(e => e.OrganizationId).IndexName(Fields.OrganizationId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName(Fields.ProjectId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Url).IndexName(Fields.Url).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.EventTypes).IndexName(Fields.EventTypes).Index(FieldIndexOption.NotAnalyzed)) )); }
public override PutMappingDescriptor <Employee> BuildMapping(PutMappingDescriptor <Employee> map) { return(base.BuildMapping(map .Dynamic(false) .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .SetupDefaults() .String(f => f.Name(e => e.Id).IndexName(Fields.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyId).IndexName(Fields.CompanyId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyName).IndexName(Fields.CompanyName).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Name).Index(FieldIndexOption.Analyzed)) .Number(f => f.Name(e => e.Age).IndexName(Fields.Age)) ))); }
private PutMappingDescriptor <ElasticsearchCategory> GetCategoryMapping(IConnectionSettingsValues connectionSettings) { var mapping = new PutMappingDescriptor <ElasticsearchCategory>(connectionSettings) .MapFromAttributes() .TimestampField(t => t.Enabled(true)) .Properties(p => p .MultiField(mf => mf .Name(l => l.Name) .Fields(fs => fs .String(s => s.Name(l => l.Name).IndexAnalyzer("autocompletenative")) .String(s => s.Name(l => l.Name.Suffix("raw")).IndexAnalyzer("autocomplete"))))); return(mapping); }
private PutMappingDescriptor <WebHook> GetWebHookMap(PutMappingDescriptor <WebHook> map) { return(map .Index(VersionedName) .Dynamic() .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName("project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Url).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.EventTypes).IndexName("types").Index(FieldIndexOption.NotAnalyzed)) )); }
public override PutMappingDescriptor <Models.Token> BuildMapping(PutMappingDescriptor <Models.Token> map) { return(map .Dynamic(false) .IncludeInAll(false) .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(u => u.OrganizationId).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.OrganizationId)) .String(f => f.Name(u => u.UserId).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.UserId)) .Date(f => f.Name(u => u.CreatedUtc).IndexName(Fields.CreatedUtc)) .Date(f => f.Name(u => u.UpdatedUtc).IndexName(Fields.UpdatedUtc)) .Date(f => f.Name(u => u.Refresh).IndexName(Fields.Refresh)) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) )); }
private PutMappingDescriptor<Employee> GetEmployeeMap(PutMappingDescriptor<Employee> map) { return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName(Fields.Employee.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyId).IndexName(Fields.Employee.CompanyId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyName).IndexName(Fields.Employee.CompanyName).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Employee.Name).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(e => e.Age).IndexName(Fields.Employee.Age)) .Date(f => f.Name(e => e.CreatedUtc).IndexName(Fields.Employee.CreatedUtc)) .Date(f => f.Name(e => e.UpdatedUtc).IndexName(Fields.Employee.UpdatedUtc)) ); }
public override PutMappingDescriptor <User> BuildMapping(PutMappingDescriptor <User> map) { return(map .Dynamic(false) .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(u => u.EmailAddress).IndexName(Fields.EmailAddress).Analyzer("keyword_lowercase")) .String(f => f.Name(u => u.PasswordResetToken).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.PasswordResetToken)) .String(f => f.Name(u => u.VerifyEmailAddressToken).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.VerifyEmailAddressToken)) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) .Object <OAuthAccount>(f => f.Name(o => o.OAuthAccounts.First()).RootPath().Properties(mp => mp .String(fu => fu.Name(m => m.ProviderUserId).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.OAuthAccountProviderUserId)))) .Object <Membership>(f => f.Name(o => o.Memberships.First()).RootPath().Properties(mp => mp.String(fu => fu.Name(m => m.OrganizationId).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.MembershipOrganizationId)))) )); }
private PutMappingDescriptor <TContact> MapTagCompletionFields <TContact>( PutMappingDescriptor <TContact> tmd) where TContact : Tag { return(tmd.Properties(props => props .Completion(s => s .Name(p => p.TagNameAutoComplete) .IndexAnalyzer("custom") .SearchAnalyzer("custom") .MaxInputLength(75) .Payloads() .PreservePositionIncrements() .PreserveSeparators() ) )); }
private PutMappingDescriptor <Employee> GetEmployeeMap(PutMappingDescriptor <Employee> map) { return(map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.UpdatedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.Id).IndexName(Fields.Employee.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyId).IndexName(Fields.Employee.CompanyId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.CompanyName).IndexName(Fields.Employee.CompanyName).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Employee.Name).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(e => e.Age).IndexName(Fields.Employee.Age)) .Date(f => f.Name(e => e.CreatedUtc).IndexName(Fields.Employee.CreatedUtc)) .Date(f => f.Name(e => e.UpdatedUtc).IndexName(Fields.Employee.UpdatedUtc)) )); }
protected virtual void CodeBasedSerializes() { var descriptor = new PutMappingDescriptor <T>().Properties(FluentProperties); if (this.AutoMap) { descriptor.AutoMap(); } Expect(ExpectJson) .WhenSerializing(descriptor as IPutMappingRequest); if (ExpectJsonFluentOnly != null) { Expect(ExpectJsonFluentOnly) .WhenSerializing(new PutMappingDescriptor <T>().Properties(FluentOnlyProperties) as IPutMappingRequest); } }
private PutMappingDescriptor <Project> GetProjectMap(PutMappingDescriptor <Project> map) { return(map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .Date(f => f.Name(e => e.ModifiedUtc).IndexName("modified")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PromotedTabs).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.CustomContent).Index(FieldIndexOption.No)) .Object <ClientConfiguration>(f => f.Name(u => u.Configuration).Dynamic(false)) .Object <Dictionary <string, NotificationSettings> >(f => f.Name(u => u.NotificationSettings).Dynamic(false)) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) )); }
public override PutMappingDescriptor <Project> BuildMapping(PutMappingDescriptor <Project> map) { return(map .Type(Name) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .SetupDefaults() .Date(f => f.Name(e => e.ModifiedUtc).IndexName(Fields.ModifiedUtc)) .String(f => f.Name(e => e.OrganizationId).IndexName(Fields.OrganizationId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Name).Index(FieldIndexOption.Analyzed)) .String(f => f.Name(u => u.PromotedTabs).IndexName(Fields.PromotedTabs).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.CustomContent).IndexName(Fields.CustomContent).Index(FieldIndexOption.No)) .Object <ClientConfiguration>(f => f.Name(u => u.Configuration).Dynamic(false)) .Object <Dictionary <string, NotificationSettings> >(f => f.Name(u => u.NotificationSettings).Dynamic(false)) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) )); }
private PutMappingDescriptor <Organization> GetOrganizationMap(PutMappingDescriptor <Organization> map) { return(map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName(Fields.Organization.CreatedUtc)) .Date(f => f.Name(e => e.ModifiedUtc).IndexName(Fields.Organization.ModifiedUtc)) .String(f => f.Name(e => e.Id).IndexName(Fields.Organization.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Organization.Name).Index(FieldIndexOption.Analyzed)) .String(f => f.Name(u => u.StripeCustomerId).IndexName("stripe").Index(FieldIndexOption.NotAnalyzed)) .Boolean(f => f.Name(u => u.HasPremiumFeatures).IndexName("premium")) .String(f => f.Name(u => u.PlanId).IndexName(Fields.Organization.PlanId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PlanName).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PlanDescription).Index(FieldIndexOption.No)) .String(f => f.Name(u => u.CardLast4).Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(u => u.SubscribeDate).IndexName(Fields.Organization.SubscribeDate)) .Number(f => f.Name(u => u.BillingStatus).IndexName(Fields.Organization.BillingStatus)) .String(f => f.Name(u => u.BillingChangedByUserId).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(u => u.BillingPrice).IndexName(Fields.Organization.BillingPrice)) .Boolean(f => f.Name(u => u.IsSuspended).IndexName(Fields.Organization.IsSuspended)) .String(f => f.Name(u => u.SuspendedByUserId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.SuspensionNotes).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(u => u.RetentionDays).IndexName("retention")) .Object <DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) .Object <Invite>(f => f.Name(o => o.Invites.First()).RootPath().Properties(ip => ip .String(fu => fu.Name(i => i.Token).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.Organization.InviteToken)) .String(fu => fu.Name(i => i.EmailAddress).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.Organization.InviteEmail)))) .Object <UsageInfo>(ui => ui.Name(o => o.Usage.First()).RootPath().Properties(ip => ip .Date(fu => fu.Name(i => i.Date).IndexName(Fields.Organization.UsageDate)) .Number(fu => fu.Name(i => i.Total).IndexName(Fields.Organization.UsageTotal)) .Number(fu => fu.Name(i => i.Blocked).IndexName(Fields.Organization.UsageBlocked)) .Number(fu => fu.Name(i => i.Limit).IndexName(Fields.Organization.UsageLimit)) .Number(fu => fu.Name(i => i.TooBig).IndexName(Fields.Organization.UsageTooBig)))) .Object <UsageInfo>(ui => ui.Name(o => o.OverageHours.First()).RootPath().Properties(ip => ip .Date(fu => fu.Name(i => i.Date).IndexName(Fields.Organization.OverageHoursDate)) .Number(fu => fu.Name(i => i.Total).IndexName(Fields.Organization.OverageHoursTotal)) .Number(fu => fu.Name(i => i.Blocked).IndexName(Fields.Organization.OverageHoursBlocked)) .Number(fu => fu.Name(i => i.Limit).IndexName(Fields.Organization.OverageHoursLimit)) .Number(fu => fu.Name(i => i.TooBig).IndexName(Fields.Organization.OverageHoursTooBig)))) )); }
private PutMappingDescriptor<Organization> GetOrganizationMap(PutMappingDescriptor<Organization> map){ return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName(Fields.Organization.CreatedUtc)) .Date(f => f.Name(e => e.ModifiedUtc).IndexName(Fields.Organization.ModifiedUtc)) .String(f => f.Name(e => e.Id).IndexName(Fields.Organization.Id).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Name).IndexName(Fields.Organization.Name).Index(FieldIndexOption.Analyzed)) .String(f => f.Name(u => u.StripeCustomerId).IndexName("stripe").Index(FieldIndexOption.NotAnalyzed)) .Boolean(f => f.Name(u => u.HasPremiumFeatures).IndexName("premium")) .String(f => f.Name(u => u.PlanId).IndexName(Fields.Organization.PlanId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PlanName).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PlanDescription).Index(FieldIndexOption.No)) .String(f => f.Name(u => u.CardLast4).Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(u => u.SubscribeDate).IndexName(Fields.Organization.SubscribeDate)) .Number(f => f.Name(u => u.BillingStatus).IndexName(Fields.Organization.BillingStatus)) .String(f => f.Name(u => u.BillingChangedByUserId).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(u => u.BillingPrice).IndexName(Fields.Organization.BillingPrice)) .Boolean(f => f.Name(u => u.IsSuspended).IndexName(Fields.Organization.IsSuspended)) .String(f => f.Name(u => u.SuspendedByUserId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.SuspensionNotes).Index(FieldIndexOption.NotAnalyzed)) .Number(f => f.Name(u => u.RetentionDays).IndexName("retention")) .Object<DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) .Object<Invite>(f => f.Name(o => o.Invites.First()).RootPath().Properties(ip => ip .String(fu => fu.Name(i => i.Token).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.Organization.InviteToken)) .String(fu => fu.Name(i => i.EmailAddress).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.Organization.InviteEmail)))) .Object<UsageInfo>(ui => ui.Name(o => o.Usage.First()).RootPath().Properties(ip => ip .Date(fu => fu.Name(i => i.Date).IndexName(Fields.Organization.UsageDate)) .Number(fu => fu.Name(i => i.Total).IndexName(Fields.Organization.UsageTotal)) .Number(fu => fu.Name(i => i.Blocked).IndexName(Fields.Organization.UsageBlocked)) .Number(fu => fu.Name(i => i.Limit).IndexName(Fields.Organization.UsageLimit)) .Number(fu => fu.Name(i => i.TooBig).IndexName(Fields.Organization.UsageTooBig)))) .Object<UsageInfo>(ui => ui.Name(o => o.OverageHours.First()).RootPath().Properties(ip => ip .Date(fu => fu.Name(i => i.Date).IndexName(Fields.Organization.OverageHoursDate)) .Number(fu => fu.Name(i => i.Total).IndexName(Fields.Organization.OverageHoursTotal)) .Number(fu => fu.Name(i => i.Blocked).IndexName(Fields.Organization.OverageHoursBlocked)) .Number(fu => fu.Name(i => i.Limit).IndexName(Fields.Organization.OverageHoursLimit)) .Number(fu => fu.Name(i => i.TooBig).IndexName(Fields.Organization.OverageHoursTooBig)))) ); }
private PutMappingDescriptor <T> MapSuppressionListFields <T>(PutMappingDescriptor <T> pmd) where T : SuppressionList { if (typeof(T).Equals(typeof(SuppressedEmail))) { return(pmd .Properties(props => props .String(s => s.Name("email").Index(FieldIndexOption.NotAnalyzed).Store(true).IndexAnalyzer("duplicateCheckAnalyzer").SearchAnalyzer("duplicateCheckAnalyzer"))) .TimestampField(t => t .Enabled(true))); } else { return(pmd .Properties(props => props .String(s => s.Name("domain").Index(FieldIndexOption.NotAnalyzed).Store(true).IndexAnalyzer("duplicateCheckAnalyzer").SearchAnalyzer("duplicateCheckAnalyzer"))) .TimestampField(t => t .Enabled(true))); } }
public override PutMappingDescriptor <Models.Token> BuildMapping(PutMappingDescriptor <Models.Token> map) { return(map .Type(Name) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .SetupDefaults() .String(f => f.Name(e => e.CreatedBy).IndexName(Fields.CreatedBy).Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(e => e.ModifiedUtc).IndexName(Fields.ModifiedUtc)) .String(f => f.Name(e => e.ApplicationId).IndexName(Fields.ApplicationId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName(Fields.OrganizationId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName(Fields.ProjectId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.DefaultProjectId).IndexName(Fields.DefaultProjectId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.UserId).IndexName(Fields.UserId).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Refresh).IndexName(Fields.Refresh).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Scopes).IndexName(Fields.Scopes).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Notes).IndexName(Fields.Notes).Index(FieldIndexOption.No)) )); }
private PutMappingDescriptor <Models.Token> GetTokenMap(PutMappingDescriptor <Models.Token> map) { return(map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.CreatedBy).IndexName("createdby").Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .Date(f => f.Name(e => e.ModifiedUtc).IndexName("modified")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ApplicationId).IndexName("application").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName("project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.DefaultProjectId).IndexName("default_project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.UserId).IndexName("user").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Refresh).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Scopes).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Notes).Index(FieldIndexOption.No)) )); }
public override PutMappingDescriptor <User> BuildMapping(PutMappingDescriptor <User> map) { return(map .Type(Name) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .SetupDefaults() .Date(f => f.Name(e => e.ModifiedUtc).IndexName(Fields.ModifiedUtc)) .String(f => f.Name(e => e.OrganizationIds).IndexName(Fields.OrganizationIds).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.FullName).IndexName(Fields.FullName)) .String(f => f.Name(u => u.EmailAddress).IndexName(Fields.EmailAddress).Analyzer(KEYWORD_LOWERCASE_ANALYZER)) .String(f => f.Name(u => u.VerifyEmailAddressToken).IndexName(Fields.VerifyEmailAddressToken).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Password).IndexName(Fields.Password).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PasswordResetToken).IndexName(Fields.PasswordResetToken).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Salt).IndexName(Fields.Salt).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Roles).IndexName(Fields.Roles).Index(FieldIndexOption.NotAnalyzed)) .Object <OAuthAccount>(f => f.Name(o => o.OAuthAccounts.First()).Path("just_name").Properties(mp => mp .String(fu => fu.Name(m => m.Provider).IndexName(Fields.OAuthAccountProvider).Index(FieldIndexOption.NotAnalyzed)) .String(fu => fu.Name(m => m.ProviderUserId).IndexName(Fields.OAuthAccountProviderUserId).Index(FieldIndexOption.NotAnalyzed)) .String(fu => fu.Name(m => m.Username).IndexName(Fields.OAuthAccountUsername).Index(FieldIndexOption.NotAnalyzed)))) )); }
public Nest.RootObjectMapping GetRootMapping() { PutMappingDescriptor<GenericJsonItem> putMappingRequest = new PutMappingDescriptor<GenericJsonItem>(ElasticClientWrapper.ConnectionSettings); putMappingRequest.MapFromAttributes(); putMappingRequest.TimestampField(t => t.Enabled().Path("date")); putMappingRequest.Type(Type.Name); return ((IPutMappingRequest)putMappingRequest).Mapping; }
//hide public void PutMappingAlsoAdheresToMaxRecursion() { var descriptor = new PutMappingDescriptor<A>().AutoMap(); var expected = new { properties = new { child = new { properties = new { }, type = "object" } } }; Expect(expected).WhenSerializing((IPutMappingRequest)descriptor); var withMaxRecursionDescriptor = new PutMappingDescriptor<A>().AutoMap(3); var expectedWithMaxRecursion = new { properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { child = new { type = "object", properties = new { } } } } } } } } } }; Expect(expectedWithMaxRecursion).WhenSerializing((IPutMappingRequest)withMaxRecursionDescriptor); }
private PutMappingDescriptor<Project> GetProjectMap(PutMappingDescriptor<Project> map) { return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .Date(f => f.Name(e => e.ModifiedUtc).IndexName("modified")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PromotedTabs).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.CustomContent).Index(FieldIndexOption.No)) .Object<ClientConfiguration>(f => f.Name(u => u.Configuration).Dynamic(false)) .Object<Dictionary<string, NotificationSettings>>(f => f.Name(u => u.NotificationSettings).Dynamic(false)) .Object<DataDictionary>(f => f.Name(u => u.Data).Dynamic(false)) ); }
private PutMappingDescriptor<WebHook> GetWebHookMap(PutMappingDescriptor<WebHook> map) { return map .Index(VersionedName) .Dynamic() .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName("project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Url).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.EventTypes).IndexName("types").Index(FieldIndexOption.NotAnalyzed)) ); }
public PutMappingDescriptor<User> GetUserMap(PutMappingDescriptor<User> map) { return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .Date(f => f.Name(e => e.ModifiedUtc).IndexName("modified")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationIds).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.FullName).IndexName("name")) .String(f => f.Name(u => u.EmailAddress).IndexName("email").Analyzer(KEYWORD_LOWERCASE)) .String(f => f.Name(u => u.Password).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Salt).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.PasswordResetToken).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.VerifyEmailAddressToken).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Roles).Index(FieldIndexOption.NotAnalyzed)) .Object<OAuthAccount>(f => f.Name(o => o.OAuthAccounts.First()).RootPath().Properties(mp => mp .String(fu => fu.Name(m => m.Provider).Index(FieldIndexOption.NotAnalyzed)) .String(fu => fu.Name(m => m.ProviderUserId).Index(FieldIndexOption.NotAnalyzed).IndexName(Fields.User.OAuthAccountProviderUserId)) .String(fu => fu.Name(m => m.Username).Index(FieldIndexOption.NotAnalyzed)))) ); }
private PutMappingDescriptor<Models.Token> GetTokenMap(PutMappingDescriptor<Models.Token> map) { return map .Index(VersionedName) .Dynamic() .TimestampField(ts => ts.Enabled().Path(u => u.ModifiedUtc).IgnoreMissing(false)) .Properties(p => p .String(f => f.Name(e => e.CreatedBy).IndexName("createdby").Index(FieldIndexOption.NotAnalyzed)) .Date(f => f.Name(e => e.CreatedUtc).IndexName("created")) .Date(f => f.Name(e => e.ModifiedUtc).IndexName("modified")) .String(f => f.Name(e => e.Id).IndexName("id").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ApplicationId).IndexName("application").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.OrganizationId).IndexName("organization").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.ProjectId).IndexName("project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.DefaultProjectId).IndexName("default_project").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.UserId).IndexName("user").Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Refresh).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(e => e.Scopes).Index(FieldIndexOption.NotAnalyzed)) .String(f => f.Name(u => u.Notes).Index(FieldIndexOption.No)) ); }