# How does request cache work when there are multiple indices involved?

**URL:** https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727
**Category:** Elasticsearch
**Created:** [May 6, 2018, 5:22am UTC](https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727 "2018-05-06T05:22:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vangap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vangap/32/44927_2.png) [@vangap](https://discuss.elastic.co/u/vangap)
#### Post date: [May 6, 2018, 5:22am UTC](https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727/1 "2018-05-06T05:22:28Z")

</div>

I understand that as long as the request JSON doesn't change and the shards don't get refreshed, request cache can be utilized.

Let's consider this scenario where I have daily indices and I do a wildcard search on these indices to do some aggregations.

If I am applying rounded datetime filters to query last 1 month results, JSON request would be changing. Does this mean that request cache is not going to work?

I remember reading something about ES rewriting range, numeric filters internally to optimize in 2.x/5.x release notes. i.e if an index min,max limits fall in between the limits of main range filters that user is using, it will get rewritten to use those min,max limits before running the query on that index. In which case reqeust cache would work on those indices?

I can't find that link now, any clarification in this regard is appreciated.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [May 6, 2018, 6:34am UTC](https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727/2 "2018-05-06T06:34:07Z")

</div>

I think you might be looking for [this blog post](https://www.elastic.co/blog/instant-aggregations-rewriting-queries-for-fun-and-profit).

---

<div class="post-metadata">

### Author: ![vangap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vangap/32/44927_2.png) [@vangap](https://discuss.elastic.co/u/vangap)
#### Post date: [May 6, 2018, 10:25am UTC](https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727/3 "2018-05-06T10:25:26Z")

</div>

Thanks a lot, that's the blog post I was looking for. That clarifies my doubt that the request cache will work on those intermediate indices.

---

<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: [June 3, 2018, 10:38am UTC](https://discuss.elastic.co/t/how-does-request-cache-work-when-there-are-multiple-indices-involved/130727/4 "2018-06-03T10:38:56Z")

</div>

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