44<titleabbrev>Index shard stores</titleabbrev>
55++++
66
7- Provides store information for shard copies of indices.
8- Store information reports on which nodes shard copies exist, the shard
9- copy allocation ID, a unique identifier for each shard copy, and any exceptions
10- encountered while opening the shard index or from earlier engine failure.
7+ Returns store information
8+ about replica shards in one or more indices.
119
12- By default, only lists store information for shards that have at least one
13- unallocated copy. When the cluster health status is yellow, this will list
14- store information for shards that have at least one unassigned replica.
15- When the cluster health status is red, this will list store information
16- for shards, which has unassigned primaries.
10+ [source,js]
11+ ----
12+ GET /twitter/_shard_stores
13+ ----
14+ // CONSOLE
15+ // TEST[setup:twitter]
16+
17+
18+ [[index-shard-stores-api-request]]
19+ ==== {api-request-title}
20+
21+ `GET /<index>/_shard_stores`
22+
23+ `GET /_shard_stores`
24+
25+
26+ [[index-shard-stores-api-desc]]
27+ ==== {api-description-title}
28+
29+ Use the index shard stores API to return store information
30+ about replica shards in one or more indices.
31+
32+ Returned information includes:
33+
34+ * The node on which each replica shard exists
35+ * Allocation ID for each replica shard
36+ * Unique ID for each replica shard
37+ * Any errors encountered
38+ while opening the shard index
39+ or from an earlier failure
40+
41+ By default, the API only returns store information
42+ for primary shards that are unassigned
43+ or have one or more unassigned replica shards.
44+
45+
46+ [[index-shard-stores-api-path-params]]
47+ ==== {api-path-parms-title}
48+
49+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
50+ +
51+ To retrieve information for all indices in the cluster,
52+ use a value of `_all` or `*`
53+ or omit this parameter.
54+
55+
56+ [[index-shard-stores-api-query-params]]
57+ ==== {api-query-parms-title}
58+
59+ include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
60+
61+ include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
62+ +
63+ Defaults to `open`.
64+
65+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
66+
67+ `status`::
68+ +
69+ --
70+ (Optional, string)
71+ Comma-separated list of shard health statuses
72+ used to limit the request.
73+
74+ Valid values include:
1775
18- Endpoints include shard stores information for a specific index, several
19- indices, or all:
76+ `green`::
77+ The primary shard and all replica shards are assigned.
78+
79+ `yellow`::
80+ One or more replica shards are unassigned.
81+
82+ `red`::
83+ The primary shard is unassigned.
84+
85+ `all`::
86+ Return all shards,
87+ regardless of health status.
88+
89+ Defaults to `yellow,red`.
90+ --
91+
92+ [[index-shard-stores-api-example]]
93+ ==== {api-examples-title}
94+
95+
96+ [[index-shard-stores-api-single-ex]]
97+ ===== Get shard store information for a specific index
2098
2199[source,js]
22- --------------------------------------------------
23- # return information of only index test
100+ ----
24101GET /test/_shard_stores
102+ ----
103+ // CONSOLE
104+ // TEST[s/^/PUT test\n/]
105+
106+
107+ [[index-shard-stores-api-multi-ex]]
108+ ===== Get shard store information for several indices
25109
26- # return information of only test1 and test2 indices
110+ [source,js]
111+ ----
27112GET /test1,test2/_shard_stores
113+ ----
114+ // CONSOLE
115+ // TEST[s/^/PUT test1\nPUT test2\n/]
116+
28117
29- # return information of all indices
118+ [[index-shard-stores-api-all-ex]]
119+ ===== Get shard store information for all indices
120+
121+ [source,js]
122+ ----
30123GET /_shard_stores
31- --------------------------------------------------
124+ ----
32125// CONSOLE
33- // TEST[s/^/PUT test\nPUT test1\nPUT test2\n/]
126+ // TEST[continued]
127+
128+
129+ [[index-shard-stores-api-health-ex]]
130+ ===== Get shard store information based on cluster health
34131
35- The scope of shards to list store information can be changed through
36- `status` param. Defaults to 'yellow' and 'red'. 'yellow' lists store information of
37- shards with at least one unassigned replica and 'red' for shards with unassigned
38- primary shard.
39- Use 'green' to list store information for shards with all assigned copies .
132+ You can use the `status` query parameter
133+ to limit returned information based on shard health.
134+
135+ The following request only returns information
136+ for assigned primary and replica shards .
40137
41138[source,js]
42139--------------------------------------------------
@@ -46,9 +143,7 @@ GET /_shard_stores?status=green
46143// TEST[setup:node]
47144// TEST[s/^/PUT my-index\n{"settings":{"number_of_shards":1, "number_of_replicas": 0}}\nPOST my-index\/test\?refresh\n{"test": "test"}\n/]
48145
49- Response:
50-
51- The shard stores information is grouped by indices and shard ids.
146+ The API returns the following response:
52147
53148[source,js]
54149--------------------------------------------------
0 commit comments