update_by_query
Update documents matching a query in an index using a Painless script, with asynchronous task tracking and explicit confirmation for destructive operations.
Instructions
Update documents in place by query, using a painless script. DESTRUCTIVE and irreversible. A query is mandatory: match_all is refused so you cannot rewrite a whole index by accident. Runs asynchronously; returns a task_id to poll with get_task. Reports how many documents match before updating. Requires writes enabled, ES_MCP_ALLOW_DESTRUCTIVE=true, and confirm=true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | ||
| query | Yes | ||
| slices | No | auto | |
| confirm | No | ||
| script_params | No | ||
| script_source | Yes | ||
| requests_per_second | No | ||
| wait_for_completion | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |