-
Notifications
You must be signed in to change notification settings - Fork 578
adding docs for shard_stores api #10124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AntonEliatra
wants to merge
4
commits into
opensearch-project:main
Choose a base branch
from
AntonEliatra:adding-shard_stores-api-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
--- | ||
layout: default | ||
title: Shard stores | ||
parent: Cluster APIs | ||
nav_order: 70 | ||
--- | ||
|
||
# Shard stores | ||
|
||
The `_shard_stores` API provides information about the shard copies for one or more indexes. This API helps to diagnose issues with unallocated shards by indicating why shards are unassigned and providing their current states. | ||
|
||
<!-- spec_insert_start | ||
api: indices.shard_stores | ||
component: endpoints | ||
--> | ||
## Endpoints | ||
```json | ||
GET /_shard_stores | ||
GET /{index}/_shard_stores | ||
``` | ||
<!-- spec_insert_end --> | ||
|
||
<!-- spec_insert_start | ||
api: indices.shard_stores | ||
component: path_parameters | ||
include_global: false | ||
include_deprecated: false | ||
pretty: false | ||
--> | ||
## Path parameters | ||
|
||
The following table lists the available path parameters. All path parameters are optional. | ||
|
||
| Parameter | Data type | Description | | ||
| :--- | :--- | :--- | | ||
| `index` | List or String | List of data streams, indexes, and aliases used to limit the request. | | ||
|
||
<!-- spec_insert_end --> | ||
|
||
<!-- spec_insert_start | ||
api: indices.shard_stores | ||
component: query_parameters | ||
include_global: false | ||
include_deprecated: false | ||
columns: Parameter, Data type, Description, Default | ||
pretty: true | ||
--> | ||
## Query parameters | ||
|
||
The following table lists the available query parameters. All query parameters are optional. | ||
|
||
| Parameter | Data type | Description | Default | | ||
| `allow_no_indices` | Boolean | If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indexes. This behavior applies even if the request targets other open indexes. | `false` | | ||
| `expand_wildcards` | List or String | Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. <br> Valid values are: <br> - `all`: Match any index, including hidden ones. <br> - `closed`: Match closed, non-hidden indexes. <br> - `hidden`: Match hidden indexes. Must be combined with open, closed, or both. <br> - `none`: Wildcard expressions are not accepted. <br> - `open`: Match open, non-hidden indexes. | `open` | | ||
AntonEliatra marked this conversation as resolved.
Show resolved
Hide resolved
AntonEliatra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `ignore_unavailable` | Boolean | If `true`, missing or closed indexes are not included in the response. | `false` | | ||
| `status` | List or String | List of shard health statuses used to limit the request. <br> Valid values are: <br> - `all`: Return all shards, regardless of health status. <br> - `green`: The primary shard and all replica shards are assigned. <br> - `red`: The primary shard is unassigned. <br> - `yellow`: One or more replica shards are unassigned. | `yellow,red` | | ||
AntonEliatra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<!-- spec_insert_end --> | ||
|
||
## Example | ||
|
||
Create an index with multiple primary shards on a single-node cluster: | ||
|
||
```json | ||
PUT /logs-shardstore | ||
{ | ||
"settings": { | ||
"number_of_shards": 2, | ||
"number_of_replicas": 0 | ||
}, | ||
"mappings": { | ||
"properties": { | ||
"timestamp": { "type": "date" }, | ||
"message": { "type": "text" } | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
Index a document: | ||
|
||
```json | ||
POST /logs-shardstore/_doc | ||
{ | ||
"timestamp": "2025-06-20T12:00:00Z", | ||
"message": "Log message 1" | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
Get shard store status for the `logs-shardstore` index: | ||
|
||
```json | ||
GET /logs-shardstore/_shard_stores?status=all | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Example response | ||
|
||
The response lists the stores that were assigned to each shard. If a shard has no assigned stores, it is marked `unassigned`: | ||
|
||
```json | ||
{ | ||
"indices": { | ||
"logs-shardstore": { | ||
"shards": { | ||
"0": { | ||
"stores": [ | ||
{ | ||
"UFyVYVMCSDOObiRwPxSW5w": { | ||
"name": "opensearch-node1", | ||
"ephemeral_id": "vkSB_-M7QVyFXvgda6oRZg", | ||
"transport_address": "172.19.0.2:9300", | ||
"attributes": { | ||
"shard_indexing_pressure_enabled": "true" | ||
} | ||
}, | ||
"allocation_id": "PEM5YjEWSz-jJEj-Not6Aw", | ||
"allocation": "primary" | ||
} | ||
] | ||
}, | ||
"1": { | ||
"stores": [] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Response body fields | ||
|
||
The following table lists all response body fields. | ||
|
||
| Field | Data type | Description| | ||
| `indices` | Object| Contains shard store information for each index. | | ||
| `indices.<index>.shards`| Object| Contains store data for each shard in the index. | | ||
| `shards.<shard_id>.stores`| Array | A list of store entries for the shard.| | ||
| `stores[n].<node_id>` | Object| Node metadata, including name, transport address, and attributes. | | ||
| `stores[n].allocation`| String| The shard role on this node (`primary` or `replica`). | | ||
| `stores[n].allocation_id` | String| The unique allocation ID for this shard copy.| | ||
| `stores[n].store_exception` | Object (optional) | Stores exceptions encountered when reading the shard store. | | ||
| `stores[n].store_exception.type`| String| The type of exception.| | ||
| `stores[n].store_exception.reason`| String| The reason message for the exception.| |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.