Using the task management API
Elasticsearch, from version 5.x, allows you to define actions that are executed on the server side. These actions can take some time to complete, and they can consume huge cluster resources. The most common ones are as follows:
delete_by_query
update_by_query
reindex
When these actions are called, they create a server-side task that executes the job; the task management API allows you to control these jobs.
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 task information, we will perform the...