HistogramFacet & date oddness


(Rich Kroll) #1

Hey all,
I have ran into an oddity when working with the HistogramFacet and hoped
someone could point me in the direction of what i'm doing wrong. The
problem relates to the time_interval of the Histogram facet, and if I try to
bucked on a day (24h), my dates are shifting backwards a day.

The following gist exemplifies the problem:

Thanks for the help!

--
“We can't solve problems by using the same kind of thinking we used when we
created them.” ~ Albert Einstein


(Shay Banon) #2

Heya,

It seems like its working for me. Note, all times stored in ES are UTC
based, and when stating things like 24h interval in the histogram facet it
will be computed based on the UTC based values. Here is, for example, what I
get for both values:

2010-12-13T00:00:00.000Z from 2010-12-13T17:21:09.000Z
2010-12-16T00:00:00.000Z from 2010-12-16T17:21:09.000Z

The first value is the UTC based value of the histogram facet, and the
second is the value provided when indexing. You can see that they fall into
the correct buckets.

There was a thread a few days ago suggesting that the histogram facet (or
maybe a specialized date histogram facet), should allow to provide the
timezones to work with, since the main computations are done on the facet
itself, and it make sense to want it in a day interval, but with a different
timezone.

-shay.banon

On Thu, Dec 16, 2010 at 8:14 PM, Rich Kroll kroll.rich@gmail.com wrote:

Hey all,
I have ran into an oddity when working with the HistogramFacet and hoped
someone could point me in the direction of what i'm doing wrong. The
problem relates to the time_interval of the Histogram facet, and if I try to
bucked on a day (24h), my dates are shifting backwards a day.

The following gist exemplifies the problem:

https://gist.github.com/743752

Thanks for the help!

--
“We can't solve problems by using the same kind of thinking we used when we
created them.” ~ Albert Einstein


(Rich Kroll) #3

Shay,
Thanks for following up. I ran my gist example again and this time output
the times in UTC, and discovered why this behaved strangely for me. When
bucketing the results with 12h, the time portion of the date is set to
12:00:00+00:00,
and when output in EST will still be on the same "day". When using the 24h
interval the time is set to 00:00:00+00:00 which when converted to EST will
display as the previous "day".

A specialized date range facet which allowed configuration of the timezone
would be a huge benefit in my use case.

Again,
Thanks for lending a hand!

On Sat, Dec 18, 2010 at 9:58 PM, Shay Banon shay.banon@elasticsearch.comwrote:

Heya,

It seems like its working for me. Note, all times stored in ES are UTC
based, and when stating things like 24h interval in the histogram facet it
will be computed based on the UTC based values. Here is, for example, what I
get for both values:

2010-12-13T00:00:00.000Z from 2010-12-13T17:21:09.000Z
2010-12-16T00:00:00.000Z from 2010-12-16T17:21:09.000Z

The first value is the UTC based value of the histogram facet, and the
second is the value provided when indexing. You can see that they fall into
the correct buckets.

There was a thread a few days ago suggesting that the histogram facet
(or maybe a specialized date histogram facet), should allow to provide the
timezones to work with, since the main computations are done on the facet
itself, and it make sense to want it in a day interval, but with a different
timezone.

-shay.banon

--
“We can't solve problems by using the same kind of thinking we used when we
created them.” ~ Albert Einstein


(Shay Banon) #4

Great :), so one issue/feature instead of possible two, I call it a good day
:). Can you open a feature request for that? I plan to revisit facets and do
some refactoring there, and once its done, I can implement things like
date_interval facet.

On Sun, Dec 19, 2010 at 4:07 PM, Rich Kroll kroll.rich@gmail.com wrote:

Shay,
Thanks for following up. I ran my gist example again and this time output
the times in UTC, and discovered why this behaved strangely for me. When
bucketing the results with 12h, the time portion of the date is set to 12:00:00+00:00,
and when output in EST will still be on the same "day". When using the 24h
interval the time is set to 00:00:00+00:00 which when converted to EST will
display as the previous "day".

A specialized date range facet which allowed configuration of the timezone
would be a huge benefit in my use case.

Again,
Thanks for lending a hand!

On Sat, Dec 18, 2010 at 9:58 PM, Shay Banon shay.banon@elasticsearch.comwrote:

Heya,

It seems like its working for me. Note, all times stored in ES are UTC
based, and when stating things like 24h interval in the histogram facet it
will be computed based on the UTC based values. Here is, for example, what I
get for both values:

2010-12-13T00:00:00.000Z from 2010-12-13T17:21:09.000Z
2010-12-16T00:00:00.000Z from 2010-12-16T17:21:09.000Z

The first value is the UTC based value of the histogram facet, and the
second is the value provided when indexing. You can see that they fall into
the correct buckets.

There was a thread a few days ago suggesting that the histogram facet
(or maybe a specialized date histogram facet), should allow to provide the
timezones to work with, since the main computations are done on the facet
itself, and it make sense to want it in a day interval, but with a different
timezone.

-shay.banon

--
“We can't solve problems by using the same kind of thinking we used when we
created them.” ~ Albert Einstein


(system) #5