Fix indices.shard_stores ShardStoreException to use ErrorCause schema - #1109
Open
sean- wants to merge 1 commit into
Open
Fix indices.shard_stores ShardStoreException to use ErrorCause schema#1109sean- wants to merge 1 commit into
indices.shard_stores ShardStoreException to use ErrorCause schema#1109sean- wants to merge 1 commit into
Conversation
sean-
requested review from
Tokesh,
VachaShah,
Xtansia,
aabeshov,
harshavamsi,
karenyrx,
lucy66hw and
sachetalva
as code owners
May 15, 2026 12:52
sean-
force-pushed
the
fix-shard-store-exception-fields
branch
from
May 15, 2026 13:01
78f13c4 to
d8ae730
Compare
The server serializes `store_exception` via [`OpenSearchException.generateThrowableXContent`](https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/libs/core/src/main/java/org/opensearch/OpenSearchException.java#L601) (called from [`IndicesShardStoresResponse.StoreStatus.toXContent`](https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/server/src/main/java/org/opensearch/action/admin/indices/shards/IndicesShardStoresResponse.java#L208-L209)), which delegates to [`innerToXContent`](https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/libs/core/src/main/java/org/opensearch/OpenSearchException.java#L395-L446) and produces the full ErrorCause shape. The previous schema only declared `type` and `reason`, causing typed clients to drop the [`index`, `index_uuid`, and `shard` metadata fields](https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/libs/core/src/main/java/org/opensearch/OpenSearchException.java#L96-L98) that the server includes when the exception is associated with a specific shard (metadata keys are [stripped of the `opensearch.` prefix](https://github.com/opensearch-project/OpenSearch/blob/27333365da0d55a16bea2ebaf34f6f2a691f6d50/libs/core/src/main/java/org/opensearch/OpenSearchException.java#L409) before serialization). Use `allOf` to extend ErrorCause with the three explicit exception metadata properties so code generators emit named fields for them (ErrorCause's `additionalProperties` catch-all is not rendered by most generators). This serialization has been present since OpenSearch 1.0.0 (inherited from the Elasticsearch fork — the original `_shard_stores` API commit predates the rename). All OpenSearch versions emit the full ErrorCause shape for `store_exception`. Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
sean-
force-pushed
the
fix-shard-store-exception-fields
branch
from
May 19, 2026 06:33
d8ae730 to
24bc743
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The server serializes
store_exceptionviaOpenSearchException.generateThrowableXContent(called fromIndicesShardStoresResponse.StoreStatus.toXContent), which delegates toinnerToXContentand produces the full ErrorCause shape. The previous schema only declaredtypeandreason, causing typed clients to drop theindex,index_uuid, andshardmetadata fields that the server includes when the exception is associated with a specific shard (metadata keys are stripped of theopensearch.prefix before serialization).Use
allOfto extend ErrorCause with the three explicit exception metadata properties so code generators emit named fields for them (ErrorCause'sadditionalPropertiescatch-all is not rendered by most generators).This serialization has been present since OpenSearch 1.0.0 (inherited from the Elasticsearch fork — the original
_shard_storesAPI commit predates the rename). All OpenSearch versions emit the full ErrorCause shape forstore_exception.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.