SearchRequestBuilder srb1 = node.client().prepareSearch("meal").setQuery(QueryBuilders.queryString("pale")).setSize(1);
logger.info("Your 1st query is : {}", srb1);
SearchRequestBuilder srb2 = node.client().prepareSearch("meal").setQuery(QueryBuilders.matchQuery("brand", "HEINEKEN")).setSize(1);
logger.info("Your 2nd query is : {}", srb2);
MultiSearchResponse sr = node.client().prepareMultiSearch()
.add(srb1)
.add(srb2)
.execute().actionGet();
Assert.assertNotNull(sr);
Assert.assertEquals(2, sr.getResponses().length);
long nbHits = 0;
for (MultiSearchResponse.Item item : sr.getResponses()) {
SearchResponse response = item.getResponse();
nbHits += response.getHits().totalHits();
}
Assert.assertTrue(nbHits > 0);
logger.info("Full json result is: {}", sr.toString());
}