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
|
|
|
|
|
|
|
Provides store information for shard copies of indices.
|
|
|
|
Store information reports on which nodes shard copies exist, the shard
|
2016-02-09 05:07:32 -05:00
|
|
|
copy allocation ID, a unique identifier for each shard copy, and any exceptions
|
2015-06-02 12:31:04 -04:00
|
|
|
encountered while opening the shard index or from earlier engine failure.
|
|
|
|
|
|
|
|
By default, only lists store information for shards that have at least one
|
|
|
|
unallocated copy. When the cluster health status is yellow, this will list
|
|
|
|
store information for shards that have at least one unassigned replica.
|
|
|
|
When the cluster health status is red, this will list store information
|
|
|
|
for shards, which has unassigned primaries.
|
|
|
|
|
|
|
|
Endpoints include shard stores information for a specific index, several
|
|
|
|
indices, or all:
|
|
|
|
|
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
|
|
|
# return information of only index test
|
|
|
|
GET /test/_shard_stores
|
|
|
|
|
|
|
|
# return information of only test1 and test2 indices
|
|
|
|
GET /test1,test2/_shard_stores
|
|
|
|
|
|
|
|
# return information of all indices
|
|
|
|
GET /_shard_stores
|
2015-06-02 12:31:04 -04:00
|
|
|
--------------------------------------------------
|
2017-08-28 05:23:09 -04:00
|
|
|
// TEST[s/^/PUT test\nPUT test1\nPUT test2\n/]
|
2015-06-02 12:31:04 -04:00
|
|
|
|
|
|
|
The scope of shards to list store information can be changed through
|
|
|
|
`status` param. Defaults to 'yellow' and 'red'. 'yellow' lists store information of
|
|
|
|
shards with at least one unassigned replica and 'red' for shards with unassigned
|
|
|
|
primary shard.
|
|
|
|
Use 'green' to list store information for shards with all assigned copies.
|
|
|
|
|
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]
|
|
|
|
// TEST[s/^/PUT my-index\n{"settings":{"number_of_shards":1, "number_of_replicas": 0}}\nPOST my-index\/test\?refresh\n{"test": "test"}\n/]
|
2015-06-02 12:31:04 -04:00
|
|
|
|
|
|
|
Response:
|
|
|
|
|
|
|
|
The shard stores information is grouped by indices and shard ids.
|
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2015-06-02 12:31:04 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2017-08-28 05:23:09 -04:00
|
|
|
"indices": {
|
|
|
|
"my-index": {
|
|
|
|
"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
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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
|