淘先锋技术网

首页 1 2 3 4 5 6 7

有如下索引

PUT ellisintstring/
{
  "mappings": {
    "properties": {
      "ceshi":{
        "type": "nested"
      }
    }
  }
}

其中有这么一条数据

{
        "_index" : "ellisintstring",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 1.0,
        "_source" : {
          "ceshi" : {
            "item" : "0001",
            "shuju" : "haha"
          }
        }
      }

现在要修改item

POST ellisintstring/_update_by_query
{
  "query": {
    "ids": {
      "values": ["1"]
    }
  },
  "script": {
    "source": """ctx._source['ceshi']['item'] = params.item;""",
    "lang": "painless",
    "params": {
      "item":"0000045"
    }
  }
}