-
Notifications
You must be signed in to change notification settings - Fork 25.3k
ESQL - Add K mandatory param for KNN function #129763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🔍 Preview links for changed docs: 🔔 The preview site may take up to 3 minutes to finish building. These links will become live once it completes. |
@@ -511,9 +511,6 @@ tests: | |||
- class: org.elasticsearch.entitlement.runtime.policy.FileAccessTreeTests | |||
method: testWindowsAbsolutPathAccess | |||
issue: https://github.com/elastic/elasticsearch/issues/129168 | |||
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is removed in this PR as it's already being tested in all other tests
@@ -29,31 +29,12 @@ chartreuse | [127.0, 255.0, 0.0] | |||
// end::knn-function-result[] | |||
; | |||
|
|||
knnSearchWithKOption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed test - k is already added to all other tests
@@ -100,14 +109,6 @@ public Knn( | |||
description = "Floating point number used to decrease or increase the relevance scores of the query." | |||
+ "Defaults to 1.0." | |||
), | |||
@MapParam.MapParamEntry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k is removed as an option
@@ -2172,24 +2173,25 @@ private void checkFullTextFunctionNullArgs(String functionInvocation, String arg | |||
); | |||
} | |||
|
|||
public void testFullTextFunctionsConstantQuery() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed as we're checking other params not being null now
Pinging @elastic/es-analytical-engine (Team:Analytics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does what it says 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one question
Right now KNN function sets k as an option:
| WHERE KNN(vector, [0, 1, 2], {"k": 10})
This is a problem as it makes k optional. Setting a default value makes no sense until we use LIMIT for setting k (#129353).
Until we use LIMIT, this PR makes k a mandatory parameter for KNN function:
The new function format will be:
| WHERE KNN(vector, [0, 1, 2], 10)
In case users want to set num_candidates, they can do so via option:
| WHERE KNN(vector, [0, 1, 2], 10, {"num_candidates": 50})
After #129353 is done, we can make this parameter optional and check that a LIMIT can be used to set K on behalf of the user. Users will be able to override the default K by setting it explicitly.
This PR removes a test for the k option, which makes no sense now, and closes the following related issues for this test:
Closes #129447
Closes #129512