code | type | title | description |
---|---|---|---|
true |
page |
updateByQuery |
Updates documents matching query |
Updates documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
An empty or null query will match all documents in the collection.
updateByQuery(index, collection, query, changes, [options])
Argument | Type | Description |
---|---|---|
index |
string |
Index name |
collection |
string |
Collection name |
query |
object |
Query to match |
changes |
object |
Partial changes to apply to the documents |
options |
object |
Optional parameters |
Additional query options.
Options | Type (default) |
Description |
---|---|---|
refresh |
string ( "" ) |
If set to wait_for , waits for the change to be reflected for search (up to 1s) |
timeout |
number |
Time (in ms) during which a request will still be waited to be resolved. Set it -1 if you want to wait indefinitely |
Returns the number of updated documents.
<<< ./snippets/update-by-query.js