您可以使用update
API进行脚本更新:
curl -XPOST 'localhost:9200/test_index/doc/1/_update' -d '{ "script" : { "inline": "ctx._source.parent += ['name': name, 'label': label]", "params" : { "name" : "Pakistan", "label": "PK" } }}'更新
如果要在批量查询中使用它,也可以
curl -XPOST 'localhost:9200/test_index/doc/_bulk' -d '{ "update" : { "_id" : "1"} }{ "script" : { "inline": "ctx._source.parent += ['name': name, 'label': label]", "lang" : "groovy", "params" : {"name" : "Pakistan", "label": "PK"}}}'


