Skip to content

Commit b942e4e

Browse files
bwc correctly
1 parent 07bc5e8 commit b942e4e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.apache.lucene.search.TopFieldDocs;
1616
import org.elasticsearch.ExceptionsHelper;
1717
import org.elasticsearch.TransportVersions;
18+
import org.elasticsearch.Version;
1819
import org.elasticsearch.action.ActionListener;
1920
import org.elasticsearch.action.IndicesRequest;
2021
import org.elasticsearch.action.OriginalIndices;
@@ -424,10 +425,9 @@ protected void run() {
424425
} else {
425426
final String nodeId = routing.getNodeId();
426427
// local requests don't need batching as there's no network latency
427-
final var target = new CanMatchPreFilterSearchPhase.SendingTarget(routing.getClusterAlias(), routing.getNodeId());
428428
if (localNodeId.equals(nodeId) == false) {
429429
perNodeQueries.computeIfAbsent(
430-
target,
430+
new CanMatchPreFilterSearchPhase.SendingTarget(routing.getClusterAlias(), routing.getNodeId()),
431431
ignored -> new NodeQueryRequest(
432432
new ArrayList<>(),
433433
request,
@@ -468,7 +468,9 @@ protected void run() {
468468
onNodeQueryFailure(e, request, routing);
469469
return;
470470
}
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)) {
472474
for (ShardToQuery shard : request.shards) {
473475
final int sidx = shard.shardIndex;
474476
this.performPhaseOnShard(

0 commit comments

Comments
 (0)