MultiGet extends GenericResultAbstractAction { @Override public String getRestMethodName() { return "POST"; } protected  MultiGet(AbstractAction.Builder builder); protected  MultiGet(Builder.ByDoc builder); protected  MultiGet(Builder.ById builder); @Override String getRestMethodName(); @Override String getPathToResult();  }
@Test public void getMultipleDocs() throws JSONException { MultiGet get = new MultiGet.Builder.ByDoc(Arrays.asList(doc1, doc2, doc3)).build(); assertEquals("POST", get.getRestMethodName()); assertEquals("/_mget", get.getURI(ElasticsearchVersion.UNKNOWN)); JSONAssert.assertEquals("{\"docs\":[" + "{\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"1\"}," + "{\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"2\"}," + "{\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"3\"}]}", get.getData(new Gson()), false); }
@Test public void getDocumentWithMultipleIds() throws JSONException { MultiGet get = new MultiGet.Builder.ById("twitter", "tweet").addId(Arrays.asList("1", "2", "3")).build(); assertEquals("POST", get.getRestMethodName()); assertEquals("twitter/tweet/_mget", get.getURI(ElasticsearchVersion.UNKNOWN)); JSONAssert.assertEquals("{\"ids\":[\"1\",\"2\",\"3\"]}", get.getData(new Gson()), false); }