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

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 cuda.jit加速报错
    • ¥15 Octave 安装工具箱出错 Only Win32 target is supported!
    • ¥15 Unity Animation Rigging使用问题
    • ¥15 mbedtls握手返回-7200
    • ¥30 c++ http服务器
    • ¥15 express连接mssql,每条额外附加了语句
    • ¥20 IQOO12如何有效ADB方法
    • ¥15 ios如何获取用户的订阅情况
    • ¥15 复杂表达式求值程序里的函数优先级问题
    • ¥15 求密码学的客成社记ji着用