Skip to content

Commit 088a742

Browse files
authored
Add shutdown API examples (#3438)
1 parent 2d49d47 commit 088a742

File tree

9 files changed

+67
-17
lines changed

9 files changed

+67
-17
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 14 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ monitor-elasticsearch-cluster,https://www.elastic.co/guide/en/elasticsearch/refe
375375
multi-fields,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/multi-fields.html
376376
network-direction-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/network-direction-processor.html
377377
node-roles,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/modules-node.html#node-roles
378+
nodes-api-shutdown-delete,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-shutdown.html
379+
nodes-api-shutdown-status,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-shutdown.html
380+
nodes-api-shutdown,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/put-shutdown.html
378381
paginate-search-results,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/paginate-search-results.html
379382
painless-contexts,https://www.elastic.co/guide/en/elasticsearch/painless/{branch}/painless-contexts.html
380383
painless-execute-api,https://www.elastic.co/guide/en/elasticsearch/painless/{branch}/painless-execute-api.html

specification/shutdown/delete_node/ShutdownDeleteNodeRequest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { TimeUnit } from '@_types/Time'
3434
* @rest_spec_name shutdown.delete_node
3535
* @availability stack since=7.13.0 stability=stable
3636
* @cluster_privileges manage
37+
* @doc_id nodes-api-shutdown-delete
3738
*/
3839
export interface Request extends RequestBase {
3940
path_parts: {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# summary:
2+
description: A successful response from `DELETE /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`.
3+
# type: response
4+
# response_code: ''
5+
value: "{\n \"acknowledged\": true\n}"

specification/shutdown/get_node/ShutdownGetNodeRequest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { TimeUnit } from '@_types/Time'
3333
* @rest_spec_name shutdown.get_node
3434
* @availability stack since=7.13.0 stability=stable
3535
* @cluster_privileges manage
36+
* @doc_id nodes-api-shutdown-status
3637
*/
3738
export interface Request extends RequestBase {
3839
path_parts: {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# summary:
2+
description: >
3+
Get the status of shutdown preparations with `GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`.
4+
The response shows information about the shutdown preparations, including the status of shard migration, task migration, and plugin cleanup
5+
# type: response
6+
# response_code: ''
7+
value:
8+
"{\n \"nodes\": [\n {\n \"node_id\": \"USpTGYaBSIKbgSUJR2Z9lg\"\
9+
,\n \"type\": \"RESTART\",\n \"reason\": \"Demonstrating how\
10+
\ the node shutdown API works\",\n \"shutdown_startedmillis\": 1624406108685,\n\
11+
\ \"allocation_delay\": \"10m\",\n \"status\": \"COMPLETE\"\
12+
,\n \"shard_migration\": {\n \"status\": \"COMPLETE\"\
13+
,\n \"shard_migrations_remaining\": 0,\n \"explanation\"\
14+
: \"no shard relocation is necessary for a node restart\"\n },\n \
15+
\ \"persistent_tasks\": {\n \"status\": \"COMPLETE\"\n \
16+
\ },\n \"plugins\": {\n \"status\": \"COMPLETE\"\
17+
\n }\n }\n ]\n}"

specification/shutdown/put_node/ShutdownPutNodeRequest.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { Type } from '../_types/types'
2727
*
2828
* NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.
2929
*
30+
* If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.
31+
*
3032
* If the operator privileges feature is enabled, you must be an operator to use this API.
3133
*
3234
* The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster.
@@ -40,19 +42,28 @@ import { Type } from '../_types/types'
4042
* @rest_spec_name shutdown.put_node
4143
* @availability stack since=7.13.0 stability=stable
4244
* @cluster_privileges manage
45+
* @doc_id nodes-api-shutdown
4346
*/
4447
export interface Request extends RequestBase {
4548
path_parts: {
49+
/**
50+
* The node identifier.
51+
* This parameter is not validated against the cluster's active nodes.
52+
* This enables you to register a node for shut down while it is offline.
53+
* No error is thrown if you specify an invalid node ID.
54+
*/
4655
node_id: NodeId
4756
}
4857
query_parameters: {
4958
/**
50-
* Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
59+
* The period to wait for a connection to the master node.
60+
* If no response is received before the timeout expires, the request fails and returns an error.
5161
* @server_default 30s
5262
*/
5363
master_timeout?: TimeUnit
5464
/**
55-
* Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
65+
* The period to wait for a response.
66+
* If no response is received before the timeout expires, the request fails and returns an error.
5667
* @server_default 30s
5768
*/
5869
timeout?: TimeUnit
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# summary:
2+
# method_request: PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
3+
description: >
4+
Register a node for shutdown with `PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`.
5+
The `restart` type prepares the node to be restarted.
6+
# type: request
7+
value:
8+
"{\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown\
9+
\ API works\",\n \"allocation_delay\": \"20m\"\n}"

0 commit comments

Comments
 (0)