Reputation: 11809
I want to do an update by query (_update_by_query
), and I only want 100 documents to be affected. An analogy in SQL is UPDATE foo SET a = 5 LIMIT 100
. Is it possible?
Upvotes: 4
Views: 2282
Reputation: 217554
Since 7.3, the _update_by_query
API supports the max_docs
parameter, which you can use to specify the maximum number of documents to update
POST foo/_update_by_query?max_docs=100
{
"script": {
"source": "ctx._source.a = 5"
}
}
Upvotes: 7