The previous recipe returns information only about the health of the cluster. If you need more details on your cluster, you need to query its state.
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command-line, you need to install curl
for your operating system.
To check the cluster state, we will perform the following steps:
To view the cluster state, the HTTP method is
GET
, and thecurl
command is as follows:curl -XGET 'http://localhost:9200/_cluster/state'
The result will contain the following data sections:
General cluster information:
{ "cluster_name" : "es-cookbook", "version" : 13, "state_uuid" : "QANXXnzhS7aS5HxLlyNKsw", "master_node" : "7NwnFF1JTPOPhOYuP1AVNQ", "blocks" : { },
Node address information:
"nodes" : { ...