'How to completely disable Elasticsearch chaching?

I'm trying to measure Elasticsearch performance for some queries and make a benchmark. I'm looking for a way to completely disable the cache. I've already tried some ways but always my first request takes longer than the next queries. So I think even I disabled the cache, at some level it is still working! I've tried this:

1- GET my_index/_search?request_cache=false

2- POST /my_index/_cache/clear

3-

 PUT /my_index/_settings
{ "index.requests.cache.enable": false }


Solution 1:[1]

I think you are disabling the elasticsearch cache correctly. the problem is that there is filesystem cache memory at OS level that you cannot disable it easily. every files and segment that have been read from harddisk will be cached in memory until new segment and files arrived. you can check this cache via free -g command and buffer column. you can clear memory page cache via below command:

# sync; echo 3 > /proc/sys/vm/drop_caches

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1