【发布时间】:2022-03-31 20:08:56
【问题描述】:
我是同样的错误this questuion。 作为这个问题的答案,我正在尝试将正确的 url 设置为 PUT 索引映射,但它不适用于我的实例:
$ cat mapping.json | http PUT myhost:9200/acastest/_mapping
结果:
HTTP/1.1 400 Bad Request
Content-Length: 247
Content-Type: application/json; charset=UTF-8
{
"error": {
"reason": "Validation Failed: 1: mapping type is missing;",
"root_cause": [
{
"reason": "Validation Failed: 1: mapping type is missing;",
"type": "action_request_validation_exception"
}
],
"type": "action_request_validation_exception"
},
"status": 400
}
并尝试这样做:
$ cat mapping.json | http PUT myhost:9200/acastest/articles/_mapping
结果:
HTTP/1.1 400 Bad Request
Content-Length: 3969
Content-Type: application/json; charset=UTF-8
{
"error": {
"reason": "Root mapping definition has unsupported parameters: [mappings : {articles={properties={category_en={type=string, index=not_analyzed},blah blah blah",
"root_cause": [
{
"reason": "Root mapping definition has unsupported parameters: [mappings : {articles={properties={category_en={type=string, index=not_analyzed}, category_fa={blahblah blah",
"type": "mapper_parsing_exception"
}
],
"type": "mapper_parsing_exception"
},
"status": 400
}
弹性搜索配置:
"version": {
"number": "2.1.1",
"build_hash": "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
"build_timestamp": "2015-12-15T13:05:55Z",
"build_snapshot": false,
"lucene_version": "5.3.1"
},
我的映射文件是这样的:
{
"mappings": {
"articles": {
"properties": {
"category_en": {
"type": "string",
"index": "not_analyzed"
},
"category_fa": {
"type": "string",
"index": "not_analyzed"
},
blah
blah
blah
}
}
}
}
要查看完整的映射文件,请查看this 我该如何解决?
【问题讨论】:
-
您需要删除
"mappings"并在您的mapping.json文件的顶层添加"articles"。
标签: elasticsearch lucene