# Elasticsearch cache seems doesn't work

**URL:** <https://discuss.elastic.co/t/elasticsearch-cache-seems-doesnt-work/88371>\
**Category:** Elasticsearch\
**Created:** [June 6, 2017, 8:09am UTC](https://discuss.elastic.co/t/elasticsearch-cache-seems-doesnt-work/88371 "2017-06-06T08:09:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zangrong](https://avatars.discourse-cdn.com/v4/letter/z/dec6dc/32.png) [@zangrong](https://discuss.elastic.co/u/zangrong)\
**Post date:** [June 6, 2017, 8:09am UTC](https://discuss.elastic.co/t/elasticsearch-cache-seems-doesnt-work/88371/1 "2017-06-06T08:09:02Z")

</div>

Hi,  
I deployed an Elasticsearch5.4 cluster on server. It seems that the cache of Elasticsearch doesnt' work. Here is the detail.  
One server with CentOS6.7, 16 cores and 64 GB memory. A cluster with 2 nodes on this server. The node settings to the elasticsearch.yml :  
indices.queries.cache.size: 20%  
indices.requests.cache.size: 5%  
Also I created 3 indexes with settings like this:  
**"settings": {**  
**"number\_of\_shards" : 2,**  
**"number\_of\_replicas" : 1,**  
**"index.requests.cache.enable": true**  
**}**

After that, I started the cluster. Used Apache Bench to do the load test such as 10k requests or 1k requests.  
I found that the search took time increased from several ms to several seconds. More then 10 seconds at last. This is my query:  
GET /members/member/\_search  
{  
"from" : 0,  
"size" : 15,  
"query" : {  
"multi\_match" : {  
"query" : "London",  
"fields" : [  
"cityName^1.0",  
"nickname^1.0",  
"remark^1.0",  
"uid^1.0"  
],  
"type" : "most\_fields",  
"operator" : "AND",  
"slop" : 0,  
"prefix\_length" : 0,  
"max\_expansions" : 50,  
"lenient" : false,  
"zero\_terms\_query" : "NONE",  
"boost" : 1.0  
}  
},  
"highlight" : {  
"pre\_tags" : [  
""  
],  
"post\_tags" : [  
""  
],  
"fields" : {  
"nickname" : { },  
"remark" : { },  
"cityName" : { }  
}  
}  
}

Then I checked the request cache with this command. GET /\_stats/request\_cache?human&pretty.  
This is the response:  
{  
"\_shards" : {  
"total" : 12,  
"successful" : 12,  
"failed" : 0  
},  
"\_all" : {  
"primaries" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
},  
"total" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
}  
},  
"indices" : {  
"members" : {  
"primaries" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
},  
"total" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
}  
},  
"videos" : {  
"primaries" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
},  
"total" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
}  
},  
"products" : {  
"primaries" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
},  
"total" : {  
"request\_cache" : {  
"memory\_size" : "0b",  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0  
}  
}  
}  
}  
}

So I guess I made something wrong with the cache settings. Can anyone give me suggestion?  
Thanks!

Ray

---

<div class="post-metadata">

**Author:** ![zangrong](https://avatars.discourse-cdn.com/v4/letter/z/dec6dc/32.png) [@zangrong](https://discuss.elastic.co/u/zangrong)\
**Post date:** [June 7, 2017, 2:03am UTC](https://discuss.elastic.co/t/elasticsearch-cache-seems-doesnt-work/88371/2 "2017-06-07T02:03:52Z")

</div>

I read the cache chapter again and found this.  
[shard request cache](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html)

> Requests size is greater than 0 will not be cached even if the request cache is enabled in the index settings. To cache these requests you will need to use the query-string parameter detailed here.

But where the query-string parameter detailed? Then i read the [query-string query](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-query-string-query.html). I'm not sure there is any parameter about size.

Yes, i need to process search result with page. That drives me crazy. Does anyone face the same problem as i faced?

---

<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, 2:03am UTC](https://discuss.elastic.co/t/elasticsearch-cache-seems-doesnt-work/88371/3 "2017-07-05T02:03:55Z")

</div>

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