NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Multi Get API
editMulti Get API
editThe multi get API allows to get a list of documents based on their index
and id
:
MultiGetResponse multiGetItemResponses = client.prepareMultiGet() .add("twitter", "_doc", "1") .add("twitter", "_doc", "2", "3", "4") .add("another", "_doc", "foo") .get(); for (MultiGetItemResponse itemResponse : multiGetItemResponses) { GetResponse response = itemResponse.getResponse(); if (response.isExists()) { String json = response.getSourceAsString(); } }
get by a single id |
|
or by a list of ids for the same index |
|
you can also get from another index |
|
iterate over the result set |
|
you can check if the document exists |
|
access to the |
For more information on the multi get operation, check out the REST multi get docs.