From 40fe7865277bc01a14343371a1cb4b34db5baa62 Mon Sep 17 00:00:00 2001 From: Takumasa Ochi <4468155+aeroastro@users.noreply.github.com> Date: Mon, 20 Nov 2017 15:08:50 +0900 Subject: [PATCH 1/2] Fix mathematical representation on interval (range) --- .../bucket/histogram-aggregation.asciidoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc index 0336e21c2eaf6..64f72b0664c0f 100644 --- a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc @@ -14,7 +14,8 @@ To make this more formal, here is the rounding function that is used: bucket_key = Math.floor((value - offset) / interval) * interval + offset -------------------------------------------------- -The `interval` must be a positive decimal, while the `offset` must be a decimal in `[0, interval[`. +The `interval` must be a positive decimal, while the `offset` must be a decimal in `[0, interval)` +(a decimal greater than or euqal to `0` and less than `interval`) The following snippet "buckets" the products based on their `price` by interval of `50`: @@ -64,7 +65,7 @@ And the following may be the response: ==== Minimum document count -The response above show that no documents has a price that falls within the range of `[100 - 150)`. By default the +The response above show that no documents has a price that falls within the range of `[100, 150)`. By default the response will fill gaps in the histogram with empty buckets. It is possible change that and request buckets with a higher minimum count thanks to the `min_doc_count` setting: @@ -266,10 +267,10 @@ The above will sort the buckets based on the avg rating among the promoted produ ==== Offset By default the bucket keys start with 0 and then continue in even spaced steps of `interval`, e.g. if the interval is 10 the first buckets -(assuming there is data inside them) will be [0 - 9], [10-19], [20-29]. The bucket boundaries can be shifted by using the `offset` option. +(assuming there is data inside them) will be [0, 10), [10, 20), [20, 30). The bucket boundaries can be shifted by using the `offset` option. -This can be best illustrated with an example. If there are 10 documents with values ranging from 5 to 14, using interval `10` will result in -two buckets with 5 documents each. If an additional offset `5` is used, there will be only one single bucket [5-14] containing all the 10 +This can be best illustrated with an example. If there are 10 documents with integer values ranging from 5 to 14, using interval `10` will result in +two buckets with 5 documents each. If an additional offset `5` is used, there will be only one single bucket [5, 15) containing all the 10 documents. ==== Response Format From 381a3242f13f330908fa0e1bcbc1381aa5fefc6c Mon Sep 17 00:00:00 2001 From: Takumasa Ochi <4468155+aeroastro@users.noreply.github.com> Date: Mon, 20 Nov 2017 16:55:30 +0900 Subject: [PATCH 2/2] Fix document according to review * Fix typo on equal * Remove redundant integer * code format --- .../aggregations/bucket/histogram-aggregation.asciidoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc index 64f72b0664c0f..170a257fb4367 100644 --- a/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc +++ b/docs/reference/aggregations/bucket/histogram-aggregation.asciidoc @@ -15,7 +15,7 @@ bucket_key = Math.floor((value - offset) / interval) * interval + offset -------------------------------------------------- The `interval` must be a positive decimal, while the `offset` must be a decimal in `[0, interval)` -(a decimal greater than or euqal to `0` and less than `interval`) +(a decimal greater than or equal to `0` and less than `interval`) The following snippet "buckets" the products based on their `price` by interval of `50`: @@ -267,10 +267,10 @@ The above will sort the buckets based on the avg rating among the promoted produ ==== Offset By default the bucket keys start with 0 and then continue in even spaced steps of `interval`, e.g. if the interval is 10 the first buckets -(assuming there is data inside them) will be [0, 10), [10, 20), [20, 30). The bucket boundaries can be shifted by using the `offset` option. +(assuming there is data inside them) will be `[0, 10)`, `[10, 20)`, `[20, 30)`. The bucket boundaries can be shifted by using the `offset` option. -This can be best illustrated with an example. If there are 10 documents with integer values ranging from 5 to 14, using interval `10` will result in -two buckets with 5 documents each. If an additional offset `5` is used, there will be only one single bucket [5, 15) containing all the 10 +This can be best illustrated with an example. If there are 10 documents with values ranging from 5 to 14, using interval `10` will result in +two buckets with 5 documents each. If an additional offset `5` is used, there will be only one single bucket `[5, 15)` containing all the 10 documents. ==== Response Format