ElasticSearch为索引库添加静态映射报:Failed to parse mapping [properties]: Root mapping definition has unsupport
Posted Mixzi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch为索引库添加静态映射报:Failed to parse mapping [properties]: Root mapping definition has unsupport相关的知识,希望对你有一定的参考价值。
代码
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
以上是关于ElasticSearch为索引库添加静态映射报:Failed to parse mapping [properties]: Root mapping definition has unsupport的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearch 分布式搜索引擎 -- 索引库操作(mapping映射属性索引库的CRUD)
ElasticSearch 文档的基本操作 添加文档与自动映射