gpt4 book ai didi

Elasticsearch : Root mapping definition has unsupported parameters index : not_analyzed

转载 作者:行者123 更新时间:2023-11-29 02:42:54 26 4
gpt4 key购买 nike

大家好,我正在尝试创建架构测试。

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
}

请帮我解决这个错误

最佳答案

你快到了,你只是错过了一些东西:

PUT /test
{
"mappings": {
"type_name": { <--- add the type name
"properties": { <--- enclose all field definitions in "properties"
"field1": {
"type": "integer"
},
"field2": {
"type": "integer"
},
"field3": {
"type": "string",
"index": "not_analyzed"
},
"field4,": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
}
},
"settings": {
...
}
}

更新

如果您的索引已经存在,您还可以像这样修改您的映射:

PUT test/_mapping/type_name
{
"properties": { <--- enclose all field definitions in "properties"
"field1": {
"type": "integer"
},
"field2": {
"type": "integer"
},
"field3": {
"type": "string",
"index": "not_analyzed"
},
"field4,": {
"type": "string",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
}

更新:

从 ES 7 开始,映射类型已被删除。您可以阅读更多详情here

关于 Elasticsearch : Root mapping definition has unsupported parameters index : not_analyzed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39288997/

26 4 0