Skip to content

Conversation

@jimczi
Copy link
Contributor

@jimczi jimczi commented Jan 31, 2025

The DFS and highlight phases require rewriting the Lucene query outside of the query phase. However, if the query contains a k-NN query, this triggers a nearest neighbor search on the entire shard, which is unnecessary in these phases since computing top-N results is not required.

This change builds upon #104006, applying the same transformation used for nested inner hits.
As a result, DFS and highlight phases avoid wasting time and resources on costly nearest neighbor searches.

Note: The explain and matched query phases are also affected but still require the nearest neighbor search for accurate results, so they remain unchanged for now.

…RewriteContext

The DFS and highlight phases require rewriting the Lucene query outside of the query phase.
However, if the query contains a k-NN query, this triggers a nearest neighbor search on the entire shard,
which is unnecessary in these phases since computing top-N results is not required.

This change builds upon elastic#104006, applying the same transformation used for nested inner hits.
As a result, DFS and highlight phases avoid wasting time and resources on costly nearest neighbor searches.

Note: The explain and matched query phases are also affected but still require the nearest neighbor search
for accurate results, so they remain unchanged for now.
@jimczi jimczi requested a review from benwtrent January 31, 2025 14:03
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Jan 31, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.19.0 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants