Bailey Smith
Bailey Smith

Reputation: 2933

Elasticsearch clear cache for individual query term

According to the Elasticsearch clear cache docs, you can clear the cache for a field, but is it possible to clear the cache for a single query term?

And to prevent the problem in the future, I'd prefer that a query of "null" not be cached, or that the cache be updated quite frequently. Is it possible to set rules for the cache at that level of granularity?

Upvotes: 1

Views: 1334

Answers (1)

Alex Brasetvik
Alex Brasetvik

Reputation: 11754

No, you cannot specify that level of granularity.

You can override _cache to be false for filters that enable caching by default: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-filter.html#_caching_18

What do you mean with "cache updated frequently"? The caches are scoped to the segment, meaning they are valid as long as the segment is valid.

To learn more about both caching, filters, the benefits and downsides of immutable segments, here's some articles to look into:

I think you'll find that you don't need to worry a lot about having to clear a single term-filter's cache entry.

Upvotes: 1

Related Questions