Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dates passed to the script terms facet are now in the default time zone #3091

Closed
ejain opened this Issue May 25, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@ejain
Copy link
Contributor

ejain commented May 25, 2013

This may be on purpose, but it's a breaking change from 0.20.6, where dates were always UTC. See discussion at https://groups.google.com/d/topic/elasticsearch/a_Jj7d4Uk6c/discussion

@clintongormley

This comment has been minimized.

Copy link
Member

clintongormley commented May 25, 2013

From the comment thread:

Actually both of those are the same millisecond value stored in the date field displayed differently (In the Summer 8 AM in Seattle is the same moment in time as 3 PM in London) Therefore, it depends on the definition of what the script aDateField.date is supposed to correspond to in the Joda date library and thus what toString method is used to convert the results back to the caller. It is not a matter of honoring the original TZ, because it can't, the field stores a millisecond value; that's it. On the way out nothing knows how it got that millisecond value into the field.

As Eric as observed
it WAS converting the millisecond value to the result string using UTC.
but now
it IS converting to the millisecond value to the result string using the DEFAULT VM timezone.

This sounds like a bug to me...

@kimchy

This comment has been minimized.

Copy link
Member

kimchy commented May 25, 2013

It is a bug, it should have remained UTC, will fix shortly...

@ghost ghost assigned kimchy May 25, 2013

@kimchy kimchy closed this in b4d75a5 May 25, 2013

kimchy added a commit that referenced this issue May 25, 2013

Dates accessed from scripts should use UTC timezone
this was broken in the field data refactoring we did in 0.90, fixes #3091
@CodingFabian

This comment has been minimized.

Copy link

CodingFabian commented Nov 20, 2013

I am observing that dates in from and to fields of range facets for date field are using local time zone instead of UTC
For example, I have an entry in the index which says:
upload_date: 2013-10-02T13:40:40.681Z
~~When I do facetting on that field, the from value is for example
2012-11-20T15:06:04.770+01:00
The field is specified in index just as "date", no special formatting given.
When I query the field from ES, the field value is also in UTC.

So it seems that the generation of from and to bounds for range facets on date fields somehow does not utc, but a local time.

Shall I create a new issue, is it a new issue or the same?

Usual case of: I can see the error after writing the issue.
We are giving in in our date facet range query time stamps with +1 and it seems ES honors them when returning them back to us.

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Dates accessed from scripts should use UTC timezone
this was broken in the field data refactoring we did in 0.90, fixes elastic#3091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.