在ES 2.4.0文档中更新特定字段



我有这样的文档

               "College": "UCLA",
               "University": "American",
               "Branch": "MECH",
               "Name": {
                  "first": "john",
                  "middle": "william",
                  "last": "Richards"
                 }

我必须更新Name组中的last字段

我尝试了以下内容,但显示错误

POST alma/matter/1/_update
{
  "doc": { "Name.last": "junior" }
}

错误:

{
   "error": {
      "root_cause": [
         {
            "type": "mapper_parsing_exception",
            "reason": "Field name [Name.last] cannot contain '.'"
         }
      ],
      "type": "mapper_parsing_exception",
      "reason": "Field name [Name.last] cannot contain '.'"
   },
   "status": 400
}

您不允许您参考其中的点。您可以这样做:

POST alma/matter/1/_update
{
  "doc": { "Name": {"last": "junior" }}
}

最新更新