Query cache: Alternatives to TERM query

Hi,
I want to take advantage of Query Cache. I have many term queries inside my filters.

I have read somewhere that term queries are not cached.

What are alternatives for a String data type, that i can use, if i want my queries to get cached ?

The important part is to use a term query within a filter context, i.e. the filter part of a boolean query. Judging from what you said, you already did this.

On top of that the node query cache only kicks in at a certain segment size, I think it's 10k documents.

If you want to know if that cache is being used, you can check via

GET _nodes/stats?human&filter_path=**.query_cache

Thanks for the reply.

On the 10k document front, its not a worry, we have over billion docs and i am very sure the segment size is exceeding 10k.

Yes, i have already used Term query inside the filter clause. Does it make that term query an eligible candidate for caching ?

Just for background, the issue we are dealing with is oversized shards causing slow search performance. Our shard size has grown upto 100Gb.
We are looking at more data division by routing by partition and hoping to use query cache.

Yes, it does. However, there is more to it. You can check the IndicesQueryCache for more information. it will cache up to 10k queries in up to 10% of the total heap by default. Those queries will only be cached for a segment (in an LRU cache), if the total number if documents is greater than 10k and the segment has at least 3% of the total documents of a shard.

Next step is possibly to check for evictions in the above cache.

Yes, ok.
Let me first check with caching and performance. I will also have to study evictions after that.

Thanks Alex for your inputs.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.