diff --git a/CHANGELOG.md b/CHANGELOG.md index fdaefd86b2..6f0e48c741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Fixed - Fixed error when deserializing a normalizer without 'type' ([#1111](https://github.com/opensearch-project/opensearch-java/pull/1111)) +- Fixed deserialization of SearchRequest when `_source` is an array ([#]()) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java index 316b0239e3..29655e35e4 100644 --- a/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java @@ -239,7 +239,12 @@ public void shortcutProperty(String name) { throw new NoSuchElementException("No deserializer was setup for '" + name + "'"); } - acceptedEvents = EventSetObjectAndString; + this.acceptedEvents = EventSetObjectAndString.clone(); + + if (this.shortcutProperty instanceof FieldObjectDeserializer) { + JsonpDeserializer shortcutDeserializer = ((FieldObjectDeserializer) this.shortcutProperty).deserializer; + this.acceptedEvents.addAll(shortcutDeserializer.nativeEvents()); + } } // ----- Object types diff --git a/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java index 55527cefc0..8b190a9fa1 100644 --- a/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java @@ -179,8 +179,13 @@ public Builder addMember(Kind tag, JsonpDeserializer member = new SingleMemberHandler<>(tag, deserializer);