# Filter cache configuration

**URL:** <https://discuss.elastic.co/t/filter-cache-configuration/9472>\
**Category:** Elasticsearch\
**Created:** [October 25, 2012, 1:51pm UTC](https://discuss.elastic.co/t/filter-cache-configuration/9472 "2012-10-25T13:51:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benoit](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Benoit](https://discuss.elastic.co/u/Benoit)\
**Post date:** [October 25, 2012, 1:51pm UTC](https://discuss.elastic.co/t/filter-cache-configuration/9472/1 "2012-10-25T13:51:26Z")

</div>

Hi all,

I'm in the case where my queries are always filtered by an id group  
composed of letters (usually 4)  
The list of groups can be big, up to 2000.

I've seen available options from the following page  
[http://www.elasticsearch.org/guide/reference/query-dsl/terms-filter.html](http://www.elasticsearch.org/guide/reference/query-dsl/terms-filter.html)

But i'm not sure to understand them.  
Should using options, "execution" : "bool", "\_cache": true, improve  
performance ?

What configuration of indices.cache.filter.size are you using ? I feel 20%  
quite low.  
(From this page  
[http://www.elasticsearch.org/guide/reference/index-modules/cache.html](http://www.elasticsearch.org/guide/reference/index-modules/cache.html))

Any other tips or recommendations about filter cache tunning ?

Thanks, Benoît

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 25, 2012, 9:01pm UTC](https://discuss.elastic.co/t/filter-cache-configuration/9472/2 "2012-10-25T21:01:39Z")

</div>

Hello Benoît,

On Thu, Oct 25, 2012 at 4:51 PM, Benoît [benoit.intrw@gmail.com](mailto:benoit.intrw@gmail.com) wrote:

> Hi all,
> 
> I'm in the case where my queries are always filtered by an id group composed  
> of letters (usually 4)  
> The list of groups can be big, up to 2000.
> 
> I've seen available options from the following page  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/terms-filter.html)
> 
> But i'm not sure to understand them.  
> Should using options, "execution" : "bool", "\_cache": true, improve  
> performance ?

If you filter by only one group ID, I think the term filter would be preferable:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

Which would be cached by default and the problem is solved 🙂

If you need to filter by more than one group ID, I would choose  
depending on what kind of queries are run most often. If users  
normally choose the same sets of group IDs, I would leave caching  
settings to default. Otherwise, I would only change the execution to  
"bool", and I wouldn't turn on \_cache because that would also cache  
the bool filter - and I assume that would change too often - while  
individual term filters will be cached by default.

> What configuration of indices.cache.filter.size are you using ? I feel 20%  
> quite low.  
> (From this page  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/cache.html))
> 
> Any other tips or recommendations about filter cache tunning ?

I think if you want to fine-tune your cache settings, there's no  
getting away from some testing and monitoring. Here's an interesting  
blog article that might help:

> **[Sematext ElasticSearch Services](https://sematext.com/elasticsearch)**
>
> Optimize your Elasticsearch performance with Sematext. Get real-time monitoring, logging, and troubleshooting to ensure peak efficiency.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--

---

<div class="post-metadata">

**Author:** ![Benoit](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Benoit](https://discuss.elastic.co/u/Benoit)\
**Post date:** [October 26, 2012, 9:15am UTC](https://discuss.elastic.co/t/filter-cache-configuration/9472/3 "2012-10-26T09:15:07Z")

</div>

Hello,

Thank very must for your explanations.

On Thursday, October 25, 2012 11:01:43 PM UTC+2, Radu Gheorghe wrote:

> Hello Benoît,
> 
> On Thu, Oct 25, 2012 at 4:51 PM, Benoît \<[benoit...@gmail.com](mailto:benoit...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Hi all,
> > 
> > I'm in the case where my queries are always filtered by an id group  
> > composed  
> > of letters (usually 4)  
> > The list of groups can be big, up to 2000.
> > 
> > I've seen available options from the following page  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/terms-filter.html)
> > 
> > But i'm not sure to understand them.  
> > Should using options, "execution" : "bool", "\_cache": true, improve  
> > performance ?
> 
> If you filter by only one group ID, I think the term filter would be  
> preferable:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-filter.html)
> 
> Which would be cached by default and the problem is solved 🙂
> 
> If you need to filter by more than one group ID, I would choose  
> depending on what kind of queries are run most often. If users  
> normally choose the same sets of group IDs, I would leave caching  
> settings to default. Otherwise, I would only change the execution to  
> "bool", and I wouldn't turn on \_cache because that would also cache  
> the bool filter - and I assume that would change too often - while  
> individual term filters will be cached by default.
> 
> Yes this is my use case .

> > What configuration of indices.cache.filter.size are you using ? I feel  
> > 20%  
> > quite low.  
> > (From this page  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/cache.html))
> > 
> > Any other tips or recommendations about filter cache tunning ?
> 
> I think if you want to fine-tune your cache settings, there's no  
> getting away from some testing and monitoring. Here's an interesting  
> blog article that might help:  
> [ElasticSearch Cache Usage - Sematext](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)
> 
> Oh yes, excellent article, i knew it but don't bookmark it, that done now !

Regards.

Benoît

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:07am UTC](https://discuss.elastic.co/t/filter-cache-configuration/9472/4 "2017-07-06T03:07:07Z")

</div>


