}
public void sendExecuteFetch(DiscoveryNode node, final QuerySearchRequest request, final SearchServiceListener<QueryFetchSearchResult> listener) {
if (clusterService.state().nodes().localNodeId().equals(node.id())) {
try {
QueryFetchSearchResult result = searchService.executeFetchPhase(request);
listener.onResult(result);
} catch (Exception e) {
listener.onFailure(e);
}
} else {
transportService.sendRequest(node, SearchQueryQueryFetchTransportHandler.ACTION, request, new BaseTransportResponseHandler<QueryFetchSearchResult>() {
@Override public QueryFetchSearchResult newInstance() {
return new QueryFetchSearchResult();
}
@Override public void handleResponse(QueryFetchSearchResult response) {
listener.onResult(response);
}