在 kibana 控制台中不断收到此错误 "dynamic method [java.util.HashMap, add/1] not found"

keep getting this error "dynamic method [java.util.HashMap, add/1] not found" in kibana console

我是 elasticsearch 堆栈的新手...每当我尝试在 Kibana 开发工具控制台中执行以下查询时,都会出现下面提到的错误

POST employees-details/_update_by_query
{
  "query": {
    "match": {
      "EmpName": "Arvind"
    }
  },
  "script": {
    "source": "ctx._source.Address.add(params.tag)",
    "lang": "painless",
    "params": {
      "tag":{
        "AddressID":144,
        "AddressNumber":458
      }
    }
  }
}

keep Getting this error\/ while executing above query ^^

"caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "dynamic method [java.util.HashMap, add/1] not found"
    }
[
      {
        "_index" : "employees-details",
        "_type" : "_doc",
        "_id" : "101",
        "_score" : 1.0,
        "_source" : {
          "EmpUserID" : 101,
          "Gender" : "Male",
          "EmpName" : "John",
          "Age" : 35
        }
      },
      {
        "_index" : "employees-details",
        "_type" : "_doc",
        "_id" : "106",
        "_score" : 1.0,
        "_source" : {
          "EmpUserID" : 106,
          "Address" : {
            "AddressNumber" : 201,
            "AddressID" : 200
          },
          "Gender" : "Male",
          "EmpName" : "Arvind",
          "Age" : 30
        }
      }
]

kibana : 7.9.3 elasticsearch : 7.9.3

提前致谢:)

由于 Address 是一个散列,您不能使用 add() 方法(用于数组、列表等集合)。相反,您需要先将 Address 转换为列表,然后调用 add():

POST employees-details/_update_by_query
{
  "query": {
    "match": {
      "EmpName": "Arvind"
    }
  },
  "script": {
    "source": "if (!(ctx._source.Address instanceof Collection)) {ctx._source.Address = [ctx._source.Address];} ctx._source.Address.add(params.tag)",
    "lang": "painless",
    "params": {
      "tag":{
        "AddressID":144,
        "AddressNumber":458
      }
    }
  }
}