报错二、插入数据时间格式异常
"caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to parse date field [2022-12-09 19:31:52] with format [strict_date_optional_time||epoch_millis]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"Failed to parse with all enclosed parsers"}}}}}}
关键词:
epoch_millis,毫秒;
分析:源数据格式是2022-12-09 19:31:52,索引要求日期时间格式精确到毫秒。一个field的设置是不能被修改的,如果要修改一个Field,那么应该重新按照新的mapping,建立一个index,然后将数据批量查询出来,重新用bulk api写入index中。
解决办法:对索引中的date类型字段的格式做自定义。
PUT my_index
{
"mappings": {
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}
设置模板的时候,可以预先针对性的配置字段:
"Out_params": {
"properties": {
"ROOT-BODY-RETURN_CODE": {
"type": "keyword"
},
"data--initiateDate-*": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
},
================================================
报错一、插入模板unknown setting [index.lifecycle.name]
{ -
"error": { -
"root_cause": [ -
{ -
"type": "illegal_argument_exception",
"reason": "unknown setting [index.lifecycle.name] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.lifecycle.name] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}
分析:模板语句中的settings.index.lifecycle.name是当前os不支持的属性。
解决办法:删除掉settings.index.lifecycle.name结构体。