# Superslow simple query

**URL:** <https://discuss.elastic.co/t/superslow-simple-query/24645>\
**Category:** Elasticsearch\
**Created:** [June 30, 2015, 4:56pm UTC](https://discuss.elastic.co/t/superslow-simple-query/24645 "2015-06-30T16:56:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ted\_Smith](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@Ted\_Smith](https://discuss.elastic.co/u/Ted_Smith)\
**Post date:** [June 30, 2015, 4:56pm UTC](https://discuss.elastic.co/t/superslow-simple-query/24645/1 "2015-06-30T16:56:59Z")

</div>

Hi:

I am using termsFilter with a list of integer of 50000)  
trying to get response  
it takes like 3 minutes to get result back.  
it is not sorted in anyway, I just want to get the list of docs

Another scenario, I simply want to read all docs back without any sorted  
or intermediary processing. I tried using scrolling. it takes forever  
to get response when there more more than 100000 rows

I'd expect the db to return result quickly since it has the initial data right  
without need to arrange/pack/sort, Anyway to have a streaming mode)  
or anyway to write a plugin to enable a streaming mode.  
(I am not interested all those stats data in the response, I just want the values  
streamed back right away.

Any help would be appreciated  
Thanks

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 30, 2015, 5:14pm UTC](https://discuss.elastic.co/t/superslow-simple-query/24645/2 "2015-06-30T17:14:36Z")

</div>

50,0000 random terms and doc fetches is at least 50,000 random disk seeks.  
If you have spinning media let's assume a random disk seek takes 5ms.

50,000 \* 5ms = 4minutes.

RAM will help with OS file system caching.  
SSDs will help with faster disk seeks when you have a cache miss.

---

<div class="post-metadata">

**Author:** ![Ted\_Smith](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@Ted\_Smith](https://discuss.elastic.co/u/Ted_Smith)\
**Post date:** [June 30, 2015, 11:46pm UTC](https://discuss.elastic.co/t/superslow-simple-query/24645/3 "2015-06-30T23:46:36Z")

</div>

Thanks for the info. Is there anyway (even write a plugin) to allow streaming doc back when it  
reads one in? It is ok if it takes this much time for disk read, but I'd like to get the data read  
immediately returned while it is reading the next. Right now, the client is just sitting there  
waiting for 4 minutes before getting the first element, even though ES should get it in  
the first 4 ms and send it back

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [July 1, 2015, 8:44am UTC](https://discuss.elastic.co/t/superslow-simple-query/24645/4 "2015-07-01T08:44:50Z")

</div>

For bulk reads see [https://www.elastic.co/guide/en/elasticsearch/guide/current/scan-scroll.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/scan-scroll.html)

---

<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:03am UTC](https://discuss.elastic.co/t/superslow-simple-query/24645/6 "2017-07-06T00:03:32Z")

</div>


