简体   繁体   中英

Elasticsearch-py date malformed

I am trying to index some data but I keep getting the error

error: reason: failed to parse [date] type: mapper_parsing_exception, caused_by: Invalid format: 2016-08-12\t17:35:26 is malformed at \t17:35:26

My mapping looks like

'date': { 'type': 'date', 'format': 'dateOptionalTime' },

Is there a different way to create the date mapping?

EDIT: Here is a line from the document. I can get it to index just fine when I set time to string and date to date but the date shows a bogus time attached to it. So it looks like ES is taking my date (2016/9/20) and adding a time to it. In my case it adds 19:00:00. Which is why I can't figure out why it doesnt like the time.

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;"

Before adding the date to hashtable or before u feed it to json, convert the date "2016-02-10\\t10:25:30" to this "2016-02-10T10:25:30"

If you give elasticsearch this format, you should be able to use the original mapping - dateOptionalTime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM