logstash 同步MySQL数据库到es中,时间转化问题

CSDN问答 2021-12-30 06:28:48 阅读数:330

数据库 Mysql 数据 同步 logstash
问题遇到的现象和发生背景

在es中创建的createTime字段类型是long,用到logstash 去同步数据库数据时报,Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"89", :_index=>"test", :routing=>nil, :_type=>"_doc"}, #LogStash::Event:0x769684f6], :response=>{"index"=>{"_index"=>"test", "_type"=>"_doc", "_id"=>"89", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [createTime] of type [long] in document with id '89'. Preview of field's value: '2021-12-28T14:40:16.000Z'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"For input string: "2021-12-28T14:40:16.000Z""}}}}}

问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果



采纳答案:

type"=>"illegal_argument_exception", "reason"=>"For input string: "2021-12-28T14:40:16.000Z" 这个是String.


版权声明:本文为[CSDN问答]所创,转载请带上原文链接,感谢。 https://ask.csdn.net/questions/7617945