我有一个包含“ product_ref”字段的json数据,可以将这些值用作示例:
"product_ref": "N/A"
"product_ref": "90323"
"product_ref": "SN3005"
"product_ref": "2015-05-23"
当将数据推送到索引时,出现映射错误:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [root.product_ref] of different type, current_type [date], merged_type [text]"}],"type":"illegal_argument_exception","reason":"mapper [root.product_ref] of different type, current_type [date], merged_type [text]"},"status":400}
任何的想法?
有一种叫做日期检测的东西,默认情况下,它是启用的。
如果启用了date_detection(默认),则将检查新的字符串字段,以查看其内容是否与dynamic_date_formats中指定的任何日期模式匹配。如果找到匹配项,则会添加具有相应格式的新日期字段。
您只需要通过修改映射来禁用它:
PUT /products
{
"mappings": {
"doc": {
"date_detection": false,
"properties": {
"product_ref": { "type": "keyword" },
}
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句