/// <summary> /// The index to execute the search on. Defaults to the default index /// </summary> public TDescriptor Index(IndexNameMarker index) { if (index == null) { return((TDescriptor)this); } return(this.Indices(index)); }
public string IndexName(IndexNameMarker index) { if (index == null) { return(null); } return(index.Resolve(this._connectionSettings)); }
internal string GetIndexForType(IndexNameMarker i) { if (i == null) { return(this.GetIndexForType((Type)null)); } return(i.Name ?? this.GetIndexForType(i.Type)); }
public virtual async Task <IIndicesResponse> DeleteIndexAsync() { var client = GetClient(); var indexNameMaker = new IndexNameMarker() { Type = typeof(T), Name = _indexName }; return(await client.DeleteIndexAsync(new DeleteIndexRequest(indexNameMaker))); }
public void IndexNameMarkerEqualsDoesNotUseHashCode() { var collision = GetHashCollison(); var indexMarker1 = new IndexNameMarker { Name = collision.Item1 }; var indexMarker2 = new IndexNameMarker { Name = collision.Item2 }; this.TestAddingToDictionary(indexMarker1, indexMarker2); }
public DeleteByQueryRequest(IndexNameMarker index, TypeNameMarker type = null) { this.Indices = new [] { index }; if (type != null) { this.Types = new[] { type } } ; else { this.AllTypes = true; } }
public static string Resolve(this IndexNameMarker marker, IConnectionSettingsValues connectionSettings) { if (marker == null) { return(null); } connectionSettings.ThrowIfNull("connectionSettings"); if (marker.Type == null) { return(marker.Name); } return(new IndexNameResolver(connectionSettings).GetIndexForType(marker.Type)); }
public IOpenSearchableElasticType GetOpenSearchableElasticTypeByNameOrDefault(string indexName, string typeName, Dictionary <string, object> parameters = null) { var indexNameMarker = new IndexNameMarker(); indexNameMarker.Name = indexName; var typeNameMarker = new TypeNameMarker(); typeNameMarker.Name = typeName; IOpenSearchableElasticType type = GetOpenSearchableElasticTypeByName(indexName, typeName); if (type == null) { type = new GenericJsonOpenSearchable(indexName, typeName); } return(type); }
public IOpenSearchableElasticType GetOpenSearchableElasticTypeByName(string indexName, string typeName, Dictionary <string, object> parameters = null) { foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes(typeof(IOpenSearchableElasticType))) { IOpenSearchableElasticType etype = (IOpenSearchableElasticType)node.CreateInstance(); if (etype.Identifier == typeName) { Type type = node.Type; var ctor = type.GetConstructor(new Type[2] { typeof(IndexNameMarker), typeof(TypeNameMarker) }); var indexNameMarker = new IndexNameMarker(); indexNameMarker.Name = indexName; var typeNameMarker = new TypeNameMarker(); typeNameMarker.Name = typeName; etype = (IOpenSearchableElasticType)ctor.Invoke(new object[2] { indexNameMarker, typeNameMarker }); etype.Parameters = parameters; return(etype); } } return(null); }
public TermvectorRequest(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
public MultiTermVectorsRequest(IndexNameMarker index, TypeNameMarker typeNameMarker) : base(index, typeNameMarker) { }
public IndexExistsRequest(IndexNameMarker index) : base(index) { }
/// <summary> /// Calls putmapping on /{index}/{type} /// </summary> public PutMappingRequest(IndexNameMarker index, TypeNameMarker type) { this.Type = type; this.Indices = new [] { index }; }
public IOpenSearchableElasticType GetOpenSearchableElasticTypeByName(string indexName, string typeName, Dictionary<string, object> parameters = null) { foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (typeof(IOpenSearchableElasticType))) { IOpenSearchableElasticType etype = (IOpenSearchableElasticType)node.CreateInstance(); if (etype.Identifier == typeName) { Type type = node.Type; var ctor = type.GetConstructor(new Type[2]{ typeof(IndexNameMarker), typeof(TypeNameMarker) }); var indexNameMarker = new IndexNameMarker(); indexNameMarker.Name = indexName; var typeNameMarker = new TypeNameMarker(); typeNameMarker.Name = typeName; etype = (IOpenSearchableElasticType)ctor.Invoke(new object[2]{ indexNameMarker, typeNameMarker }); etype.Parameters = parameters; return etype; } } return null; }
public SourceRequest(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
public GenericJsonOpenSearchable(IndexNameMarker index, TypeNameMarker type) { this.type = type; this.index = index; }
public IOpenSearchableElasticType GetOpenSearchableElasticTypeByNameOrDefault(string indexName, string typeName, Dictionary<string, object> parameters = null) { var indexNameMarker = new IndexNameMarker(); indexNameMarker.Name = indexName; var typeNameMarker = new TypeNameMarker(); typeNameMarker.Name = typeName; IOpenSearchableElasticType type = GetOpenSearchableElasticTypeByName(indexName, typeName); if (type == null) { type = new GenericJsonOpenSearchable(indexName, typeName); } return type; }
protected DocumentPathBase(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
internal IndexInformation CreateCatalogueIndex(Terradue.ElasticCas.Request.CreateIndexRequest createRequest, bool destroy = false) { if (client.IndexExists(i => i.Index(createRequest.IndexName)).Exists) { if (destroy) { client.DeleteIndex(d => d.Index(createRequest.IndexName)); } else { throw new InvalidOperationException(string.Format("'{0}' index already exists and cannot be overriden without data loss", createRequest.IndexName)); } } var response = client.CreateIndex(c => c.Index(createRequest.IndexName)); IndexInformation indexInformation = new IndexInformation(); var status = client.Status(s => s.Index(createRequest.IndexName)); indexInformation.Name = createRequest.IndexName; indexInformation.Shards = status.Shards; indexInformation.Mappings = new Dictionary<string, ICollection<PropertyNameMarker>>(); // Init mappings for each types declared if (createRequest.TypeNames == null || createRequest.TypeNames.Length == 0) { List<string> typeNames = new List<string>(); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (typeof(IOpenSearchableElasticType))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); if (type is GenericJsonOpenSearchable) continue; IndexNameMarker indexName = new IndexNameMarker(); indexName.Name = createRequest.IndexName; PutMappingRequest putMappingRequest = new PutMappingRequest(indexName, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); typeNames.Add(type.Type.Name); } createRequest.TypeNames = typeNames.ToArray(); } else { foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (typeof(IElasticItem))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); foreach (string typeName in createRequest.TypeNames) { if (typeName == type.Type.Name) { PutMappingRequest putMappingRequest = new PutMappingRequest(type.Index, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); } } } } return indexInformation; }
public CreateIndexRequest(IndexNameMarker index) : base(index) { }
public CloseIndexRequest(IndexNameMarker index) : base(index) { }
public DocumentExistsRequest(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
internal IndexInformation CreateCatalogueIndex(Terradue.ElasticCas.Request.CreateIndexRequest createRequest, bool destroy = false) { if (client.IndexExists(i => i.Index(createRequest.IndexName)).Exists) { if (destroy) { client.DeleteIndex(d => d.Index(createRequest.IndexName)); } else { throw new InvalidOperationException(string.Format("'{0}' index already exists and cannot be overriden without data loss", createRequest.IndexName)); } } var response = client.CreateIndex(c => c.Index(createRequest.IndexName)); IndexInformation indexInformation = new IndexInformation(); var status = client.Status(s => s.Index(createRequest.IndexName)); indexInformation.Name = createRequest.IndexName; indexInformation.Shards = status.Shards; indexInformation.Mappings = new Dictionary <string, ICollection <PropertyNameMarker> >(); // Init mappings for each types declared if (createRequest.TypeNames == null || createRequest.TypeNames.Length == 0) { List <string> typeNames = new List <string>(); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes(typeof(IOpenSearchableElasticType))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); if (type is GenericJsonOpenSearchable) { continue; } IndexNameMarker indexName = new IndexNameMarker(); indexName.Name = createRequest.IndexName; PutMappingRequest putMappingRequest = new PutMappingRequest(indexName, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); typeNames.Add(type.Type.Name); } createRequest.TypeNames = typeNames.ToArray(); } else { foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes(typeof(IElasticItem))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); foreach (string typeName in createRequest.TypeNames) { if (typeName == type.Type.Name) { PutMappingRequest putMappingRequest = new PutMappingRequest(type.Index, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); } } } } return(indexInformation); }
public GetMappingRequest(IndexNameMarker index, TypeNameMarker typeNameMarker) : base(index, typeNameMarker) { }
public MoreLikeThisRequest(IndexNameMarker indexName, TypeNameMarker typeName, string id) : base(indexName, typeName, id) { }
public OpenIndexRequest(IndexNameMarker index) : base(index) { }
public IndexNamePathBase(IndexNameMarker index, string name) { this.Index = index; this.Name = name; }
public GetIndexSettingsRequest(IndexNameMarker index) : base(index) { }
public IndexPathBase(IndexNameMarker index) { this.Index = index; }
public UnregisterPercolatorRequest(IndexNameMarker index, string name) : base(index, name) { }
public DocumentOptionalPathBase(IndexNameMarker indexName, TypeNameMarker typeName, string id) { this.Index = indexName; this.Type = typeName; this.Id = id; }
/// <summary> /// Does an _optimize on /{index}/_optimize /// </summary> public OptimizeRequest(IndexNameMarker index) { this.Indices = new[] { index }; }
public IndexTypePathBase(IndexNameMarker index, TypeNameMarker typeNameMarker) { this.Index = index; this.Type = typeNameMarker; }