Skip to content
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

Forbid negative scores in function_score query #35709

Conversation

mayya-sharipova
Copy link
Contributor

  • Throw an exception when scores are negative in field_value_factor
    function
  • Throw an exception when scores are negative in script_score
    function

Relates to #33309

- Throw an exception when scores are negative in field_value_factor
function
- Throw an exception when scores are negative in script_score
function

Relates to elastic#33309
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I wonder if we also need to check the finalScore
computed by FunctionScoreQuery#FunctionFactorScorer#scorer ? It should not be possible to produce a negative score with the current checks but I could have missed something.

query:
term:
test: value
"functions": [{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indent

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a note in the breaking changes ?

@rjernst
Copy link
Member

rjernst commented Nov 19, 2018

This this only be made in 7.0, not 6.6? Maybe a deprecation warning in 6.6 instead?

@mayya-sharipova mayya-sharipova force-pushed the script-score-ensure-nonnegative-scores branch from d55bf1e to 35ebc96 Compare November 20, 2018 13:38
@mayya-sharipova
Copy link
Contributor Author

@elasticmachine test this please

@mayya-sharipova mayya-sharipova merged commit b6014d9 into elastic:master Nov 22, 2018
@mayya-sharipova mayya-sharipova deleted the script-score-ensure-nonnegative-scores branch November 22, 2018 11:08
original-brownbear pushed a commit that referenced this pull request Nov 23, 2018
* Forbid negative scores in functon_score query

- Throw an exception when scores are negative in field_value_factor
function
- Throw an exception when scores are negative in script_score
function

Relates to #33309
mayya-sharipova added a commit that referenced this pull request Nov 23, 2018
@jimczi jimczi mentioned this pull request Nov 23, 2018
5 tasks
@javanna javanna changed the title Forbid negative scores in functon_score query Forbid negative scores in function_score query Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Search Relevance/Ranking Scoring, rescoring, rank evaluation. v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants