TheVirginia 2021-12-28 15:11 采纳率: 100%
浏览 98
已结题

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

问题遇到的现象和发生背景

在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""}}}}}

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

1条回答 默认 最新

  • Vae 东 2021-12-28 15:28
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月6日
  • 已采纳回答 12月29日
  • 创建了问题 12月28日

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突