# Slow query performance with a large size value

**URL:** <https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702>\
**Category:** Elasticsearch\
**Created:** [July 16, 2015, 8:55am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702 "2015-07-16T08:55:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dag](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dag](https://discuss.elastic.co/u/dag)\
**Post date:** [July 16, 2015, 8:55am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/1 "2015-07-16T08:55:26Z")

</div>

Hello,

Firstly, sorry for my wrong english.

I have a index called sample.  
This index has a lot of documents. (about 2 millions)

My query example:

POST samples/sample/\_search  
{  
"\_source": ["someId"],  
"size": 50000  
}

This will take a long time. Why?

What can i do for improve my performance?

Currently has someId this mapping

"someId": {  
"type": "string",  
"analyzer": "keywords"  
}

thanks for your help

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [July 16, 2015, 9:07am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/2 "2015-07-16T09:07:39Z")

</div>

literary just from your description, size of 50000 looks a lot. but it also depend on how many nodes you have in cluster, what are the existing work load like index/query.

---

<div class="post-metadata">

**Author:** ![dag](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dag](https://discuss.elastic.co/u/dag)\
**Post date:** [July 16, 2015, 9:48am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/3 "2015-07-16T09:48:53Z")

</div>

> [@Jason\_Wee](#):
>
> literary just from your description

thanks for your response.

my cluster has 3 nodes two data and one logical node.

if this so expensive?  
i will all someId's from my sample index.

in mysql i can do "select someId from sample" and this is very very fast

what is the problem?

thank's

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [July 16, 2015, 10:08am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/4 "2015-07-16T10:08:26Z")

</div>

How long is "long" in your case? Do you know if the machines are I/O or CPU bound while running this query? Could you try to capture the output of the hot threads API while the query is running, it could give an idea of where time is spent.

---

<div class="post-metadata">

**Author:** ![dag](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dag](https://discuss.elastic.co/u/dag)\
**Post date:** [July 16, 2015, 10:38am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/5 "2015-07-16T10:38:33Z")

</div>

thanks for your reply  
Long in my case is by a size from 50000 about 30 seconds.

Sorry i do not know a hot threads API.  
What is this and how can i use this API?

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [July 16, 2015, 11:50am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/6 "2015-07-16T11:50:33Z")

</div>

fwiw [https://www.elastic.co/guide/en/elasticsearch/reference/1.6/cluster-nodes-hot-threads.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.6/cluster-nodes-hot-threads.html)

when the node is busy due to segment merging or gc on the heap, running this command it stuck in the command line forever, but in your case, it is worth to try.

hth

---

<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, 12:01am UTC](https://discuss.elastic.co/t/slow-query-performance-with-a-large-size-value/25702/7 "2017-07-06T00:01:01Z")

</div>


