Index shard stores API

Retrieves store information about replica shards in one or more indices. For data streams, the API retrieves store information for the stream’s backing indices.

  1. GET /my-index-000001/_shard_stores

Request

GET /<target>/_shard_stores

GET /_shard_stores

Description

The index shard stores API returns the following information:

  • 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.

Path parameters

<target>

(Optional, string) Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

To target all data streams and indices in a cluster, omit this parameter or use _all or *.

Query parameters

allow_no_indices

(Optional, boolean) If true, the request does not return an error if a wildcard expression or _all value retrieves only missing or closed indices.

This parameter also applies to index aliases that point to a missing or closed index.

Defaults to true.

expand_wildcards

(Optional, string) Controls what kind of indices that wildcard expressions can expand to. Multiple values are accepted when separated by a comma, as in open,hidden. Valid values are:

  • all

    Expand to open and closed indices, including hidden indices.

    open

    Expand only to open indices.

    closed

    Expand only to closed indices.

    hidden

    Expansion of wildcards will include hidden indices. Must be combined with open, closed, or both.

    none

    Wildcard expressions are not accepted.

Defaults to open.

ignore_unavailable

(Optional, boolean) If true, missing or closed indices are not included in the response. Defaults to false.

status

(Optional, string) Comma-separated list of shard health statuses used to limit the request.

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.

Examples

Get shard store information for a specific data stream or index

  1. GET /test/_shard_stores

Get shard store information for several data streams and indices

  1. GET /test1,test2/_shard_stores

Get shard store information for all data streams and indices

  1. GET /_shard_stores

Get shard store information based on cluster health

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.

  1. GET /_shard_stores?status=green

The API returns the following response:

  1. {
  2. "indices": {
  3. "my-index-00001": {
  4. "shards": {
  5. "0": {
  6. "stores": [
  7. {
  8. "sPa3OgxLSYGvQ4oPs-Tajw": {
  9. "name": "node_t0",
  10. "ephemeral_id": "9NlXRFGCT1m8tkvYCMK-8A",
  11. "transport_address": "local[1]",
  12. "attributes": {}
  13. },
  14. "allocation_id": "2iNySv_OQVePRX-yaRH_lQ",
  15. "allocation": "primary|replica|unused"
  16. "store_exception": ...
  17. }
  18. ]
  19. }
  20. }
  21. }
  22. }
  23. }

The key is the corresponding shard id for the store information

A list of store information for all copies of the shard

The node information that hosts a copy of the store, the key is the unique node id.

The allocation id of the store copy

The status of the store copy, whether it is used as a primary, replica or not used at all

Any exception encountered while opening the shard index or from earlier engine failure