lucene - Elasticsearch: Inconsistent number of shards in stats & cluster APIs -
i uploaded data single node cluster , named index 'gequest'.
when http://localhost:9200/_cluster/stats?human&pretty, get:
"cluster_name" : "elasticsearch", "status" : "yellow", "indices" : { "count" : 1, "shards" : { "total" : 5, "primaries" : 5, "replication" : 0.0, "index" : { "shards" : { "min" : 5, "max" : 5, "avg" : 5.0 }, "primaries" : { "min" : 5, "max" : 5, "avg" : 5.0 }, "replication" : { "min" : 0.0, "max" : 0.0, "avg" : 0.0 } } }
when on http://localhost:9200/_stats?pretty=true
"_shards" : { "total" : 10, "successful" : 5, "failed" : 0 }
how come total number of shards not consistent in 2 reports? why total shards 10 stats api. how track other 5?
from results have single elasticsearch node running , created index default values(which creates 5 shards , 1 replica). since there 1 node running elasticsearch unable assign replica shards anywhere(elasticsearch never assign primary , replica of same shard in single node).
the _cluster/stats api gives information cluster including current state. result seen cluster state "yellow" indicating primary shards allocated not replicas have been allocated/initialized. showing allocated shards 5.
the _stats api gives information indices in cluster. give information how many shards index have , how many replicas. since index needs total of 10 shards (5 primary , 5 replica specified when create index) stats contain information total 10, successful 5 , failed 5(failed because unable allocate in node).
use http://localhost:9200/_cat/shards see overall shard status