Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch refresh effect on cache

In ElasticSearch, does calling Refresh or Flush clear field and filter cache?

I have a write-heavy application, is it better to run refresh or flush, or is there any better approach for this?

like image 301
mjalajel Avatar asked Feb 11 '14 10:02

mjalajel


1 Answers

A refresh causes new documents to be visible for searching. This happens by writing a new index segment. A new segment can also be made by merging old large ones.

Filter- and field caches are managed per segment, since a segment is immutable. You can use the warmer APIs to ensure caches are pre-warmed before being made available for search. If not, then parts of the cache is essentially "cleared".

A flush in Elasticsearch terms actually calls a Lucene commit. This is quite more expensive.

If you have a write heavy app, you probably want to increase the refresh interval to get better indexing throughput.

There's some more details about these things in these two articles:

  • Elasticsearch from the Bottom Up, Part 1
  • Elasticsearch Refresh Interval vs Indexing Performance
like image 115
Alex Brasetvik Avatar answered Oct 13 '22 09:10

Alex Brasetvik