Skip to content

Commit

Permalink
Switch stored script example to script_score query (#47691)
Browse files Browse the repository at this point in the history
The example use of a scoring script was incorrectly using a filter
script query, which has no scoring, and thus no _score variable
avialable. This commit converts the example doc to using the newer
script_score query.
  • Loading branch information
rjernst committed Oct 8, 2019
1 parent 5a0d843 commit 1aff080
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/reference/scripting/using.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ POST _scripts/calculate-score
}
-----------------------------------
// CONSOLE
// TEST[setup:twitter]

This same script can be retrieved with:

Expand All @@ -169,10 +170,15 @@ Stored scripts can be used by specifying the `id` parameters as follows:

[source,js]
--------------------------------------------------
GET _search
GET twitter/_search
{
"query": {
"script": {
"script_score": {
"query": {
"match": {
"message": "some message"
}
},
"script": {
"id": "calculate-score",
"params": {
Expand Down

0 comments on commit 1aff080

Please sign in to comment.