From 88e06cba80e76674dd2be4865ba263cbf2de3e7c Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Fri, 28 Nov 2014 16:53:09 +0100 Subject: [PATCH] Update daterange-aggregation.asciidoc Clarified the date-math expressions on date range aggregations Closes #8703 --- .../aggregations/bucket/daterange-aggregation.asciidoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/reference/search/aggregations/bucket/daterange-aggregation.asciidoc b/docs/reference/search/aggregations/bucket/daterange-aggregation.asciidoc index 02ebf5d50be..7c5d6cc86fc 100644 --- a/docs/reference/search/aggregations/bucket/daterange-aggregation.asciidoc +++ b/docs/reference/search/aggregations/bucket/daterange-aggregation.asciidoc @@ -1,7 +1,7 @@ [[search-aggregations-bucket-daterange-aggregation]] === Date Range Aggregation -A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal <> aggregation is that the `from` and `to` values can be expressed in Date Math expressions, and it is also possible to specify a date format by which the `from` and `to` response fields will be returned. +A range aggregation that is dedicated for date values. The main difference between this aggregation and the normal <> aggregation is that the `from` and `to` values can be expressed in <> expressions, and it is also possible to specify a date format by which the `from` and `to` response fields will be returned. Note that this aggregration includes the `from` value and excludes the `to` value for each range. Example: @@ -15,14 +15,16 @@ Example: "field": "date", "format": "MM-yyy", "ranges": [ - { "to": "now-10M/M" }, - { "from": "now-10M/M" } + { "to": "now-10M/M" }, <1> + { "from": "now-10M/M" } <2> ] } } } } -------------------------------------------------- +<1> < now minus 10 months, rounded down to the start of the month. +<2> >= now minus 10 months, rounded down to the start of the month. In the example above, we created two range buckets, the first will "bucket" all documents dated prior to 10 months ago and the second will "bucket" all documents dated since 10 months ago @@ -108,4 +110,4 @@ Zone:: 'Z' outputs offset without a colon, 'ZZ' outputs the offset with a colon, Zone names:: Time zone names ('z') cannot be parsed. -Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '?' will appear in the resulting time text even they are not embraced within single quotes. \ No newline at end of file +Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '?' will appear in the resulting time text even they are not embraced within single quotes.