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

Timestamp defaults to parsing int even if given a format #2937

Closed
GustavMauler opened this issue Apr 25, 2013 · 1 comment
Closed

Timestamp defaults to parsing int even if given a format #2937

GustavMauler opened this issue Apr 25, 2013 · 1 comment
Labels
>bug help wanted adoptme :Search/Mapping Index mappings, including merging and defining field types

Comments

@GustavMauler
Copy link

if given some document date field that is a basic date, such as
{
"doc_field" : "20130425"
}
and _timestamp uses it as its path, it defaults to parsing the integer as ms rather than as the format
_timestamp{
"format":"yyyyMMdd",
"enabled":true
}

spinscale added a commit to spinscale/elasticsearch that referenced this issue May 22, 2013
The current implementation tries to parse every timestamp as a long first
and uses it as a unix timestamp.
This fails if the configured timestamp is like 'YYYYMMDD' and also
resembles a long by coincidence.

This PR tries to fix this issue by trying to parse it as a date first and
only it fails is tried to be parsed as a long from unix timestamp.

Possible problems:
* Performance: Reversing the order might make things slower.
* Wrong parsing: An additional check was added to make sure no negative
  unix timestamps can be generated.

Closes elastic#2937
@clintongormley
Copy link

Closing in favour of #10971

@clintongormley clintongormley added :Search/Mapping Index mappings, including merging and defining field types and removed :Dates labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug help wanted adoptme :Search/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants