client.prepareIndex("test", "type1", "1").setSource("field1", "value1", "field2", "value2").execute().actionGet();
logger.info("--> realtime get 1");
response = client.prepareGet("test", "type1", "1").execute().actionGet();
assertThat(response.exists(), equalTo(true));
assertThat(response.sourceAsMap().get("field1").toString(), equalTo("value1"));
assertThat(response.sourceAsMap().get("field2").toString(), equalTo("value2"));
logger.info("--> realtime get 1 (no source)");
response = client.prepareGet("test", "type1", "1").setFields(Strings.EMPTY_ARRAY).execute().actionGet();
assertThat(response.exists(), equalTo(true));