Switch to Sending a Bad Request User When Function Score Query Generates Negative Scores#133357
Merged
john-wagster merged 12 commits intoelastic:mainfrom Aug 24, 2025
Merged
Conversation
…on score query logic generates bad scores
Collaborator
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
Collaborator
|
Hi @john-wagster, I've created a changelog YAML for you. |
Contributor
Author
|
Keen for opinions here. I was looking at some failures around this and it seemed like IllegalArgumentException made the most sense but not 100% sure. |
…asticsearch into excetpion_funcscorequery
benwtrent
approved these changes
Aug 24, 2025
Member
benwtrent
left a comment
There was a problem hiding this comment.
Agreed! This should return a bad request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user forms up a function score query that will cause an exception in the scoring logic we should just inform them instead of failing:
For instance for something like:
we return
but should instead throw back an
IllegalArgumentExceptionas it's a user provided error to pass a function that will generate negative scores.Relevant stack: