ElasticSearch 7.6 使用ApiPost/Postman 创建索引报错

创建信息:

{
    "mappings":{
        "article":{
            "properties":{
                "id":{
                    "type":"long",
                    "store":true
                },
                "title":{
                    "type":"text",
                    "store":true,
                    "index":true,
                    "analyzer":"standard"
                },
                "content":{
                    "type":"text",
                    "store":true,
                    "index":true,
                    "analyzer":"standard"
                }
            }
        }
    }
}

错误信息如下:

"reason": "Root mapping definition has unsupported parameters:

{
	"error": {
		"root_cause": [
			{
				"type": "mapper_parsing_exception",
				"reason": "Root mapping definition has unsupported parameters:  [article : {properties={id={store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]"
			}
		],
		"type": "mapper_parsing_exception",
		"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [article : {properties={id={store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]",
		"caused_by": {
			"type": "mapper_parsing_exception",
			"reason": "Root mapping definition has unsupported parameters:  [article : {properties={id={store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]"
		}
	},
	"status": 400
}

原因:

ElasticSearch 7.x 默认不在支持指定索引类型

需要在创建的时候加入  include_type_name=true

即可成功创建索引

发布了108 篇原创文章 · 获赞 48 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/larry1648637120/article/details/105346826