【问题标题】:Getting illegal_argument_exception when trying to create index with mapping尝试使用映射创建索引时出现非法参数异常
【发布时间】:2023-03-17 00:04:01
【问题描述】:

我使用的是 elasticsearch 6.6.0,我正在尝试创建和索引它失败并出现非法参数异常:

[root_cause] => Array
                (
                    [0] => stdClass Object
                        (
                            [type] => illegal_argument_exception
                            [reason] => unknown setting [index.mappings.place.properties.address.fields.city.fields.de.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
                        )

                )

            [type] => illegal_argument_exception
            [reason] => unknown setting [index.mappings.place.properties.address.fields.city.fields.de.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
            [suppressed] => Array
                (
                    [0] => stdClass Object
                        (
                            [type] => illegal_argument_exception
                            [reason] => unknown setting [index.mappings.place.properties.address.fields.city.fields.de.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
                        )...

我的映射:http://myjson.com/1559qq

此时我不知道我做错了什么。根据documentation,我应该能够使用包含其他属性的字段创建索引。

[编辑] 所以我遇到了多个问题:

  • 每个人都指出设置中右花括号的位置错误
  • string 不再是一种类型,应由@IanGabes 指出的文本或关键字替换
  • text + not_analyzed 必须替换为关键字
  • 使用关键字(类型)作为字段名称
  • 地址上右花括号的位置错误

非常感谢大家。

【问题讨论】:

  • 映射的第一个问题是它mapping 不是settings 的子对象,它是兄弟对象。你想要:PUT index {"settings":{...},"mapping":{...}}。在此之后,您在类型中还有一些问题需要解决,但至少您会有一些新的错误消息需要处理。
  • string 不是数据类型,请在 textkeyword 之间选择

标签: elasticsearch


【解决方案1】:

您的 json 错误,您的映射在 settings 内部,并且 elastic 认为您的 field mappingsindex mapping settings,正如您在错误消息中看到的那样:

unknown setting [index.mappings.place.properties.address.fields.city.fields.de.type] 

您需要关闭 settings 的大括号,如下所示。

{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 1
     }
    },
    "mappings": {
      "place": {
        "properties": {
          ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-07
    • 2021-07-15
    • 1970-01-01
    • 2013-07-08
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 1970-01-01
    相关资源
    最近更新 更多