Get shutdown API

edit

This 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.

Request

edit

GET _nodes/shutdown

GET _nodes/<node-id>/shutdown

Prerequisites

edit

Description

edit

Indicates 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

edit

Prepare 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"
            }
        }
    ]
}