Alireza
Alireza

Reputation: 6848

How to map specific date into an Elasticsearch date/time field?

I have used many different ways to convert the date/time below into an ES date format:

Thu Oct 29 08:17:25 2015

The format I use for a date like 2012-12-12 12:12:12 is as below

"properties":{
   "my_date_field":{
   "type":"date",
   "format":"yyyy-mm-dd HH:mm:ss"
 }
}

I went through the documentation of Elasticsearch, but there was not a format I need to turn Thu Oct 29 08:17:25 2015 into Elasticsearch date/time field. In what way should I convert it? Any help?

Upvotes: 1

Views: 471

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

Try this:

    "date": {
      "type": "date",
      "format": "EEE MMM dd HH:mm:ss yyyy||EEE MMM  dd HH:mm:ss yyyy"
    }

Upvotes: 2

Related Questions