Elasticsearch cache clear doesn't seems to do what I expected Elasticsearch cache clear doesn't seems to do what I expected elasticsearch elasticsearch

Elasticsearch cache clear doesn't seems to do what I expected


Clearing the cache will empty:

  • Field data (used by facets, sorting, geo, etc)
  • Filter cache
  • parent/child cache
  • Bloom filters for posting lists

The effect you are seeing is probably due to the OS file system cache. Elasticsearch and Lucene leverage the OS file system cache heavily due to the immutable nature of lucene segments. This means that small indices tend to be cached entirely in memory by your OS and become diskless.

As an aside, it doesn't really make sense to benchmark Elasticsearch in a "cacheless" state. It is designed and built to operate in a cached environment - much of the performance that Elasticsearch is known for is due to it's excellent use of caching.

To be completely accurate, your benchmark should really be looking at a system that has fully warmed the JVM (to properly size the new-eden space, optimize JIT output, etc) and using real, production-like data to simulate "real world" cache filling and eviction on both the ES and OS levels.

Synthetic tests such as "no-cache environment" make little sense.


I don't know if this is what you're experiencing, but the cache isn't cleared immediately when you call clear cache. It is scheduled to be deleted in the next 60 seconds.

source: https://www.elastic.co/guide/en/elasticsearch/reference/1.5/indices-clearcache.html