我需要更新elasticsearch 5.X
中的嵌套文档(批量)条件
例如:{
"hits": {
"hits": [{
"_index": "myindex",
"_id": "1",
"_source": {
"ticketdesc": [{
"groupid": 244,
"groupname": "Fire and run"
}]
}
},
{
"_index": "myindex",
"_id": "2",
"_source": {
"ticketdesc": [{
"groupid": 244,
"groupname": "Fire and run"
}]
}
},
{
"_index": "myindex",
"_id": "3",
"_source": {
"ticketdesc": [{
"groupid": 244,
"groupname": "Fire and run"
}]
}
},
{
"_index": "myindex",
"_id": "4",
"_source": {
"ticketdesc": [{
"groupid": 245,
"groupname": "Fire and run"
}]
}
}
]
}
}
提前致谢
答案 0 :(得分:1)
您可以轻松地使用update by query API
POST myindex/_update_by_query
{
"query": {
"term": {"groupid": 245}
},
"script": {
"source": "ctx._source.groupname = 'New name' "
}
}