获取索引分片计数

问题描述 投票:0回答:1

我需要使用Nest(或Elastic.Net,无关紧要)在C#中获取特定索引的主分片数。我应该使用哪个API调用?

  1. IndicesShardStores
  2. CatShards
  3. GetIndexSettings

或者是其他东西?

这是正确的,表现最好的方式吗?

var settings = client.GetIndexSettings(i => i.Index(sourceIndexName));
settings.Indices[sourceIndexName].Settings.NumberOfShards
elasticsearch nest elasticsearch-net
1个回答
1
投票

如果您只想计算给定索引的主分片数,那么GetIndexSettings()是最佳选择。您列出的其他选项会返回比您需要的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.