go-mysql-org / go-mysql-elasticsearch

Sync MySQL data into elasticsearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

日期转换错误

Hydrapony opened this issue · comments

commented

直接在数据库里修改日期,发现不能同步,报错:

[2020/05/14 10:01:13] [error] sync.go:480 update index: uni_seamap, type: uni_seamap, id: ff80808171b974a60171ba6279640vdv, status: 400, error: {"type":"mapper_parsing_exception","reason":"failed to parse [operator_date]","caused_by":{"type":"illegal_argument_exception","reason":"Invalid format: \"2020-05-14T00:00:00+08:00\" is malformed at \"T00:00:00+08:00\""}}

现在在_mapping里的设置是:

"operator_date" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},

应该怎样写这种时间格式的format呢

commented

直接把format去掉可以,但是yyyy-MM-dd HH:mm:ss格式又没办法了,二者不能兼容吗