无法在弹性搜索中更新映射

Not able to update mapping in elastic search

我一直在尝试更新我的地图,但无法做到这一点。这个问题主要与更新嵌套部分有关。假设有一个字段“Anand”,其中包含一个字段“hello”

{
  "properties": {
    "anand": {
      "hello": {
        "type": "short"
      }
    }
  }
}

但是我收到了错误

  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "No type specified for field [anand]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "No type specified for field [anand]"
  },
  "status" : 400
}

当前映射是

{
  "anandschool" : {
    "mappings" : {
      "properties" : {
        "anand" : {
          "type" : "nested"
        },
        "doc" : {
          "properties" : {
            "properties" : {
              "properties" : {
                "shop_tier" : {
                  "type" : "long"
                }
              }
            }
          }
        },
        "message" : {
          "type" : "byte"
        },
        "properties" : {
          "properties" : {
            "shop_tier" : {
              "type" : "long"
            },
            "shop_type" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "shop" : {
          "type" : "long"
        }
      }
    }
  }
}

我什至创建了一个嵌套类型 anand 以便它可以工作

{
  "properties": {
    "anand": {
        "type": "nested"
    }
  }
}

自答

更新嵌套事物的映射时需要更新嵌套字段的属性。

对于上面的例子更新

  "properties": {
    "anand": {
     "properties":{
      "hello": {
        "type": "short"
      }
     }
    }
  }
}

虽然如果 anand 类型是“嵌套的”,这在 nested.Ex 的字段内将不起作用,它将不起作用。如果有人知道解决方案,请告诉我。