Wednesday, September 11, 2019

ElasticSearch - Cache aggregations and suggestions

A quick tip for everyone using ElasticSearch(aren’t you all?);

It can be a good idea to separate the search request that fetches the results from the search request that returns the aggregations or suggestions. Why would you do that?

Caching of course! On each shard the request cache module caches the local search results. But(!) by default the request cache module only caches the results of search requests where size=0.  This means that it only works when you don’t want any hits returned.

We tested it on our development cluster and the difference in performance is significant.

More information: https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html

No comments: