Map<SearchShardTarget, FetchSearchResult> fetchResults = newHashMap();
for (Map.Entry<SearchShardTarget, ExtTIntArrayList> entry : docIdsToLoad.entrySet()) {
SearchShardTarget shardTarget = entry.getKey();
ExtTIntArrayList docIds = entry.getValue();
FetchSearchResult fetchResult = nodeToSearchService.get(shardTarget.nodeId()).executeFetchPhase(new FetchSearchRequest(queryResults.get(shardTarget).queryResult().id(), docIds));
fetchResults.put(fetchResult.shardTarget(), fetchResult.initCounter());
}
SearchHits hits = searchPhaseController.merge(sortedShardList, queryResults, fetchResults).hits();
assertThat(hits.totalHits(), equalTo(100l));
assertThat(hits.hits().length, equalTo(60));