【问题标题】:Elasticsearch 7 : Root mapping definition has unsupported parameters (mapper_parsing_exception)Elasticsearch 7:根映射定义具有不受支持的参数(mapper_parsing_exception)
【发布时间】:2019-09-06 01:14:45
【问题描述】:

尝试在 Elasticsearch 7 中插入以下映射时

PUT my_index/items/_mapping
{
   "settings":{

   },
   "mappings":{
      "items":{
         "properties":{
            "products":{
               "properties":{
                  "classification":{
                     "type":"text",
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "original_text":{
                     "type":"text",
                     "store":false,
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  }
               }
            },
            "title":{
               "type":"text",
               "fields":{
                  "raw":{
                     "type":"keyword",
                     "ignore_above":256
                  }
               },
               "analyzer":"autocomplete"
            },
            "image":{
               "properties":{
                  "type":{
                     "type":"text",
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "location":{
                     "type":"text",
                     "store":false,
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  }
               }
            }
         }
      }
   }
}

我收到表单错误:

{
"error": {
    "root_cause": [
    {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  

是什么导致了这个错误?

【问题讨论】:

  • 还有一些其他问题问的很相似,但是都和具体的用途有关或者和Elasticsearch 7.0.0之前的版本有关这个问题/答案的目标是有为 Elasticsearch 7 提供一个单一、干净、可概括的答案,因为随着人们从以前的版本升级到 ES 7,这可能是一个常见问题

标签: elasticsearch


【解决方案1】:

在 Elasticsearch 7 中,映射类型已被弃用,这导致了此问题根源的重大更改。

Announcement Elasticsearch 团队的弃用、路线图和替代方案。

要解决此问题,只需删除对映射类型的所有引用(本例中为“项目”):

PUT my_index/_mapping
{
   "settings":{

   },
   "mappings":{
      "properties":{
         "products":{
            "properties":{
               "classification":{
                  "type":"text",
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               },
               "original_text":{
                  "type":"text",
                  "store":false,
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               }
            }
         },
         "title":{
            "type":"text",
            "fields":{
               "raw":{
                  "type":"keyword",
                  "ignore_above":256
               }
            },
            "analyzer":"autocomplete"
         },
         "image":{
            "properties":{
               "type":{
                  "type":"text",
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               },
               "location":{
                  "type":"text",
                  "store":false,
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               }
            }
         }
      }
   }
}

【讨论】:

  • 另一个平滑过渡到 ES7 的临时解决方案是在 URL 中包含 ?include_type_name=true
  • 谢谢。答案可能在文档中,但很高兴有一个简单的问题+答案可供参考。我建议的唯一改进是现在提到 type == index,因为当您习惯将索引视为数据库并将类型视为其中的表时,这可能并不容易让您理解!
【解决方案2】:

你只需要升级你的 elasticsearch 版本..一切都会解决的..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多