Getting nodes information via API
The previous recipes allow information to be reutrned to the cluster level; Elasticsearch provides calls to gather information at node level. In production clusters, it's very important to monitor nodes via this API to detect misconfiguration and problems relating to different plugins and modules.
Getting ready
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 commandline, you need to install curl
for your operating system.
How to do it...
For getting nodes information, we will perform the following steps:
To retrieve the node information, the HTTP method is
GET
and thecurl
command is as follows:curl -XGET 'http://localhost:9200/_nodes' curl -XGET 'http://localhost:9200/_nodes/<nodeId1>,<nodeId2>'
The result will contain a lot of information about the node. It's huge, so the repetitive parts have...