From 56948f3770f9f27fbe40d2c4d7ca4ff9fb0c274c Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Sun, 5 Jul 2026 12:55:04 +0530 Subject: [PATCH 1/3] Fix DerivedField serializing unsupported name field causing mapper_parsing_exception The _common___DerivedField schema in opensearch-openapi.yaml included a required name property. This caused DerivedField.java to serialize a name key into the JSON mapping body, but the OpenSearch API does not accept name inside a derived field definition and returns: mapper_parsing_exception: unknown parameter [name] on mapper In the API, the derived field's name is expressed as the map key in the parent derived object, not as a property inside the field definition. Remove name from the _common___DerivedField schema (both from properties and required) and update the generated DerivedField.java accordingly. The Java client no longer serializes name inside derived field definitions. Fixes #1937 Signed-off-by: Radhakrishnan Pachyappan --- .../opensearch/_types/DerivedField.java | 30 ------------------- java-codegen/opensearch-openapi.yaml | 3 -- 2 files changed, 33 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DerivedField.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DerivedField.java index eb2e081559..41602d50a2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DerivedField.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DerivedField.java @@ -68,9 +68,6 @@ public class DerivedField implements PlainJsonSerializable, ToCopyableBuilder op) { op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::prefilterField, JsonpDeserializer.stringDeserializer(), "prefilter_field"); op.add(Builder::properties, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "properties"); op.add(Builder::script, Script._DESERIALIZER, "script"); @@ -385,7 +357,6 @@ public int hashCode() { int result = 17; result = 31 * result + Objects.hashCode(this.format); result = 31 * result + Objects.hashCode(this.ignoreMalformed); - result = 31 * result + this.name.hashCode(); result = 31 * result + Objects.hashCode(this.prefilterField); result = 31 * result + Objects.hashCode(this.properties); result = 31 * result + this.script.hashCode(); @@ -400,7 +371,6 @@ public boolean equals(Object o) { DerivedField other = (DerivedField) o; return Objects.equals(this.format, other.format) && Objects.equals(this.ignoreMalformed, other.ignoreMalformed) - && this.name.equals(other.name) && Objects.equals(this.prefilterField, other.prefilterField) && Objects.equals(this.properties, other.properties) && this.script.equals(other.script) diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index b4829f72a0..a0ef850985 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -38878,8 +38878,6 @@ components: _common___DerivedField: type: object properties: - name: - type: string type: type: string script: @@ -38893,7 +38891,6 @@ components: format: type: string required: - - name - script - type _common___DFIIndependenceMeasure: From 8e261bcd848a4a45583f4918beae0ff477aa105d Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Sun, 5 Jul 2026 13:06:26 +0530 Subject: [PATCH 2/3] Fix ShardFailure.shard incorrectly required causing deserialization failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ShardFailure.shard was marked as required in the spec, so the generated class threw MissingRequiredPropertyException when OpenSearch returned a ShardFailure without the shard field — masking the real failure. Per the OpenSearch API, shard is an optional integer in ShardFailure (the primary failure reason is always present; the shard number may be absent for certain failure types). Remove shard from the required list in _common___ShardFailure and update the generated ShardFailure.java to use @Nullable Integer with proper null guards in serialization, hashCode, and equals. Fixes #1799 Signed-off-by: Radhakrishnan Pachyappan --- .../opensearch/_types/ShardFailure.java | 22 +++++++++++-------- java-codegen/opensearch-openapi.yaml | 1 - 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index c46b364053..8dff45ebde 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -71,7 +71,8 @@ public class ShardFailure implements PlainJsonSerializable, ToCopyableBuilder Date: Sun, 5 Jul 2026 15:40:00 +0530 Subject: [PATCH 3/3] Add CHANGELOG entry for #2037 Signed-off-by: Radhakrishnan Pachyappan --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f85eaecf78..e512cce146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add document lifecycle guide and runnable sample ([#2017](https://github.com/opensearch-project/opensearch-java/pull/2017)) ### Fixed +- Fix `ShardFailure.shard` incorrectly marked required causing `MissingRequiredPropertyException` ([#2037](https://github.com/opensearch-project/opensearch-java/pull/2037)) ## [Unreleased 3.x] ### Added