Ids Query VS Multi Get API

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"?

1 Like

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.