I'm looking to update a large amount of documents. I am able to update individual documents if I use the following script where MD51 and MD52 are the actual values that I enter.
{
"script": {
"source": "ctx._source.isDupe = \"true\"",
"lang": "painless"
},
"query": {
"terms": {
"MD5.keyword":["MD51","MD52"]
}}}
I'd like to know if there's a way to do this from the results of an aggregation and update them all at once.
POST testsizeindex/_update_by_query
{
"script": {
"source": "ctx._source.isDupe = \"true\"",
"lang": "painless"
},
"aggs": {
"2": {
"terms": {
"field": "MD5_hash.keyword",
"min_doc_count": 2
}
}
}
}