ElasticSearch does not display JODA time format

I am indexing tweets and would like to map the created_at field to the date. An example of a date is as follows:

'created_at': 'Wed Sep 21 05:19:16 +0000 2011'

which uses the JODA time format, I realized that:

"format" : "EEE MMM dd HH:mm:ss +SSSS yyyy",

However, when I try to index a new tweet, I get the following error:

{u'status': 400, u'error': u'RemoteTransportException[[Rattler][inet[/192.155.85.243:9301]][index]]; nested: MapperParsingException[Failed to parse [created_at]]; nested: MapperParsingException[failed to parse date field [2013-04-30 20:34:43], tried both date format [yyyyMMdd HH:mm:ss], and timestamp number]; nested: IllegalArgumentException[Invalid format: "2013-04-30 20:34:43" is malformed at "-04-30 20:34:43"]; '}

I tried changing the date format to use

yyyy-MM-dd HH:mm:ss
EEE, dd MMM yyyy HH:mm:ss Z
EEE dd MMM yyyy HH:mm:ss Z
EEE MMM dd HH:mm:ss +0000 yyyy

and a few other variations that you can just see, and no luck. I use the following call to create the original tweet document:

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "tweet" : {
        "properties" : {
            "created_at" : {"type" : "date", "format" : "EEE dd MMM yyyy HH:mm:ss Z"}
        }
    }
}'

Any help is much appreciated!

+5
source share
1 answer

The time format in the Joda format that you specified is not entirely correct. S for a split second, not a time zone as you like. In addition, the + sign is included in the time zone parser.

twitter elasticsearch :

"format": "EE MMM d HH:mm:ss Z yyyy"
+9

All Articles