Getting node statistics using the API
The node statistics call API is used to collect real-time metrics of your node, such as memory usage, threads usage, the number of indices, and searches.
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 get the node statistics, we will perform the following steps:
- To retrieve the node statistics, the HTTP method that we will use is
GET
, and the command is as follows:GET /_nodes/<nodeId1>,<nodeId2>/stats
- The result will be a long list of all the node statistics. The most significant parts...