代码
PUT /my_index
{
"mappings": {
"properties": {
"title": {
"type": "text",
"index": true,
"store": true,
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"category": {
"type": "keyword",
"index": true,
"store": true
},
"images": {
"type": "keyword",
"index": true,
"store": true
},
"price": {
"type": "integer",
"index": true,
"store": true
}
}
}
}
报错信息
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [images : {index=true, store=true, type=keyword}] [price : {index=true, store=true, type=integer}] [title : {search_analyzer=ik_max_word, analyzer=ik_max_word, index=true, store=true, type=text}] [category : {index=true, store=true, type=keyword}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [properties]: Root mapping definition has unsupported parameters: [images : {index=true, store=true, type=keyword}] [price : {index=true, store=true, type=integer}] [title : {search_analyzer=ik_max_word, analyzer=ik_max_word, index=true, store=true, type=text}] [category : {index=true, store=true, type=keyword}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [images : {index=true, store=true, type=keyword}] [price : {index=true, store=true, type=integer}] [title : {search_analyzer=ik_max_word, analyzer=ik_max_word, index=true, store=true, type=text}] [category : {index=true, store=true, type=keyword}]"
}
},
"status": 400
}
解决方案
添加一个“article”属性、或者“_doc”
PUT /my_index
{
"mappings": {
"article":{
"properties": {
"title": {
"type": "text",
"index": true,
"store": true,
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"category": {
"type": "keyword",
"index": true,
"store": true
},
"images": {
"type": "keyword",
"index": true,
"store": true
},
"price": {
"type": "integer",
"index": true,
"store": true
}
}
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)