I am experiencing stress testing of Elastic Search by submitting queries, but I'm afraid that the responses are cached. How to disable caching when testing Elastic Search?
Before I answer, the disclaimer, which I agree with the comments on the issue, disabling the cache is not the best way to stress test Elasticsearch. Getting into it simultaneous queries representing your production set of queries and active indexing at the same time will be a much better way to see how the ES responds under load.
However, to answer your question and point out some caveats:
You can clear the cache between starts:
The cache clear API allows you to clear either all caches, or specific caching is associated with one or more indexes.
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html
You can disable the filter cache by setting index.cache.filter.type to none - this will prevent filtering results from the cache:
http://elasticsearch-users.115913.n3.nabble.com/Disable-cache-td3825105.html
http://elasticsearch-users.115913.n3.nabble.com/Disabling-cache-td3201850.html
You can change the settings for the field data cache - however, I do not know what will happen if you set this to zero:
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-fielddata.html
In general, keep in mind that Elasticsearch makes significant use of the native OS file system cache, so most of the "caching" occurs outside of ES control:
https://blog.codecentric.de/en/2014/05/elasticsearch-indexing-performance-cheatsheet/
GET / my_index / _search? Request_cache = false https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html