我想在更新时附加 elasticsearch 嵌套对象
{
"_index": "feed",
"_type": "feed",
"_id": "41",
"_version": 1,
"found": true,
"_source": {
"id": 1,
"name": "Trip to LA",
"stats": {
"likes": 40,
"comments": 50,
},
}
}
这是查询
POST feed / feed / 41 / _update
{
"script": {
"source" : "ctx._source.stats.add(params.abc)",
"params": {
"abc": {
"likes":1
}
}
}
}
答案 0 :(得分:1)
用于在嵌套对象中追加
POST Feed / feed / 47 / _update
{
"script": {
"source" : "ctx._source.stats.likes += params.value",
"params": {
"value":1
}
}
}