I need to get the number of primary shards for a particular index, in C#, using Nest (or Elastic.Net, doesn't matter). Which API call should I use?
or something else?
Is this right and the best-performing way?
var settings = client.GetIndexSettings(i => i.Index(sourceIndexName));
settings.Indices[sourceIndexName].Settings.NumberOfShards
If you simply want to count the number of primary shards of a given index, then GetIndexSettings()
is the best option. Other options you listed return way more information than you need.