Skip to content

Conversation

@mayya-sharipova
Copy link
Contributor

7.5 and 7.6 had a regression that allowed for
script_score queries to have negative scores.
We have corrected this regression in #52478.
This is an addition to #52478 that adds
a test and release notes.

7.5 and 7.6 had a regression that allowed for
script_score queries to have negative scores.
We have corrected this regression in elastic#52478.
This is an addition to elastic#52478 that adds
a test and release notes.
@mayya-sharipova mayya-sharipova added the :Search Relevance/Ranking Scoring, rescoring, rank evaluation. label Mar 4, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Ranking)

Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

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

@mayya-sharipova thanks for making this update!

For the test, I think it'd be nice to add a case to ScriptScoreQueryTests instead of adding a new yml REST test. The behavior seems pretty straightforward to cover through a unit test, and unit tests tend to be faster to run and easier to debug than integration tests.

@mayya-sharipova
Copy link
Contributor Author

@jtibshirani Thanks for the review, I have addressed your comments in the second commit. Please continue to review.
I thought yml test is more understandable and it highlights versions we made changes, while in unit tests with scripts we do a lot of mocks.

Remove yml test, add unit test
@mayya-sharipova mayya-sharipova force-pushed the script-score-negative-score-7.x branch from 1263ec2 to ed6e118 Compare March 5, 2020 16:32
assertThat(explanation.getValue(), equalTo(2.0f));
}

public void testScriptScoreErrorOnNegativeScore() {
Copy link
Contributor

Choose a reason for hiding this comment

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

For me this set of unit tests is quite straightforward + easy to understand. I think yml tests are slower to debug and are most helpful for testing the end-to-end integration. We recently added a set of testing guidelines that I think are really helpful: https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#what-kind-of-tests-should-i-write

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jtibshirani Thanks a lot, I missed these guidelines, will study them

@mayya-sharipova mayya-sharipova merged commit 7e2a9f5 into elastic:7.x Mar 5, 2020
mayya-sharipova added a commit that referenced this pull request Mar 5, 2020
7.5 and 7.6 had a regression that allowed for
script_score queries to have negative scores.
We have corrected this regression in #52478.
This is an addition to #52478 that adds a test for this.

Related to #53133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Search Relevance/Ranking Scoring, rescoring, rank evaluation. v7.7.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants