I'm aggregating documents that each have a timestamp. The timestamp is UTC, but the documents each also have a local time zone ("timezone": "America/Los_Angeles"
) that can be different across documents.
I'm trying to do a date_histogram aggregation
based on local time, not UTC or a fixed time zone (e.g., using the option "time_zone": "America/Los_Angeles"
).
How can I convert the timezone for each document to its local time before the aggregation?
Here's the simple aggregation:
{
"aggs": {
"date": {
"date_histogram": {
"field": "created_timestamp",
"interval": "day"
}
}
}
}