Skip to content

Conversation

@jdconrad
Copy link
Contributor

We have allowed hybrid search since 8.4. This means the internal changes for sub_searches must be able to write a compound query as early as 8.4, but currently we only do that back to 8.8. This change fixes that issue.

Closes ##97144

@jdconrad jdconrad requested a review from benwtrent July 11, 2023 16:50
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Jul 11, 2023
@elasticsearchmachine
Copy link
Collaborator

Hi @jdconrad, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@jdconrad jdconrad removed the request for review from benwtrent July 11, 2023 17:33
@benwtrent benwtrent added the test-full-bwc Trigger full BWC version matrix tests label Jul 11, 2023
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_500_013)) {
out.writeList(subSearchSourceBuilders);
} else if (out.getTransportVersion().before(TransportVersion.V_8_8_0) && subSearchSourceBuilders.size() >= 2) {
} else if (out.getTransportVersion().before(TransportVersion.V_8_4_0) && subSearchSourceBuilders.size() >= 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only works if one of the subsearches is kNN and one is a query. Two queries breaks here right?

Copy link
Contributor Author

@jdconrad jdconrad Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. However, I don't like the fragility of doing an instanceof check to ensure that one of these is a kNN query. Versions prior to the implementation kNN should break anyway when de-serializing the knn docs and score query. At this point I would prefer to rely on the implicit contract with the user of not using new features during upgrades that are unsupported. For any case after or equal to 8.4 it would send a combined boolean query to the old node which is the same as what happens in the newer versions. Also if ranking is involved serialization will fail as part of the ShardSearchRequest.

@jdconrad
Copy link
Contributor Author

@elasticsearchmachine run elasticsearch-ci/bwc

@benwtrent
Copy link
Member

@elasticmachine update branch

@benwtrent
Copy link
Member

@elasticmachine elasticsearch-ci/full-bwc

@benwtrent
Copy link
Member

@elasticmachine run elasticsearch-ci/full-bwc

@jdconrad
Copy link
Contributor Author

@benwtrent Thanks for the review and adding full-bwc!

@jdconrad jdconrad merged commit ab65e6f into elastic:main Jul 18, 2023
jdconrad added a commit to jdconrad/elasticsearch that referenced this pull request Jul 18, 2023
We have allowed hybrid search since 8.4. This means the internal changes for sub_searches must be able to write a compound query as early as 8.4, but currently we only do that back to 8.8. This change fixes that issue. Closes #elastic#97144
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.9
elasticsearchmachine pushed a commit that referenced this pull request Jul 18, 2023
We have allowed hybrid search since 8.4. This means the internal changes for sub_searches must be able to write a compound query as early as 8.4, but currently we only do that back to 8.8. This change fixes that issue. Closes ##97144
@rjernst rjernst added v8.9.0 and removed v8.9.1 labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Search Relevance/Ranking Scoring, rescoring, rank evaluation. Team:Search Meta label for search team test-full-bwc Trigger full BWC version matrix tests v8.9.0 v8.10.0

5 participants