Skip to content

[9.3] Corrects a seemingly simple bug where we pass numCands instead of k (#140839)#140852

Merged
elasticsearchmachine merged 1 commit intoelastic:9.3from
benwtrent:backport/9.3/pr-140839
Jan 17, 2026
Merged

[9.3] Corrects a seemingly simple bug where we pass numCands instead of k (#140839)#140852
elasticsearchmachine merged 1 commit intoelastic:9.3from
benwtrent:backport/9.3/pr-140839

Conversation

@benwtrent
Copy link
Member

Backports the following commits to 9.3:

…lastic#140839)

Digging through the long and sordid history of this class, I noticed we
previously passed in `null`, which would indicate "dynamic K" which
defaulted to the size of the request.

However, in an effort to simplify the APIs when we rewrote these paths
for rescoring, I switched this to numCands.

But, since then @pmpailis actually fixed all the default logic in the
`Builder#build(int)` parameter, correctly defaulting `k` and `numCands`.


So, we SHOULD be able to pass in `k`. A quick check of our yaml tests
and they all passed...let's see what CI says.

While this is a bug, it would adjust behavior slightly, so only
considering the latest bugfix. I could be convinced to backport
everywhere if CI is happy.
@benwtrent benwtrent added :Search Relevance/Vectors Vector search >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch labels Jan 17, 2026
@elasticsearchmachine elasticsearchmachine merged commit 89d9bb0 into elastic:9.3 Jan 17, 2026
35 checks passed
@benwtrent benwtrent deleted the backport/9.3/pr-140839 branch January 17, 2026 16:14
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 Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.3.1

2 participants