Skip to content

Conversation

benwtrent
Copy link
Member

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

When originally added, the knn query didn't apply `top-k` restrictions
to the query. Instead it would allow the resulting `num_candidate` to be
combined with sibling queries without restricting to `top-size` results
ahead of time.

This honestly is confusing behavior and leads to some bugs in understand
how it all works.

This commit addresses this by eagerly gathering only `size` results when
`k==null` before combining with other queries.

To achieve the previous behavior, this can be done directly by setting
`k==num_candidates` in the query.

(cherry picked from commit c18b48d)
Copy link
Contributor

github-actions bot commented Jan 7, 2025

Documentation preview:

@benwtrent benwtrent added >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Search Relevance/Vectors Vector search v8.18.0 labels Jan 7, 2025
@elasticsearchmachine elasticsearchmachine merged commit e5dc173 into elastic:8.x Jan 7, 2025
16 checks passed
@benwtrent benwtrent deleted the backport/8.x/pr-118774 branch January 7, 2025 22:12
elasticsearchmachine pushed a commit that referenced this pull request Jan 14, 2025
Since we do the queries with `k` now, need to update the required
feature set for the tests.

The reason for doing the queries with `k` is to ensure coverage since
now we automatically set `k` to `size`

related: #119700

closes: #119760 closes:
#119805 closes:
#119804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :Search Relevance/Vectors Vector search v8.18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants