Date range aggregation does not convert ranges #9916
Labels
enhancement
New value added to drive a business result
Feature:Aggregations
Aggregation infrastructure (AggConfig, esaggs, ...)
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
When you select a time range using the time picker (e.g. "Today"), the URL will update with a representation of this time range (e.g.
{ from: "now/d", to: "now/d" }
). This is consistent with Elasticsearch's date math formats. However, what ends up being sent in the request to Elasticsearch isn't this same representation. It is converted to milliseconds since the epoch. You can see this in the request body:{"range":{"date":{"gte":1483858800000,"lte":1484636400000,"format":"epoch_millis"}}}
From my understanding, the reasoning behind this is that the time on the Kibana/Elasticsearch server can be off from the time of the user using Kibana in the browser.
If you create a visualization, one of the aggregation types we support is "Date Range". If you select this aggregation, it allows you to specify different date ranges, and it accepts values in Elasticsearch date formats:
However, the range in this case does NOT get converted on the client into number of milliseconds since the epoch. You can see this in the request body:
{"date_range":{"field":"date","ranges":[{"from":"now/d","to":"now/d"}]}}
This is inconsistent. Either we should always be translating to milliseconds since the epoch, or we should always stick to the relative format.
The text was updated successfully, but these errors were encountered: