# Ids Query VS Multi Get API

**URL:** <https://discuss.elastic.co/t/ids-query-vs-multi-get-api/42388>\
**Category:** Elasticsearch\
**Created:** [February 22, 2016, 1:03pm UTC](https://discuss.elastic.co/t/ids-query-vs-multi-get-api/42388 "2016-02-22T13:03:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luk](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@luk](https://discuss.elastic.co/u/luk)\
**Post date:** [February 22, 2016, 1:03pm UTC](https://discuss.elastic.co/t/ids-query-vs-multi-get-api/42388/1 "2016-02-22T13:03:01Z")

</div>

I need to fetch a bunch of documents by \_id.

"Multi Get API" _should_ be faster but "Ids Query" is more flexible (works with aliases for example).

I'm doing some simple tests:

1. fetch 1000 ids from elasticsearch using a "match all" query.
2. fetch 1000 document by \_id using a multi-get query.
3. fetch 1000 document by \_id using an ids query.

and I'm noticing pretty the same response time.

So my question is:  
better using an "Ids Query" or the "Multi Get API"?

---

<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:** [February 22, 2016, 6:33pm UTC](https://discuss.elastic.co/t/ids-query-vs-multi-get-api/42388/2 "2016-02-22T18:33:08Z")

</div>

Not really, they are doing more or less the same thing. There is one important difference which is that multi-get would be realtime while the ids query would potentially not see what has been written since the last refresh.

---

<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:14pm UTC](https://discuss.elastic.co/t/ids-query-vs-multi-get-api/42388/3 "2017-07-05T23:14:24Z")

</div>


