我有一个 json 数据,它有一个“product_ref”字段,可以以这些值为例:
"product_ref": "N/A"
"product_ref": "90323"
"product_ref": "SN3005"
"product_ref": "2015-05-23"
Run Code Online (Sandbox Code Playgroud)
将数据推送到索引时,出现映射错误:
{"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}
Run Code Online (Sandbox Code Playgroud)
任何的想法?
有一种叫做date detection 的东西,默认情况下,它是启用的。
如果 date_detection 已启用(默认),则检查新字符串字段以查看其内容是否与 dynamic_date_formats 中指定的任何日期模式匹配。如果找到匹配项,则会添加一个具有相应格式的新日期字段。
您只需要通过修改映射来禁用它:
PUT /products
{
"mappings": {
"doc": {
"date_detection": false,
"properties": {
"product_ref": { "type": "keyword" },
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3686 次 |
| 最近记录: |