Skip to content

Commit c9d05ad

Browse files
author
Christoph Büscher
authored
Clarify using time_zone and date math in range query (#40655)
Currently, the docs correctly state that using `now` in range queries will not be affected by the `time_zone` parameter. However, using date math roundings like e.g. `now\d` will be affected by the `time_zone`. Adding this example because it seems to be a frequently asked question and source of confusion. Relates to #40581
1 parent 0ad3d90 commit c9d05ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/reference/query-dsl/range-query.asciidoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ GET _search
138138
--------------------------------------------------
139139
// CONSOLE
140140
<1> This date will be converted to `2014-12-31T23:00:00 UTC`.
141-
<2> `now` is not affected by the `time_zone` parameter (dates must be stored as UTC).
141+
<2> `now` is not affected by the `time_zone` parameter, its always the current system time (in UTC).
142+
However, when using <<date-math,date math rounding>> (e.g. down to the nearest day using `now/d`),
143+
the provided `time_zone` will be considered.
144+
142145

143146
[[querying-range-fields]]
144147
==== Querying range fields

0 commit comments

Comments
 (0)