elasticsearch/elasticsearch — pull request #3072 by spinscale (2013-05-22 11:53:02+00:00)
Title: Inverting logic of parsing timestamp fields

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 #2937