-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/common-options.html#time-units
Time Units
Whenever durations need to be specified, e.g. for a timeout parameter, the duration must specify the unit, like 2d for 2 days. The supported units are:
Key Represents d days h hours m minutes s seconds ms milliseconds micros microseconds nanos nanoseconds
The issue is that this table incomplete and inaccurate. Units below ms
make no sense because we do not represent dates at a better resolution than milliseconds. Both 1micros
and 1nanos
(thankfully) result in "Zero or negative time interval not supported"
.
However, there are other units that can be used sometimes, but for some reason not other times. Like:
Key | Represents |
---|---|
y | years |
year | years |
M | months |
month | months |
w | weeks |
week | weeks |
quarter | 3 months |
1y
works, but 2y
does not. 1M
works, but 2M
does not. If I recall, the reasoning for these surrounds the changing nature of it.
In some ways, I can appreciate that something like "2y" and 2M
are not consistent intervals (because of leap years and inconsistent month lengths). But weeks are consistent and quarters can only be true if you consider Q1 January - March (etc), which I feel like 3M
could do too.
Regardless, if we are going to block higher number ranges, then we should look at blocking all number ranges for a given time unit and we need to drop units that simply do not work.