parent
5fe782b784
commit
1dd26888f6
|
@ -305,8 +305,7 @@ There are a few limitations relative to other script languages:
|
||||||
=== Score
|
=== Score
|
||||||
|
|
||||||
In all scripts that can be used in aggregations, the current
|
In all scripts that can be used in aggregations, the current
|
||||||
document's score is accessible in `doc.score`. When using a `script_score`,
|
document's score is accessible in `_score`.
|
||||||
the current score is available in `_score`.
|
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
=== Computing scores based on terms in scripts
|
=== Computing scores based on terms in scripts
|
||||||
|
@ -410,6 +409,13 @@ are much slower to access compared with document fields, as they are not
|
||||||
loaded into memory. They can be simply accessed using
|
loaded into memory. They can be simply accessed using
|
||||||
`_fields['my_field_name'].value` or `_fields['my_field_name'].values`.
|
`_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]
|
[float]
|
||||||
=== Source Field
|
=== Source Field
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ relevancy order of the most relevant document in a bucket.
|
||||||
},
|
},
|
||||||
"top_hit" : {
|
"top_hit" : {
|
||||||
"max": {
|
"max": {
|
||||||
"script": "_doc.score"
|
"script": "_score"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue