Skip to content

Commit e455fd0

Browse files
committed
[doc] explain avg in function_score better (#19154)
* [doc] explain avg in function_score better
1 parent eae0790 commit e455fd0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/reference/query-dsl/function-score-query.asciidoc

+8-1
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ First, each document is scored by the defined functions. The parameter
7171
`max`:: maximum score is used
7272
`min`:: minimum score is used
7373

74-
Because scores can be on different scales (for example, between 0 and 1 for decay functions but arbitrary for `field_value_factor`) and also because sometimes a different impact of functions on the score is desirable, the score of each function can be adjusted with a user defined `weight` (). The `weight` can be defined per function in the `functions` array (example above) and is multiplied with the score computed by the respective function.
74+
Because scores can be on different scales (for example, between 0 and 1 for decay functions but arbitrary for `field_value_factor`) and also
75+
because sometimes a different impact of functions on the score is desirable, the score of each function can be adjusted with a user defined
76+
`weight`. The `weight` can be defined per function in the `functions` array (example above) and is multiplied with the score computed by
77+
the respective function.
7578
If weight is given without any other function declaration, `weight` acts as a function that simply returns the `weight`.
7679

80+
In case `score_mode` is set to `avg` the individual scores will be combined by a **weighted** average.
81+
For example, if two functions return score 1 and 2 and their respective weights are 3 and 4, then their scores will be combined as
82+
`(1*3+2*4)/(3+4)` and **not** `(1*3+2*4)/2`.
83+
7784
The new score can be restricted to not exceed a certain limit by setting
7885
the `max_boost` parameter. The default for `max_boost` is FLT_MAX.
7986

0 commit comments

Comments
 (0)