Cleaning the cache
During its execution, Elasticsearch caches data in order to speed up aspects of searching, such as results, items, and filter results.
Elasticsearch frees up memory automatically by following internal indicators, such as the percentage size of the cache regarding the memory (that is, 20%). If you want to start some performance tests or free up memory manually, then it's necessary to call the cache API.
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.
To correctly execute the following commands, you will need an index that is populated with the...