Multi Get API

edit

The 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 _source field

For more information on the multi get operation, check out the REST multi get docs.