【发布时间】:2014-10-01 01:10:43
【问题描述】:
我需要列出 Elasticsearch 中的所有索引和类型。
基本上我使用_client.stats().Indices 获取索引,并使用foreach 排除索引列表进行过滤,如下所示:
public Dictionary<string, Stats> AllIndexes()
{
_client = new ElasticClient(setting);
var result = _client.Stats();
var allIndex = result.Indices;
var excludedIndexList = ExcludedIndexList();
foreach (var index in excludedIndexList)
{
if (allIndex.ContainsKey(index)) allIndex.Remove(index);
}
return allIndex;
}
这是列出 Elasticsearch 中所有索引的正确方法还是有更好的方法?
【问题讨论】:
标签: c# .net elasticsearch nest