Managing the shard allocation
During normal Elasticsearch usage, it is not necessary to change the shard allocation, because the default settings work very well with all standard scenarios. Sometimes, due to massive relocation, or due to nodes restarting, or some other cluster issues, it's necessary to monitor or define custom shard allocation.
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 the current state of unassigned shard allocation, we will perform the following steps:
To retrieve the cluster allocation information, the HTTP method is
GET
and thecurl
command is as follows:curl -XGET 'http://localhost:9200/_cluster/allocation/explain? pretty'
The result will be something similar to the preceding one:
{ ...