|
15 | 15 | import org.apache.lucene.search.TopFieldDocs; |
16 | 16 | import org.elasticsearch.ExceptionsHelper; |
17 | 17 | import org.elasticsearch.TransportVersions; |
| 18 | +import org.elasticsearch.Version; |
18 | 19 | import org.elasticsearch.action.ActionListener; |
19 | 20 | import org.elasticsearch.action.IndicesRequest; |
20 | 21 | import org.elasticsearch.action.OriginalIndices; |
@@ -424,10 +425,9 @@ protected void run() { |
424 | 425 | } else { |
425 | 426 | final String nodeId = routing.getNodeId(); |
426 | 427 | // local requests don't need batching as there's no network latency |
427 | | - final var target = new CanMatchPreFilterSearchPhase.SendingTarget(routing.getClusterAlias(), routing.getNodeId()); |
428 | 428 | if (localNodeId.equals(nodeId) == false) { |
429 | 429 | perNodeQueries.computeIfAbsent( |
430 | | - target, |
| 430 | + new CanMatchPreFilterSearchPhase.SendingTarget(routing.getClusterAlias(), routing.getNodeId()), |
431 | 431 | ignored -> new NodeQueryRequest( |
432 | 432 | new ArrayList<>(), |
433 | 433 | request, |
@@ -468,7 +468,9 @@ protected void run() { |
468 | 468 | onNodeQueryFailure(e, request, routing); |
469 | 469 | return; |
470 | 470 | } |
471 | | - if (connection.getTransportVersion().before(TransportVersions.BATCHED_QUERY_PHASE_VERSION)) { |
| 471 | + // must check both node and transport versions to correctly deal with BwC on proxy connections |
| 472 | + if (connection.getTransportVersion().before(TransportVersions.BATCHED_QUERY_PHASE_VERSION) |
| 473 | + || connection.getNode().getVersionInformation().nodeVersion().before(Version.V_9_1_0)) { |
472 | 474 | for (ShardToQuery shard : request.shards) { |
473 | 475 | final int sidx = shard.shardIndex; |
474 | 476 | this.performPhaseOnShard( |
|
0 commit comments