Timezones in date_histogram

Hi,

I'm trying to get my head wrapped around how timezones are used within a
date_histogram facet, I think I'm slightly confused!

Right now I have ~1mil docs with a timestamp field, each one stored with a
+2:00 timezone. I limit a query with a date range also specifying the
timezone as follows:
"timestamp": {
"from": "2012-07-05T14:27:14+02:00",
"to": "2012-08-05T14:27:14+02:00",
"include_lower": true,
"include_upper": true
}

However, if I specify date ranges set in -07:00 timezone things things get
a little confusing.

Consider it is 2012-08-04 22:00+00:00 right now.
If I set "time_zone" in the date_histogram facet to -07:00, the date
buckets returned are missing everything within 2012-08-04 when actually
there should be thousands - 15 hours worth.
Trying to read the timezone docs on the guide (
http://www.elasticsearch.org/guide/reference/api/search/facets/date-histogram-facet.html),
are the times returned actually in UTC despite the time_zone setting? If
this is the case, then it would make sense that I would need to set the
post_zone setting also to -07:00. However this pushes the times back as
expected making things look worse.

Should I need to set post_zone? If so, what to?

And as a side question, can you pass anything to post_zone and ES simply
adjusts the times returned while keeping the bucket counts the same? This
seems odd.. if I've understood it correctly.

Thanks,
Darren

I set "pre_zone" to e.g. "-07:00" and "pre_zone_adjust_large_interval" to
true. This returns buckets for the specified time zone that include all
documents with timestamps that actually fall within the date range of each
bucket.

Not sure I understand why it's working but it definitely looks a lot more
convincing now.. thanks!

On Mon, Aug 6, 2012 at 5:54 PM, Eric Jain eric.jain@gmail.com wrote:

I set "pre_zone" to e.g. "-07:00" and "pre_zone_adjust_large_interval" to
true. This returns buckets for the specified time zone that include all
documents with timestamps that actually fall within the date range of each
bucket.