From dc5919533fdb40beae1b6238835c9b946f7ed181 Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Wed, 3 Jul 2024 17:30:01 -0600 Subject: [PATCH 1/7] Add bucket aggregations documentation Signed-off-by: Melissa Vagi --- .../bucket/auto-interval-date-histogram.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 _aggregations/bucket/auto-interval-date-histogram.md diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md new file mode 100644 index 0000000000..1d9f2b7f1b --- /dev/null +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -0,0 +1,59 @@ +--- +layout: default +title: Auto-interval date histogram +parent: Bucket aggregations +grand_parent: Aggregations +nav_order: 15 +--- + +# Auto-interval date histogram + +The `auto_date_histogram` aggregation automatically creates date histogram buckets based on the time range of your data. This aggregation is particularly useful when you are working with time-series data and want to visualize or analyze data over different time intervals without having to specify the bucket size manually. + +To use the `auto_date_histogram` aggregation, you need to specify the field containing the date or timestamp values. Additionally, you can provide optional parameters to customize the behavior of the aggregation. + +For example, you can use the `auto_date_histogram` aggregation to : + +```json +GET /sample-index/_search +{ + "size": 0, + "aggs": { + "histogram": { + "auto_date_histogram": { + "field": "timestamp", + "buckets": 2, + "minimum_interval": "day", + "time_zone": "America/Los_Angeles", + "format": "yyyy-MM-dd HH:mm:ss" + } + } + } +} +``` +{% include copy-curl.html %} + +#### Example response + +```json +... + "aggregations": { + "histogram": { + "buckets": [ + { + "key_as_string": "2023-04-01 00:00:00", + "key": 1680332400000, + "doc_count": 2 + }, + { + "key_as_string": "2023-04-02 00:00:00", + "key": 1680418800000, + "doc_count": 1 + } + ], + "interval": "1d" + } + } +} +``` +{% include copy-curl.html %} From daef30ed20750cf6d0260f43920f42d1364285cc Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Wed, 3 Jul 2024 17:33:26 -0600 Subject: [PATCH 2/7] Update auto-interval-date-histogram.md Signed-off-by: Melissa Vagi Signed-off-by: Melissa Vagi --- _aggregations/bucket/auto-interval-date-histogram.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index 1d9f2b7f1b..3d15061d9d 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -1,12 +1,12 @@ --- layout: default -title: Auto-interval date histogram +title: Auto-date histogram parent: Bucket aggregations grand_parent: Aggregations nav_order: 15 --- -# Auto-interval date histogram +# Auto-date histogram The `auto_date_histogram` aggregation automatically creates date histogram buckets based on the time range of your data. This aggregation is particularly useful when you are working with time-series data and want to visualize or analyze data over different time intervals without having to specify the bucket size manually. From aa2f3ae332f5f9cdd348bdf5656505112f9f5b6a Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Wed, 3 Jul 2024 17:35:11 -0600 Subject: [PATCH 3/7] Update _aggregations/bucket/auto-interval-date-histogram.md Signed-off-by: Melissa Vagi --- _aggregations/bucket/auto-interval-date-histogram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index 3d15061d9d..fa4e5a7664 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -12,7 +12,7 @@ The `auto_date_histogram` aggregation automatically creates date histogram bucke To use the `auto_date_histogram` aggregation, you need to specify the field containing the date or timestamp values. Additionally, you can provide optional parameters to customize the behavior of the aggregation. -For example, you can use the `auto_date_histogram` aggregation to : +For example, you can use the `auto_date_histogram` aggregation to create date-based buckets: ```json GET /sample-index/_search From 55de8c24351cd308822fa07a3ce78effa0cde5ac Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Fri, 30 Aug 2024 15:33:39 -0600 Subject: [PATCH 4/7] Update _aggregations/bucket/auto-interval-date-histogram.md Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Melissa Vagi --- _aggregations/bucket/auto-interval-date-histogram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index fa4e5a7664..46f2f8178c 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -8,7 +8,7 @@ nav_order: 15 # Auto-date histogram -The `auto_date_histogram` aggregation automatically creates date histogram buckets based on the time range of your data. This aggregation is particularly useful when you are working with time-series data and want to visualize or analyze data over different time intervals without having to specify the bucket size manually. +The `auto_date_histogram` aggregation automatically creates date histogram buckets based on the time range of your data. This aggregation is particularly useful when you are working with time-series data and want to visualize or analyze data over different time intervals without specifying the bucket size manually. To use the `auto_date_histogram` aggregation, you need to specify the field containing the date or timestamp values. Additionally, you can provide optional parameters to customize the behavior of the aggregation. From 33390c7e892697af4ddffe51c7542c248e40c053 Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Fri, 30 Aug 2024 15:33:50 -0600 Subject: [PATCH 5/7] Update _aggregations/bucket/auto-interval-date-histogram.md Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: Melissa Vagi --- _aggregations/bucket/auto-interval-date-histogram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index 46f2f8178c..4767f85853 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -12,7 +12,7 @@ The `auto_date_histogram` aggregation automatically creates date histogram bucke To use the `auto_date_histogram` aggregation, you need to specify the field containing the date or timestamp values. Additionally, you can provide optional parameters to customize the behavior of the aggregation. -For example, you can use the `auto_date_histogram` aggregation to create date-based buckets: +For example, you can use the following `auto_date_histogram` aggregation to create date-based buckets: ```json GET /sample-index/_search From 1ed14f75dd98be74c8ede5a5d412c8a752155601 Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Tue, 1 Oct 2024 14:36:15 -0600 Subject: [PATCH 6/7] Address doc review feedback Signed-off-by: Melissa Vagi --- .../bucket/auto-interval-date-histogram.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index 4767f85853..b0c33ce1a0 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -33,8 +33,20 @@ GET /sample-index/_search ``` {% include copy-curl.html %} -#### Example response +The accepted units for the minimum_interval parameter are as follows: + +- year +- month +- day +- hour +- minute +- second + +The `auto_date_histogram` aggregation will not try to use an interval shorter than the one specified in the `minimum_interval` parameter. +The following example response shows that the `auto_date_histogram` aggregation has generated a set of date-based buckets for the data in the `sample-index` index. The response shows two buckets, each representing a single day. + +#### Example response ```json ... "aggregations": { From 3b7175322076a3dbcf07979f74c882d10009b374 Mon Sep 17 00:00:00 2001 From: Melissa Vagi Date: Wed, 2 Oct 2024 09:37:05 -0600 Subject: [PATCH 7/7] Address doc review feedback Signed-off-by: Melissa Vagi --- _aggregations/bucket/auto-interval-date-histogram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_aggregations/bucket/auto-interval-date-histogram.md b/_aggregations/bucket/auto-interval-date-histogram.md index b0c33ce1a0..c06966bf49 100644 --- a/_aggregations/bucket/auto-interval-date-histogram.md +++ b/_aggregations/bucket/auto-interval-date-histogram.md @@ -46,7 +46,7 @@ The `auto_date_histogram` aggregation will not try to use an interval shorter th The following example response shows that the `auto_date_histogram` aggregation has generated a set of date-based buckets for the data in the `sample-index` index. The response shows two buckets, each representing a single day. -#### Example response +#### Response: Automated date bucketing ```json ... "aggregations": {