In Understanding cluster, replication recipe, and sharding in Chapter 1, Getting Started, we discussed ElasticSearch cluster and how to manage in the case of red and yellow state.
ElasticSearch provides a convenient way to control the cluster state, which is one of the first things to control in case of problems.
For controlling the cluster health, we need to perform the following steps:
To view the cluster health, the HTTP method is GET and the curl command is as follows:
curl -XGET 'http://localhost:9200/_cluster/health'
The result will be:
{ "cluster_name" : "elasticsearch", "status" : "green", "timed_out" : false, "number_of_nodes" : 2, "number_of_data_nodes" : 2, "active_primary_shards" : 5, "active_shards" : 10, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0 }