Search Profiler in Kibana - Unable to Clear Cached Data

I'm attempting to optimize a query using the Search Profiler in Kibana. I'm having issues as it appears ES keeps caching something so my first query is slow and subsequent ones are quick.

I have attempted the following on the index but it does not appear to help: 'POST /index-name/_cache/clear'

Is there another step I need?

Hey,

so that is clearing the caches used within the heap of the Elasticsearch JVM. However there are other caches like the Linux Kernel Page Cache, which are not cleared - that cache is responsible to keep that is frequently accessed in the main memory.

--Alex

I also tried the following, closed the index, and modified the following setting:

PUT /index-name/_settings
{
  
    "index.queries.cache.enabled" : "false"
}

After opening the index I think the queries are still being cached.

What makes you think so? Have you checked the index stats?