Monitoring segments with the segment API
Monitoring the index segments means monitoring the health of an index. It contains information about the number of segments and data stored in them.
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 command line, you need to install curl
for your operating system.
How to do it...
For getting information about index segments, we will perform the following steps:
To retrieve the index segments, the HTTP method is
GET
and thecurl
command is as follows:
curl -XGET 'http://localhost:9200/test-index/_segments'
The result will be something similar to the preceding one:
{ "_shards" : { ...truncated... }, "indices" : { "test-index" : { "shards" : { "0" : [ { "routing" : { "state...