From 47d2e2ac5a6464508b749d2c64c0e1e3b71375c2 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Thu, 3 Apr 2025 14:09:27 +0200 Subject: [PATCH] Fork per-node query action to search_coordination pool The runtime of this action can heavily depend on the number of shards queried, how quickly queries execute and how likely the can_match we execute during the query phase is to return `false`. As we shouldn't have O(n) cost tasks that may run unpredictably long, lets fork this to search_coordination like we do for can_match and field_caps which both have similar runtime cost. --- .../action/search/SearchQueryThenFetchAsyncAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java b/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java index 545e28f64749d..fc4aad617ddc0 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java @@ -559,7 +559,7 @@ static void registerNodeSearchAction( final int searchPoolMax = threadPool.info(ThreadPool.Names.SEARCH).getMax(); transportService.registerRequestHandler( NODE_SEARCH_ACTION_NAME, - EsExecutors.DIRECT_EXECUTOR_SERVICE, + threadPool.executor(ThreadPool.Names.SEARCH_COORDINATION), NodeQueryRequest::new, (request, channel, task) -> { final CancellableTask cancellableTask = (CancellableTask) task;