Update daterange-aggregation.asciidoc

Clarified the date-math expressions on date range aggregations

Closes #8703
This commit is contained in:
Clinton Gormley 2014-11-28 16:53:09 +01:00
parent 1d8fd0fc04
commit 88e06cba80
1 changed files with 6 additions and 4 deletions

View File

@ -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 <<search-aggregations-bucket-range-aggregation,range>> 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 <<search-aggregations-bucket-range-aggregation,range>> aggregation is that the `from` and `to` values can be expressed in <<date-math,Date Math>> 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