大家好,我正在尝试创建模式测试。
PUT /test
{
"mappings": {
"field1": {
"type": "integer"
},
"field2": {
"type": "integer"
},
"field3": {
"type": "string",
"index": "not_analyzed"
},
"field4": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
},
"settings": {
bla
bla
bla
}
}
我收到以下错误
{
"error": {
"root_cause": [{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [index : not_analyzed] [type : string]"
}],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [featured]: Root mapping definition has unsupported parameters: [index : not_analyzed] [type : string]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [index : not_analyzed] [type : string]"
}
},
"status": 400
}
请帮助我解决此错误
8条答案
按热度按时间z8dt9xmd1#
你就快到了,你还差几样东西:
更新
如果你的索引已经存在,你也可以像这样修改你的Map:
更新:
从ES 7开始,Map类型被删除了.您可以阅读更多详情here
cvxl0en22#
我希望以上答案适用于<7.0的ElasticSearch,但在7.0中,我们不能指定文档类型,并且不再支持。在这种情况下,如果我们指定文档类型,我们会得到类似的错误。
如果你正在使用Elastic search 7.0和Nest C#最新版本(6.6)。ES 7.0中有一些重大更改导致了此问题。这是因为我们不能指定文档类型,而在版本6.6的NEST中,他们使用的是doctype。因此,为了解决这个问题,直到NEST7.0发布,我们需要下载他们的测试包
请通过此链接进行修复
https://xyzcoder.github.io/elasticsearch/nest/2019/04/12/es-70-and-nest-mapping-error.html
**编辑:**NEST 7.0现已发布。NEST 7.0与Elastic 7.0兼容。详情请参阅release notes here。
00jrzges3#
检查您的Elastic版本。
我有这些问题,因为我正在寻找不正确的版本的文档。
uubf1zoe4#
从ES 7开始,Map类型被删除了.您可以阅读更多详情here
如果您使用的是Ruby On Rails,这意味着您可能需要从模型或关注点中删除
document_type
。作为Map类型的替代方案,一种解决方案是对每个文档类型使用索引。
之前:
之后:
omhiaaxx5#
我正在运行Elastic Search版本7.12
当我运行以下命令时
返回以下错误。
为了缓解这种情况,请按如下方式修改查询中的json。
注意:删除了“movie”:{}层。现在起作用了
wrrgggsh6#
下面是我知道的一个类似的命令:
上面curl命令的细分如下:
1yjd4xko7#
如果你在Python中使用
elasticsearch_dsl
,这个错误可能只是意味着你没有使用正确版本的库。库版本对应于Elasticsearch版本。
所以如果你使用的是Elasticsearch
7.x
,elasticsearch_dsl应该是7.x
,以此类推vd2z7a6w8#
如果你使用的是
Python
,你也可以使用requests
库:POST_URL = '<kibana_instance>/index_name/type_name/'
postdata = 'content_in_json_file.json'
检查状态和返回,看看是否一切正常: