public CreateIndexDescriptor InitializeUsing(IIndexState indexSettings) => Assign(indexSettings, (a, v) => { a.Settings = v.Settings; a.Mappings = v.Mappings; a.Aliases = v.Aliases; CreateIndexRequest.RemoveReadOnlySettings(a.Settings); });
public CreateIndexRequest(IndexName index, IIndexState state) : this(index) { this.Settings = state.Settings; this.Mappings = state.Mappings; this.Similarity = state.Similarity; CreateIndexRequest.RemoveReadOnlySettings(this.Settings); }
public CreateIndexDescriptor InitializeUsing(IIndexState indexSettings) => Assign(a => { a.Settings = indexSettings.Settings; a.Mappings = indexSettings.Mappings; a.Warmers = indexSettings.Warmers; a.Aliases = indexSettings.Aliases; });
public CreateIndexDescriptor InitializeUsing(IIndexState indexSettings) => Assign(a => { a.Settings = indexSettings.Settings; a.Mappings = indexSettings.Mappings; a.Aliases = indexSettings.Aliases; a.Similarity = indexSettings.Similarity; CreateIndexRequest.RemoveReadOnlySettings(a.Settings); });
public void CreateIndex(ElasticClient client, IIndexState indexState, string indexName) { var indexExist = client.IndexExists(indexName.ToLower()); if (!indexExist.Exists) { client.CreateIndex(indexName.ToLower(), p => p.InitializeUsing(indexState).Mappings(m => m.Map <T>(mp => mp.AutoMap()))); } }
protected IEnumerable <Nest.CorePropertyBase> GetElasticMapping() { if (_mapping == null) { var getIndexResponse = this.client.Indices.Get(this.client.ConnectionSettings.DefaultIndex); //todo: es7 check IIndexState remote = getIndexResponse.Indices[this.client.ConnectionSettings.DefaultIndex]; var dataMapping = remote?.Mappings?.Properties; if (dataMapping == null) { return new Nest.CorePropertyBase[] { } } ; _mapping = dataMapping.Select(m => (Nest.CorePropertyBase)m.Value); } return(_mapping); }
protected IEnumerable <Nest.CorePropertyBase> GetElasticMapping() { if (_mapping == null) { var getIndexResponse = this.client.GetIndex(this.client.ConnectionSettings.DefaultIndex); IIndexState remote = getIndexResponse.Indices[this.client.ConnectionSettings.DefaultIndex]; var dataMapping = remote.Mappings .Where(m => m.Key.Name == "data") .FirstOrDefault(); //type data if (dataMapping.Value.Properties == null) { return new Nest.CorePropertyBase[] { } } ; _mapping = dataMapping .Value .Properties .Select(m => (Nest.CorePropertyBase)m.Value) ; } return(_mapping); }
public CreateIndexRequest(IndexName index, IIndexState state) : this(index) { Settings = state.Settings; Mappings = state.Mappings; RemoveReadOnlySettings(Settings); }