This documentation contains work-in-progress information for future Elastic Stack and Cloud releases. Use the version selector to view supported release docs. It also contains some Elastic Cloud serverless information. Check out our serverless docs for more details.
Get shutdown API
editGet shutdown API
editThis feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.
Retrieves the status of a node that’s being prepared for shutdown.
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have the
manage
cluster privilege to use this API. - If the operator privileges feature is enabled, you must be an operator to use this API.
Description
editIndicates whether a node is ready to be shut down, or if shut down preparations are still in progress or have stalled. Returns status information for each part of the shut down process. Use to monitor the shut down process after calling put shutdown.
Path parameters
edit-
<node-id>
- (Optional, string) The ID of a node that is being prepared for shutdown. If no ID is specified, returns the status of all nodes being prepared for shutdown.
Examples
editPrepare a node to be restarted:
resp = client.shutdown.put_node( node_id="USpTGYaBSIKbgSUJR2Z9lg", type="restart", reason="Demonstrating how the node shutdown API works", allocation_delay="10m", ) print(resp)
response = client.shutdown.put_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg', body: { type: 'restart', reason: 'Demonstrating how the node shutdown API works', allocation_delay: '10m' } ) puts response
const response = await client.shutdown.putNode({ node_id: "USpTGYaBSIKbgSUJR2Z9lg", type: "restart", reason: "Demonstrating how the node shutdown API works", allocation_delay: "10m", }); console.log(response);
PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown { "type": "restart", "reason": "Demonstrating how the node shutdown API works", "allocation_delay": "10m" }
Get the status of the shutdown preparations:
resp = client.shutdown.get_node( node_id="USpTGYaBSIKbgSUJR2Z9lg", ) print(resp)
response = client.shutdown.get_node( node_id: 'USpTGYaBSIKbgSUJR2Z9lg' ) puts response
const response = await client.shutdown.getNode({ node_id: "USpTGYaBSIKbgSUJR2Z9lg", }); console.log(response);
GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
The response shows information about the shutdown preparations, including the status of shard migration, task migration, and plugin cleanup:
{ "nodes": [ { "node_id": "USpTGYaBSIKbgSUJR2Z9lg", "type": "RESTART", "reason": "Demonstrating how the node shutdown API works", "shutdown_startedmillis": 1624406108685, "allocation_delay": "10m", "status": "COMPLETE", "shard_migration": { "status": "COMPLETE", "shard_migrations_remaining": 0, "explanation": "no shard relocation is necessary for a node restart" }, "persistent_tasks": { "status": "COMPLETE" }, "plugins": { "status": "COMPLETE" } } ] }