From 1a113af42d9ffb3534aacfad8a683533b6b0fa0d Mon Sep 17 00:00:00 2001 From: Salvatore Campagna Date: Fri, 3 Dec 2021 12:53:02 +0100 Subject: [PATCH 1/2] [DOCS] Fix the weighet average documentation The documentations states that if the `weight` field is missing, and no explicit missing configuration is provided, a default value of 1 is used. This is incorrect and does not match the implementation of the weighted average aggregator. In this specific case the document is skipped, instead. --- .../aggregations/metrics/weighted-avg-aggregation.asciidoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc b/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc index 164d2307d02a3..8722287b63122 100644 --- a/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc +++ b/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc @@ -210,8 +210,7 @@ Which should look like: The `missing` parameter defines how documents that are missing a value should be treated. The default behavior is different for `value` and `weight`: -By default, if the `value` field is missing the document is ignored and the aggregation moves on to the next document. -If the `weight` field is missing, it is assumed to have a weight of `1` (like a normal average). +By default, if the `value` or `weight` field is missing the document is ignored and the aggregation moves on to the next document. Both of these defaults can be overridden with the `missing` parameter: From de3fed9db96cb642eb0871b2690977dc5d47a523 Mon Sep 17 00:00:00 2001 From: Salvatore Campagna Date: Fri, 3 Dec 2021 17:57:19 +0100 Subject: [PATCH 2/2] Fix surrounding text and make it shorter --- .../metrics/weighted-avg-aggregation.asciidoc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc b/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc index 8722287b63122..c209867591763 100644 --- a/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc +++ b/docs/reference/aggregations/metrics/weighted-avg-aggregation.asciidoc @@ -207,12 +207,8 @@ Which should look like: ==== Missing values -The `missing` parameter defines how documents that are missing a value should be treated. -The default behavior is different for `value` and `weight`: - -By default, if the `value` or `weight` field is missing the document is ignored and the aggregation moves on to the next document. - -Both of these defaults can be overridden with the `missing` parameter: +By default, the aggregation excludes documents with a missing or `null` value for the `value` or `weight` field. Use the + `missing` parameter to specify a default value for these documents instead. [source,console] --------------------------------------------------