Elasticsearch Nest - Querying Aliases
Elasticsearch NEST API 是否公开对
1 2 3 4 5 6 7 | { "ntdev-events017-v1": { "aliases": { "ntdev-events017": {} } } } |
http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
您可以在
看看这个例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | var indexName ="sampleindex"; var uri = new Uri("http://localhost:9200"); var settings = new ConnectionSettings(uri).SetDefaultIndex(indexName).EnableTrace(); var client = new ElasticClient(settings); client.CreateIndex(descriptor => descriptor.Index(indexName)); var putAliasResponse = client.PutAlias(descriptor => descriptor .Index(indexName).Name("alias1")); var putAliasResponse2 = client.PutAlias(descriptor => descriptor .Index(indexName).Name("alias2")); var aliasesForIndex = client.GetAlias(descriptor => descriptor .Index(indexName)) .Indices[indexName] .Select(x => x.Name).ToList(); var indexesMappedToAlias = client.GetAlias(descriptor => descriptor.Alias("alias2")) .Indices.Select(x => x.Key).ToList(); |