Time Zone


(Yehuda Zargarov) #1

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at(1324188000000 /
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov


(Shay Banon) #2

You hit a problem with time zone rounding and date histogram for intervals lower than day. Its fixed in 0.19: https://github.com/elasticsearch/elasticsearch/issues/1580.

On Wednesday, February 15, 2012 at 2:02 PM, Yehuda Zargarov wrote:

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at (http://Time.at)(1324188000000 /
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov


(Yehuda Zargarov) #3

Hi Shay,

Just installed elasticsearch-0.19.0.RC2, and still the "time_zone"
option on date histogram does not affect the result.

Thanks,

Yehuda Zargarov

On Feb 15, 3:34 pm, Shay Banon kim...@gmail.com wrote:

You hit a problem with time zone rounding and date histogram for intervals lower than day. Its fixed in 0.19:https://github.com/elasticsearch/elasticsearch/issues/1580.

On Wednesday, February 15, 2012 at 2:02 PM, Yehuda Zargarov wrote:

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}­}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at (http://Time.at)(1324188000000/
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov- Hide quoted text -

  • Show quoted text -

(Shay Banon) #4

Then gist a full recreation, I will have a look. (see http://www.elasticsearch.org/help).

On Thursday, February 16, 2012 at 5:03 PM, Yehuda Zargarov wrote:

Hi Shay,

Just installed elasticsearch-0.19.0.RC2, and still the "time_zone"
option on date histogram does not affect the result.

Thanks,

Yehuda Zargarov

On Feb 15, 3:34 pm, Shay Banon <kim...@gmail.com (http://gmail.com)> wrote:

You hit a problem with time zone rounding and date histogram for intervals lower than day. Its fixed in 0.19:https://github.com/elasticsearch/elasticsearch/issues/1580.

On Wednesday, February 15, 2012 at 2:02 PM, Yehuda Zargarov wrote:

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}­}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at (http://Time.at)(1324188000000/
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov- Hide quoted text -

  • Show quoted text -

(Shay Banon) #5

Note though, that the time_zone in 0.19 just sets the pre_zone, which basically applies the time zone before the rounding/bucketing, you might need to also pass post_zone to convert the bucket data to a time zone from UTC. See more here: http://www.elasticsearch.org/guide/reference/api/search/facets/date-histogram-facet.html.

On Thursday, February 16, 2012 at 9:31 PM, Shay Banon wrote:

Then gist a full recreation, I will have a look. (see http://www.elasticsearch.org/help).

On Thursday, February 16, 2012 at 5:03 PM, Yehuda Zargarov wrote:

Hi Shay,

Just installed elasticsearch-0.19.0.RC2, and still the "time_zone"
option on date histogram does not affect the result.

Thanks,

Yehuda Zargarov

On Feb 15, 3:34 pm, Shay Banon <kim...@gmail.com (http://gmail.com)> wrote:

You hit a problem with time zone rounding and date histogram for intervals lower than day. Its fixed in 0.19:https://github.com/elasticsearch/elasticsearch/issues/1580.

On Wednesday, February 15, 2012 at 2:02 PM, Yehuda Zargarov wrote:

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}­}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at (http://Time.at) (http://Time.at)(1324188000000/
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov- Hide quoted text -

  • Show quoted text -

(Yehuda Zargarov) #6

post_zone does the job. thanks.

On Feb 16, 9:34 pm, Shay Banon kim...@gmail.com wrote:

Note though, that the time_zone in 0.19 just sets the pre_zone, which basically applies the time zone before the rounding/bucketing, you might need to also pass post_zone to convert the bucket data to a time zone from UTC. See more here:http://www.elasticsearch.org/guide/reference/api/search/facets/date-h....

On Thursday, February 16, 2012 at 9:31 PM, Shay Banon wrote:

Then gist a full recreation, I will have a look. (seehttp://www.elasticsearch.org/help).

On Thursday, February 16, 2012 at 5:03 PM, Yehuda Zargarov wrote:

Hi Shay,

Just installed elasticsearch-0.19.0.RC2, and still the "time_zone"
option on date histogram does not affect the result.

Thanks,

Yehuda Zargarov

On Feb 15, 3:34 pm, Shay Banon <kim...@gmail.com (http://gmail.com)> wrote:

You hit a problem with time zone rounding and date histogram for intervals lower than day. Its fixed in 0.19:https://github.com/elasticsearch/elasticsearch/issues/1580.

On Wednesday, February 15, 2012 at 2:02 PM, Yehuda Zargarov wrote:

Hi,

I'm trying to use the time zone option within a date histogram, since
the hour I get is greater than the hour saved in elastic (by 2 hours).
I'm using 0.18.7.

This is my query:
{"query":{"filtered":{"query":{"range":{"date":
{"from":"2011-12-18","to":"2011-12-18"}}},"filter":[{"terms":{"ctid":
["11"]}}]}},"facets":{"date_sum_stats":{"date_histogram":
{"key_field":"date","value_field":"sum","interval":"hour","time_zone":-2}}}­}

And it returns this:
facets: {
date_sum_stats: {
_type: date_histogram
entries: [
{
time: 1324184400000
count: 2
min: 5
max: 10
total: 15
total_count: 2
mean: 7.5
}
{
time: 1324188000000
count: 1
min: 35
max: 35
total: 35
total_count: 1
mean: 35
}
]
}

1324188000000 epoch is "08" in hours (doing Time.at (http://Time.at) (http://Time.at)(1324188000000/
1000).strftime("%H")) but the document is saved with the hour "06":
users
new_user
370563565
1
IE
US
11
2011-12-18T06:00:00+00:00
35

Any ideas?
I've tried also with 2 as time zone and with no time zone at all, but
always getting same (wrong) hours.

Thanks,

Yehuda Zargarov- Hide quoted text -

  • Show quoted text -

(system) #7