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

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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据