尝试在Elasticsearch 7中插入以下映射时
PUT my_index/items/_mapping
{
"settings":{
},
"mappings":{
"items":{
"properties":{
"products":{
"properties":{
"classification":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
},
"original_text":{
"type":"text",
"store":false,
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
}
}
},
"title":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
},
"analyzer":"autocomplete"
},
"image":{
"properties":{
"type":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
},
"location":{
"type":"text",
"store":false,
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下形式的错误:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters:
Run Code Online (Sandbox Code Playgroud)
是什么导致此错误?
Joh*_*n D 10
在Elasticsearch 7中,不赞成使用映射类型,这从根本上导致了变化。
Elasticsearch团队宣布弃用,路线图和替代方案。
要解决此问题,只需删除对映射类型的所有引用(此示例中为“ items”):
PUT my_index/_mapping
{
"settings":{
},
"mappings":{
"properties":{
"products":{
"properties":{
"classification":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
},
"original_text":{
"type":"text",
"store":false,
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
}
}
},
"title":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
},
"analyzer":"autocomplete"
},
"image":{
"properties":{
"type":{
"type":"text",
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
},
"location":{
"type":"text",
"store":false,
"fields":{
"raw":{
"type":"keyword",
"ignore_above":256
}
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6654 次 |
| 最近记录: |