@Test
public void testNestedObjectsRewriting() {
prepareNested();
SearchIntoRequest request = new SearchIntoRequest("test");
request.source("{\"fields\": [\"_id\", [\"x.city\", \"_source.city\"], [\"x.surname\", \"_source.name.surname\"], [\"x.name\", \"_source.name.name\"], [\"_index\", \"'newindex'\"]]}");
SearchIntoResponse res = esSetup.client().execute(SearchIntoAction.INSTANCE, request).actionGet();
GetRequestBuilder rb = new GetRequestBuilder(esSetup.client(), "newindex");
GetResponse getRes = rb.setType("a").setId("1").execute().actionGet();
assertTrue(getRes.isExists());
assertEquals("{\"x\":{\"name\":\"Doe\",\"surname\":\"John\",\"city\":\"Dornbirn\"}}", getRes.getSourceAsString());