Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix `unitTest` task not running the tests in the `test` source set ([#2074](https://github.com/opensearch-project/opensearch-java/pull/2074))
- Run model tests against both JSON mappers instead of picking one at random ([#2085](https://github.com/opensearch-project/opensearch-java/pull/2085))
- Fix currentSize calculation in BulkIngester ([#2113](https://github.com/opensearch-project/opensearch-java/pull/2113))
- Fix `ShardFailure` serializing/deserializing `index`/`node`/`shard` instead of the server's `_index`/`_node`/`_shard` keys, causing `MissingRequiredPropertyException` and silently dropped fields ([#2037](https://github.com/opensearch-project/opensearch-java/pull/2037))

### Changed
- Updated API spec download URL to `https://api-spec.opensearch.org` ([#2116](https://github.com/opensearch-project/opensearch-java/pull/2116))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ public class DerivedField implements PlainJsonSerializable, ToCopyableBuilder<De
@Nullable
private final Boolean ignoreMalformed;

@Nonnull
private final String name;

@Nullable
private final String prefilterField;

Expand All @@ -88,7 +85,6 @@ public class DerivedField implements PlainJsonSerializable, ToCopyableBuilder<De
private DerivedField(Builder builder) {
this.format = builder.format;
this.ignoreMalformed = builder.ignoreMalformed;
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.prefilterField = builder.prefilterField;
this.properties = ApiTypeHelper.unmodifiable(builder.properties);
this.script = ApiTypeHelper.requireNonNull(builder.script, this, "script");
Expand All @@ -115,14 +111,6 @@ public final Boolean ignoreMalformed() {
return this.ignoreMalformed;
}

/**
* Required - API name: {@code name}
*/
@Nonnull
public final String name() {
return this.name;
}

/**
* API name: {@code prefilter_field}
*/
Expand Down Expand Up @@ -176,9 +164,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.ignoreMalformed);
}

generator.writeKey("name");
generator.write(this.name);

if (this.prefilterField != null) {
generator.writeKey("prefilter_field");
generator.write(this.prefilterField);
Expand Down Expand Up @@ -222,7 +207,6 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder
private String format;
@Nullable
private Boolean ignoreMalformed;
private String name;
@Nullable
private String prefilterField;
@Nullable
Expand All @@ -235,7 +219,6 @@ public Builder() {}
private Builder(DerivedField o) {
this.format = o.format;
this.ignoreMalformed = o.ignoreMalformed;
this.name = o.name;
this.prefilterField = o.prefilterField;
this.properties = _mapCopy(o.properties);
this.script = o.script;
Expand All @@ -245,7 +228,6 @@ private Builder(DerivedField o) {
private Builder(Builder o) {
this.format = o.format;
this.ignoreMalformed = o.ignoreMalformed;
this.name = o.name;
this.prefilterField = o.prefilterField;
this.properties = _mapCopy(o.properties);
this.script = o.script;
Expand Down Expand Up @@ -276,15 +258,6 @@ public final Builder ignoreMalformed(@Nullable Boolean value) {
return this;
}

/**
* Required - API name: {@code name}
*/
@Nonnull
public final Builder name(String value) {
this.name = value;
return this;
}

/**
* API name: {@code prefilter_field}
*/
Expand Down Expand Up @@ -373,7 +346,6 @@ public DerivedField build() {
protected static void setupDerivedFieldDeserializer(ObjectDeserializer<DerivedField.Builder> 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");
Expand All @@ -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();
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public static ShardFailure of(Function<ShardFailure.Builder, ObjectBuilder<Shard
}

/**
* API name: {@code index}
* API name: {@code _index}
*/
@Nullable
public final String index() {
return this.index;
}

/**
* API name: {@code node}
* API name: {@code _node}
*/
@Nullable
public final String node() {
Expand All @@ -123,7 +123,7 @@ public final ErrorCause reason() {
}

/**
* Required - API name: {@code shard}
* Required - API name: {@code _shard}
*/
public final int shard() {
return this.shard;
Expand All @@ -149,12 +149,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.index != null) {
generator.writeKey("index");
generator.writeKey("_index");
generator.write(this.index);
}

if (this.node != null) {
generator.writeKey("node");
generator.writeKey("_node");
generator.write(this.node);
}

Expand All @@ -164,7 +164,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("reason");
this.reason.serialize(generator, mapper);

generator.writeKey("shard");
generator.writeKey("_shard");
generator.write(this.shard);

if (this.status != null) {
Expand Down Expand Up @@ -227,7 +227,7 @@ public Builder copy() {
}

/**
* API name: {@code index}
* API name: {@code _index}
*/
@Nonnull
public final Builder index(@Nullable String value) {
Expand All @@ -236,7 +236,7 @@ public final Builder index(@Nullable String value) {
}

/**
* API name: {@code node}
* API name: {@code _node}
*/
@Nonnull
public final Builder node(@Nullable String value) {
Expand Down Expand Up @@ -271,7 +271,7 @@ public final Builder reason(Function<ErrorCause.Builder, ObjectBuilder<ErrorCaus
}

/**
* Required - API name: {@code shard}
* Required - API name: {@code _shard}
*/
@Nonnull
public final Builder shard(int value) {
Expand Down Expand Up @@ -313,11 +313,11 @@ public ShardFailure build() {
);

protected static void setupShardFailureDeserializer(ObjectDeserializer<ShardFailure.Builder> op) {
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node");
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index");
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "_node");
op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary");
op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason");
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard");
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "_shard");
op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status");
}

Expand Down
11 changes: 4 additions & 7 deletions java-codegen/opensearch-openapi.yaml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit a change against https://github.com/opensearch-project/openSearch-api-specification, thank you

@gingeekrishna gingeekrishna Aug 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted the spec fix upstream: opensearch-project/opensearch-api-specification#1194

Original file line number Diff line number Diff line change
Expand Up @@ -38878,8 +38878,6 @@ components:
_common___DerivedField:
type: object
properties:
name:
type: string
type:
type: string
script:
Expand All @@ -38893,7 +38891,6 @@ components:
format:
type: string
required:
- name
- script
- type
_common___DFIIndependenceMeasure:
Expand Down Expand Up @@ -40834,22 +40831,22 @@ components:
_common___ShardFailure:
type: object
properties:
index:
_index:
$ref: '#/components/schemas/_common___IndexName'
node:
_node:
type: string
reason:
$ref: '#/components/schemas/_common___ErrorCause'
shard:
_shard:
type: integer
status:
type: string
primary:
type: boolean
required:
- _shard
- primary
- reason
- shard
_common___ShardInfo:
type: object
properties:
Expand Down
Loading