浏览代码

[doc] explain avg in function_score better (#19154)

* [doc] explain avg in function_score better
Britta Weber 9 年之前
父节点
当前提交
57a734e641
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      docs/reference/query-dsl/function-score-query.asciidoc

+ 8 - 1
docs/reference/query-dsl/function-score-query.asciidoc

@@ -83,9 +83,16 @@ First, each document is scored by the defined functions. The parameter
 `max`::         maximum score is used
 `min`::         minimum score is used
 
-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.
+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.
 If weight is given without any other function declaration, `weight` acts as a function that simply returns the `weight`.
 
+In case `score_mode` is set to `avg` the individual scores will be combined by a **weighted** average.
+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
+`(1*3+2*4)/(3+4)` and **not** `(1*3+2*4)/2`.
+
 The new score can be restricted to not exceed a certain limit by setting
 the `max_boost` parameter. The default for `max_boost` is FLT_MAX.