Controlling the cluster health using the health API
Elasticsearch provides a health check API to control the cluster state, and this is one of the first things to check whether any problems do occur.
Getting ready
You will need an up-and-running Elasticsearch installation, similar to the one that we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
To execute the commands, any HTTP client can be used, such as curl (https://curl.haxx.se/) or Postman (https://www.getpostman.com/). You can use the Kibana console, as it provides code completion and better character escaping for Elasticsearch.
How to do it...
To control the cluster health, we will perform the following steps:
- In order to view the cluster health, the HTTP method that we use is
GET
:GET /_cluster/health
The result will be as follows:
{ "cluster_name":"elasticsearch", "status": "yellow", "timed_out...