# Understanding filter cache and writing warmers to keep filter cache warm

**URL:** <https://discuss.elastic.co/t/understanding-filter-cache-and-writing-warmers-to-keep-filter-cache-warm/39587>\
**Category:** Elasticsearch\
**Created:** [January 19, 2016, 7:02pm UTC](https://discuss.elastic.co/t/understanding-filter-cache-and-writing-warmers-to-keep-filter-cache-warm/39587 "2016-01-19T19:02:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddartha\_Guthikonda](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@Siddartha\_Guthikonda](https://discuss.elastic.co/u/Siddartha_Guthikonda)\
**Post date:** [January 19, 2016, 7:02pm UTC](https://discuss.elastic.co/t/understanding-filter-cache-and-writing-warmers-to-keep-filter-cache-warm/39587/1 "2016-01-19T19:02:45Z")

</div>

```
> {
> "query": {
> "filtered": {
> "filter": {
> "and": [{
> "bool": {
> "must": [{
> "term": {
> "application.raw": "Application1"
> }
> }]
> }
> }, {
> "term": {
> "metric.raw": "Metric1",
> "_cache": false
> }
> }, {
> "nested": {
> "path": "tags",
> "query": {
> "filtered": {
> "filter": {
> "and": [{
> "term": {
> "tags.key.raw": "tagkey1",
> "_cache": false
> }
> }, {
> "term": {
> "tags.value.raw": "tagvalue1",
> "_cache": false
> }
> }]
> }
> }
> }
> }
> }]
> }
> }
> }
> }

```

This a sample query for a index with 500M documents. When the cache is cold this takes around 23 sec for the query to complete. When it is cached (when I run the same query more than twice) I get the response within 500 ms which is great. Note that the "metric" field that I am interested in is the value that are in the "Application1" documents.  
I want to understand if "application" is the only field that is cached from this query?  
Also, is "Application1" is the only value that is cached? What if I change the query to match "Application2" and a different set of nested documents?

How can I write warmers to cache all the applications I have in the index?

---

<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 5, 2017, 11:23pm UTC](https://discuss.elastic.co/t/understanding-filter-cache-and-writing-warmers-to-keep-filter-cache-warm/39587/2 "2017-07-05T23:23:19Z")

</div>


