During its execution, Elasticsearch caches data in order to speed up searching, such as results, items, and filter results.
Automatically, Elasticsearch frees up memory 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.