IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. 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
, type
and id
:
MultiGetResponse multiGetItemResponses = client.prepareMultiGet() .add("twitter", "tweet", "1") .add("twitter", "tweet", "2", "3", "4") .add("another", "type", "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 / type |
|
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.