Get shutdown API

Get shutdown API

This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

New API reference

For the most up-to-date API details, refer to Node lifecycle APIs.

Retrieves the status of a node that’s being prepared for shutdown.

Request

GET _nodes/shutdown

GET _nodes/<node-id>/shutdown

Prerequisites

Description

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

<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

Prepare a node to be restarted:

  1. resp = client.shutdown.put_node(
  2. node_id="USpTGYaBSIKbgSUJR2Z9lg",
  3. type="restart",
  4. reason="Demonstrating how the node shutdown API works",
  5. allocation_delay="10m",
  6. )
  7. print(resp)
  1. response = client.shutdown.put_node(
  2. node_id: 'USpTGYaBSIKbgSUJR2Z9lg',
  3. body: {
  4. type: 'restart',
  5. reason: 'Demonstrating how the node shutdown API works',
  6. allocation_delay: '10m'
  7. }
  8. )
  9. puts response
  1. const response = await client.shutdown.putNode({
  2. node_id: "USpTGYaBSIKbgSUJR2Z9lg",
  3. type: "restart",
  4. reason: "Demonstrating how the node shutdown API works",
  5. allocation_delay: "10m",
  6. });
  7. console.log(response);
  1. PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
  2. {
  3. "type": "restart",
  4. "reason": "Demonstrating how the node shutdown API works",
  5. "allocation_delay": "10m"
  6. }

Get the status of the shutdown preparations:

  1. resp = client.shutdown.get_node(
  2. node_id="USpTGYaBSIKbgSUJR2Z9lg",
  3. )
  4. print(resp)
  1. response = client.shutdown.get_node(
  2. node_id: 'USpTGYaBSIKbgSUJR2Z9lg'
  3. )
  4. puts response
  1. const response = await client.shutdown.getNode({
  2. node_id: "USpTGYaBSIKbgSUJR2Z9lg",
  3. });
  4. console.log(response);
  1. GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown

The response shows information about the shutdown preparations, including the status of shard migration, task migration, and plugin cleanup:

  1. {
  2. "nodes": [
  3. {
  4. "node_id": "USpTGYaBSIKbgSUJR2Z9lg",
  5. "type": "RESTART",
  6. "reason": "Demonstrating how the node shutdown API works",
  7. "shutdown_startedmillis": 1624406108685,
  8. "allocation_delay": "10m",
  9. "status": "COMPLETE",
  10. "shard_migration": {
  11. "status": "COMPLETE",
  12. "shard_migrations_remaining": 0,
  13. "explanation": "no shard relocation is necessary for a node restart"
  14. },
  15. "persistent_tasks": {
  16. "status": "COMPLETE"
  17. },
  18. "plugins": {
  19. "status": "COMPLETE"
  20. }
  21. }
  22. ]
  23. }