本文介绍了为渗滤查询创建索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Elasticsearch中进行渗滤查询,但按照文档我遇到了一个错误.我运行了以下内容:
I'm trying percolate query in elasticsearch, but creating an index as explained in the docs I'm greeted with an error. I ran the following:
PUT /my_percolate_index { "mappings": { "doctype": { "properties": { "message": { "type": "text" } } }, "queries": { "properties": { "query": { "type": "percolator" } } } } }我遇到以下错误:
{ "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "Rejecting mapping update to [my_percolate_index] as the final mapping would have more than 1 type: [doctype, queries]" } ], "type": "illegal_argument_exception", "reason": "Rejecting mapping update to [my_percolate_index] as the final mapping would have more than 1 type: [doctype, queries]" }, "status": 400 }我在这里想念东西吗?
推荐答案由于您使用的是ES 6 ,因此只需要在映射类型内移动query字段
Since you're using ES 6, you just need to move the query field inside your mapping type
PUT /my_percolate_index { "mappings": { "doctype": { "properties": { "message": { "type": "text" }, "query": { "type": "percolator" } } } } }请注意,从ES 6开始,任何索引内都只允许使用一种映射类型.
Note that as of ES 6, only a single mapping type is allowed within any index.
更多推荐
为渗滤查询创建索引
发布评论