# Trouble disabling query cache

**URL:** https://discuss.elastic.co/t/trouble-disabling-query-cache/8845
**Category:** Elasticsearch
**Created:** [August 24, 2012, 5:22pm UTC](https://discuss.elastic.co/t/trouble-disabling-query-cache/8845 "2012-08-24T17:22:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Josh\_P](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Josh\_P](https://discuss.elastic.co/u/Josh_P)
#### Post date: [August 24, 2012, 5:22pm UTC](https://discuss.elastic.co/t/trouble-disabling-query-cache/8845/1 "2012-08-24T17:22:18Z")

</div>

I'd like to disable query caching to compare performance of different  
mapping configurations. The trouble is that ES seems to be always caching  
the results, despite that I've attempted many different ways to disable the  
cache. For example, the first time I try the following query:

curl -XPOST "[http://localhost:9200/users/\_search?search\_type=count](http://localhost:9200/users/_search?search_type=count)" -d'  
{  
"query": {  
"query\_string": {  
"fields": [  
"keywords\_search"  
],  
"query": ""corn chowder" OR "air conditioner""  
}  
}  
}'

It takes about about 8 seconds and returns roughly 117,000 hits. But if I  
attempt the same query a minute later, it takes only 90ms and returns the  
same number of hits. But if I change the query, it takes about 8 seconds  
again. So clearly there's some kind of caching going on.

I've tried many different ways to disable caching. I tried doing so at the  
cluster level (index.cache.field.max\_size = 0 and index.cache.field.expire  
= 0), at the index level (index.cache.filter.max\_size = 0 and index.cache.filter.expire  
= 0), at the query level (\_cache = false), and even explicitly clearing the  
cache between requests:

curl -XPOST '[http://localhost:9200/users\_20120819/\_cache/clear](http://localhost:9200/users_20120819/_cache/clear)'

...but same result. Any help would really be appreciated. I thought  
caching wasn't even performed for regular queries.

--

---

<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:15am UTC](https://discuss.elastic.co/t/trouble-disabling-query-cache/8845/2 "2017-07-06T03:15:08Z")

</div>


