Controlling the cluster state using the API
The previous recipe returns information only about the health of the cluster. If you need more details on your cluster, then you need to query its state.
The cluster state is the core of all functionalities and the metadata stored in Elasticsearch.
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.
In order 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 check the cluster state, we will perform the following steps:
- In order to view the cluster state, the HTTP method that you can use is
GET
, and thecurl
command is as follows:GET /_cluster/state
- The result...