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

"-4" parsed as a date #2694

Closed
pcarrier opened this issue Feb 26, 2013 · 6 comments
Closed

"-4" parsed as a date #2694

pcarrier opened this issue Feb 26, 2013 · 6 comments

Comments

@pcarrier
Copy link

$ curl -s -XPOST localhost:9200/test/1 \
       -d '{"foo":[{"bar": "-4"},{"bar": "::1"}]}' | \
       jq .
{
  "status": 400,
  "error": "MapperParsingException[Failed to parse [foo.bar]]; nested: MapperParsingException[failed to parse date field [::1], tried both date format [dateOptionalTime], and timestamp number]; nested: IllegalArgumentException[Invalid format: \"::1\"]; "
}
@s1monw
Copy link
Contributor

s1monw commented Mar 1, 2013

this is above my head is '-4' a valid timestamp or not. It could be relative to 01.01.1970 in millis?

@ghost ghost assigned s1monw Mar 1, 2013
@s1monw
Copy link
Contributor

s1monw commented Mar 1, 2013

hmm maybe I missunderstand are you complaining that -4 shoudl throw an exception as well or that -4 is interpreted as a date and you get a subsequent exception?

@pcarrier
Copy link
Author

pcarrier commented Mar 1, 2013

Hu no, I believe no human would ever say that this document looks like it contains any dates, so I'd expect not to run into any exceptions.

@kimchy
Copy link
Member

kimchy commented Mar 1, 2013

Agreed on no humans, sadly, we are using computers :). Will work on fixing it, the string -4 should not be detected as a date, but as a string.

@pcarrier
Copy link
Author

pcarrier commented Mar 1, 2013

💻 doesn't have to overthrow 👪, but if it cannot find a year, month and day, I'd say it should not be guessing a timestamp.

@pcarrier
Copy link
Author

pcarrier commented Mar 1, 2013

If anybody arrives here by searching for the error, here's a workaround (disables date detection altogether on foo!):

% curl -XPUT localhost:9200/foo/_default_/_mapping -d '{"_default_":{"date_detection":0}}'

@kimchy kimchy closed this as completed in 9b68e98 Mar 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants