Hi, i using elastic 6.3.2 and have issue with date_aggregation and timezones
This is me aggregation
"aggs": {
"histograms2": {
"date_histogram": {
"field": "createdAt",
"interval": "hour",
"format": "YYYY_MM_dd:HH",
"time_zone": "+03:00"
}
},
"histograms": {
"composite": {
"size": 1000,
"sources": [
{
"agg_0": {
"date_histogram": {
"field": "createdAt",
"interval": "hour",
"format": "YYYY_MM_dd:HH",
"time_zone": "+03:00"
}
}
}
]
}
}
}
and result is
"aggregations": {
"histograms": {
"after_key": {
"agg_0": "2019_03_13:11"
},
"buckets": [
{
"key": {
"agg_0": "2019_03_13:10"
},
"doc_count": 7
},
{
"key": {
"agg_0": "2019_03_13:11"
},
"doc_count": 1
}
]
},
"histograms2": {
"buckets": [
{
"key_as_string": "2019_03_13:13",
"key": 1552471200000,
"doc_count": 7
},
{
"key_as_string": "2019_03_13:14",
"key": 1552474800000,
"doc_count": 1
}
]
}
}
As you can see "string" keys are different. Me objects have dates "2019-03-13T10:23:30.992Z" until "2019-03-13T11:23:30.992Z".
Why keys are not same?
UPDATE: if i change aggs to daily aggregation result is also different
"aggregations": {
"histograms": {
"after_key": {
"agg_0": "2019_03_12"
},
"buckets": [
{
"key": {
"agg_0": "2019_03_12"
},
"doc_count": 8
}
]
},
"histograms2": {
"buckets": [
{
"key_as_string": "2019_03_13",
"key": 1552424400000,
"doc_count": 8
}
]
}
}
Date key 2019_03_13 seems to be correct, but not 2019_03_12