Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] searchShards fails on Managed OpenSearch servers that omit node metadata

Aperta
#2,145 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
api, databases

Direzione di ricerca

Inizia da OpenSearchClient.searchShards e SearchShardsResponse._DESERIALIZER, quindi esamina gli schemi canonici e inclusi che definiscono NodeAttributes. Rigenera il modello Java dopo aver reso opzionali i due campi dei metadati ed esegui i casi di regressione con Jackson e JSON-B, inclusi shards popolati, metadati completi, round trip e lo schema condiviso _shard_stores. Il lavoro è completo quando i campi omessi vengono deserializzati come la mappa vuota proposta e null, mentre i metadati forniti rimangono preservati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug untriaged
What is the bug?

OpenSearchClient.searchShards(...) rejects an HTTP 200 response when a node omits attributes and transport_address. Applications that only need shard routing information cannot access the typed response, even when the index and shard data are present. This shape was reported from an Amazon OpenSearch Service 1.3.x domain:

{"nodes":{"node-id":{"name":"node-name","ephemeral_id":"ephemeral-id"}},"indices":{},"shards":[]}

The example is redacted and minimized; the reported response also contained index and shard data.

Reproduction

Reproduced with the published 3.9.0 and 3.10.0 clients using Jackson and JSON-B, and through the public method with a local HTTP 200 fixture server. The required fields are also unchanged on current main (1abf420c).

String json = "{\"nodes\":{\"node-id\":{\"name\":\"node-name\","
    + "\"ephemeral_id\":\"ephemeral-id\"}},\"indices\":{},\"shards\":[]}";
var mapper = new org.opensearch.client.json.jackson.JacksonJsonpMapper();
try (var parser = mapper.jsonProvider().createParser(new java.io.StringReader(json))) {
    org.opensearch.client.opensearch.core.SearchShardsResponse._DESERIALIZER
        .deserialize(parser, mapper);
}

This throws Missing required property 'NodeAttributes.attributes'. Adding "attributes":{} then throws Missing required property 'NodeAttributes.transportAddress', so both omissions need handling.

Expected behavior and proposed fix

Could the response model tolerate these two omitted metadata fields so applications can still consume the shard routing information? The proposed behavior is an empty map from node.attributes() and null from node.transportAddress(), preserving metadata when supplied. name and ephemeral_id would remain required.

Stock server serializers in 1.3.0, 1.3.20, 2.19.6, 3.0.0, and 3.8.0 emit both fields, and the current client follows that contract. This request is for client compatibility with the reported managed response. Newer managed domains have not been tested here. A related omission in task responses was handled by making node fields optional in #463, fixing #356.

The local candidate removes both requirements from the canonical and bundled schemas and regenerates the Java model. All 14 regression cases pass across Jackson and JSON-B, including populated shards, complete metadata, and round trips. The schema is also shared with _shard_stores, which is covered by the tests. I can submit linked specification and client PRs if this approach is suitable; guidance on endpoint-specific or distribution-specific treatment would also be welcome.

Thanks!

Lingua principale
Java
Stelle
165
Fork
256
Merge medio
19h 9m
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opensearch-project/opensearch-java

Tutte le issue di opensearch-project/opensearch-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.