|
@@ -62,10 +62,17 @@ multiplied by `boost` to produce final documents' scores. Defaults to `1.0`.
|
|
|
===== Use relevance scores in a script
|
|
===== Use relevance scores in a script
|
|
|
|
|
|
|
|
Within a script, you can
|
|
Within a script, you can
|
|
|
-{ref}/modules-scripting-fields.html#scripting-score[access]
|
|
|
|
|
|
|
+{ref}/modules-scripting-fields.html#scripting-score[access]
|
|
|
the `_score` variable which represents the current relevance score of a
|
|
the `_score` variable which represents the current relevance score of a
|
|
|
document.
|
|
document.
|
|
|
|
|
|
|
|
|
|
+[[script-score-access-term-statistics]]
|
|
|
|
|
+===== Use term statistics in a script
|
|
|
|
|
+
|
|
|
|
|
+Within a script, you can
|
|
|
|
|
+{ref}/modules-scripting-fields.html#scripting-term-statistics[access]
|
|
|
|
|
+the `_termStats` variable which provides statistical information about the terms used in the child query of the `script_score` query.
|
|
|
|
|
+
|
|
|
[[script-score-predefined-functions]]
|
|
[[script-score-predefined-functions]]
|
|
|
===== Predefined functions
|
|
===== Predefined functions
|
|
|
You can use any of the available {painless}/painless-contexts.html[painless
|
|
You can use any of the available {painless}/painless-contexts.html[painless
|
|
@@ -147,7 +154,7 @@ updated since update operations also update the value of the `_seq_no` field.
|
|
|
|
|
|
|
|
[[decay-functions-numeric-fields]]
|
|
[[decay-functions-numeric-fields]]
|
|
|
====== Decay functions for numeric fields
|
|
====== Decay functions for numeric fields
|
|
|
-You can read more about decay functions
|
|
|
|
|
|
|
+You can read more about decay functions
|
|
|
{ref}/query-dsl-function-score-query.html#function-decay[here].
|
|
{ref}/query-dsl-function-score-query.html#function-decay[here].
|
|
|
|
|
|
|
|
* `double decayNumericLinear(double origin, double scale, double offset, double decay, double docValue)`
|
|
* `double decayNumericLinear(double origin, double scale, double offset, double decay, double docValue)`
|
|
@@ -233,7 +240,7 @@ The `script_score` query calculates the score for
|
|
|
every matching document, or hit. There are faster alternative query types that
|
|
every matching document, or hit. There are faster alternative query types that
|
|
|
can efficiently skip non-competitive hits:
|
|
can efficiently skip non-competitive hits:
|
|
|
|
|
|
|
|
-* If you want to boost documents on some static fields, use the
|
|
|
|
|
|
|
+* If you want to boost documents on some static fields, use the
|
|
|
<<query-dsl-rank-feature-query, `rank_feature`>> query.
|
|
<<query-dsl-rank-feature-query, `rank_feature`>> query.
|
|
|
* If you want to boost documents closer to a date or geographic point, use the
|
|
* If you want to boost documents closer to a date or geographic point, use the
|
|
|
<<query-dsl-distance-feature-query, `distance_feature`>> query.
|
|
<<query-dsl-distance-feature-query, `distance_feature`>> query.
|