# Slow query\_string with lot of memory

**URL:** <https://discuss.elastic.co/t/slow-query-string-with-lot-of-memory/79368>\
**Category:** Elasticsearch\
**Created:** [March 21, 2017, 8:28am UTC](https://discuss.elastic.co/t/slow-query-string-with-lot-of-memory/79368 "2017-03-21T08:28:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ales\_Kafka\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Ales\_Kafka\_2](https://discuss.elastic.co/u/Ales_Kafka_2)\
**Post date:** [March 21, 2017, 8:28am UTC](https://discuss.elastic.co/t/slow-query-string-with-lot-of-memory/79368/1 "2017-03-21T08:28:50Z")

</div>

Hi,

I need to speed-up query\_string to always run as fast as when it is warmed-up.

I have an index with couple of million documents (about 10GB big) and two string fields that are used in query\_string (title and perex of article). I have 1 instance of Elastic with 24GB of RAM (64GB total on the server). Search is fairly simple as I need to obtain all document ids that match given query.

When I warm-up the queries, search takes about 300ms (depending on number of matched documents). But after couple of hours (sometimes minutes), it takes 10-20x more to run same query.

I need to be able to run arbitrary query\_string (as a filter) in hundreds of milliseconds.

I tried to add ['fielddata' =\> ['loading' =\> 'eager\_global\_ordinals']] into mapping of those string properties. I'm also trying to run aggregation on those fields to keep them in memory. I tried not indexing new documents to keep index segments immutable. Nothing is working.

I run fairly old version of ES (1.3), will upgrade to 5.0 mean massive improvement?

Is there a way to keep inverted index of string field always in memory and run as fast as possible? There should be enough memory (jvm heap fluctuates between 20% and 75%).

Thank you for any advice.

---

<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:** [April 18, 2017, 8:29am UTC](https://discuss.elastic.co/t/slow-query-string-with-lot-of-memory/79368/2 "2017-04-18T08:29:05Z")

</div>

Closed on April 18, 2017, 8:29am UTC

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