@@ -12,7 +12,6 @@ Changes the allocation of shards in a cluster.
12
12
13
13
`POST /_cluster/reroute`
14
14
15
-
16
15
[[cluster-reroute-api-desc]]
17
16
==== {api-description-title}
18
17
@@ -21,15 +20,15 @@ shards in the cluster. For example, a shard can be moved from one node to
21
20
another explicitly, an allocation can be cancelled, and an unassigned shard can
22
21
be explicitly allocated to a specific node.
23
22
24
- It is important to note that after processing any reroute commands {es} will
25
- perform rebalancing as normal (respecting the values of settings such as
26
- `cluster.routing.rebalance.enable`) in order to remain in a balanced state. For
27
- example, if the requested allocation includes moving a shard from `node1` to
28
- `node2` then this may cause a shard to be moved from `node2` back to `node1` to
23
+ It is important to note that after processing any reroute commands {es} will
24
+ perform rebalancing as normal (respecting the values of settings such as
25
+ `cluster.routing.rebalance.enable`) in order to remain in a balanced state. For
26
+ example, if the requested allocation includes moving a shard from `node1` to
27
+ `node2` then this may cause a shard to be moved from `node2` back to `node1` to
29
28
even things out.
30
29
31
30
The cluster can be set to disable allocations using the
32
- `cluster.routing.allocation.enable` setting. If allocations are disabled then
31
+ `cluster.routing.allocation.enable` setting. If allocations are disabled then
33
32
the only allocations that will be performed are explicit ones given using the
34
33
`reroute` command, and consequent allocations due to rebalancing.
35
34
@@ -55,31 +54,34 @@ query parameter, which will attempt a single retry round for these shards.
55
54
56
55
57
56
[[cluster-reroute-api-query-params]]
57
+ [role="child_attributes"]
58
58
==== {api-query-parms-title}
59
59
60
60
`dry_run`::
61
- (Optional, boolean) If `true`, then the request simulates the operation only
61
+ (Optional, boolean) If `true`, then the request simulates the operation only
62
62
and returns the resulting state.
63
-
63
+
64
64
`explain`::
65
- (Optional, boolean) If `true`, then the response contains an explanation of
65
+ (Optional, boolean) If `true`, then the response contains an explanation of
66
66
why the commands can or cannot be executed.
67
67
68
68
`metric`::
69
- (Optional, string) Limits the information returned to the specified metrics.
69
+ (Optional, string) Limits the information returned to the specified metrics.
70
70
Defaults to all but metadata The following options are available:
71
71
72
72
+
73
- --
73
+ .Options for `metric`
74
+ [%collapsible%open]
75
+ ======
74
76
`_all`::
75
77
Shows all metrics.
76
-
78
+
77
79
`blocks`::
78
80
Shows the `blocks` part of the response.
79
81
80
82
`master_node`::
81
83
Shows the elected `master_node` part of the response.
82
-
84
+
83
85
`metadata`::
84
86
Shows the `metadata` part of the response. If you supply a comma separated
85
87
list of indices, the returned output will only contain metadata for these
@@ -90,29 +92,33 @@ query parameter, which will attempt a single retry round for these shards.
90
92
91
93
`routing_table`::
92
94
Shows the `routing_table` part of the response.
93
-
95
+
94
96
`version`::
95
97
Shows the cluster state version.
96
- --
98
+ ======
99
+
97
100
98
101
`retry_failed`::
99
- (Optional, boolean) If `true`, then retries allocation of shards that are
102
+ (Optional, boolean) If `true`, then retries allocation of shards that are
100
103
blocked due to too many subsequent allocation failures.
101
104
102
105
include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
103
106
104
-
107
+ [role="child_attributes"]
105
108
[[cluster-reroute-api-request-body]]
106
109
==== {api-request-body-title}
107
110
108
111
`commands`::
109
- (Required, object ) Defines the commands to perform. Supported commands are:
112
+ (Required, array of objects ) Defines the commands to perform. Supported commands are:
110
113
111
114
+
112
- --
115
+ .Properties of `commands`
116
+ [%collapsible%open]
117
+ ======
118
+
113
119
`move`::
114
- Move a started shard from one node to another node. Accepts `index` and
115
- `shard` for index name and shard number, `from_node` for the node to move
120
+ Move a started shard from one node to another node. Accepts `index` and
121
+ `shard` for index name and shard number, `from_node` for the node to move
116
122
the shard from, and `to_node` for the node to move the shard to.
117
123
118
124
`cancel`::
@@ -129,11 +135,10 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
129
135
Allocate an unassigned replica shard to a node. Accepts `index` and `shard`
130
136
for index name and shard number, and `node` to allocate the shard to. Takes
131
137
<<modules-cluster,allocation deciders>> into account.
132
- --
133
138
134
139
Two more commands are available that allow the allocation of a primary shard to
135
140
a node. These commands should however be used with extreme care, as primary
136
- shard allocation is usually fully automatically handled by {es}. Reasons why a
141
+ shard allocation is usually fully automatically handled by {es}. Reasons why a
137
142
primary shard cannot be automatically allocated include the
138
143
following:
139
144
@@ -169,7 +174,7 @@ will be deleted or overwritten.
169
174
data rejoins the cluster later on, that data will be deleted. To ensure
170
175
that these implications are well-understood, this command requires the flag
171
176
`accept_data_loss` to be explicitly set to `true`.
172
-
177
+ ======
173
178
174
179
[[cluster-reroute-api-example]]
175
180
==== {api-examples-title}
0 commit comments