Elasticsearch’s cluster API is a good 30,000 ft high description of your cluster health. If you have Elasticsearch installed on your local machine, give this a try:
You output might look something like this:
Lets start off by talking about the traffic light status indicators of elastic. From their documentation:
Green : All primary and replica shards are allocated. Your cluster is 100% operational.
Yellow :All primary shards are allocated, but at least one replica is missing. No data is missing, so search results will still be complete. However, your high availability is compromised to some degree. If more shards disappear, you might lose data. Think of
yellowas a warning that should prompt investigation.
Red:At least one primary shard (and all of its replicas) is missing. This means that you are missing data: searches will return partial results, and indexing into that shard will return an exception.
My local machine is clearly running on 5 shards and 0 replicas. The ‘active_primary_shards’ indicate how many primary shards you have in your cluster and the “active_shards” indicate the total number of shards you have in your cluster, this includes the number of replicas too. So if I had 1 (extra) replica for each shard, this number would be 10. That also explains why the cluster health is ‘yellow’, as the replicas are missing.
Here are the most important ones:
“cluster_name”: name the cluster
“status”: red | yellow | green – when each would occur is described above)
“timed_out”: true | false – was it able to reach the cluster
“number_of_nodes”: number of nodes in your cluster,
“number_of_data_nodes”: number of data nodes in your cluster (an ES cluster could have master and data nodes
“active_primary_shards”: explained above,
“active_shards”: explained above,
“relocating_shards”: shows the number of nodes moving from one node to another. When you add a node, ES might rebalance itself by moving shards and replicas to the new node. This value is generally 0
“initializing_shards”: this indicates the count of shards being freshly created. When a new index is being created, you might see the number here. But this should generally be 0. Even when the node is first created, you might see a number here as shards are loaded from disk.
“unassigned_shards”: Unassigned shards represent the number of unassigned replicas. In your local machine, you might see the same number as of primary shards, as you only have replicas.
Dive a level in by using this:
This API gives you the current status of all indexes.