assertThat(queryResult.topDocs().totalHits, equalTo(1));
}
@Test public void testDirectFetch() throws Exception {
QueryFetchSearchResult queryFetchResult = searchService.executeFetchPhase(searchRequest(searchSource().query(termQuery("name", "test1")), SearchType.QUERY_AND_FETCH));
assertThat(queryFetchResult.queryResult().topDocs().totalHits, equalTo(1));
assertThat(queryFetchResult.fetchResult().hits().hits().length, equalTo(1));
assertThat(queryFetchResult.fetchResult().hits().hits()[0].sourceAsString(), equalTo(source("1", "test1", 1)));
assertThat(queryFetchResult.fetchResult().hits().hits()[0].id(), equalTo("1"));
assertThat(queryFetchResult.fetchResult().hits().hits()[0].type(), equalTo("type1"));
}