forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script_score query errors on negative scores
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.
- Loading branch information
1 parent
302980e
commit 557f5be
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
37 changes: 37 additions & 0 deletions
37
...inless/src/test/resources/rest-api-spec/test/painless/120_script_score_negative_score.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Integration tests for ScriptScoreQuery using Painless | ||
setup: | ||
- skip: | ||
version: " - 7.6.99" | ||
reason: "script_score negative score was not allowed again from 7.7" | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
k: | ||
type: keyword | ||
|
||
- do: | ||
index: | ||
index: test_index | ||
id: 1 | ||
body: { "k": "value" } | ||
refresh: true | ||
|
||
--- | ||
"script_score should error on negative score": | ||
- do: | ||
catch: /.*script_score script returned an invalid score \[-1000.0\] for doc \[0\].*/ | ||
search: | ||
index: test_index | ||
body: | ||
query: | ||
script_score: | ||
query: {match_all: {}} | ||
script: | ||
source: "-1000" |