Skip to content
Open
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- 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))
- Use protocol version from response (rather than request) ([#2118](https://github.com/opensearch-project/opensearch-java/pull/2118))
- 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))
- Fix `PathHierarchyTokenizer` optional fields incorrectly marked required causing deserialization failure ([#2038](https://github.com/opensearch-project/opensearch-java/pull/2038))

### 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
Loading
Loading