-
Notifications
You must be signed in to change notification settings - Fork 191
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
Not possible to deserialize/create a score function of type "weight" #820
Labels
bug
Something isn't working
Comments
Want to contribute the missing code @brentam? Also I would check what we have in https://github.com/opensearch-project/opensearch-api-specification |
russcam
added a commit
to russcam/opensearch-java
that referenced
this issue
Feb 26, 2024
This commit supports function score functions with an optional function variant. The function is optional as it is perfectly valid to have a function with only a weight e.g. a function score query with multiple functions and a score mode of "first", where the last weight function acts as some default value. Closes opensearch-project#820
russcam
added a commit
to russcam/opensearch-java
that referenced
this issue
Feb 26, 2024
This commit supports function score functions with an optional function variant. The function is optional as it is perfectly valid to have a function with only a weight e.g. a function score query with multiple functions and a score mode of "first", where the last weight function acts as some default value. Closes opensearch-project#820 Signed-off-by: Russ Cam <russcam@canva.com>
VachaShah
pushed a commit
that referenced
this issue
Feb 27, 2024
* Support optional function score variant This commit supports function score functions with an optional function variant. The function is optional as it is perfectly valid to have a function with only a weight e.g. a function score query with multiple functions and a score mode of "first", where the last weight function acts as some default value. Closes #820 Signed-off-by: Russ Cam <russcam@canva.com> * Address CI build issues Signed-off-by: Russ Cam <russcam@canva.com> * remove changelog entry for 3.0 Signed-off-by: Russ Cam <russcam@canva.com> --------- Signed-off-by: Russ Cam <russcam@canva.com>
opensearch-trigger-bot bot
pushed a commit
that referenced
this issue
Feb 27, 2024
* Support optional function score variant This commit supports function score functions with an optional function variant. The function is optional as it is perfectly valid to have a function with only a weight e.g. a function score query with multiple functions and a score mode of "first", where the last weight function acts as some default value. Closes #820 Signed-off-by: Russ Cam <russcam@canva.com> * Address CI build issues Signed-off-by: Russ Cam <russcam@canva.com> * remove changelog entry for 3.0 Signed-off-by: Russ Cam <russcam@canva.com> --------- Signed-off-by: Russ Cam <russcam@canva.com> (cherry picked from commit 045c805) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
VachaShah
pushed a commit
that referenced
this issue
Feb 27, 2024
* Support optional function score variant This commit supports function score functions with an optional function variant. The function is optional as it is perfectly valid to have a function with only a weight e.g. a function score query with multiple functions and a score mode of "first", where the last weight function acts as some default value. Closes #820 * Address CI build issues * remove changelog entry for 3.0 --------- (cherry picked from commit 045c805) Signed-off-by: Russ Cam <russcam@canva.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the bug?
not possible to build/deserialize a score function of type "weight".
Therefore, we are not able to construct queries that contains the "weight" score function type.
This search query is a correct query:
Notice the function array, the second one is a correct function type "weight" as per the documentation.
Unfortunatelly, there is no way to deserialize or build that score function using the api.
The problem seems in the FunctionScore.Kind enum
These are hardcoded values with the json field expected by all the types.
The issue is that she "weight" function is characterized by the abscense of any of the values above,
How can one reproduce the bug?
Look at the test below:
the
willThrowException
test should not throw any exceptionWhat is the expected behavior?
We should be able to build/deserialize the "weight" type function
What is your host/environment?
MacOs Sonoma
Do you have any screenshots?
N/A
Do you have any additional context?
documentation for score-functions
https://opensearch.org/docs/latest/query-dsl/compound/function-score
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-function-score-query.html#score-functions
The text was updated successfully, but these errors were encountered: