private List<SearchHit> searchInternal(final XContentQueryBuilder query, final int maxResults) {
final SearchResponse response = executeGet(new ClientCallback<SearchResponse>() {
@Override
public ActionFuture<SearchResponse> execute(final Client client) {
final SearchRequest request = Requests.searchRequest().searchType(
SearchType.DFS_QUERY_AND_FETCH);
final SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(query);
sourceBuilder.size(maxResults);
request.source(sourceBuilder);
return client.search(request);
}
});
return Arrays.asList(response.getHits().getHits());