# Index warm up to speed up query time

**URL:** <https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523>\
**Category:** Elasticsearch\
**Created:** [January 4, 2017, 7:50am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523 "2017-01-04T07:50:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DBS](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@DBS](https://discuss.elastic.co/u/DBS)\
**Post date:** [January 4, 2017, 7:50am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/1 "2017-01-04T07:50:38Z")

</div>

Hi,  
I'd like to know whether there is a way that I can perform some kind of warm-up to speed up query process. Say if I have 50,000 documents in an index, and need to warm up 500 query strings. What I found was if I run es query for every 500 query string , it will boost query speed if I query the same query string again. So users won't experience delay. However, after certain time, say 24 hours, it slows down again when query the same query string. I thought the query result somehow will be cached in memory or hard drive for next same query search. But it doesn't seem like this way. I am new to this field, so any idea about this question would be really appreciated.

Thanks so much

---

<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:** [January 4, 2017, 7:54am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/2 "2017-01-04T07:54:24Z")

</div>

There is a cache, it's an LRU eviction.  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-cache.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-cache.html) might be useful.

---

<div class="post-metadata">

**Author:** ![DBS](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@DBS](https://discuss.elastic.co/u/DBS)\
**Post date:** [January 8, 2017, 8:25am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/3 "2017-01-08T08:25:02Z")

</div>

Thanks for the info.  
Additionally, is there any way I can set up cache in hard ware level?

Thanks

---

<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:** [January 8, 2017, 8:25am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/4 "2017-01-08T08:25:44Z")

</div>

Dunno, check your server manuals?

---

<div class="post-metadata">

**Author:** ![DBS](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@DBS](https://discuss.elastic.co/u/DBS)\
**Post date:** [January 8, 2017, 9:33am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/5 "2017-01-08T09:33:59Z")

</div>

More specifically, the es query I use is full-text query, using match. I assume I can also use LRU eviction, as you mentioned?

In addition, how long does this cache last, e.g. 1 or 2 days? Or there is no setting regarding to how to control how long the search cache last?

---

<div class="post-metadata">

**Author:** ![DBS](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@DBS](https://discuss.elastic.co/u/DBS)\
**Post date:** [January 8, 2017, 9:40am UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/6 "2017-01-08T09:40:36Z")

</div>

Sorry for the typo. I meant can I save cache in hard drive\* ? Thanks

---

<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:** [January 8, 2017, 8:05pm UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/7 "2017-01-08T20:05:18Z")

</div>

Caches like this one are stored in heap.  
There is no ability to control how to age them out/

---

<div class="post-metadata">

**Author:** ![DBS](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@DBS](https://discuss.elastic.co/u/DBS)\
**Post date:** [January 8, 2017, 10:36pm UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/8 "2017-01-08T22:36:09Z")

</div>

Thanks.

1. To clarify, I am not so sure about the following statement in the official document. Would you mind to explain? Does this mean if my es query only involves full text search, using match, without bool filter (e.g. should, must ..etc.) will NOT work in cache?

"The query cache only caches queries which are being used in a filter context."

1. Also, any suggestion of how to test efficiently if cache really works?

Thanks

---

<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:** [February 5, 2017, 10:36pm UTC](https://discuss.elastic.co/t/index-warm-up-to-speed-up-query-time/70523/9 "2017-02-05T22:36:44Z")

</div>

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