ElasticSearch Date Mapping Issue


(Matt Altman) #1

I am trying to create an index with a date mapping. I have tried a couple of different things but I get different results.

So first, here is a line from a document I am indexing:

2016-06-14 18:12:35 1.1.1.1 GET /origin-www.origin.com/Images/pipe-gray.png? 200 1442 0 "http://www.origin.com/Main.css" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" "__qca=P0-920525163; s_fid=4CDFF16906A35CC4; __CSCookie=z5ayStQYdIbcPTxGKyhsjRIi0peP5GAP6K; icxid=1459286804904; icxid=1459286804904; ASP.NET_SessionId=dzg3esjzp4tpg; __SessionCookie=gXA9BuDiF245ZJeuh; dtCookie=0C05828501CE759D; s_vi=[CS]v1|2A069D04051D2E2A; __CSUserIbcIDCookie=NL7VeN+rh05z5FWSCgTnzTC6G;"

The mapping I am using for the date looks like this:

'date': { 'type': 'date' } or 'date': { 'type': 'date', 'format': 'YYYY-MM-DD HH:MM:SS' }

However, I get an error message saying

"parsing exception: failed to parse [date] 2016-06-14\t18:12:35. Malformed at \t18:12:35."

I then tried to use this in my mapping

'date': { 'type': 'date', 'format': "yyyy-MM-dd HH:mm:ss||yyyy-MM-ddTHH:mm:ss||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-ddTHH:mm:ss.SSSZ||yyyy-MM-ddTHH:mm:ssZ" },

The issue here is, though it indexes, it indexes as a string. That means I can't add it to Kibana as a time-field.

Can anyone help me figure out what I am doing wrong?


(Matt Altman) #2

Convert date with strptime and strftime.


(system) #3