2015-06-02 12:31:04 -04:00
|
|
|
[[indices-shards-stores]]
|
2019-10-01 17:07:28 -04:00
|
|
|
=== Index shard stores API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Index shard stores</titleabbrev>
|
|
|
|
++++
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2020-07-07 14:57:47 -04:00
|
|
|
Retrieves store information
|
2019-10-03 15:57:11 -04:00
|
|
|
about replica shards in one or more indices.
|
2020-07-07 14:57:47 -04:00
|
|
|
For data streams, the API retrieves store
|
|
|
|
information for the stream's backing indices.
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
[source,console]
|
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
GET /my-index-000001/_shard_stores
|
2019-10-03 15:57:11 -04:00
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[setup:my_index]
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2020-07-07 14:57:47 -04:00
|
|
|
`GET /<target>/_shard_stores`
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
`GET /_shard_stores`
|
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
2020-07-07 14:57:47 -04:00
|
|
|
The index shard stores API returns the following information:
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
* The node on which each replica shard exists
|
|
|
|
* Allocation ID for each replica shard
|
|
|
|
* Unique ID for each replica shard
|
|
|
|
* Any errors encountered
|
|
|
|
while opening the shard index
|
|
|
|
or from an earlier failure
|
|
|
|
|
|
|
|
By default, the API only returns store information
|
|
|
|
for primary shards that are unassigned
|
|
|
|
or have one or more unassigned replica shards.
|
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-07-07 14:57:47 -04:00
|
|
|
`<target>`::
|
|
|
|
(Optional, string)
|
|
|
|
Comma-separated list of data streams, indices, and index aliases used to limit
|
|
|
|
the request. Wildcard expressions (`*`) are supported.
|
2019-10-03 15:57:11 -04:00
|
|
|
+
|
2020-07-07 14:57:47 -04:00
|
|
|
To target all data streams and indices in a cluster, omit this parameter or use
|
|
|
|
`_all` or `*`.
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
2020-02-24 05:57:32 -05:00
|
|
|
+
|
|
|
|
Defaults to `true`.
|
2019-10-03 15:57:11 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
2019-10-03 15:57:11 -04:00
|
|
|
+
|
|
|
|
Defaults to `open`.
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
`status`::
|
|
|
|
+
|
|
|
|
--
|
|
|
|
(Optional, string)
|
|
|
|
Comma-separated list of shard health statuses
|
|
|
|
used to limit the request.
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
Valid values include:
|
|
|
|
|
|
|
|
`green`::
|
|
|
|
The primary shard and all replica shards are assigned.
|
|
|
|
|
|
|
|
`yellow`::
|
|
|
|
One or more replica shards are unassigned.
|
|
|
|
|
|
|
|
`red`::
|
|
|
|
The primary shard is unassigned.
|
|
|
|
|
|
|
|
`all`::
|
|
|
|
Return all shards,
|
|
|
|
regardless of health status.
|
|
|
|
|
|
|
|
Defaults to `yellow,red`.
|
|
|
|
--
|
|
|
|
|
|
|
|
[[index-shard-stores-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-single-ex]]
|
2020-07-07 14:57:47 -04:00
|
|
|
===== Get shard store information for a specific data stream or index
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-10-03 15:57:11 -04:00
|
|
|
----
|
2017-08-28 05:23:09 -04:00
|
|
|
GET /test/_shard_stores
|
2019-10-03 15:57:11 -04:00
|
|
|
----
|
|
|
|
// TEST[s/^/PUT test\n/]
|
|
|
|
|
2017-08-28 05:23:09 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
[[index-shard-stores-api-multi-ex]]
|
2020-07-07 14:57:47 -04:00
|
|
|
===== Get shard store information for several data streams and indices
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
----
|
2017-08-28 05:23:09 -04:00
|
|
|
GET /test1,test2/_shard_stores
|
2019-10-03 15:57:11 -04:00
|
|
|
----
|
|
|
|
// TEST[s/^/PUT test1\nPUT test2\n/]
|
|
|
|
|
2017-08-28 05:23:09 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
[[index-shard-stores-api-all-ex]]
|
2020-07-07 14:57:47 -04:00
|
|
|
===== Get shard store information for all data streams and indices
|
2019-10-03 15:57:11 -04:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
----
|
2017-08-28 05:23:09 -04:00
|
|
|
GET /_shard_stores
|
2019-10-03 15:57:11 -04:00
|
|
|
----
|
|
|
|
// TEST[continued]
|
|
|
|
|
|
|
|
|
|
|
|
[[index-shard-stores-api-health-ex]]
|
|
|
|
===== Get shard store information based on cluster health
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
You can use the `status` query parameter
|
|
|
|
to limit returned information based on shard health.
|
|
|
|
|
|
|
|
The following request only returns information
|
|
|
|
for assigned primary and replica shards.
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2015-06-02 12:31:04 -04:00
|
|
|
--------------------------------------------------
|
2017-08-28 05:23:09 -04:00
|
|
|
GET /_shard_stores?status=green
|
2015-06-02 12:31:04 -04:00
|
|
|
--------------------------------------------------
|
2017-08-28 05:23:09 -04:00
|
|
|
// TEST[setup:node]
|
2020-07-27 15:58:26 -04:00
|
|
|
// TEST[s/^/PUT my-index-00001\n{"settings":{"number_of_shards":1, "number_of_replicas": 0}}\nPOST my-index-00001\/test\?refresh\n{"test": "test"}\n/]
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-10-03 15:57:11 -04:00
|
|
|
The API returns the following response:
|
2015-06-02 12:31:04 -04:00
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2015-06-02 12:31:04 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2020-07-27 15:58:26 -04:00
|
|
|
"indices": {
|
|
|
|
"my-index-00001": {
|
|
|
|
"shards": {
|
|
|
|
"0": { <1>
|
|
|
|
"stores": [ <2>
|
|
|
|
{
|
|
|
|
"sPa3OgxLSYGvQ4oPs-Tajw": { <3>
|
|
|
|
"name": "node_t0",
|
|
|
|
"ephemeral_id": "9NlXRFGCT1m8tkvYCMK-8A",
|
|
|
|
"transport_address": "local[1]",
|
|
|
|
"attributes": {}
|
|
|
|
},
|
|
|
|
"allocation_id": "2iNySv_OQVePRX-yaRH_lQ", <4>
|
|
|
|
"allocation": "primary|replica|unused" <5>
|
|
|
|
"store_exception": ... <6>
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-02 12:31:04 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2017-08-28 05:23:09 -04:00
|
|
|
// TESTRESPONSE[s/"store_exception": \.\.\.//]
|
|
|
|
// TESTRESPONSE[s/"sPa3OgxLSYGvQ4oPs-Tajw"/\$node_name/]
|
|
|
|
// TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
|
|
|
|
// TESTRESPONSE[s/"attributes": \{[^}]*\}/"attributes": $body.$_path/]
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-02 12:31:04 -04:00
|
|
|
<1> The key is the corresponding shard id for the store information
|
|
|
|
<2> A list of store information for all copies of the shard
|
|
|
|
<3> The node information that hosts a copy of the store, the key
|
|
|
|
is the unique node id.
|
2016-01-26 10:40:02 -05:00
|
|
|
<4> The allocation id of the store copy
|
2017-02-08 04:00:55 -05:00
|
|
|
<5> The status of the store copy, whether it is used as a
|
2015-06-02 12:31:04 -04:00
|
|
|
primary, replica or not used at all
|
2017-02-08 04:00:55 -05:00
|
|
|
<6> Any exception encountered while opening the shard index or
|
2015-06-02 12:31:04 -04:00
|
|
|
from earlier engine failure
|