Skip to content

Commit

Permalink
[DOCS] Additional documentation for _score accessing
Browse files Browse the repository at this point in the history
Closes #7043

Conflicts:
	docs/reference/modules/scripting.asciidoc
  • Loading branch information
dakrone committed Sep 11, 2014
1 parent 58f7b4a commit cccef6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions docs/reference/modules/scripting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,8 @@ There are a few limitations relative to other script languages:
[float]
=== Score

In all scripts that can be used in facets, the current
document's score is accessible in `doc.score`. When using a `script_score`,
the current score is available in `_score`.
In all scripts that can be used in aggregations, the current
document's score is accessible in `_score`.

[float]
=== Computing scores based on terms in scripts
Expand Down Expand Up @@ -408,6 +407,13 @@ are much slower to access compared with document fields, as they are not
loaded into memory. They can be simply accessed using
`_fields['my_field_name'].value` or `_fields['my_field_name'].values`.

[float]
=== Accessing the score of a document within a script

When using scripting for calculating the score of a document (for instance, with
the `function_score` query), you can access the score using the `_score`
variable inside of a Groovy script.

[float]
=== Source Field

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ relevancy order of the most relevant document in a bucket.
},
"top_hit" : {
"max": {
"script": "_doc.score"
"script": "_score"
}
}
}
Expand Down

0 comments on commit cccef6a

Please sign in to comment.