5959 */
6060final class CanMatchPreFilterSearchPhase {
6161
62+ private static final String PHASE_NAME = "can_match" ;
63+
6264 private final Logger logger ;
6365 private final SearchRequest request ;
6466 private final List <SearchShardIterator > shardsIts ;
@@ -152,7 +154,7 @@ public static SubscribableListener<List<SearchShardIterator>> execute(
152154 public void onResponse (List <SearchShardIterator > shardsIts ) {
153155 // searchResponseMetrics is null for node can-match requests
154156 if (searchResponseMetrics != null ) {
155- searchResponseMetrics .recordSearchPhaseDuration ("can_match" , System .nanoTime () - phaseStartTimeInNanos );
157+ searchResponseMetrics .recordSearchPhaseDuration (PHASE_NAME , System .nanoTime () - phaseStartTimeInNanos );
156158 }
157159 }
158160
@@ -169,7 +171,7 @@ public void onFailure(Exception e) {
169171 if (logger .isDebugEnabled ()) {
170172 logger .debug (() -> format ("Failed to execute [%s] while running [can_match] phase" , request ), e );
171173 }
172- listener .onFailure (new SearchPhaseExecutionException ("can_match" , "start" , e , ShardSearchFailure .EMPTY_ARRAY ));
174+ listener .onFailure (new SearchPhaseExecutionException (PHASE_NAME , "start" , e , ShardSearchFailure .EMPTY_ARRAY ));
173175 }
174176
175177 @ Override
@@ -270,7 +272,7 @@ private synchronized void consumeResult(int shardIndex, boolean canMatch, MinAnd
270272
271273 private void checkNoMissingShards (List <SearchShardIterator > shards ) {
272274 assert assertSearchCoordinationThread ();
273- SearchPhase .doCheckNoMissingShards ("can_match" , request , shards );
275+ SearchPhase .doCheckNoMissingShards (PHASE_NAME , request , shards );
274276 }
275277
276278 private Map <SendingTarget , List <SearchShardIterator >> groupByNode (List <SearchShardIterator > shards ) {
@@ -407,7 +409,7 @@ public void onFailure(Exception e) {
407409 if (logger .isDebugEnabled ()) {
408410 logger .debug (() -> format ("Failed to execute [%s] while running [can_match] phase" , request ), e );
409411 }
410- listener .onFailure (new SearchPhaseExecutionException ("can_match" , "round" , e , ShardSearchFailure .EMPTY_ARRAY ));
412+ listener .onFailure (new SearchPhaseExecutionException (PHASE_NAME , "round" , e , ShardSearchFailure .EMPTY_ARRAY ));
411413 }
412414 }
413415
0 commit comments