# Fetch time too slow for a query that only needs documents ids

**URL:** <https://discuss.elastic.co/t/fetch-time-too-slow-for-a-query-that-only-needs-documents-ids/41953>\
**Category:** Elasticsearch\
**Created:** [February 16, 2016, 11:37pm UTC](https://discuss.elastic.co/t/fetch-time-too-slow-for-a-query-that-only-needs-documents-ids/41953 "2016-02-16T23:37:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Soderlund](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max_soderlund/32/7848_2.png) [@Max\_Soderlund](https://discuss.elastic.co/u/Max_Soderlund)\
**Post date:** [February 16, 2016, 11:37pm UTC](https://discuss.elastic.co/t/fetch-time-too-slow-for-a-query-that-only-needs-documents-ids/41953/1 "2016-02-16T23:37:04Z")

</div>

Hi there, I'm working on a query that only needs to get the id's of the results. I'm doing this with a scan/scroll search, however, the size of the fetch time for the results is too big for a realtime application (over 30 millions documents). I need to get only the id's, setting setNoFields() doesn't avoid the fetch time so I'm considering implementing a plugin for extending elasticsearch and avoid the fetch phase, but I don't know where to start or if this is even posible.

Any help is welcome, thanks!

---

<div class="post-metadata">

**Author:** ![gcampbell-epiq](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gcampbell-epiq](https://discuss.elastic.co/u/gcampbell-epiq)\
**Post date:** [March 16, 2016, 4:54pm UTC](https://discuss.elastic.co/t/fetch-time-too-slow-for-a-query-that-only-needs-documents-ids/41953/2 "2016-03-16T16:54:04Z")

</div>

I'm very interested in this as well. It would be great if there were an option in Elastic's API to optimize for returning only IDs. Omitting the fetch phase of the search seems like the right place to start.

Also, interested in implementing a plugin. Max, have you made progress on this?

---

<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, 11:07pm UTC](https://discuss.elastic.co/t/fetch-time-too-slow-for-a-query-that-only-needs-documents-ids/41953/3 "2017-07-05T23:07:51Z")

</div>


