【问题标题】:Get index shard count获取索引分片计数
【发布时间】:2018-09-03 10:11:01
【问题描述】:

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

  1. IndicesShardStores
  2. 猫碎片
  3. 获取索引设置

还是别的什么?

这是正确且效果最好的方式吗?

var settings = client.GetIndexSettings(i => i.Index(sourceIndexName));
settings.Indices[sourceIndexName].Settings.NumberOfShards

【问题讨论】:

  • 试试curl -XGET 'localhost:9200/_cat/shards?pretty'

标签: elasticsearch nest elasticsearch-net


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-18
    • 2012-05-28
    • 2012-06-25
    • 1970-01-01
    • 2014-03-03
    相关资源
    最近更新 更多