# How are filters cached?

**URL:** <https://discuss.elastic.co/t/how-are-filters-cached/78713>\
**Category:** Elasticsearch\
**Created:** [March 15, 2017, 1:59pm UTC](https://discuss.elastic.co/t/how-are-filters-cached/78713 "2017-03-15T13:59:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utkarsh\_Pyne](https://avatars.discourse-cdn.com/v4/letter/u/a587f6/32.png) [@Utkarsh\_Pyne](https://discuss.elastic.co/u/Utkarsh_Pyne)\
**Post date:** [March 15, 2017, 1:59pm UTC](https://discuss.elastic.co/t/how-are-filters-cached/78713/1 "2017-03-15T13:59:05Z")

</div>

We use date math in our filters which eventually converts to some time in milliseconds, so let's say I have a filter from **now/m - 5m** to **now/m** , what I want to understand is that will such a filter get evicted every minute because the date math will eventually result in some new time every minute.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 16, 2017, 2:57am UTC](https://discuss.elastic.co/t/how-are-filters-cached/78713/2 "2017-03-16T02:57:44Z")

</div>

Every time a segment changes it'll need to be rebuilt.  
Plus they are LRU, so if you are making a lot of queries in short succession you may see high eviction rates.

---

<div class="post-metadata">

**Author:** ![Utkarsh\_Pyne](https://avatars.discourse-cdn.com/v4/letter/u/a587f6/32.png) [@Utkarsh\_Pyne](https://discuss.elastic.co/u/Utkarsh_Pyne)\
**Post date:** [March 16, 2017, 1:22pm UTC](https://discuss.elastic.co/t/how-are-filters-cached/78713/3 "2017-03-16T13:22:59Z")

</div>

If there is a chain of filters (filtered query for example) and such a range filter with "now" is just one filter in that chain, will all the filters need to get executed again when this "now" based filter gets stale or only this specific filter ? Essentially, each filter in that chain is separate or they are seen as a whole ?

---

<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:** [April 13, 2017, 1:23pm UTC](https://discuss.elastic.co/t/how-are-filters-cached/78713/4 "2017-04-13T13:23:13Z")

</div>

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