I'm trying to do a date histogram using Spring Data Elasticsearch, allowing a customizable time zone. I'm seeing strange behavior. The doc counts in each bucket change with the time zone, which seems to indicate that the time zone is being used in some way. But the bucket key still seems to stay in GMT. I tried doing this query using the search API just to make sure it wasn't a problem with my Java code:
{
"aggs": {
"by_month": {
"date_histogram": {
"field": "dates.created",
"interval": "month",
"time_zone": "America/New_York"
}
}
}
}
And here is a sample of the results:
{
"key_as_string": "2015-11-01T00:00:00.000Z",
"key": 1446336000000,
"doc_count": 300
},
{
"key_as_string": "2015-12-01T00:00:00.000Z",
"key": 1448928000000,
"doc_count": 500
},
Note that these times (both the key_as_string
and key
) are at midnight GMT instead of EST. Is there something I'm doing wrong here, or is this expected behavior? My Elasticsearch cluster is running version 1.7.1 if that helps at all.