mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 22:45:04 +00:00
Adding time_zone
parameter to daterange-aggregation docs
This commit is contained in:
parent
5ff413074a
commit
6b0f63e1a6
@ -111,3 +111,31 @@ Zone:: 'Z' outputs offset without a colon, 'ZZ' outputs the offset with a colon,
|
|||||||
Zone names:: Time zone names ('z') cannot be parsed.
|
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.
|
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.
|
||||||
|
|
||||||
|
[[time-zones]]
|
||||||
|
==== Time zone in date range aggregations
|
||||||
|
|
||||||
|
Dates can be converted from another time zone to UTC by specifying the `time_zone` parameter.
|
||||||
|
The `time_zone` parameter is also applied to rounding in date math expressions. As an example,
|
||||||
|
to round to the beginning of the day in the CET time zone, you can do the following:
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
--------------------------------------------------
|
||||||
|
{
|
||||||
|
"aggs": {
|
||||||
|
"range": {
|
||||||
|
"date_range": {
|
||||||
|
"field": "date",
|
||||||
|
"time_zone": "CET",
|
||||||
|
"ranges": [
|
||||||
|
{ "to": "2016-02-15/d" }, <1>
|
||||||
|
{ "from": "2016-02-15/d", "to" : "now/d" <2>},
|
||||||
|
{ "from": "now/d" },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--------------------------------------------------
|
||||||
|
<1> This date will be converted to `2016-02-15T00:00:00.000+01:00`.
|
||||||
|
<2> `now\d` will be rounded to the beginning of the day in the CET time zone.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user