diff --git a/UPGRADING.md b/UPGRADING.md index 44761b055a..4e007d76d7 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -76,4 +76,10 @@ After: - The `smartcn_stop` Builder method has been renamed to `smartcnStop`. ### TokenizerDefinition -- The `smartcn` Builder method has been renamed to `smartcnTokenizer`. \ No newline at end of file +- The `smartcn` Builder method has been renamed to `smartcnTokenizer`. + +### PointProperty +- `PointProperty` has been removed and is replaced by `XyPointProperty`. + +### PropertyBase +- The `name` and `localMetadata` fields, getters and builder methods have been removed from `PropertyBase` as they are not supported by OpenSearch. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java index a9ed18b6d5..f37286c733 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,24 +53,26 @@ // typedef: _types.GeoHashLocation @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GeoHashLocation implements PlainJsonSerializable { + + @Nonnull private final String geohash; // --------------------------------------------------------------------------------------------- private GeoHashLocation(Builder builder) { - this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); - } - public static GeoHashLocation of(Function> fn) { + public static GeoHashLocation of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code geohash} */ + @Nonnull public final String geohash() { return this.geohash; } @@ -72,6 +80,7 @@ public final String geohash() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,10 +88,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("geohash"); generator.write(this.geohash); - } // --------------------------------------------------------------------------------------------- @@ -90,7 +97,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link GeoHashLocation}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String geohash; @@ -105,8 +111,7 @@ public final Builder geohash(String value) { /** * Builds a {@link GeoHashLocation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GeoHashLocation build() { _checkSingleUse(); @@ -126,9 +131,21 @@ public GeoHashLocation build() { ); protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { - op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.geohash.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoHashLocation other = (GeoHashLocation) o; + return this.geohash.equals(other.geohash); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java index f04f86d802..bd20ce101b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java @@ -30,15 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -49,26 +56,27 @@ // typedef: _types.GeoLocation /** - * A latitude/longitude as a 2 dimensional point. It can be represented in - * various ways: + *

+ * A latitude/longitude as a two-dimensional point. It can be represented in the following ways: + *

*
    - *
  • as a {lat, long} object
  • - *
  • as a geo hash value
  • - *
  • as a [lon, lat] array
  • - *
  • as a string in "<lat>, <lon>" or WKT - * point formats
  • + *
  • As a {lat, long} object.
  • + *
  • As a geohash value.
  • + *
  • As a [lon, lat] array.
  • + *
  • As a string in "<lat>, <lon>" or WKT point format.
  • *
- * */ @JsonpDeserializable -public class GeoLocation implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoLocation implements TaggedUnion, PlainJsonSerializable { + /** + * {@link GeoLocation} variant kinds. + */ public enum Kind { Coords, Geohash, Latlon, Text - } private final Kind _kind; @@ -90,13 +98,11 @@ private GeoLocation(Kind kind, Object value) { } private GeoLocation(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static GeoLocation of(Function> fn) { + public static GeoLocation of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -110,8 +116,7 @@ public boolean isCoords() { /** * Get the {@code coords} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. + * @throws IllegalStateException if the current variant is not the {@code coords} kind. */ public List coords() { return TaggedUnionUtils.get(this, Kind.Coords); @@ -127,8 +132,7 @@ public boolean isGeohash() { /** * Get the {@code geohash} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash} kind. + * @throws IllegalStateException if the current variant is not the {@code geohash} kind. */ public GeoHashLocation geohash() { return TaggedUnionUtils.get(this, Kind.Geohash); @@ -144,8 +148,7 @@ public boolean isLatlon() { /** * Get the {@code latlon} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code latlon} kind. + * @throws IllegalStateException if the current variant is not the {@code latlon} kind. */ public LatLonGeoLocation latlon() { return TaggedUnionUtils.get(this, Kind.Latlon); @@ -161,8 +164,7 @@ public boolean isText() { /** * Get the {@code text} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code text} kind. + * @throws IllegalStateException if the current variant is not the {@code text} kind. */ public String text() { return TaggedUnionUtils.get(this, Kind.Text); @@ -178,18 +180,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (Double item0 : ((List) this._value)) { generator.write(item0); - } generator.writeEnd(); - break; case Text: generator.write(((String) this._value)); - break; } } - } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @@ -228,11 +226,11 @@ public ObjectBuilder text(String v) { return this; } + @Override public GeoLocation build() { _checkSingleUse(); return new GeoLocation(this); } - } private static JsonpDeserializer buildGeoLocationDeserializer() { @@ -247,4 +245,20 @@ private static JsonpDeserializer buildGeoLocationDeserializer() { } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoLocation::buildGeoLocationDeserializer); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoLocation other = (GeoLocation) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java index 7568ad87a6..46ef504427 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java @@ -30,33 +30,38 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; + /** + *

* Builders for {@link GeoLocation} variants. + *

*

- * Variants coords, text are not available here as - * they don't have a dedicated class. Use {@link GeoLocation}'s builder for - * these. - * + * Variants coords, text are not available here as they don't have a dedicated class. Use {@link GeoLocation}'s + * builder for these. + *

*/ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GeoLocationBuilders { private GeoLocationBuilders() {} /** - * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} - * variant. + * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} variant. */ public static GeoHashLocation.Builder geohash() { return new GeoHashLocation.Builder(); } /** - * Creates a builder for the {@link LatLonGeoLocation latlon} - * {@code GeoLocation} variant. + * Creates a builder for the {@link LatLonGeoLocation latlon} {@code GeoLocation} variant. */ public static LatLonGeoLocation.Builder latlon() { return new LatLonGeoLocation.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java similarity index 76% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java index 972e9e9aaa..bfbe518695 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,7 +52,9 @@ // typedef: _types.LatLonGeoLocation @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class LatLonGeoLocation implements PlainJsonSerializable { + private final double lat; private final double lon; @@ -55,25 +62,29 @@ public class LatLonGeoLocation implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private LatLonGeoLocation(Builder builder) { - this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); - } - public static LatLonGeoLocation of(Function> fn) { + public static LatLonGeoLocation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code lat} + * Required - Latitude + *

+ * API name: {@code lat} + *

*/ public final double lat() { return this.lat; } /** - * Required - API name: {@code lon} + * Required - Longitude + *

+ * API name: {@code lon} + *

*/ public final double lon() { return this.lon; @@ -82,6 +93,7 @@ public final double lon() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,13 +101,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("lat"); generator.write(this.lat); generator.writeKey("lon"); generator.write(this.lon); - } // --------------------------------------------------------------------------------------------- @@ -103,14 +113,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link LatLonGeoLocation}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Double lat; - private Double lon; /** - * Required - API name: {@code lat} + * Required - Latitude + *

+ * API name: {@code lat} + *

*/ public final Builder lat(double value) { this.lat = value; @@ -118,7 +129,10 @@ public final Builder lat(double value) { } /** - * Required - API name: {@code lon} + * Required - Longitude + *

+ * API name: {@code lon} + *

*/ public final Builder lon(double value) { this.lon = value; @@ -128,8 +142,7 @@ public final Builder lon(double value) { /** * Builds a {@link LatLonGeoLocation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public LatLonGeoLocation build() { _checkSingleUse(); @@ -149,10 +162,23 @@ public LatLonGeoLocation build() { ); protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { - op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.lat); + result = 31 * result + Double.hashCode(this.lon); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LatLonGeoLocation other = (LatLonGeoLocation) o; + return this.lat == other.lat && this.lon == other.lon; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyCartesianCoordinates.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyCartesianCoordinates.java new file mode 100644 index 0000000000..3c690d45d2 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyCartesianCoordinates.java @@ -0,0 +1,160 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: _types.XyCartesianCoordinates + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class XyCartesianCoordinates implements PlainJsonSerializable { + + private final double x; + + private final double y; + + // --------------------------------------------------------------------------------------------- + + private XyCartesianCoordinates(Builder builder) { + this.x = ApiTypeHelper.requireNonNull(builder.x, this, "x"); + this.y = ApiTypeHelper.requireNonNull(builder.y, this, "y"); + } + + public static XyCartesianCoordinates of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The x coordinate. + *

+ * API name: {@code x} + *

+ */ + public final double x() { + return this.x; + } + + /** + * Required - The y coordinate. + *

+ * API name: {@code y} + *

+ */ + public final double y() { + return this.y; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("x"); + generator.write(this.x); + + generator.writeKey("y"); + generator.write(this.y); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link XyCartesianCoordinates}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Double x; + private Double y; + + /** + * Required - The x coordinate. + *

+ * API name: {@code x} + *

+ */ + public final Builder x(double value) { + this.x = value; + return this; + } + + /** + * Required - The y coordinate. + *

+ * API name: {@code y} + *

+ */ + public final Builder y(double value) { + this.y = value; + return this; + } + + /** + * Builds a {@link XyCartesianCoordinates}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public XyCartesianCoordinates build() { + _checkSingleUse(); + + return new XyCartesianCoordinates(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link XyCartesianCoordinates} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + XyCartesianCoordinates::setupXyCartesianCoordinatesDeserializer + ); + + protected static void setupXyCartesianCoordinatesDeserializer(ObjectDeserializer op) { + op.add(Builder::x, JsonpDeserializer.doubleDeserializer(), "x"); + op.add(Builder::y, JsonpDeserializer.doubleDeserializer(), "y"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.x); + result = 31 * result + Double.hashCode(this.y); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + XyCartesianCoordinates other = (XyCartesianCoordinates) o; + return this.x == other.x && this.y == other.y; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocation.java new file mode 100644 index 0000000000..2e81ee3cba --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocation.java @@ -0,0 +1,211 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.UnionDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: _types.XyLocation + +/** + *

+ * A two-dimensional Cartesian point specified by x and y coordinates. It can be represented in the following ways: + *

+ *
    + *
  • As an {x, y} object.
  • + *
  • As an [x, y] array.
  • + *
  • As a string in "x, y" or WKT point format.
  • + *
+ */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class XyLocation implements TaggedUnion, PlainJsonSerializable { + /** + * {@link XyLocation} variant kinds. + */ + public enum Kind { + Cartesian, + Coords, + Text + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private XyLocation(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private XyLocation(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static XyLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code cartesian}? + */ + public boolean isCartesian() { + return _kind == Kind.Cartesian; + } + + /** + * Get the {@code cartesian} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code cartesian} kind. + */ + public XyCartesianCoordinates cartesian() { + return TaggedUnionUtils.get(this, Kind.Cartesian); + } + + /** + * Is this variant instance of kind {@code coords}? + */ + public boolean isCoords() { + return _kind == Kind.Coords; + } + + /** + * Get the {@code coords} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code coords} kind. + */ + public List coords() { + return TaggedUnionUtils.get(this, Kind.Coords); + } + + /** + * Is this variant instance of kind {@code text}? + */ + public boolean isText() { + return _kind == Kind.Text; + } + + /** + * Get the {@code text} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code text} kind. + */ + public String text() { + return TaggedUnionUtils.get(this, Kind.Text); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Coords: + generator.writeStartArray(); + for (Double item0 : ((List) this._value)) { + generator.write(item0); + } + generator.writeEnd(); + break; + case Text: + generator.write(((String) this._value)); + break; + } + } + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder cartesian(XyCartesianCoordinates v) { + this._kind = Kind.Cartesian; + this._value = v; + return this; + } + + public ObjectBuilder cartesian(Function> fn) { + return this.cartesian(fn.apply(new XyCartesianCoordinates.Builder()).build()); + } + + public ObjectBuilder coords(List v) { + this._kind = Kind.Coords; + this._value = v; + return this; + } + + public ObjectBuilder text(String v) { + this._kind = Kind.Text; + this._value = v; + return this; + } + + @Override + public XyLocation build() { + _checkSingleUse(); + return new XyLocation(this); + } + } + + private static JsonpDeserializer buildXyLocationDeserializer() { + return new UnionDeserializer.Builder(XyLocation::new, false).addMember( + Kind.Cartesian, + XyCartesianCoordinates._DESERIALIZER + ) + .addMember(Kind.Coords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())) + .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(XyLocation::buildXyLocationDeserializer); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + XyLocation other = (XyLocation) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocationBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocationBuilders.java new file mode 100644 index 0000000000..e43b84ccc3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/XyLocationBuilders.java @@ -0,0 +1,36 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import javax.annotation.Generated; + +/** + *

+ * Builders for {@link XyLocation} variants. + *

+ *

+ * Variants coords, text are not available here as they don't have a dedicated class. Use {@link XyLocation}'s + * builder for these. + *

+ */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class XyLocationBuilders { + private XyLocationBuilders() {} + + /** + * Creates a builder for the {@link XyCartesianCoordinates cartesian} {@code XyLocation} variant. + */ + public static XyCartesianCoordinates.Builder cartesian() { + return new XyCartesianCoordinates.Builder(); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java similarity index 77% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java index d61da6dfd3..9c482357e1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/AggregateMetricDoubleProperty.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -46,27 +52,31 @@ // typedef: _types.mapping.AggregateMetricDoubleProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class AggregateMetricDoubleProperty extends PropertyBase implements PropertyVariant { + + @Nonnull private final String defaultMetric; + @Nonnull private final List metrics; // --------------------------------------------------------------------------------------------- private AggregateMetricDoubleProperty(Builder builder) { super(builder); - this.defaultMetric = ApiTypeHelper.requireNonNull(builder.defaultMetric, this, "defaultMetric"); this.metrics = ApiTypeHelper.unmodifiableRequired(builder.metrics, this, "metrics"); - } - public static AggregateMetricDoubleProperty of(Function> fn) { + public static AggregateMetricDoubleProperty of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -76,6 +86,7 @@ public Property.Kind _propertyKind() { /** * Required - API name: {@code default_metric} */ + @Nonnull public final String defaultMetric() { return this.defaultMetric; } @@ -83,28 +94,23 @@ public final String defaultMetric() { /** * Required - API name: {@code metrics} */ + @Nonnull public final List metrics() { return this.metrics; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "aggregate_metric_double"); super.serializeInternal(generator, mapper); generator.writeKey("default_metric"); generator.write(this.defaultMetric); - if (ApiTypeHelper.isDefined(this.metrics)) { - generator.writeKey("metrics"); - generator.writeStartArray(); - for (String item0 : this.metrics) { - generator.write(item0); - - } - generator.writeEnd(); - + generator.writeKey("metrics"); + generator.writeStartArray(); + for (String item0 : this.metrics) { + generator.write(item0); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- @@ -112,10 +118,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link AggregateMetricDoubleProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { private String defaultMetric; - private List metrics; /** @@ -128,8 +132,10 @@ public final Builder defaultMetric(String value) { /** * Required - API name: {@code metrics} + * *

* Adds all elements of list to metrics. + *

*/ public final Builder metrics(List list) { this.metrics = _listAddAll(this.metrics, list); @@ -138,8 +144,10 @@ public final Builder metrics(List list) { /** * Required - API name: {@code metrics} + * *

* Adds one or more values to metrics. + *

*/ public final Builder metrics(String value, String... values) { this.metrics = _listAdd(this.metrics, value, values); @@ -154,8 +162,7 @@ protected Builder self() { /** * Builds a {@link AggregateMetricDoubleProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public AggregateMetricDoubleProperty build() { _checkSingleUse(); @@ -175,11 +182,29 @@ public AggregateMetricDoubleProperty build() { ); protected static void setupAggregateMetricDoublePropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.add(Builder::defaultMetric, JsonpDeserializer.stringDeserializer(), "default_metric"); op.add(Builder::metrics, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "metrics"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.defaultMetric.hashCode(); + result = 31 * result + this.metrics.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AggregateMetricDoubleProperty other = (AggregateMetricDoubleProperty) o; + return this.defaultMetric.equals(other.defaultMetric) && this.metrics.equals(other.metrics); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java index 32737e3edc..5ab50521e8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/BinaryProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.BinaryProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class BinaryProperty extends DocValuesPropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private BinaryProperty(Builder builder) { super(builder); - } - public static BinaryProperty of(Function> fn) { + public static BinaryProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "binary"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link BinaryProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link BinaryProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public BinaryProperty build() { _checkSingleUse(); @@ -112,4 +115,19 @@ protected static void setupBinaryPropertyDeserializer(ObjectDeserializer> fn) { + public static BooleanProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -116,30 +122,27 @@ public final Boolean nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "boolean"); super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.fielddata != null) { generator.writeKey("fielddata"); this.fielddata.serialize(generator, mapper); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -147,17 +150,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link BooleanProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double boost; - @Nullable private NumericFielddata fielddata; - @Nullable private Boolean index; - @Nullable private Boolean nullValue; @@ -181,7 +180,7 @@ public final Builder fielddata(@Nullable NumericFielddata value) { * API name: {@code fielddata} */ public final Builder fielddata(Function> fn) { - return this.fielddata(fn.apply(new NumericFielddata.Builder()).build()); + return fielddata(fn.apply(new NumericFielddata.Builder()).build()); } /** @@ -208,8 +207,7 @@ protected Builder self() { /** * Builds a {@link BooleanProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public BooleanProperty build() { _checkSingleUse(); @@ -238,4 +236,27 @@ protected static void setupBooleanPropertyDeserializer(ObjectDeserializer> fn) { + public static ByteNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Number nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "byte"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue.doubleValue()); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ByteNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Number nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link ByteNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ByteNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public ByteNumberProperty build() { ); protected static void setupByteNumberPropertyDeserializer(ObjectDeserializer op) { - setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.numberDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ByteNumberProperty other = (ByteNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java index 0ca2678268..4416c2a8ec 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/CompletionProperty.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -47,10 +54,13 @@ // typedef: _types.mapping.CompletionProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CompletionProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final String analyzer; + @Nonnull private final List contexts; @Nullable @@ -69,22 +79,20 @@ public class CompletionProperty extends DocValuesPropertyBase implements Propert private CompletionProperty(Builder builder) { super(builder); - this.analyzer = builder.analyzer; this.contexts = ApiTypeHelper.unmodifiable(builder.contexts); this.maxInputLength = builder.maxInputLength; this.preservePositionIncrements = builder.preservePositionIncrements; this.preserveSeparators = builder.preserveSeparators; this.searchAnalyzer = builder.searchAnalyzer; - } - public static CompletionProperty of(Function> fn) { + public static CompletionProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -102,6 +110,7 @@ public final String analyzer() { /** * API name: {@code contexts} */ + @Nonnull public final List contexts() { return this.contexts; } @@ -139,45 +148,41 @@ public final String searchAnalyzer() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "completion"); super.serializeInternal(generator, mapper); if (this.analyzer != null) { generator.writeKey("analyzer"); generator.write(this.analyzer); - } + if (ApiTypeHelper.isDefined(this.contexts)) { generator.writeKey("contexts"); generator.writeStartArray(); for (SuggestContext item0 : this.contexts) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.maxInputLength != null) { generator.writeKey("max_input_length"); generator.write(this.maxInputLength); - } + if (this.preservePositionIncrements != null) { generator.writeKey("preserve_position_increments"); generator.write(this.preservePositionIncrements); - } + if (this.preserveSeparators != null) { generator.writeKey("preserve_separators"); generator.write(this.preserveSeparators); - } + if (this.searchAnalyzer != null) { generator.writeKey("search_analyzer"); generator.write(this.searchAnalyzer); - } - } // --------------------------------------------------------------------------------------------- @@ -185,23 +190,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CompletionProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String analyzer; - @Nullable private List contexts; - @Nullable private Integer maxInputLength; - @Nullable private Boolean preservePositionIncrements; - @Nullable private Boolean preserveSeparators; - @Nullable private String searchAnalyzer; @@ -215,8 +214,10 @@ public final Builder analyzer(@Nullable String value) { /** * API name: {@code contexts} + * *

* Adds all elements of list to contexts. + *

*/ public final Builder contexts(List list) { this.contexts = _listAddAll(this.contexts, list); @@ -225,8 +226,10 @@ public final Builder contexts(List list) { /** * API name: {@code contexts} + * *

* Adds one or more values to contexts. + *

*/ public final Builder contexts(SuggestContext value, SuggestContext... values) { this.contexts = _listAdd(this.contexts, value, values); @@ -235,8 +238,10 @@ public final Builder contexts(SuggestContext value, SuggestContext... values) { /** * API name: {@code contexts} + * *

* Adds a value to contexts using a builder lambda. + *

*/ public final Builder contexts(Function> fn) { return contexts(fn.apply(new SuggestContext.Builder()).build()); @@ -282,8 +287,7 @@ protected Builder self() { /** * Builds a {@link CompletionProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CompletionProperty build() { _checkSingleUse(); @@ -303,7 +307,7 @@ public CompletionProperty build() { ); protected static void setupCompletionPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer"); op.add(Builder::contexts, JsonpDeserializer.arrayDeserializer(SuggestContext._DESERIALIZER), "contexts"); op.add(Builder::maxInputLength, JsonpDeserializer.integerDeserializer(), "max_input_length"); @@ -314,4 +318,31 @@ protected static void setupCompletionPropertyDeserializer(ObjectDeserializer> fn) { + public static ConstantKeywordProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -80,15 +86,12 @@ public final JsonData value() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "constant_keyword"); super.serializeInternal(generator, mapper); if (this.value != null) { generator.writeKey("value"); this.value.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- @@ -96,7 +99,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ConstantKeywordProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private JsonData value; @@ -117,8 +119,7 @@ protected Builder self() { /** * Builds a {@link ConstantKeywordProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ConstantKeywordProperty build() { _checkSingleUse(); @@ -138,10 +139,27 @@ public ConstantKeywordProperty build() { ); protected static void setupConstantKeywordPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.add(Builder::value, JsonData._DESERIALIZER, "value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.value); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ConstantKeywordProperty other = (ConstantKeywordProperty) o; + return Objects.equals(this.value, other.value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java index 5fa50ad933..7002552576 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateNanosProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.DateNanosProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DateNanosProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final Double boost; @@ -68,22 +76,20 @@ public class DateNanosProperty extends DocValuesPropertyBase implements Property private DateNanosProperty(Builder builder) { super(builder); - this.boost = builder.boost; this.format = builder.format; this.ignoreMalformed = builder.ignoreMalformed; this.index = builder.index; this.nullValue = builder.nullValue; this.precisionStep = builder.precisionStep; - } - public static DateNanosProperty of(Function> fn) { + public static DateNanosProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -139,40 +145,37 @@ public final Integer precisionStep() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "date_nanos"); super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } + if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } + if (this.precisionStep != null) { generator.writeKey("precision_step"); generator.write(this.precisionStep); - } - } // --------------------------------------------------------------------------------------------- @@ -180,23 +183,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DateNanosProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double boost; - @Nullable private String format; - @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean index; - @Nullable private String nullValue; - @Nullable private Integer precisionStep; @@ -256,8 +253,7 @@ protected Builder self() { /** * Builds a {@link DateNanosProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DateNanosProperty build() { _checkSingleUse(); @@ -288,4 +284,31 @@ protected static void setupDateNanosPropertyDeserializer(ObjectDeserializer> fn) { + public static DateProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -139,6 +145,14 @@ public final Boolean index() { return this.index; } + /** + * API name: {@code locale} + */ + @Nullable + public final String locale() { + return this.locale; + } + /** * API name: {@code null_value} */ @@ -155,59 +169,48 @@ public final Integer precisionStep() { return this.precisionStep; } - /** - * API name: {@code locale} - */ - @Nullable - public final String locale() { - return this.locale; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "date"); super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.fielddata != null) { generator.writeKey("fielddata"); this.fielddata.serialize(generator, mapper); - } + if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } + if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); + } + if (this.locale != null) { + generator.writeKey("locale"); + generator.write(this.locale); } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } + if (this.precisionStep != null) { generator.writeKey("precision_step"); generator.write(this.precisionStep); - - } - if (this.locale != null) { - generator.writeKey("locale"); - generator.write(this.locale); - } - } // --------------------------------------------------------------------------------------------- @@ -215,32 +218,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DateProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double boost; - @Nullable private NumericFielddata fielddata; - @Nullable private String format; - @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean index; - + @Nullable + private String locale; @Nullable private String nullValue; - @Nullable private Integer precisionStep; - @Nullable - private String locale; - /** * API name: {@code boost} */ @@ -261,7 +256,7 @@ public final Builder fielddata(@Nullable NumericFielddata value) { * API name: {@code fielddata} */ public final Builder fielddata(Function> fn) { - return this.fielddata(fn.apply(new NumericFielddata.Builder()).build()); + return fielddata(fn.apply(new NumericFielddata.Builder()).build()); } /** @@ -288,6 +283,14 @@ public final Builder index(@Nullable Boolean value) { return this; } + /** + * API name: {@code locale} + */ + public final Builder locale(@Nullable String value) { + this.locale = value; + return this; + } + /** * API name: {@code null_value} */ @@ -304,14 +307,6 @@ public final Builder precisionStep(@Nullable Integer value) { return this; } - /** - * API name: {@code locale} - */ - public final Builder locale(@Nullable String value) { - this.locale = value; - return this; - } - @Override protected Builder self() { return this; @@ -320,8 +315,7 @@ protected Builder self() { /** * Builds a {@link DateProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DateProperty build() { _checkSingleUse(); @@ -341,17 +335,48 @@ public DateProperty build() { ); protected static void setupDatePropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); op.add(Builder::fielddata, NumericFielddata._DESERIALIZER, "fielddata"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); + op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); op.add(Builder::precisionStep, JsonpDeserializer.integerDeserializer(), "precision_step"); - op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.boost); + result = 31 * result + Objects.hashCode(this.fielddata); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.locale); + result = 31 * result + Objects.hashCode(this.nullValue); + result = 31 * result + Objects.hashCode(this.precisionStep); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DateProperty other = (DateProperty) o; + return Objects.equals(this.boost, other.boost) + && Objects.equals(this.fielddata, other.fielddata) + && Objects.equals(this.format, other.format) + && Objects.equals(this.ignoreMalformed, other.ignoreMalformed) + && Objects.equals(this.index, other.index) + && Objects.equals(this.locale, other.locale) + && Objects.equals(this.nullValue, other.nullValue) + && Objects.equals(this.precisionStep, other.precisionStep); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java index 323e175750..52b360c79a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DateRangeProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.DateRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DateRangeProperty extends RangePropertyBase implements PropertyVariant { + @Nullable private final String format; @@ -53,17 +61,15 @@ public class DateRangeProperty extends RangePropertyBase implements PropertyVari private DateRangeProperty(Builder builder) { super(builder); - this.format = builder.format; - } - public static DateRangeProperty of(Function> fn) { + public static DateRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final String format() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "date_range"); super.serializeInternal(generator, mapper); if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DateRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String format; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link DateRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DateRangeProperty build() { _checkSingleUse(); @@ -143,4 +144,21 @@ protected static void setupDateRangePropertyDeserializer(ObjectDeserializer> fn) { + public static DoubleNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Double nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "double"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DoubleNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link DoubleNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DoubleNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public DoubleNumberProperty build() { ); protected static void setupDoubleNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.doubleDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DoubleNumberProperty other = (DoubleNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java index 314fce2ea8..9658a0a127 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/DoubleRangeProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.DoubleRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DoubleRangeProperty extends RangePropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private DoubleRangeProperty(Builder builder) { super(builder); - } - public static DoubleRangeProperty of(Function> fn) { + public static DoubleRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "double_range"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DoubleRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link DoubleRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DoubleRangeProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public DoubleRangeProperty build() { ); protected static void setupDoubleRangePropertyDeserializer(ObjectDeserializer op) { - RangePropertyBase.setupRangePropertyBaseDeserializer(op); + setupRangePropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java index 88eebbe79b..f6bfbf014e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FieldAliasProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.FieldAliasProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class FieldAliasProperty extends PropertyBase implements PropertyVariant { + @Nullable private final String path; @@ -53,17 +61,15 @@ public class FieldAliasProperty extends PropertyBase implements PropertyVariant private FieldAliasProperty(Builder builder) { super(builder); - this.path = builder.path; - } - public static FieldAliasProperty of(Function> fn) { + public static FieldAliasProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final String path() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "alias"); super.serializeInternal(generator, mapper); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FieldAliasProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String path; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link FieldAliasProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FieldAliasProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public FieldAliasProperty build() { ); protected static void setupFieldAliasPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.path); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldAliasProperty other = (FieldAliasProperty) o; + return Objects.equals(this.path, other.path); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java index bb317da753..942d12a35d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FlatObjectProperty.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,31 +51,63 @@ // typedef: _types.mapping.FlatObjectProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class FlatObjectProperty extends PropertyBase implements PropertyVariant { + @Nullable + private final Boolean aggregatable; + + @Nullable + private final Boolean searchable; + // --------------------------------------------------------------------------------------------- private FlatObjectProperty(Builder builder) { super(builder); - + this.aggregatable = builder.aggregatable; + this.searchable = builder.searchable; } - public static FlatObjectProperty of(Function> fn) { + public static FlatObjectProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { return Property.Kind.FlatObject; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * API name: {@code aggregatable} + */ + @Nullable + public final Boolean aggregatable() { + return this.aggregatable; + } + /** + * API name: {@code searchable} + */ + @Nullable + public final Boolean searchable() { + return this.searchable; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "flat_object"); super.serializeInternal(generator, mapper); + if (this.aggregatable != null) { + generator.writeKey("aggregatable"); + generator.write(this.aggregatable); + } + + if (this.searchable != null) { + generator.writeKey("searchable"); + generator.write(this.searchable); + } } // --------------------------------------------------------------------------------------------- @@ -76,8 +115,27 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FlatObjectProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean aggregatable; + @Nullable + private Boolean searchable; + + /** + * API name: {@code aggregatable} + */ + public final Builder aggregatable(@Nullable Boolean value) { + this.aggregatable = value; + return this; + } + + /** + * API name: {@code searchable} + */ + public final Builder searchable(@Nullable Boolean value) { + this.searchable = value; + return this; + } @Override protected Builder self() { @@ -87,8 +145,7 @@ protected Builder self() { /** * Builds a {@link FlatObjectProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FlatObjectProperty build() { _checkSingleUse(); @@ -108,9 +165,29 @@ public FlatObjectProperty build() { ); protected static void setupFlatObjectPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); + op.add(Builder::aggregatable, JsonpDeserializer.booleanDeserializer(), "aggregatable"); + op.add(Builder::searchable, JsonpDeserializer.booleanDeserializer(), "searchable"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.aggregatable); + result = 31 * result + Objects.hashCode(this.searchable); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FlatObjectProperty other = (FlatObjectProperty) o; + return Objects.equals(this.aggregatable, other.aggregatable) && Objects.equals(this.searchable, other.searchable); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java index 32677797db..47cfb180aa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatNumberProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.FloatNumberProperty @JsonpDeserializable -public class FloatNumberProperty extends StandardNumberProperty implements PropertyVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FloatNumberProperty extends NumberPropertyBase implements PropertyVariant { + @Nullable private final Float nullValue; @@ -53,17 +61,15 @@ public class FloatNumberProperty extends StandardNumberProperty implements Prope private FloatNumberProperty(Builder builder) { super(builder); - this.nullValue = builder.nullValue; - } - public static FloatNumberProperty of(Function> fn) { + public static FloatNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Float nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "float"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FloatNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Float nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link FloatNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FloatNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public FloatNumberProperty build() { ); protected static void setupFloatNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.floatDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FloatNumberProperty other = (FloatNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java index 9029afe952..f94992ddb6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/FloatRangeProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.FloatRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class FloatRangeProperty extends RangePropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private FloatRangeProperty(Builder builder) { super(builder); - } - public static FloatRangeProperty of(Function> fn) { + public static FloatRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "float_range"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FloatRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link FloatRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FloatRangeProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public FloatRangeProperty build() { ); protected static void setupFloatRangePropertyDeserializer(ObjectDeserializer op) { - RangePropertyBase.setupRangePropertyBaseDeserializer(op); + setupRangePropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java index fe98fcc151..a6c18aba2f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoOrientation.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.mapping.GeoOrientation + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum GeoOrientation implements JsonEnum { - Right("right", "RIGHT", "counterclockwise", "ccw"), - Left("left", "LEFT", "clockwise", "cw"), - ; + Right("right", "RIGHT", "counterclockwise", "ccw"); private final String jsonValue; private final String[] aliases; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java index 42af866e16..120f4e043d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/GeoPointProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -46,7 +52,9 @@ // typedef: _types.mapping.GeoPointProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GeoPointProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final Boolean ignoreMalformed; @@ -60,19 +68,17 @@ public class GeoPointProperty extends DocValuesPropertyBase implements PropertyV private GeoPointProperty(Builder builder) { super(builder); - this.ignoreMalformed = builder.ignoreMalformed; this.ignoreZValue = builder.ignoreZValue; this.nullValue = builder.nullValue; - } - public static GeoPointProperty of(Function> fn) { + public static GeoPointProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -104,25 +110,22 @@ public final GeoLocation nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "geo_point"); super.serializeInternal(generator, mapper); if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.ignoreZValue != null) { generator.writeKey("ignore_z_value"); generator.write(this.ignoreZValue); - } + if (this.nullValue != null) { generator.writeKey("null_value"); this.nullValue.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- @@ -130,14 +133,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link GeoPointProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean ignoreZValue; - @Nullable private GeoLocation nullValue; @@ -169,7 +169,7 @@ public final Builder nullValue(@Nullable GeoLocation value) { * API name: {@code null_value} */ public final Builder nullValue(Function> fn) { - return this.nullValue(fn.apply(new GeoLocation.Builder()).build()); + return nullValue(fn.apply(new GeoLocation.Builder()).build()); } @Override @@ -180,8 +180,7 @@ protected Builder self() { /** * Builds a {@link GeoPointProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GeoPointProperty build() { _checkSingleUse(); @@ -209,4 +208,25 @@ protected static void setupGeoPointPropertyDeserializer(ObjectDeserializergeo_shape data type facilitates the indexing of and - * searching with arbitrary geo shapes such as rectangles and polygons. - * - */ @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GeoShapeProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final Boolean coerce; + @Nullable + private final Double distanceErrorPct; + @Nullable private final Boolean ignoreMalformed; @@ -70,21 +76,20 @@ public class GeoShapeProperty extends DocValuesPropertyBase implements PropertyV private GeoShapeProperty(Builder builder) { super(builder); - this.coerce = builder.coerce; + this.distanceErrorPct = builder.distanceErrorPct; this.ignoreMalformed = builder.ignoreMalformed; this.ignoreZValue = builder.ignoreZValue; this.orientation = builder.orientation; this.strategy = builder.strategy; - } - public static GeoShapeProperty of(Function> fn) { + public static GeoShapeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -99,6 +104,14 @@ public final Boolean coerce() { return this.coerce; } + /** + * API name: {@code distance_error_pct} + */ + @Nullable + public final Double distanceErrorPct() { + return this.distanceErrorPct; + } + /** * API name: {@code ignore_malformed} */ @@ -132,33 +145,37 @@ public final GeoStrategy strategy() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "geo_shape"); super.serializeInternal(generator, mapper); if (this.coerce != null) { generator.writeKey("coerce"); generator.write(this.coerce); + } + if (this.distanceErrorPct != null) { + generator.writeKey("distance_error_pct"); + generator.write(this.distanceErrorPct); } + if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.ignoreZValue != null) { generator.writeKey("ignore_z_value"); generator.write(this.ignoreZValue); - } + if (this.orientation != null) { generator.writeKey("orientation"); this.orientation.serialize(generator, mapper); } + if (this.strategy != null) { generator.writeKey("strategy"); this.strategy.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- @@ -166,20 +183,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link GeoShapeProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean coerce; - + @Nullable + private Double distanceErrorPct; @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean ignoreZValue; - @Nullable private GeoOrientation orientation; - @Nullable private GeoStrategy strategy; @@ -191,6 +205,14 @@ public final Builder coerce(@Nullable Boolean value) { return this; } + /** + * API name: {@code distance_error_pct} + */ + public final Builder distanceErrorPct(@Nullable Double value) { + this.distanceErrorPct = value; + return this; + } + /** * API name: {@code ignore_malformed} */ @@ -231,8 +253,7 @@ protected Builder self() { /** * Builds a {@link GeoShapeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GeoShapeProperty build() { _checkSingleUse(); @@ -254,6 +275,7 @@ public GeoShapeProperty build() { protected static void setupGeoShapePropertyDeserializer(ObjectDeserializer op) { setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); + op.add(Builder::distanceErrorPct, JsonpDeserializer.doubleDeserializer(), "distance_error_pct"); op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.add(Builder::ignoreZValue, JsonpDeserializer.booleanDeserializer(), "ignore_z_value"); op.add(Builder::orientation, GeoOrientation._DESERIALIZER, "orientation"); @@ -262,4 +284,31 @@ protected static void setupGeoShapePropertyDeserializer(ObjectDeserializer> fn) { + public static HalfFloatNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Float nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "half_float"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link HalfFloatNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Float nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link HalfFloatNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public HalfFloatNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public HalfFloatNumberProperty build() { ); protected static void setupHalfFloatNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.floatDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HalfFloatNumberProperty other = (HalfFloatNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java index dd21c257cc..ba46ff5f93 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/HistogramProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.HistogramProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class HistogramProperty extends PropertyBase implements PropertyVariant { + @Nullable private final Boolean ignoreMalformed; @@ -53,17 +61,15 @@ public class HistogramProperty extends PropertyBase implements PropertyVariant { private HistogramProperty(Builder builder) { super(builder); - this.ignoreMalformed = builder.ignoreMalformed; - } - public static HistogramProperty of(Function> fn) { + public static HistogramProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Boolean ignoreMalformed() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "histogram"); super.serializeInternal(generator, mapper); if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link HistogramProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean ignoreMalformed; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link HistogramProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public HistogramProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public HistogramProperty build() { ); protected static void setupHistogramPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HistogramProperty other = (HistogramProperty) o; + return Objects.equals(this.ignoreMalformed, other.ignoreMalformed); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java index 0876e46265..3fd17b4084 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java @@ -6,10 +6,40 @@ * compatible open source license. */ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -22,33 +52,32 @@ import org.opensearch.client.opensearch._types.analysis.IcuCollationStrength; import org.opensearch.client.util.ObjectBuilder; -// typedef: _types.mapping.ICUCollationKeywordProperty +// typedef: _types.mapping.IcuCollationKeywordProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class IcuCollationKeywordProperty extends DocValuesPropertyBase implements PropertyVariant { @Nullable - private final Boolean index; + private final IcuCollationAlternate alternate; @Nullable - private final String nullValue; - - // Collation Options + private final IcuCollationCaseFirst caseFirst; @Nullable - private final IcuCollationAlternate alternate; + private final Boolean caseLevel; @Nullable - private final Boolean caseLevel; + private final IcuCollationDecomposition decomposition; @Nullable - private final IcuCollationCaseFirst caseFirst; + private final Boolean hiraganaQuaternaryMode; @Nullable - private final IcuCollationDecomposition decomposition; + private final Boolean index; @Nullable - private final Boolean hiraganaQuaternaryMode; + private final String nullValue; @Nullable private final Boolean numeric; @@ -63,67 +92,60 @@ public class IcuCollationKeywordProperty extends DocValuesPropertyBase implement private IcuCollationKeywordProperty(Builder builder) { super(builder); - this.index = builder.index; - this.nullValue = builder.nullValue; this.alternate = builder.alternate; - this.caseLevel = builder.caseLevel; this.caseFirst = builder.caseFirst; + this.caseLevel = builder.caseLevel; this.decomposition = builder.decomposition; this.hiraganaQuaternaryMode = builder.hiraganaQuaternaryMode; + this.index = builder.index; + this.nullValue = builder.nullValue; this.numeric = builder.numeric; this.strength = builder.strength; this.variableTop = builder.variableTop; } - public static IcuCollationKeywordProperty of(Function> fn) { + public static IcuCollationKeywordProperty of( + Function> fn + ) { return fn.apply(new Builder()).build(); } + /** + * {@link Property} variant kind. + */ @Override public Property.Kind _propertyKind() { return Property.Kind.IcuCollationKeyword; } /** - * API name: {@code index} + * API name: {@code alternate} */ @Nullable - public final Boolean index() { - return this.index; + public final IcuCollationAlternate alternate() { + return this.alternate; } /** - * API name: {@code null_value} + * API name: {@code case_first} */ @Nullable - public final String nullValue() { - return this.nullValue; - } - - /** - * API name: {@code alternate} - */ - public final IcuCollationAlternate alternate() { - return this.alternate; + public final IcuCollationCaseFirst caseFirst() { + return this.caseFirst; } /** * API name: {@code case_level} */ + @Nullable public final Boolean caseLevel() { return this.caseLevel; } - /** - * API name: {@code case_first} - */ - public final IcuCollationCaseFirst caseFirst() { - return this.caseFirst; - } - /** * API name: {@code decomposition} */ + @Nullable public final IcuCollationDecomposition decomposition() { return this.decomposition; } @@ -131,13 +153,31 @@ public final IcuCollationDecomposition decomposition() { /** * API name: {@code hiragana_quaternary_mode} */ + @Nullable public final Boolean hiraganaQuaternaryMode() { return this.hiraganaQuaternaryMode; } + /** + * API name: {@code index} + */ + @Nullable + public final Boolean index() { + return this.index; + } + + /** + * API name: {@code null_value} + */ + @Nullable + public final String nullValue() { + return this.nullValue; + } + /** * API name: {@code numeric} */ + @Nullable public final Boolean numeric() { return this.numeric; } @@ -145,6 +185,7 @@ public final Boolean numeric() { /** * API name: {@code strength} */ + @Nullable public final IcuCollationStrength strength() { return this.strength; } @@ -152,6 +193,7 @@ public final IcuCollationStrength strength() { /** * API name: {@code variable_top} */ + @Nullable public final String variableTop() { return this.variableTop; } @@ -159,42 +201,51 @@ public final String variableTop() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "icu_collation_keyword"); super.serializeInternal(generator, mapper); - if (this.index != null) { - generator.writeKey("index"); - generator.write(this.index); - } - if (this.nullValue != null) { - generator.writeKey("null_value"); - generator.write(this.nullValue); - } if (this.alternate != null) { generator.writeKey("alternate"); - generator.write(this.alternate.jsonValue()); + this.alternate.serialize(generator, mapper); } + + if (this.caseFirst != null) { + generator.writeKey("case_first"); + this.caseFirst.serialize(generator, mapper); + } + if (this.caseLevel != null) { generator.writeKey("case_level"); generator.write(this.caseLevel); } - if (this.caseFirst != null) { - generator.writeKey("case_first"); - generator.write(this.caseFirst.jsonValue()); - } + if (this.decomposition != null) { generator.writeKey("decomposition"); - generator.write(this.decomposition.jsonValue()); + this.decomposition.serialize(generator, mapper); } + if (this.hiraganaQuaternaryMode != null) { generator.writeKey("hiragana_quaternary_mode"); generator.write(this.hiraganaQuaternaryMode); } + + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + } + + if (this.nullValue != null) { + generator.writeKey("null_value"); + generator.write(this.nullValue); + } + if (this.numeric != null) { generator.writeKey("numeric"); generator.write(this.numeric); } + if (this.strength != null) { generator.writeKey("strength"); - generator.write(this.strength.jsonValue()); + this.strength.serialize(generator, mapper); } + if (this.variableTop != null) { generator.writeKey("variable_top"); generator.write(this.variableTop); @@ -206,93 +257,83 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IcuCollationKeywordProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean index; - - @Nullable - private String nullValue; - @Nullable private IcuCollationAlternate alternate; - - @Nullable - private Boolean caseLevel; - @Nullable private IcuCollationCaseFirst caseFirst; - + @Nullable + private Boolean caseLevel; @Nullable private IcuCollationDecomposition decomposition; - @Nullable private Boolean hiraganaQuaternaryMode; - + @Nullable + private Boolean index; + @Nullable + private String nullValue; @Nullable private Boolean numeric; - @Nullable private IcuCollationStrength strength; - @Nullable private String variableTop; /** - * API name: {@code index} + * API name: {@code alternate} */ - public final Builder index(@Nullable Boolean value) { - this.index = value; + public final Builder alternate(@Nullable IcuCollationAlternate value) { + this.alternate = value; return this; } /** - * API name: {@code null_value} + * API name: {@code case_first} */ - public final Builder nullValue(@Nullable String value) { - this.nullValue = value; + public final Builder caseFirst(@Nullable IcuCollationCaseFirst value) { + this.caseFirst = value; return this; } /** - * API name: {@code alternate} + * API name: {@code case_level} */ - public final Builder alternate(@Nullable IcuCollationAlternate value) { - this.alternate = value; + public final Builder caseLevel(@Nullable Boolean value) { + this.caseLevel = value; return this; } /** - * API name: {@code case_level} + * API name: {@code decomposition} */ - public final Builder caseLevel(@Nullable Boolean value) { - this.caseLevel = value; + public final Builder decomposition(@Nullable IcuCollationDecomposition value) { + this.decomposition = value; return this; } /** - * API name: {@code case_first} + * API name: {@code hiragana_quaternary_mode} */ - public final Builder caseFirst(@Nullable IcuCollationCaseFirst value) { - this.caseFirst = value; + public final Builder hiraganaQuaternaryMode(@Nullable Boolean value) { + this.hiraganaQuaternaryMode = value; return this; } /** - * API name: {@code decomposition} + * API name: {@code index} */ - public final Builder decomposition(@Nullable IcuCollationDecomposition value) { - this.decomposition = value; + public final Builder index(@Nullable Boolean value) { + this.index = value; return this; } /** - * API name: {@code hiragana_quaternary_mode} + * API name: {@code null_value} */ - public final Builder hiraganaQuaternaryMode(@Nullable Boolean value) { - this.hiraganaQuaternaryMode = value; + public final Builder nullValue(@Nullable String value) { + this.nullValue = value; return this; } @@ -328,11 +369,11 @@ protected Builder self() { /** * Builds a {@link IcuCollationKeywordProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IcuCollationKeywordProperty build() { _checkSingleUse(); + return new IcuCollationKeywordProperty(this); } } @@ -348,16 +389,54 @@ public IcuCollationKeywordProperty build() { ); protected static void setupIcuCollationKeywordPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); - op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); - op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::alternate, IcuCollationAlternate._DESERIALIZER, "alternate"); - op.add(Builder::caseLevel, JsonpDeserializer.booleanDeserializer(), "case_level"); op.add(Builder::caseFirst, IcuCollationCaseFirst._DESERIALIZER, "case_first"); + op.add(Builder::caseLevel, JsonpDeserializer.booleanDeserializer(), "case_level"); op.add(Builder::decomposition, IcuCollationDecomposition._DESERIALIZER, "decomposition"); op.add(Builder::hiraganaQuaternaryMode, JsonpDeserializer.booleanDeserializer(), "hiragana_quaternary_mode"); + op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); + op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); op.add(Builder::numeric, JsonpDeserializer.booleanDeserializer(), "numeric"); op.add(Builder::strength, IcuCollationStrength._DESERIALIZER, "strength"); op.add(Builder::variableTop, JsonpDeserializer.stringDeserializer(), "variable_top"); + + op.ignore("type"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.alternate); + result = 31 * result + Objects.hashCode(this.caseFirst); + result = 31 * result + Objects.hashCode(this.caseLevel); + result = 31 * result + Objects.hashCode(this.decomposition); + result = 31 * result + Objects.hashCode(this.hiraganaQuaternaryMode); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.nullValue); + result = 31 * result + Objects.hashCode(this.numeric); + result = 31 * result + Objects.hashCode(this.strength); + result = 31 * result + Objects.hashCode(this.variableTop); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IcuCollationKeywordProperty other = (IcuCollationKeywordProperty) o; + return Objects.equals(this.alternate, other.alternate) + && Objects.equals(this.caseFirst, other.caseFirst) + && Objects.equals(this.caseLevel, other.caseLevel) + && Objects.equals(this.decomposition, other.decomposition) + && Objects.equals(this.hiraganaQuaternaryMode, other.hiraganaQuaternaryMode) + && Objects.equals(this.index, other.index) + && Objects.equals(this.nullValue, other.nullValue) + && Objects.equals(this.numeric, other.numeric) + && Objects.equals(this.strength, other.strength) + && Objects.equals(this.variableTop, other.variableTop); } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java index 1ff1ff07cb..85c729363e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IndexOptions.java @@ -30,22 +30,28 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.mapping.IndexOptions + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum IndexOptions implements JsonEnum { Docs("docs"), Freqs("freqs"), - Positions("positions"), - Offsets("offsets"), - ; + Positions("positions"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java index 72113c162e..cbecb71abc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerNumberProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.IntegerNumberProperty @JsonpDeserializable -public class IntegerNumberProperty extends StandardNumberProperty implements PropertyVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IntegerNumberProperty extends NumberPropertyBase implements PropertyVariant { + @Nullable private final Integer nullValue; @@ -53,17 +61,15 @@ public class IntegerNumberProperty extends StandardNumberProperty implements Pro private IntegerNumberProperty(Builder builder) { super(builder); - this.nullValue = builder.nullValue; - } - public static IntegerNumberProperty of(Function> fn) { + public static IntegerNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Integer nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "integer"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IntegerNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Integer nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link IntegerNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IntegerNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public IntegerNumberProperty build() { ); protected static void setupIntegerNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.integerDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IntegerNumberProperty other = (IntegerNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java index d69382b37f..20099ef5fb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IntegerRangeProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.IntegerRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class IntegerRangeProperty extends RangePropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private IntegerRangeProperty(Builder builder) { super(builder); - } - public static IntegerRangeProperty of(Function> fn) { + public static IntegerRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "integer_range"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IntegerRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link IntegerRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IntegerRangeProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public IntegerRangeProperty build() { ); protected static void setupIntegerRangePropertyDeserializer(ObjectDeserializer op) { - RangePropertyBase.setupRangePropertyBaseDeserializer(op); + setupRangePropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java index 797d6a1e7e..02674513fc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,37 +51,37 @@ // typedef: _types.mapping.IpProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class IpProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final Double boost; @Nullable - private final Boolean index; + private final Boolean ignoreMalformed; @Nullable - private final String nullValue; + private final Boolean index; @Nullable - private final Boolean ignoreMalformed; + private final String nullValue; // --------------------------------------------------------------------------------------------- private IpProperty(Builder builder) { super(builder); - this.boost = builder.boost; + this.ignoreMalformed = builder.ignoreMalformed; this.index = builder.index; this.nullValue = builder.nullValue; - this.ignoreMalformed = builder.ignoreMalformed; - } - public static IpProperty of(Function> fn) { + public static IpProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -90,6 +96,14 @@ public final Double boost() { return this.boost; } + /** + * API name: {@code ignore_malformed} + */ + @Nullable + public final Boolean ignoreMalformed() { + return this.ignoreMalformed; + } + /** * API name: {@code index} */ @@ -106,39 +120,28 @@ public final String nullValue() { return this.nullValue; } - /** - * API name: {@code ignore_malformed} - */ - @Nullable - public final Boolean ignoreMalformed() { - return this.ignoreMalformed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "ip"); super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); + } + if (this.ignoreMalformed != null) { + generator.writeKey("ignore_malformed"); + generator.write(this.ignoreMalformed); } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - if (this.ignoreMalformed != null) { - generator.writeKey("ignore_malformed"); - generator.write(this.ignoreMalformed); - - } - } // --------------------------------------------------------------------------------------------- @@ -146,20 +149,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IpProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double boost; - + @Nullable + private Boolean ignoreMalformed; @Nullable private Boolean index; - @Nullable private String nullValue; - @Nullable - private Boolean ignoreMalformed; - /** * API name: {@code boost} */ @@ -168,6 +167,14 @@ public final Builder boost(@Nullable Double value) { return this; } + /** + * API name: {@code ignore_malformed} + */ + public final Builder ignoreMalformed(@Nullable Boolean value) { + this.ignoreMalformed = value; + return this; + } + /** * API name: {@code index} */ @@ -184,14 +191,6 @@ public final Builder nullValue(@Nullable String value) { return this; } - /** - * API name: {@code ignore_malformed} - */ - public final Builder ignoreMalformed(@Nullable Boolean value) { - this.ignoreMalformed = value; - return this; - } - @Override protected Builder self() { return this; @@ -200,8 +199,7 @@ protected Builder self() { /** * Builds a {@link IpProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IpProperty build() { _checkSingleUse(); @@ -221,13 +219,36 @@ public IpProperty build() { ); protected static void setupIpPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); + op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); - op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.boost); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IpProperty other = (IpProperty) o; + return Objects.equals(this.boost, other.boost) + && Objects.equals(this.ignoreMalformed, other.ignoreMalformed) + && Objects.equals(this.index, other.index) + && Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java index 481d550cb1..cb78d0695b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/IpRangeProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.IpRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class IpRangeProperty extends RangePropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private IpRangeProperty(Builder builder) { super(builder); - } - public static IpRangeProperty of(Function> fn) { + public static IpRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "ip_range"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link IpRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link IpRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public IpRangeProperty build() { _checkSingleUse(); @@ -112,4 +115,19 @@ protected static void setupIpRangePropertyDeserializer(ObjectDeserializer> relations; // --------------------------------------------------------------------------------------------- private JoinProperty(Builder builder) { super(builder); - + this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals; this.relations = ApiTypeHelper.unmodifiable(builder.relations); - } - public static JoinProperty of(Function> fn) { + public static JoinProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { return Property.Kind.Join; } + /** + * API name: {@code eager_global_ordinals} + */ + @Nullable + public final Boolean eagerGlobalOrdinals() { + return this.eagerGlobalOrdinals; + } + /** * API name: {@code relations} */ + @Nonnull public final Map> relations() { return this.relations; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "join"); super.serializeInternal(generator, mapper); + if (this.eagerGlobalOrdinals != null) { + generator.writeKey("eager_global_ordinals"); + generator.write(this.eagerGlobalOrdinals); + } + if (ApiTypeHelper.isDefined(this.relations)) { generator.writeKey("relations"); generator.writeStartObject(); @@ -92,16 +117,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (item0.getValue() != null) { for (String item1 : item0.getValue()) { generator.write(item1); - } } generator.writeEnd(); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- @@ -109,15 +130,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link JoinProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean eagerGlobalOrdinals; @Nullable private Map> relations; + /** + * API name: {@code eager_global_ordinals} + */ + public final Builder eagerGlobalOrdinals(@Nullable Boolean value) { + this.eagerGlobalOrdinals = value; + return this; + } + /** * API name: {@code relations} + * *

- * Adds all entries of map to relations. + * Adds all elements of map to relations. + *

*/ public final Builder relations(Map> map) { this.relations = _mapPutAll(this.relations, map); @@ -126,8 +158,10 @@ public final Builder relations(Map> map) { /** * API name: {@code relations} + * *

* Adds an entry to relations. + *

*/ public final Builder relations(String key, List value) { this.relations = _mapPut(this.relations, key, value); @@ -142,8 +176,7 @@ protected Builder self() { /** * Builds a {@link JoinProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public JoinProperty build() { _checkSingleUse(); @@ -163,7 +196,8 @@ public JoinProperty build() { ); protected static void setupJoinPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); + op.add(Builder::eagerGlobalOrdinals, JsonpDeserializer.booleanDeserializer(), "eager_global_ordinals"); op.add( Builder::relations, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), @@ -173,4 +207,22 @@ protected static void setupJoinPropertyDeserializer(ObjectDeserializer> fn) { + public static KeywordProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -163,49 +169,47 @@ public final Boolean splitQueriesOnWhitespace() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "keyword"); super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.eagerGlobalOrdinals != null) { generator.writeKey("eager_global_ordinals"); generator.write(this.eagerGlobalOrdinals); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.indexOptions != null) { generator.writeKey("index_options"); this.indexOptions.serialize(generator, mapper); } + if (this.normalizer != null) { generator.writeKey("normalizer"); generator.write(this.normalizer); - } + if (this.norms != null) { generator.writeKey("norms"); generator.write(this.norms); - } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } + if (this.splitQueriesOnWhitespace != null) { generator.writeKey("split_queries_on_whitespace"); generator.write(this.splitQueriesOnWhitespace); - } - } // --------------------------------------------------------------------------------------------- @@ -213,29 +217,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link KeywordProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Double boost; - @Nullable private Boolean eagerGlobalOrdinals; - @Nullable private Boolean index; - @Nullable private IndexOptions indexOptions; - @Nullable private String normalizer; - @Nullable private Boolean norms; - @Nullable private String nullValue; - @Nullable private Boolean splitQueriesOnWhitespace; @@ -311,8 +307,7 @@ protected Builder self() { /** * Builds a {@link KeywordProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public KeywordProperty build() { _checkSingleUse(); @@ -332,7 +327,7 @@ public KeywordProperty build() { ); protected static void setupKeywordPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); op.add(Builder::eagerGlobalOrdinals, JsonpDeserializer.booleanDeserializer(), "eager_global_ordinals"); op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); @@ -345,4 +340,35 @@ protected static void setupKeywordPropertyDeserializer(ObjectDeserializer> fn) { + public static LongNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Long nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "long"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link LongNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Long nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link LongNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public LongNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public LongNumberProperty build() { ); protected static void setupLongNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.longDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LongNumberProperty other = (LongNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java index 41ddd90286..8be8fc7005 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/LongRangeProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.LongRangeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class LongRangeProperty extends RangePropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private LongRangeProperty(Builder builder) { super(builder); - } - public static LongRangeProperty of(Function> fn) { + public static LongRangeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "long_range"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link LongRangeProperty}. */ - public static class Builder extends RangePropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link LongRangeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public LongRangeProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public LongRangeProperty build() { ); protected static void setupLongRangePropertyDeserializer(ObjectDeserializer op) { - RangePropertyBase.setupRangePropertyBaseDeserializer(op); + setupRangePropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/MatchOnlyTextProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/MatchOnlyTextProperty.java new file mode 100644 index 0000000000..13316e28ed --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/MatchOnlyTextProperty.java @@ -0,0 +1,327 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.mapping; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: _types.mapping.MatchOnlyTextProperty + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MatchOnlyTextProperty implements PropertyVariant, PlainJsonSerializable { + + @Nonnull + private final List copyTo; + + @Nonnull + private final Map fields; + + @Nonnull + private final Map meta; + + // --------------------------------------------------------------------------------------------- + + private MatchOnlyTextProperty(Builder builder) { + this.copyTo = ApiTypeHelper.unmodifiable(builder.copyTo); + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.meta = ApiTypeHelper.unmodifiable(builder.meta); + } + + public static MatchOnlyTextProperty of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Property} variant kind. + */ + @Override + public Property.Kind _propertyKind() { + return Property.Kind.MatchOnlyText; + } + + /** + * API name: {@code copy_to} + */ + @Nonnull + public final List copyTo() { + return this.copyTo; + } + + /** + * Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and a + * multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + *

+ * API name: {@code fields} + *

+ */ + @Nonnull + public final Map fields() { + return this.fields; + } + + /** + * Metadata about the field. + *

+ * API name: {@code meta} + *

+ */ + @Nonnull + public final Map meta() { + return this.meta; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.write("type", "match_only_text"); + if (ApiTypeHelper.isDefined(this.copyTo)) { + generator.writeKey("copy_to"); + generator.writeStartArray(); + for (String item0 : this.copyTo) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MatchOnlyTextProperty}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private List copyTo; + @Nullable + private Map fields; + @Nullable + private Map meta; + + /** + * API name: {@code copy_to} + * + *

+ * Adds all elements of list to copyTo. + *

+ */ + public final Builder copyTo(List list) { + this.copyTo = _listAddAll(this.copyTo, list); + return this; + } + + /** + * API name: {@code copy_to} + * + *

+ * Adds one or more values to copyTo. + *

+ */ + public final Builder copyTo(String value, String... values) { + this.copyTo = _listAdd(this.copyTo, value, values); + return this; + } + + /** + * Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and + * a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + *

+ * API name: {@code fields} + *

+ * + *

+ * Adds all elements of map to fields. + *

+ */ + public final Builder fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return this; + } + + /** + * Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and + * a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + *

+ * API name: {@code fields} + *

+ * + *

+ * Adds an entry to fields. + *

+ */ + public final Builder fields(String key, Property value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and + * a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. + *

+ * API name: {@code fields} + *

+ * + *

+ * Adds a value to fields using a builder lambda. + *

+ */ + public final Builder fields(String key, Function> fn) { + return fields(key, fn.apply(new Property.Builder()).build()); + } + + /** + * Metadata about the field. + *

+ * API name: {@code meta} + *

+ * + *

+ * Adds all elements of map to meta. + *

+ */ + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; + } + + /** + * Metadata about the field. + *

+ * API name: {@code meta} + *

+ * + *

+ * Adds an entry to meta. + *

+ */ + public final Builder meta(String key, String value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + + /** + * Builds a {@link MatchOnlyTextProperty}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public MatchOnlyTextProperty build() { + _checkSingleUse(); + + return new MatchOnlyTextProperty(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MatchOnlyTextProperty} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + MatchOnlyTextProperty::setupMatchOnlyTextPropertyDeserializer + ); + + protected static void setupMatchOnlyTextPropertyDeserializer(ObjectDeserializer op) { + op.add(Builder::copyTo, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "copy_to"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "fields"); + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "meta"); + + op.ignore("type"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.copyTo); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.meta); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MatchOnlyTextProperty other = (MatchOnlyTextProperty) o; + return Objects.equals(this.copyTo, other.copyTo) + && Objects.equals(this.fields, other.fields) + && Objects.equals(this.meta, other.meta); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java index deb3e3651a..fb4a94d1f2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Murmur3HashProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.Murmur3HashProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class Murmur3HashProperty extends DocValuesPropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private Murmur3HashProperty(Builder builder) { super(builder); - } - public static Murmur3HashProperty of(Function> fn) { + public static Murmur3HashProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "murmur3"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link Murmur3HashProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link Murmur3HashProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public Murmur3HashProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public Murmur3HashProperty build() { ); protected static void setupMurmur3HashPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java index 507d9169d8..242ce6c7af 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/NestedProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.NestedProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class NestedProperty extends CorePropertyBase implements PropertyVariant { + @Nullable private final Boolean enabled; @@ -59,19 +67,17 @@ public class NestedProperty extends CorePropertyBase implements PropertyVariant private NestedProperty(Builder builder) { super(builder); - this.enabled = builder.enabled; this.includeInParent = builder.includeInParent; this.includeInRoot = builder.includeInRoot; - } - public static NestedProperty of(Function> fn) { + public static NestedProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -103,25 +109,22 @@ public final Boolean includeInRoot() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "nested"); super.serializeInternal(generator, mapper); if (this.enabled != null) { generator.writeKey("enabled"); generator.write(this.enabled); - } + if (this.includeInParent != null) { generator.writeKey("include_in_parent"); generator.write(this.includeInParent); - } + if (this.includeInRoot != null) { generator.writeKey("include_in_root"); generator.write(this.includeInRoot); - } - } // --------------------------------------------------------------------------------------------- @@ -129,14 +132,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link NestedProperty}. */ - public static class Builder extends CorePropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean enabled; - @Nullable private Boolean includeInParent; - @Nullable private Boolean includeInRoot; @@ -172,8 +172,7 @@ protected Builder self() { /** * Builds a {@link NestedProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public NestedProperty build() { _checkSingleUse(); @@ -201,4 +200,25 @@ protected static void setupNestedPropertyDeserializer(ObjectDeserializer builder) { super(builder); - - this.index = builder.index; + this.boost = builder.boost; + this.coerce = builder.coerce; this.ignoreMalformed = builder.ignoreMalformed; + this.index = builder.index; + } + /** + * API name: {@code boost} + */ + @Nullable + public final Double boost() { + return this.boost; } /** - * API name: {@code index} + * API name: {@code coerce} */ @Nullable - public final Boolean index() { - return this.index; + public final Boolean coerce() { + return this.coerce; } /** @@ -73,35 +95,63 @@ public final Boolean ignoreMalformed() { return this.ignoreMalformed; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * API name: {@code index} + */ + @Nullable + public final Boolean index() { + return this.index; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - if (this.index != null) { - generator.writeKey("index"); - generator.write(this.index); + if (this.boost != null) { + generator.writeKey("boost"); + generator.write(this.boost); + } + if (this.coerce != null) { + generator.writeKey("coerce"); + generator.write(this.coerce); } + if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + } } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends DocValuesPropertyBase.AbstractBuilder { @Nullable - private Boolean index; - + private Double boost; + @Nullable + private Boolean coerce; @Nullable private Boolean ignoreMalformed; + @Nullable + private Boolean index; /** - * API name: {@code index} + * API name: {@code boost} */ - public final BuilderT index(@Nullable Boolean value) { - this.index = value; + public final BuilderT boost(@Nullable Double value) { + this.boost = value; + return self(); + } + + /** + * API name: {@code coerce} + */ + public final BuilderT coerce(@Nullable Boolean value) { + this.coerce = value; return self(); } @@ -113,16 +163,49 @@ public final BuilderT ignoreMalformed(@Nullable Boolean value) { return self(); } + /** + * API name: {@code index} + */ + public final BuilderT index(@Nullable Boolean value) { + this.index = value; + return self(); + } + } // --------------------------------------------------------------------------------------------- + protected static > void setupNumberPropertyBaseDeserializer( ObjectDeserializer op ) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); - op.add(AbstractBuilder::index, JsonpDeserializer.booleanDeserializer(), "index"); + setupDocValuesPropertyBaseDeserializer(op); + op.add(AbstractBuilder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); + op.add(AbstractBuilder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); op.add(AbstractBuilder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); + op.add(AbstractBuilder::index, JsonpDeserializer.booleanDeserializer(), "index"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.boost); + result = 31 * result + Objects.hashCode(this.coerce); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + result = 31 * result + Objects.hashCode(this.index); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NumberPropertyBase other = (NumberPropertyBase) o; + return Objects.equals(this.boost, other.boost) + && Objects.equals(this.coerce, other.coerce) + && Objects.equals(this.ignoreMalformed, other.ignoreMalformed) + && Objects.equals(this.index, other.index); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java index 02f15c3cf4..ddbe46e876 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ObjectProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.ObjectProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ObjectProperty extends CorePropertyBase implements PropertyVariant { + @Nullable private final Boolean enabled; @@ -53,17 +61,15 @@ public class ObjectProperty extends CorePropertyBase implements PropertyVariant private ObjectProperty(Builder builder) { super(builder); - this.enabled = builder.enabled; - } - public static ObjectProperty of(Function> fn) { + public static ObjectProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Boolean enabled() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "object"); super.serializeInternal(generator, mapper); if (this.enabled != null) { generator.writeKey("enabled"); generator.write(this.enabled); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ObjectProperty}. */ - public static class Builder extends CorePropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean enabled; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link ObjectProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ObjectProperty build() { _checkSingleUse(); @@ -143,4 +144,21 @@ protected static void setupObjectPropertyDeserializer(ObjectDeserializer> fn) { + public static PercolatorProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "percolator"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link PercolatorProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link PercolatorProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public PercolatorProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public PercolatorProperty build() { ); protected static void setupPercolatorPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Property.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Property.java index bf4db5c992..77fa8fa51c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/Property.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/Property.java @@ -30,17 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -50,107 +56,58 @@ // typedef: _types.mapping.Property @JsonpDeserializable -public class Property implements TaggedUnion, JsonpSerializable { - - /** - * {@link Property} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Property implements TaggedUnion, PlainJsonSerializable { /** * {@link Property} variant kinds. */ - public enum Kind implements JsonEnum { AggregateMetricDouble("aggregate_metric_double"), - + Alias("alias"), Binary("binary"), - Boolean("boolean"), - Byte("byte"), - Completion("completion"), - ConstantKeyword("constant_keyword"), - - DateNanos("date_nanos"), - Date("date"), - + DateNanos("date_nanos"), DateRange("date_range"), - Double("double"), - DoubleRange("double_range"), - - Alias("alias"), - FlatObject("flat_object"), - Float("float"), - FloatRange("float_range"), - GeoPoint("geo_point"), - GeoShape("geo_shape"), - HalfFloat("half_float"), - Histogram("histogram"), - IcuCollationKeyword("icu_collation_keyword"), - Integer("integer"), - IntegerRange("integer_range"), - Ip("ip"), - IpRange("ip_range"), - Join("join"), - Keyword("keyword"), - KnnVector("knn_vector"), - Long("long"), - LongRange("long_range"), - + MatchOnlyText("match_only_text"), Murmur3("murmur3"), - Nested("nested"), - Object("object"), - Percolator("percolator"), - - Point("point"), - RankFeature("rank_feature"), - RankFeatures("rank_features"), - ScaledFloat("scaled_float"), - SearchAsYouType("search_as_you_type"), - - XyShape("xy_shape"), - Short("short"), - Text("text"), - TokenCount("token_count"), - UnsignedLong("unsigned_long"), - Version("version"), - Wildcard("wildcard"), - - ; + XyPoint("xy_point"), + XyShape("xy_shape"); private final String jsonValue; @@ -158,10 +115,10 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; @@ -178,20 +135,16 @@ public final PropertyVariant _get() { } public Property(PropertyVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._propertyKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private Property(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static Property of(Function> fn) { + public static Property of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -205,14 +158,28 @@ public boolean isAggregateMetricDouble() { /** * Get the {@code aggregate_metric_double} variant value. * - * @throws IllegalStateException - * if the current variant is not of the - * {@code aggregate_metric_double} kind. + * @throws IllegalStateException if the current variant is not the {@code aggregate_metric_double} kind. */ public AggregateMetricDoubleProperty aggregateMetricDouble() { return TaggedUnionUtils.get(this, Kind.AggregateMetricDouble); } + /** + * Is this variant instance of kind {@code alias}? + */ + public boolean isAlias() { + return _kind == Kind.Alias; + } + + /** + * Get the {@code alias} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code alias} kind. + */ + public FieldAliasProperty alias() { + return TaggedUnionUtils.get(this, Kind.Alias); + } + /** * Is this variant instance of kind {@code binary}? */ @@ -223,8 +190,7 @@ public boolean isBinary() { /** * Get the {@code binary} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code binary} kind. + * @throws IllegalStateException if the current variant is not the {@code binary} kind. */ public BinaryProperty binary() { return TaggedUnionUtils.get(this, Kind.Binary); @@ -240,8 +206,7 @@ public boolean isBoolean() { /** * Get the {@code boolean} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code boolean} kind. + * @throws IllegalStateException if the current variant is not the {@code boolean} kind. */ public BooleanProperty boolean_() { return TaggedUnionUtils.get(this, Kind.Boolean); @@ -257,8 +222,7 @@ public boolean isByte() { /** * Get the {@code byte} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code byte} kind. + * @throws IllegalStateException if the current variant is not the {@code byte} kind. */ public ByteNumberProperty byte_() { return TaggedUnionUtils.get(this, Kind.Byte); @@ -274,8 +238,7 @@ public boolean isCompletion() { /** * Get the {@code completion} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code completion} kind. + * @throws IllegalStateException if the current variant is not the {@code completion} kind. */ public CompletionProperty completion() { return TaggedUnionUtils.get(this, Kind.Completion); @@ -291,46 +254,42 @@ public boolean isConstantKeyword() { /** * Get the {@code constant_keyword} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code constant_keyword} - * kind. + * @throws IllegalStateException if the current variant is not the {@code constant_keyword} kind. */ public ConstantKeywordProperty constantKeyword() { return TaggedUnionUtils.get(this, Kind.ConstantKeyword); } /** - * Is this variant instance of kind {@code date_nanos}? + * Is this variant instance of kind {@code date}? */ - public boolean isDateNanos() { - return _kind == Kind.DateNanos; + public boolean isDate() { + return _kind == Kind.Date; } /** - * Get the {@code date_nanos} variant value. + * Get the {@code date} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date_nanos} kind. + * @throws IllegalStateException if the current variant is not the {@code date} kind. */ - public DateNanosProperty dateNanos() { - return TaggedUnionUtils.get(this, Kind.DateNanos); + public DateProperty date() { + return TaggedUnionUtils.get(this, Kind.Date); } /** - * Is this variant instance of kind {@code date}? + * Is this variant instance of kind {@code date_nanos}? */ - public boolean isDate() { - return _kind == Kind.Date; + public boolean isDateNanos() { + return _kind == Kind.DateNanos; } /** - * Get the {@code date} variant value. + * Get the {@code date_nanos} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date} kind. + * @throws IllegalStateException if the current variant is not the {@code date_nanos} kind. */ - public DateProperty date() { - return TaggedUnionUtils.get(this, Kind.Date); + public DateNanosProperty dateNanos() { + return TaggedUnionUtils.get(this, Kind.DateNanos); } /** @@ -343,8 +302,7 @@ public boolean isDateRange() { /** * Get the {@code date_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date_range} kind. + * @throws IllegalStateException if the current variant is not the {@code date_range} kind. */ public DateRangeProperty dateRange() { return TaggedUnionUtils.get(this, Kind.DateRange); @@ -360,8 +318,7 @@ public boolean isDouble() { /** * Get the {@code double} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code double} kind. + * @throws IllegalStateException if the current variant is not the {@code double} kind. */ public DoubleNumberProperty double_() { return TaggedUnionUtils.get(this, Kind.Double); @@ -377,30 +334,12 @@ public boolean isDoubleRange() { /** * Get the {@code double_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code double_range} kind. + * @throws IllegalStateException if the current variant is not the {@code double_range} kind. */ public DoubleRangeProperty doubleRange() { return TaggedUnionUtils.get(this, Kind.DoubleRange); } - /** - * Is this variant instance of kind {@code alias}? - */ - public boolean isAlias() { - return _kind == Kind.Alias; - } - - /** - * Get the {@code alias} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code alias} kind. - */ - public FieldAliasProperty alias() { - return TaggedUnionUtils.get(this, Kind.Alias); - } - /** * Is this variant instance of kind {@code flat_object}? */ @@ -411,8 +350,7 @@ public boolean isFlatObject() { /** * Get the {@code flat_object} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code flat_object} kind. + * @throws IllegalStateException if the current variant is not the {@code flat_object} kind. */ public FlatObjectProperty flatObject() { return TaggedUnionUtils.get(this, Kind.FlatObject); @@ -428,8 +366,7 @@ public boolean isFloat() { /** * Get the {@code float} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code float} kind. + * @throws IllegalStateException if the current variant is not the {@code float} kind. */ public FloatNumberProperty float_() { return TaggedUnionUtils.get(this, Kind.Float); @@ -445,8 +382,7 @@ public boolean isFloatRange() { /** * Get the {@code float_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code float_range} kind. + * @throws IllegalStateException if the current variant is not the {@code float_range} kind. */ public FloatRangeProperty floatRange() { return TaggedUnionUtils.get(this, Kind.FloatRange); @@ -462,8 +398,7 @@ public boolean isGeoPoint() { /** * Get the {@code geo_point} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_point} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_point} kind. */ public GeoPointProperty geoPoint() { return TaggedUnionUtils.get(this, Kind.GeoPoint); @@ -479,8 +414,7 @@ public boolean isGeoShape() { /** * Get the {@code geo_shape} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_shape} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_shape} kind. */ public GeoShapeProperty geoShape() { return TaggedUnionUtils.get(this, Kind.GeoShape); @@ -496,8 +430,7 @@ public boolean isHalfFloat() { /** * Get the {@code half_float} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code half_float} kind. + * @throws IllegalStateException if the current variant is not the {@code half_float} kind. */ public HalfFloatNumberProperty halfFloat() { return TaggedUnionUtils.get(this, Kind.HalfFloat); @@ -513,8 +446,7 @@ public boolean isHistogram() { /** * Get the {@code histogram} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code histogram} kind. + * @throws IllegalStateException if the current variant is not the {@code histogram} kind. */ public HistogramProperty histogram() { return TaggedUnionUtils.get(this, Kind.Histogram); @@ -530,8 +462,7 @@ public boolean isIcuCollationKeyword() { /** * Get the {@code icu_collation_keyword} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code icu_collation_keyword} kind. + * @throws IllegalStateException if the current variant is not the {@code icu_collation_keyword} kind. */ public IcuCollationKeywordProperty icuCollationKeyword() { return TaggedUnionUtils.get(this, Kind.IcuCollationKeyword); @@ -547,8 +478,7 @@ public boolean isInteger() { /** * Get the {@code integer} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code integer} kind. + * @throws IllegalStateException if the current variant is not the {@code integer} kind. */ public IntegerNumberProperty integer() { return TaggedUnionUtils.get(this, Kind.Integer); @@ -564,8 +494,7 @@ public boolean isIntegerRange() { /** * Get the {@code integer_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code integer_range} kind. + * @throws IllegalStateException if the current variant is not the {@code integer_range} kind. */ public IntegerRangeProperty integerRange() { return TaggedUnionUtils.get(this, Kind.IntegerRange); @@ -581,8 +510,7 @@ public boolean isIp() { /** * Get the {@code ip} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code ip} kind. + * @throws IllegalStateException if the current variant is not the {@code ip} kind. */ public IpProperty ip() { return TaggedUnionUtils.get(this, Kind.Ip); @@ -598,8 +526,7 @@ public boolean isIpRange() { /** * Get the {@code ip_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code ip_range} kind. + * @throws IllegalStateException if the current variant is not the {@code ip_range} kind. */ public IpRangeProperty ipRange() { return TaggedUnionUtils.get(this, Kind.IpRange); @@ -615,8 +542,7 @@ public boolean isJoin() { /** * Get the {@code join} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code join} kind. + * @throws IllegalStateException if the current variant is not the {@code join} kind. */ public JoinProperty join() { return TaggedUnionUtils.get(this, Kind.Join); @@ -632,8 +558,7 @@ public boolean isKeyword() { /** * Get the {@code keyword} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code keyword} kind. + * @throws IllegalStateException if the current variant is not the {@code keyword} kind. */ public KeywordProperty keyword() { return TaggedUnionUtils.get(this, Kind.Keyword); @@ -649,8 +574,7 @@ public boolean isKnnVector() { /** * Get the {@code knn_vector} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code knn_vector} kind. + * @throws IllegalStateException if the current variant is not the {@code knn_vector} kind. */ public KnnVectorProperty knnVector() { return TaggedUnionUtils.get(this, Kind.KnnVector); @@ -666,8 +590,7 @@ public boolean isLong() { /** * Get the {@code long} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code long} kind. + * @throws IllegalStateException if the current variant is not the {@code long} kind. */ public LongNumberProperty long_() { return TaggedUnionUtils.get(this, Kind.Long); @@ -683,13 +606,28 @@ public boolean isLongRange() { /** * Get the {@code long_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code long_range} kind. + * @throws IllegalStateException if the current variant is not the {@code long_range} kind. */ public LongRangeProperty longRange() { return TaggedUnionUtils.get(this, Kind.LongRange); } + /** + * Is this variant instance of kind {@code match_only_text}? + */ + public boolean isMatchOnlyText() { + return _kind == Kind.MatchOnlyText; + } + + /** + * Get the {@code match_only_text} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code match_only_text} kind. + */ + public MatchOnlyTextProperty matchOnlyText() { + return TaggedUnionUtils.get(this, Kind.MatchOnlyText); + } + /** * Is this variant instance of kind {@code murmur3}? */ @@ -700,8 +638,7 @@ public boolean isMurmur3() { /** * Get the {@code murmur3} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code murmur3} kind. + * @throws IllegalStateException if the current variant is not the {@code murmur3} kind. */ public Murmur3HashProperty murmur3() { return TaggedUnionUtils.get(this, Kind.Murmur3); @@ -717,8 +654,7 @@ public boolean isNested() { /** * Get the {@code nested} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code nested} kind. + * @throws IllegalStateException if the current variant is not the {@code nested} kind. */ public NestedProperty nested() { return TaggedUnionUtils.get(this, Kind.Nested); @@ -734,8 +670,7 @@ public boolean isObject() { /** * Get the {@code object} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code object} kind. + * @throws IllegalStateException if the current variant is not the {@code object} kind. */ public ObjectProperty object() { return TaggedUnionUtils.get(this, Kind.Object); @@ -751,30 +686,12 @@ public boolean isPercolator() { /** * Get the {@code percolator} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code percolator} kind. + * @throws IllegalStateException if the current variant is not the {@code percolator} kind. */ public PercolatorProperty percolator() { return TaggedUnionUtils.get(this, Kind.Percolator); } - /** - * Is this variant instance of kind {@code point}? - */ - public boolean isPoint() { - return _kind == Kind.Point; - } - - /** - * Get the {@code point} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code point} kind. - */ - public PointProperty point() { - return TaggedUnionUtils.get(this, Kind.Point); - } - /** * Is this variant instance of kind {@code rank_feature}? */ @@ -785,8 +702,7 @@ public boolean isRankFeature() { /** * Get the {@code rank_feature} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code rank_feature} kind. + * @throws IllegalStateException if the current variant is not the {@code rank_feature} kind. */ public RankFeatureProperty rankFeature() { return TaggedUnionUtils.get(this, Kind.RankFeature); @@ -802,8 +718,7 @@ public boolean isRankFeatures() { /** * Get the {@code rank_features} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code rank_features} kind. + * @throws IllegalStateException if the current variant is not the {@code rank_features} kind. */ public RankFeaturesProperty rankFeatures() { return TaggedUnionUtils.get(this, Kind.RankFeatures); @@ -819,8 +734,7 @@ public boolean isScaledFloat() { /** * Get the {@code scaled_float} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code scaled_float} kind. + * @throws IllegalStateException if the current variant is not the {@code scaled_float} kind. */ public ScaledFloatNumberProperty scaledFloat() { return TaggedUnionUtils.get(this, Kind.ScaledFloat); @@ -836,31 +750,12 @@ public boolean isSearchAsYouType() { /** * Get the {@code search_as_you_type} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code search_as_you_type} - * kind. + * @throws IllegalStateException if the current variant is not the {@code search_as_you_type} kind. */ public SearchAsYouTypeProperty searchAsYouType() { return TaggedUnionUtils.get(this, Kind.SearchAsYouType); } - /** - * Is this variant instance of kind {@code xy_shape}? - */ - public boolean isXyShape() { - return _kind == Kind.XyShape; - } - - /** - * Get the {@code xy_shape} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code xy_shape} kind. - */ - public XyShapeProperty xyShape() { - return TaggedUnionUtils.get(this, Kind.XyShape); - } - /** * Is this variant instance of kind {@code short}? */ @@ -871,8 +766,7 @@ public boolean isShort() { /** * Get the {@code short} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code short} kind. + * @throws IllegalStateException if the current variant is not the {@code short} kind. */ public ShortNumberProperty short_() { return TaggedUnionUtils.get(this, Kind.Short); @@ -888,8 +782,7 @@ public boolean isText() { /** * Get the {@code text} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code text} kind. + * @throws IllegalStateException if the current variant is not the {@code text} kind. */ public TextProperty text() { return TaggedUnionUtils.get(this, Kind.Text); @@ -905,8 +798,7 @@ public boolean isTokenCount() { /** * Get the {@code token_count} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code token_count} kind. + * @throws IllegalStateException if the current variant is not the {@code token_count} kind. */ public TokenCountProperty tokenCount() { return TaggedUnionUtils.get(this, Kind.TokenCount); @@ -922,8 +814,7 @@ public boolean isUnsignedLong() { /** * Get the {@code unsigned_long} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code unsigned_long} kind. + * @throws IllegalStateException if the current variant is not the {@code unsigned_long} kind. */ public UnsignedLongNumberProperty unsignedLong() { return TaggedUnionUtils.get(this, Kind.UnsignedLong); @@ -939,8 +830,7 @@ public boolean isVersion() { /** * Get the {@code version} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code version} kind. + * @throws IllegalStateException if the current variant is not the {@code version} kind. */ public VersionProperty version() { return TaggedUnionUtils.get(this, Kind.Version); @@ -956,18 +846,47 @@ public boolean isWildcard() { /** * Get the {@code wildcard} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code wildcard} kind. + * @throws IllegalStateException if the current variant is not the {@code wildcard} kind. */ public WildcardProperty wildcard() { return TaggedUnionUtils.get(this, Kind.Wildcard); } + /** + * Is this variant instance of kind {@code xy_point}? + */ + public boolean isXyPoint() { + return _kind == Kind.XyPoint; + } + + /** + * Get the {@code xy_point} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code xy_point} kind. + */ + public XyPointProperty xyPoint() { + return TaggedUnionUtils.get(this, Kind.XyPoint); + } + + /** + * Is this variant instance of kind {@code xy_shape}? + */ + public boolean isXyShape() { + return _kind == Kind.XyShape; + } + + /** + * Get the {@code xy_shape} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code xy_shape} kind. + */ + public XyShapeProperty xyShape() { + return TaggedUnionUtils.get(this, Kind.XyShape); + } + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { - mapper.serialize(_value, generator); - } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @@ -986,6 +905,16 @@ public ObjectBuilder aggregateMetricDouble( return this.aggregateMetricDouble(fn.apply(new AggregateMetricDoubleProperty.Builder()).build()); } + public ObjectBuilder alias(FieldAliasProperty v) { + this._kind = Kind.Alias; + this._value = v; + return this; + } + + public ObjectBuilder alias(Function> fn) { + return this.alias(fn.apply(new FieldAliasProperty.Builder()).build()); + } + public ObjectBuilder binary(BinaryProperty v) { this._kind = Kind.Binary; this._value = v; @@ -1038,24 +967,24 @@ public ObjectBuilder constantKeyword( return this.constantKeyword(fn.apply(new ConstantKeywordProperty.Builder()).build()); } - public ObjectBuilder dateNanos(DateNanosProperty v) { - this._kind = Kind.DateNanos; + public ObjectBuilder date(DateProperty v) { + this._kind = Kind.Date; this._value = v; return this; } - public ObjectBuilder dateNanos(Function> fn) { - return this.dateNanos(fn.apply(new DateNanosProperty.Builder()).build()); + public ObjectBuilder date(Function> fn) { + return this.date(fn.apply(new DateProperty.Builder()).build()); } - public ObjectBuilder date(DateProperty v) { - this._kind = Kind.Date; + public ObjectBuilder dateNanos(DateNanosProperty v) { + this._kind = Kind.DateNanos; this._value = v; return this; } - public ObjectBuilder date(Function> fn) { - return this.date(fn.apply(new DateProperty.Builder()).build()); + public ObjectBuilder dateNanos(Function> fn) { + return this.dateNanos(fn.apply(new DateNanosProperty.Builder()).build()); } public ObjectBuilder dateRange(DateRangeProperty v) { @@ -1088,16 +1017,6 @@ public ObjectBuilder doubleRange(Function alias(FieldAliasProperty v) { - this._kind = Kind.Alias; - this._value = v; - return this; - } - - public ObjectBuilder alias(Function> fn) { - return this.alias(fn.apply(new FieldAliasProperty.Builder()).build()); - } - public ObjectBuilder flatObject(FlatObjectProperty v) { this._kind = Kind.FlatObject; this._value = v; @@ -1270,6 +1189,16 @@ public ObjectBuilder longRange(Function matchOnlyText(MatchOnlyTextProperty v) { + this._kind = Kind.MatchOnlyText; + this._value = v; + return this; + } + + public ObjectBuilder matchOnlyText(Function> fn) { + return this.matchOnlyText(fn.apply(new MatchOnlyTextProperty.Builder()).build()); + } + public ObjectBuilder murmur3(Murmur3HashProperty v) { this._kind = Kind.Murmur3; this._value = v; @@ -1310,16 +1239,6 @@ public ObjectBuilder percolator(Function point(PointProperty v) { - this._kind = Kind.Point; - this._value = v; - return this; - } - - public ObjectBuilder point(Function> fn) { - return this.point(fn.apply(new PointProperty.Builder()).build()); - } - public ObjectBuilder rankFeature(RankFeatureProperty v) { this._kind = Kind.RankFeature; this._value = v; @@ -1364,16 +1283,6 @@ public ObjectBuilder searchAsYouType( return this.searchAsYouType(fn.apply(new SearchAsYouTypeProperty.Builder()).build()); } - public ObjectBuilder xyShape(XyShapeProperty v) { - this._kind = Kind.XyShape; - this._value = v; - return this; - } - - public ObjectBuilder xyShape(Function> fn) { - return this.xyShape(fn.apply(new XyShapeProperty.Builder()).build()); - } - public ObjectBuilder short_(ShortNumberProperty v) { this._kind = Kind.Short; this._value = v; @@ -1436,27 +1345,46 @@ public ObjectBuilder wildcard(Function xyPoint(XyPointProperty v) { + this._kind = Kind.XyPoint; + this._value = v; + return this; + } + + public ObjectBuilder xyPoint(Function> fn) { + return this.xyPoint(fn.apply(new XyPointProperty.Builder()).build()); + } + + public ObjectBuilder xyShape(XyShapeProperty v) { + this._kind = Kind.XyShape; + this._value = v; + return this; + } + + public ObjectBuilder xyShape(Function> fn) { + return this.xyShape(fn.apply(new XyShapeProperty.Builder()).build()); + } + + @Override public Property build() { _checkSingleUse(); return new Property(this); } - } protected static void setupPropertyDeserializer(ObjectDeserializer op) { - op.add(Builder::aggregateMetricDouble, AggregateMetricDoubleProperty._DESERIALIZER, "aggregate_metric_double"); + op.add(Builder::alias, FieldAliasProperty._DESERIALIZER, "alias"); op.add(Builder::binary, BinaryProperty._DESERIALIZER, "binary"); op.add(Builder::boolean_, BooleanProperty._DESERIALIZER, "boolean"); op.add(Builder::byte_, ByteNumberProperty._DESERIALIZER, "byte"); op.add(Builder::completion, CompletionProperty._DESERIALIZER, "completion"); op.add(Builder::constantKeyword, ConstantKeywordProperty._DESERIALIZER, "constant_keyword"); - op.add(Builder::dateNanos, DateNanosProperty._DESERIALIZER, "date_nanos"); op.add(Builder::date, DateProperty._DESERIALIZER, "date"); + op.add(Builder::dateNanos, DateNanosProperty._DESERIALIZER, "date_nanos"); op.add(Builder::dateRange, DateRangeProperty._DESERIALIZER, "date_range"); op.add(Builder::double_, DoubleNumberProperty._DESERIALIZER, "double"); op.add(Builder::doubleRange, DoubleRangeProperty._DESERIALIZER, "double_range"); - op.add(Builder::alias, FieldAliasProperty._DESERIALIZER, "alias"); op.add(Builder::flatObject, FlatObjectProperty._DESERIALIZER, "flat_object"); op.add(Builder::float_, FloatNumberProperty._DESERIALIZER, "float"); op.add(Builder::floatRange, FloatRangeProperty._DESERIALIZER, "float_range"); @@ -1474,25 +1402,25 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) op.add(Builder::knnVector, KnnVectorProperty._DESERIALIZER, "knn_vector"); op.add(Builder::long_, LongNumberProperty._DESERIALIZER, "long"); op.add(Builder::longRange, LongRangeProperty._DESERIALIZER, "long_range"); + op.add(Builder::matchOnlyText, MatchOnlyTextProperty._DESERIALIZER, "match_only_text"); op.add(Builder::murmur3, Murmur3HashProperty._DESERIALIZER, "murmur3"); op.add(Builder::nested, NestedProperty._DESERIALIZER, "nested"); op.add(Builder::object, ObjectProperty._DESERIALIZER, "object"); op.add(Builder::percolator, PercolatorProperty._DESERIALIZER, "percolator"); - op.add(Builder::point, PointProperty._DESERIALIZER, "point"); op.add(Builder::rankFeature, RankFeatureProperty._DESERIALIZER, "rank_feature"); op.add(Builder::rankFeatures, RankFeaturesProperty._DESERIALIZER, "rank_features"); op.add(Builder::scaledFloat, ScaledFloatNumberProperty._DESERIALIZER, "scaled_float"); op.add(Builder::searchAsYouType, SearchAsYouTypeProperty._DESERIALIZER, "search_as_you_type"); - op.add(Builder::xyShape, XyShapeProperty._DESERIALIZER, "xy_shape"); op.add(Builder::short_, ShortNumberProperty._DESERIALIZER, "short"); op.add(Builder::text, TextProperty._DESERIALIZER, "text"); op.add(Builder::tokenCount, TokenCountProperty._DESERIALIZER, "token_count"); op.add(Builder::unsignedLong, UnsignedLongNumberProperty._DESERIALIZER, "unsigned_long"); op.add(Builder::version, VersionProperty._DESERIALIZER, "version"); op.add(Builder::wildcard, WildcardProperty._DESERIALIZER, "wildcard"); + op.add(Builder::xyPoint, XyPointProperty._DESERIALIZER, "xy_point"); + op.add(Builder::xyShape, XyShapeProperty._DESERIALIZER, "xy_shape"); - op.setTypeProperty("type", "object"); - + op.setTypeProperty("type", Kind.Object.jsonValue()); } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -1500,4 +1428,20 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) Property::setupPropertyDeserializer, Builder::build ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Property other = (Property) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java similarity index 77% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java index 422149d5b5..6408ccfb65 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBase.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; @@ -47,65 +53,48 @@ // typedef: _types.mapping.PropertyBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class PropertyBase implements PlainJsonSerializable { - private final Map localMetadata; - - private final Map meta; @Nullable - private final String name; + private final DynamicMapping dynamic; - private final Map properties; + @Nonnull + private final Map fields; @Nullable private final Integer ignoreAbove; - @Nullable - private final DynamicMapping dynamic; + @Nonnull + private final Map meta; - private final Map fields; + @Nonnull + private final Map properties; // --------------------------------------------------------------------------------------------- protected PropertyBase(AbstractBuilder builder) { - - this.localMetadata = ApiTypeHelper.unmodifiable(builder.localMetadata); - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.name = builder.name; - this.properties = ApiTypeHelper.unmodifiable(builder.properties); - this.ignoreAbove = builder.ignoreAbove; this.dynamic = builder.dynamic; this.fields = ApiTypeHelper.unmodifiable(builder.fields); - - } - - /** - * API name: {@code local_metadata} - */ - public final Map localMetadata() { - return this.localMetadata; - } - - /** - * API name: {@code meta} - */ - public final Map meta() { - return this.meta; + this.ignoreAbove = builder.ignoreAbove; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.properties = ApiTypeHelper.unmodifiable(builder.properties); } /** - * API name: {@code name} + * API name: {@code dynamic} */ @Nullable - public final String name() { - return this.name; + public final DynamicMapping dynamic() { + return this.dynamic; } /** - * API name: {@code properties} + * API name: {@code fields} */ - public final Map properties() { - return this.properties; + @Nonnull + public final Map fields() { + return this.fields; } /** @@ -117,23 +106,28 @@ public final Integer ignoreAbove() { } /** - * API name: {@code dynamic} + * Metadata about the field. + *

+ * API name: {@code meta} + *

*/ - @Nullable - public final DynamicMapping dynamic() { - return this.dynamic; + @Nonnull + public final Map meta() { + return this.meta; } /** - * API name: {@code fields} + * API name: {@code properties} */ - public final Map fields() { - return this.fields; + @Nonnull + public final Map properties() { + return this.properties; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -141,114 +135,121 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.dynamic != null) { + generator.writeKey("dynamic"); + this.dynamic.serialize(generator, mapper); + } - if (ApiTypeHelper.isDefined(this.localMetadata)) { - generator.writeKey("local_metadata"); + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); generator.writeStartObject(); - for (Map.Entry item0 : this.localMetadata.entrySet()) { + for (Map.Entry item0 : this.fields.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.ignoreAbove != null) { + generator.writeKey("ignore_above"); + generator.write(this.ignoreAbove); } + if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("meta"); generator.writeStartObject(); for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - } - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); - } if (ApiTypeHelper.isDefined(this.properties)) { generator.writeKey("properties"); generator.writeStartObject(); for (Map.Entry item0 : this.properties.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.ignoreAbove != null) { - generator.writeKey("ignore_above"); - generator.write(this.ignoreAbove); - - } - if (this.dynamic != null) { - generator.writeKey("dynamic"); - this.dynamic.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable - private Map localMetadata; - + private DynamicMapping dynamic; @Nullable - private Map meta; - + private Map fields; @Nullable - private String name; - + private Integer ignoreAbove; @Nullable - private Map properties; - + private Map meta; @Nullable - private Integer ignoreAbove; + private Map properties; - @Nullable - private DynamicMapping dynamic; + /** + * API name: {@code dynamic} + */ + public final BuilderT dynamic(@Nullable DynamicMapping value) { + this.dynamic = value; + return self(); + } - @Nullable - private Map fields; + /** + * API name: {@code fields} + * + *

+ * Adds all elements of map to fields. + *

+ */ + public final BuilderT fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return self(); + } /** - * API name: {@code local_metadata} + * API name: {@code fields} + * *

- * Adds all entries of map to localMetadata. + * Adds an entry to fields. + *

*/ - public final BuilderT localMetadata(Map map) { - this.localMetadata = _mapPutAll(this.localMetadata, map); + public final BuilderT fields(String key, Property value) { + this.fields = _mapPut(this.fields, key, value); return self(); } /** - * API name: {@code local_metadata} + * API name: {@code fields} + * *

- * Adds an entry to localMetadata. + * Adds a value to fields using a builder lambda. + *

*/ - public final BuilderT localMetadata(String key, JsonData value) { - this.localMetadata = _mapPut(this.localMetadata, key, value); + public final BuilderT fields(String key, Function> fn) { + return fields(key, fn.apply(new Property.Builder()).build()); + } + + /** + * API name: {@code ignore_above} + */ + public final BuilderT ignoreAbove(@Nullable Integer value) { + this.ignoreAbove = value; return self(); } /** + * Metadata about the field. + *

* API name: {@code meta} + *

+ * *

- * Adds all entries of map to meta. + * Adds all elements of map to meta. + *

*/ public final BuilderT meta(Map map) { this.meta = _mapPutAll(this.meta, map); @@ -256,27 +257,26 @@ public final BuilderT meta(Map map) { } /** + * Metadata about the field. + *

* API name: {@code meta} + *

+ * *

* Adds an entry to meta. + *

*/ public final BuilderT meta(String key, String value) { this.meta = _mapPut(this.meta, key, value); return self(); } - /** - * API name: {@code name} - */ - public final BuilderT name(@Nullable String value) { - this.name = value; - return self(); - } - /** * API name: {@code properties} + * *

- * Adds all entries of map to properties. + * Adds all elements of map to properties. + *

*/ public final BuilderT properties(Map map) { this.properties = _mapPutAll(this.properties, map); @@ -285,8 +285,10 @@ public final BuilderT properties(Map map) { /** * API name: {@code properties} + * *

* Adds an entry to properties. + *

*/ public final BuilderT properties(String key, Property value) { this.properties = _mapPut(this.properties, key, value); @@ -295,73 +297,48 @@ public final BuilderT properties(String key, Property value) { /** * API name: {@code properties} + * *

- * Adds an entry to properties using a builder lambda. + * Adds a value to properties using a builder lambda. + *

*/ public final BuilderT properties(String key, Function> fn) { return properties(key, fn.apply(new Property.Builder()).build()); } - /** - * API name: {@code ignore_above} - */ - public final BuilderT ignoreAbove(@Nullable Integer value) { - this.ignoreAbove = value; - return self(); - } - - /** - * API name: {@code dynamic} - */ - public final BuilderT dynamic(@Nullable DynamicMapping value) { - this.dynamic = value; - return self(); - } - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final BuilderT fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return self(); - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final BuilderT fields(String key, Property value) { - this.fields = _mapPut(this.fields, key, value); - return self(); - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields using a builder lambda. - */ - public final BuilderT fields(String key, Function> fn) { - return fields(key, fn.apply(new Property.Builder()).build()); - } - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- - protected static > void setupPropertyBaseDeserializer(ObjectDeserializer op) { - op.add(AbstractBuilder::localMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "local_metadata"); - op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "meta"); - op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(AbstractBuilder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "properties"); - op.add(AbstractBuilder::ignoreAbove, JsonpDeserializer.integerDeserializer(), "ignore_above"); + protected static > void setupPropertyBaseDeserializer(ObjectDeserializer op) { op.add(AbstractBuilder::dynamic, DynamicMapping._DESERIALIZER, "dynamic"); op.add(AbstractBuilder::fields, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "fields"); + op.add(AbstractBuilder::ignoreAbove, JsonpDeserializer.integerDeserializer(), "ignore_above"); + op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "meta"); + op.add(AbstractBuilder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "properties"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.dynamic); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.ignoreAbove); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + Objects.hashCode(this.properties); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PropertyBase other = (PropertyBase) o; + return Objects.equals(this.dynamic, other.dynamic) + && Objects.equals(this.fields, other.fields) + && Objects.equals(this.ignoreAbove, other.ignoreAbove) + && Objects.equals(this.meta, other.meta) + && Objects.equals(this.properties, other.properties); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java index 4afb4b9f2f..db1850e193 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyBuilders.java @@ -30,176 +30,170 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; +import javax.annotation.Generated; + /** * Builders for {@link Property} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class PropertyBuilders { private PropertyBuilders() {} /** - * Creates a builder for the {@link AggregateMetricDoubleProperty - * aggregate_metric_double} {@code Property} variant. + * Creates a builder for the {@link AggregateMetricDoubleProperty aggregate_metric_double} {@code Property} variant. */ public static AggregateMetricDoubleProperty.Builder aggregateMetricDouble() { return new AggregateMetricDoubleProperty.Builder(); } /** - * Creates a builder for the {@link BinaryProperty binary} {@code Property} - * variant. + * Creates a builder for the {@link FieldAliasProperty alias} {@code Property} variant. + */ + public static FieldAliasProperty.Builder alias() { + return new FieldAliasProperty.Builder(); + } + + /** + * Creates a builder for the {@link BinaryProperty binary} {@code Property} variant. */ public static BinaryProperty.Builder binary() { return new BinaryProperty.Builder(); } /** - * Creates a builder for the {@link BooleanProperty boolean} {@code Property} - * variant. + * Creates a builder for the {@link BooleanProperty boolean} {@code Property} variant. */ public static BooleanProperty.Builder boolean_() { return new BooleanProperty.Builder(); } /** - * Creates a builder for the {@link ByteNumberProperty byte} {@code Property} - * variant. + * Creates a builder for the {@link ByteNumberProperty byte} {@code Property} variant. */ public static ByteNumberProperty.Builder byte_() { return new ByteNumberProperty.Builder(); } /** - * Creates a builder for the {@link CompletionProperty completion} - * {@code Property} variant. + * Creates a builder for the {@link CompletionProperty completion} {@code Property} variant. */ public static CompletionProperty.Builder completion() { return new CompletionProperty.Builder(); } /** - * Creates a builder for the {@link ConstantKeywordProperty constant_keyword} - * {@code Property} variant. + * Creates a builder for the {@link ConstantKeywordProperty constant_keyword} {@code Property} variant. */ public static ConstantKeywordProperty.Builder constantKeyword() { return new ConstantKeywordProperty.Builder(); } /** - * Creates a builder for the {@link DateNanosProperty date_nanos} - * {@code Property} variant. + * Creates a builder for the {@link DateProperty date} {@code Property} variant. */ - public static DateNanosProperty.Builder dateNanos() { - return new DateNanosProperty.Builder(); + public static DateProperty.Builder date() { + return new DateProperty.Builder(); } /** - * Creates a builder for the {@link DateProperty date} {@code Property} variant. + * Creates a builder for the {@link DateNanosProperty date_nanos} {@code Property} variant. */ - public static DateProperty.Builder date() { - return new DateProperty.Builder(); + public static DateNanosProperty.Builder dateNanos() { + return new DateNanosProperty.Builder(); } /** - * Creates a builder for the {@link DateRangeProperty date_range} - * {@code Property} variant. + * Creates a builder for the {@link DateRangeProperty date_range} {@code Property} variant. */ public static DateRangeProperty.Builder dateRange() { return new DateRangeProperty.Builder(); } /** - * Creates a builder for the {@link DoubleNumberProperty double} - * {@code Property} variant. + * Creates a builder for the {@link DoubleNumberProperty double} {@code Property} variant. */ public static DoubleNumberProperty.Builder double_() { return new DoubleNumberProperty.Builder(); } /** - * Creates a builder for the {@link DoubleRangeProperty double_range} - * {@code Property} variant. + * Creates a builder for the {@link DoubleRangeProperty double_range} {@code Property} variant. */ public static DoubleRangeProperty.Builder doubleRange() { return new DoubleRangeProperty.Builder(); } /** - * Creates a builder for the {@link FieldAliasProperty alias} {@code Property} - * variant. - */ - public static FieldAliasProperty.Builder alias() { - return new FieldAliasProperty.Builder(); - } - - /** - * Creates a builder for the {@link FlatObjectProperty flatObject} - * {@code Property} variant. + * Creates a builder for the {@link FlatObjectProperty flat_object} {@code Property} variant. */ public static FlatObjectProperty.Builder flatObject() { return new FlatObjectProperty.Builder(); } /** - * Creates a builder for the {@link FloatNumberProperty float} {@code Property} - * variant. + * Creates a builder for the {@link FloatNumberProperty float} {@code Property} variant. */ public static FloatNumberProperty.Builder float_() { return new FloatNumberProperty.Builder(); } /** - * Creates a builder for the {@link FloatRangeProperty float_range} - * {@code Property} variant. + * Creates a builder for the {@link FloatRangeProperty float_range} {@code Property} variant. */ public static FloatRangeProperty.Builder floatRange() { return new FloatRangeProperty.Builder(); } /** - * Creates a builder for the {@link GeoPointProperty geo_point} {@code Property} - * variant. + * Creates a builder for the {@link GeoPointProperty geo_point} {@code Property} variant. */ public static GeoPointProperty.Builder geoPoint() { return new GeoPointProperty.Builder(); } /** - * Creates a builder for the {@link GeoShapeProperty geo_shape} {@code Property} - * variant. + * Creates a builder for the {@link GeoShapeProperty geo_shape} {@code Property} variant. */ public static GeoShapeProperty.Builder geoShape() { return new GeoShapeProperty.Builder(); } /** - * Creates a builder for the {@link HalfFloatNumberProperty half_float} - * {@code Property} variant. + * Creates a builder for the {@link HalfFloatNumberProperty half_float} {@code Property} variant. */ public static HalfFloatNumberProperty.Builder halfFloat() { return new HalfFloatNumberProperty.Builder(); } /** - * Creates a builder for the {@link HistogramProperty histogram} - * {@code Property} variant. + * Creates a builder for the {@link HistogramProperty histogram} {@code Property} variant. */ public static HistogramProperty.Builder histogram() { return new HistogramProperty.Builder(); } /** - * Creates a builder for the {@link IntegerNumberProperty integer} - * {@code Property} variant. + * Creates a builder for the {@link IcuCollationKeywordProperty icu_collation_keyword} {@code Property} variant. + */ + public static IcuCollationKeywordProperty.Builder icuCollationKeyword() { + return new IcuCollationKeywordProperty.Builder(); + } + + /** + * Creates a builder for the {@link IntegerNumberProperty integer} {@code Property} variant. */ public static IntegerNumberProperty.Builder integer() { return new IntegerNumberProperty.Builder(); } /** - * Creates a builder for the {@link IntegerRangeProperty integer_range} - * {@code Property} variant. + * Creates a builder for the {@link IntegerRangeProperty integer_range} {@code Property} variant. */ public static IntegerRangeProperty.Builder integerRange() { return new IntegerRangeProperty.Builder(); @@ -213,8 +207,7 @@ public static IpProperty.Builder ip() { } /** - * Creates a builder for the {@link IpRangeProperty ip_range} {@code Property} - * variant. + * Creates a builder for the {@link IpRangeProperty ip_range} {@code Property} variant. */ public static IpRangeProperty.Builder ipRange() { return new IpRangeProperty.Builder(); @@ -228,120 +221,98 @@ public static JoinProperty.Builder join() { } /** - * Creates a builder for the {@link KeywordProperty keyword} {@code Property} - * variant. + * Creates a builder for the {@link KeywordProperty keyword} {@code Property} variant. */ public static KeywordProperty.Builder keyword() { return new KeywordProperty.Builder(); } /** - * Creates a builder for the {@link KnnVectorProperty long} {@code Property} - * variant. + * Creates a builder for the {@link KnnVectorProperty knn_vector} {@code Property} variant. */ public static KnnVectorProperty.Builder knnVector() { return new KnnVectorProperty.Builder(); } /** - * Creates a builder for the {@link LongNumberProperty long} {@code Property} - * variant. + * Creates a builder for the {@link LongNumberProperty long} {@code Property} variant. */ public static LongNumberProperty.Builder long_() { return new LongNumberProperty.Builder(); } /** - * Creates a builder for the {@link LongRangeProperty long_range} - * {@code Property} variant. + * Creates a builder for the {@link LongRangeProperty long_range} {@code Property} variant. */ public static LongRangeProperty.Builder longRange() { return new LongRangeProperty.Builder(); } /** - * Creates a builder for the {@link Murmur3HashProperty murmur3} - * {@code Property} variant. + * Creates a builder for the {@link MatchOnlyTextProperty match_only_text} {@code Property} variant. + */ + public static MatchOnlyTextProperty.Builder matchOnlyText() { + return new MatchOnlyTextProperty.Builder(); + } + + /** + * Creates a builder for the {@link Murmur3HashProperty murmur3} {@code Property} variant. */ public static Murmur3HashProperty.Builder murmur3() { return new Murmur3HashProperty.Builder(); } /** - * Creates a builder for the {@link NestedProperty nested} {@code Property} - * variant. + * Creates a builder for the {@link NestedProperty nested} {@code Property} variant. */ public static NestedProperty.Builder nested() { return new NestedProperty.Builder(); } /** - * Creates a builder for the {@link ObjectProperty object} {@code Property} - * variant. + * Creates a builder for the {@link ObjectProperty object} {@code Property} variant. */ public static ObjectProperty.Builder object() { return new ObjectProperty.Builder(); } /** - * Creates a builder for the {@link PercolatorProperty percolator} - * {@code Property} variant. + * Creates a builder for the {@link PercolatorProperty percolator} {@code Property} variant. */ public static PercolatorProperty.Builder percolator() { return new PercolatorProperty.Builder(); } /** - * Creates a builder for the {@link PointProperty point} {@code Property} - * variant. - */ - public static PointProperty.Builder point() { - return new PointProperty.Builder(); - } - - /** - * Creates a builder for the {@link RankFeatureProperty rank_feature} - * {@code Property} variant. + * Creates a builder for the {@link RankFeatureProperty rank_feature} {@code Property} variant. */ public static RankFeatureProperty.Builder rankFeature() { return new RankFeatureProperty.Builder(); } /** - * Creates a builder for the {@link RankFeaturesProperty rank_features} - * {@code Property} variant. + * Creates a builder for the {@link RankFeaturesProperty rank_features} {@code Property} variant. */ public static RankFeaturesProperty.Builder rankFeatures() { return new RankFeaturesProperty.Builder(); } /** - * Creates a builder for the {@link ScaledFloatNumberProperty scaled_float} - * {@code Property} variant. + * Creates a builder for the {@link ScaledFloatNumberProperty scaled_float} {@code Property} variant. */ public static ScaledFloatNumberProperty.Builder scaledFloat() { return new ScaledFloatNumberProperty.Builder(); } /** - * Creates a builder for the {@link SearchAsYouTypeProperty search_as_you_type} - * {@code Property} variant. + * Creates a builder for the {@link SearchAsYouTypeProperty search_as_you_type} {@code Property} variant. */ public static SearchAsYouTypeProperty.Builder searchAsYouType() { return new SearchAsYouTypeProperty.Builder(); } /** - * Creates a builder for the {@link XyShapeProperty xy_shape} {@code Property} - * variant. - */ - public static XyShapeProperty.Builder xyShape() { - return new XyShapeProperty.Builder(); - } - - /** - * Creates a builder for the {@link ShortNumberProperty short} {@code Property} - * variant. + * Creates a builder for the {@link ShortNumberProperty short} {@code Property} variant. */ public static ShortNumberProperty.Builder short_() { return new ShortNumberProperty.Builder(); @@ -355,35 +326,44 @@ public static TextProperty.Builder text() { } /** - * Creates a builder for the {@link TokenCountProperty token_count} - * {@code Property} variant. + * Creates a builder for the {@link TokenCountProperty token_count} {@code Property} variant. */ public static TokenCountProperty.Builder tokenCount() { return new TokenCountProperty.Builder(); } /** - * Creates a builder for the {@link UnsignedLongNumberProperty unsigned_long} - * {@code Property} variant. + * Creates a builder for the {@link UnsignedLongNumberProperty unsigned_long} {@code Property} variant. */ public static UnsignedLongNumberProperty.Builder unsignedLong() { return new UnsignedLongNumberProperty.Builder(); } /** - * Creates a builder for the {@link VersionProperty version} {@code Property} - * variant. + * Creates a builder for the {@link VersionProperty version} {@code Property} variant. */ public static VersionProperty.Builder version() { return new VersionProperty.Builder(); } /** - * Creates a builder for the {@link WildcardProperty wildcard} {@code Property} - * variant. + * Creates a builder for the {@link WildcardProperty wildcard} {@code Property} variant. */ public static WildcardProperty.Builder wildcard() { return new WildcardProperty.Builder(); } + /** + * Creates a builder for the {@link XyPointProperty xy_point} {@code Property} variant. + */ + public static XyPointProperty.Builder xyPoint() { + return new XyPointProperty.Builder(); + } + + /** + * Creates a builder for the {@link XyShapeProperty xy_shape} {@code Property} variant. + */ + public static XyShapeProperty.Builder xyShape() { + return new XyShapeProperty.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java index 389f1e07f3..067fa6e2f1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/PropertyVariant.java @@ -30,19 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpSerializable; /** * Base interface for {@link Property} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface PropertyVariant extends JsonpSerializable { - Property.Kind _propertyKind(); default Property _toProperty() { return new Property(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java index 26bbd76d0e..63f46fac1a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RangePropertyBase.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,7 +46,9 @@ // typedef: _types.mapping.RangePropertyBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class RangePropertyBase extends DocValuesPropertyBase { + @Nullable private final Double boost; @@ -54,11 +62,9 @@ public abstract class RangePropertyBase extends DocValuesPropertyBase { protected RangePropertyBase(AbstractBuilder builder) { super(builder); - this.boost = builder.boost; this.coerce = builder.coerce; this.index = builder.index; - } /** @@ -86,34 +92,31 @@ public final Boolean index() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.coerce != null) { generator.writeKey("coerce"); generator.write(this.coerce); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends DocValuesPropertyBase.AbstractBuilder { @Nullable private Double boost; - @Nullable private Boolean coerce; - @Nullable private Boolean index; @@ -144,12 +147,33 @@ public final BuilderT index(@Nullable Boolean value) { } // --------------------------------------------------------------------------------------------- + protected static > void setupRangePropertyBaseDeserializer(ObjectDeserializer op) { setupDocValuesPropertyBaseDeserializer(op); op.add(AbstractBuilder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); op.add(AbstractBuilder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); op.add(AbstractBuilder::index, JsonpDeserializer.booleanDeserializer(), "index"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.boost); + result = 31 * result + Objects.hashCode(this.coerce); + result = 31 * result + Objects.hashCode(this.index); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RangePropertyBase other = (RangePropertyBase) o; + return Objects.equals(this.boost, other.boost) + && Objects.equals(this.coerce, other.coerce) + && Objects.equals(this.index, other.index); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java index a92318c6e0..90da23afbb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeatureProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.RankFeatureProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class RankFeatureProperty extends PropertyBase implements PropertyVariant { + @Nullable private final Boolean positiveScoreImpact; @@ -53,17 +61,15 @@ public class RankFeatureProperty extends PropertyBase implements PropertyVariant private RankFeatureProperty(Builder builder) { super(builder); - this.positiveScoreImpact = builder.positiveScoreImpact; - } - public static RankFeatureProperty of(Function> fn) { + public static RankFeatureProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Boolean positiveScoreImpact() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "rank_feature"); super.serializeInternal(generator, mapper); if (this.positiveScoreImpact != null) { generator.writeKey("positive_score_impact"); generator.write(this.positiveScoreImpact); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link RankFeatureProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean positiveScoreImpact; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link RankFeatureProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public RankFeatureProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public RankFeatureProperty build() { ); protected static void setupRankFeaturePropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.add(Builder::positiveScoreImpact, JsonpDeserializer.booleanDeserializer(), "positive_score_impact"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.positiveScoreImpact); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RankFeatureProperty other = (RankFeatureProperty) o; + return Objects.equals(this.positiveScoreImpact, other.positiveScoreImpact); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java index 5cc98be480..6aea29a5b9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/RankFeaturesProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.RankFeaturesProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class RankFeaturesProperty extends PropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private RankFeaturesProperty(Builder builder) { super(builder); - } - public static RankFeaturesProperty of(Function> fn) { + public static RankFeaturesProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "rank_features"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link RankFeaturesProperty}. */ - public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link RankFeaturesProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public RankFeaturesProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public RankFeaturesProperty build() { ); protected static void setupRankFeaturesPropertyDeserializer(ObjectDeserializer op) { - PropertyBase.setupPropertyBaseDeserializer(op); + setupPropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java index 1772f41644..ea0db8fe34 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ScaledFloatNumberProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,9 +51,8 @@ // typedef: _types.mapping.ScaledFloatNumberProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ScaledFloatNumberProperty extends NumberPropertyBase implements PropertyVariant { - @Nullable - private final Boolean coerce; @Nullable private final Double nullValue; @@ -59,33 +64,22 @@ public class ScaledFloatNumberProperty extends NumberPropertyBase implements Pro private ScaledFloatNumberProperty(Builder builder) { super(builder); - - this.coerce = builder.coerce; this.nullValue = builder.nullValue; this.scalingFactor = builder.scalingFactor; - } - public static ScaledFloatNumberProperty of(Function> fn) { + public static ScaledFloatNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { return Property.Kind.ScaledFloat; } - /** - * API name: {@code coerce} - */ - @Nullable - public final Boolean coerce() { - return this.coerce; - } - /** * API name: {@code null_value} */ @@ -103,25 +97,17 @@ public final Double scalingFactor() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "scaled_float"); super.serializeInternal(generator, mapper); - if (this.coerce != null) { - generator.writeKey("coerce"); - generator.write(this.coerce); - - } if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } + if (this.scalingFactor != null) { generator.writeKey("scaling_factor"); generator.write(this.scalingFactor); - } - } // --------------------------------------------------------------------------------------------- @@ -129,25 +115,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ScaledFloatNumberProperty}. */ - public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean coerce; - @Nullable private Double nullValue; - @Nullable private Double scalingFactor; - /** - * API name: {@code coerce} - */ - public final Builder coerce(@Nullable Boolean value) { - this.coerce = value; - return this; - } - /** * API name: {@code null_value} */ @@ -172,8 +145,7 @@ protected Builder self() { /** * Builds a {@link ScaledFloatNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ScaledFloatNumberProperty build() { _checkSingleUse(); @@ -194,11 +166,28 @@ public ScaledFloatNumberProperty build() { protected static void setupScaledFloatNumberPropertyDeserializer(ObjectDeserializer op) { setupNumberPropertyBaseDeserializer(op); - op.add(Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); op.add(Builder::nullValue, JsonpDeserializer.doubleDeserializer(), "null_value"); op.add(Builder::scalingFactor, JsonpDeserializer.doubleDeserializer(), "scaling_factor"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + result = 31 * result + Objects.hashCode(this.scalingFactor); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ScaledFloatNumberProperty other = (ScaledFloatNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue) && Objects.equals(this.scalingFactor, other.scalingFactor); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java index 9fc685f8d3..39c0f6bfce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SearchAsYouTypeProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.SearchAsYouTypeProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class SearchAsYouTypeProperty extends CorePropertyBase implements PropertyVariant { + @Nullable private final String analyzer; @@ -74,7 +82,6 @@ public class SearchAsYouTypeProperty extends CorePropertyBase implements Propert private SearchAsYouTypeProperty(Builder builder) { super(builder); - this.analyzer = builder.analyzer; this.index = builder.index; this.indexOptions = builder.indexOptions; @@ -83,15 +90,14 @@ private SearchAsYouTypeProperty(Builder builder) { this.searchAnalyzer = builder.searchAnalyzer; this.searchQuoteAnalyzer = builder.searchQuoteAnalyzer; this.termVector = builder.termVector; - } - public static SearchAsYouTypeProperty of(Function> fn) { + public static SearchAsYouTypeProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -163,48 +169,47 @@ public final TermVectorOption termVector() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "search_as_you_type"); super.serializeInternal(generator, mapper); if (this.analyzer != null) { generator.writeKey("analyzer"); generator.write(this.analyzer); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.indexOptions != null) { generator.writeKey("index_options"); this.indexOptions.serialize(generator, mapper); } + if (this.maxShingleSize != null) { generator.writeKey("max_shingle_size"); generator.write(this.maxShingleSize); - } + if (this.norms != null) { generator.writeKey("norms"); generator.write(this.norms); - } + if (this.searchAnalyzer != null) { generator.writeKey("search_analyzer"); generator.write(this.searchAnalyzer); - } + if (this.searchQuoteAnalyzer != null) { generator.writeKey("search_quote_analyzer"); generator.write(this.searchQuoteAnalyzer); - } + if (this.termVector != null) { generator.writeKey("term_vector"); this.termVector.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- @@ -212,29 +217,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link SearchAsYouTypeProperty}. */ - public static class Builder extends CorePropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String analyzer; - @Nullable private Boolean index; - @Nullable private IndexOptions indexOptions; - @Nullable private Integer maxShingleSize; - @Nullable private Boolean norms; - @Nullable private String searchAnalyzer; - @Nullable private String searchQuoteAnalyzer; - @Nullable private TermVectorOption termVector; @@ -310,8 +307,7 @@ protected Builder self() { /** * Builds a {@link SearchAsYouTypeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public SearchAsYouTypeProperty build() { _checkSingleUse(); @@ -344,4 +340,35 @@ protected static void setupSearchAsYouTypePropertyDeserializer(ObjectDeserialize op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.analyzer); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.indexOptions); + result = 31 * result + Objects.hashCode(this.maxShingleSize); + result = 31 * result + Objects.hashCode(this.norms); + result = 31 * result + Objects.hashCode(this.searchAnalyzer); + result = 31 * result + Objects.hashCode(this.searchQuoteAnalyzer); + result = 31 * result + Objects.hashCode(this.termVector); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SearchAsYouTypeProperty other = (SearchAsYouTypeProperty) o; + return Objects.equals(this.analyzer, other.analyzer) + && Objects.equals(this.index, other.index) + && Objects.equals(this.indexOptions, other.indexOptions) + && Objects.equals(this.maxShingleSize, other.maxShingleSize) + && Objects.equals(this.norms, other.norms) + && Objects.equals(this.searchAnalyzer, other.searchAnalyzer) + && Objects.equals(this.searchQuoteAnalyzer, other.searchQuoteAnalyzer) + && Objects.equals(this.termVector, other.termVector); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java index fd9e1694c8..28fd07e052 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/ShortNumberProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.ShortNumberProperty @JsonpDeserializable -public class ShortNumberProperty extends StandardNumberProperty implements PropertyVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShortNumberProperty extends NumberPropertyBase implements PropertyVariant { + @Nullable private final Number nullValue; @@ -53,17 +61,15 @@ public class ShortNumberProperty extends StandardNumberProperty implements Prope private ShortNumberProperty(Builder builder) { super(builder); - this.nullValue = builder.nullValue; - } - public static ShortNumberProperty of(Function> fn) { + public static ShortNumberProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final Number nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "short"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue.doubleValue()); - } - } // --------------------------------------------------------------------------------------------- @@ -95,8 +98,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ShortNumberProperty}. */ - - public static class Builder extends StandardNumberProperty.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Number nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link ShortNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ShortNumberProperty build() { _checkSingleUse(); @@ -137,10 +138,27 @@ public ShortNumberProperty build() { ); protected static void setupShortNumberPropertyDeserializer(ObjectDeserializer op) { - StandardNumberProperty.setupStandardNumberPropertyDeserializer(op); + setupNumberPropertyBaseDeserializer(op); op.add(Builder::nullValue, JsonpDeserializer.numberDeserializer(), "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShortNumberProperty other = (ShortNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java index 3315a15bfb..0bd7544f7d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/SuggestContext.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -48,35 +55,38 @@ // typedef: _types.mapping.SuggestContext @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class SuggestContext implements PlainJsonSerializable { + + @Nonnull private final String name; @Nullable private final String path; - private final String type; - @Nullable private final String precision; + @Nonnull + private final String type; + // --------------------------------------------------------------------------------------------- private SuggestContext(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.path = builder.path; - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.precision = builder.precision; - + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); } - public static SuggestContext of(Function> fn) { + public static SuggestContext of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } @@ -89,13 +99,6 @@ public final String path() { return this.path; } - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - /** * API name: {@code precision} */ @@ -104,9 +107,18 @@ public final String precision() { return this.precision; } + /** + * Required - API name: {@code type} + */ + @Nonnull + public final String type() { + return this.type; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -114,24 +126,21 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("name"); generator.write(this.name); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); - } - generator.writeKey("type"); - generator.write(this.type); if (this.precision != null) { generator.writeKey("precision"); generator.write(this.precision); - } + generator.writeKey("type"); + generator.write(this.type); } // --------------------------------------------------------------------------------------------- @@ -139,17 +148,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link SuggestContext}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String name; - @Nullable private String path; - - private String type; - @Nullable private String precision; + private String type; /** * Required - API name: {@code name} @@ -168,26 +173,25 @@ public final Builder path(@Nullable String value) { } /** - * Required - API name: {@code type} + * API name: {@code precision} */ - public final Builder type(String value) { - this.type = value; + public final Builder precision(@Nullable String value) { + this.precision = value; return this; } /** - * API name: {@code precision} + * Required - API name: {@code type} */ - public final Builder precision(@Nullable String value) { - this.precision = value; + public final Builder type(String value) { + this.type = value; return this; } /** * Builds a {@link SuggestContext}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public SuggestContext build() { _checkSingleUse(); @@ -207,12 +211,30 @@ public SuggestContext build() { ); protected static void setupSuggestContextDeserializer(ObjectDeserializer op) { - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); op.add(Builder::precision, JsonpDeserializer.stringDeserializer(), "precision"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.path); + result = 31 * result + Objects.hashCode(this.precision); + result = 31 * result + this.type.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SuggestContext other = (SuggestContext) o; + return this.name.equals(other.name) + && Objects.equals(this.path, other.path) + && Objects.equals(this.precision, other.precision) + && this.type.equals(other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java index be87835d1b..a2d93689bc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TermVectorOption.java @@ -30,17 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.mapping.TermVectorOption + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum TermVectorOption implements JsonEnum { No("no"), - Yes("yes"), - WithOffsets("with_offsets"), WithPositions("with_positions"), @@ -51,7 +57,7 @@ public enum TermVectorOption implements JsonEnum { WithPositionsPayloads("with_positions_payloads"), - ; + Yes("yes"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java index a74d31c9b0..9410d06f90 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextIndexPrefixes.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,7 +52,9 @@ // typedef: _types.mapping.TextIndexPrefixes @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class TextIndexPrefixes implements PlainJsonSerializable { + private final int maxChars; private final int minChars; @@ -55,13 +62,11 @@ public class TextIndexPrefixes implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private TextIndexPrefixes(Builder builder) { - this.maxChars = ApiTypeHelper.requireNonNull(builder.maxChars, this, "maxChars"); this.minChars = ApiTypeHelper.requireNonNull(builder.minChars, this, "minChars"); - } - public static TextIndexPrefixes of(Function> fn) { + public static TextIndexPrefixes of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -82,6 +87,7 @@ public final int minChars() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,13 +95,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("max_chars"); generator.write(this.maxChars); generator.writeKey("min_chars"); generator.write(this.minChars); - } // --------------------------------------------------------------------------------------------- @@ -103,10 +107,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link TextIndexPrefixes}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Integer maxChars; - private Integer minChars; /** @@ -128,8 +130,7 @@ public final Builder minChars(int value) { /** * Builds a {@link TextIndexPrefixes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public TextIndexPrefixes build() { _checkSingleUse(); @@ -149,10 +150,23 @@ public TextIndexPrefixes build() { ); protected static void setupTextIndexPrefixesDeserializer(ObjectDeserializer op) { - op.add(Builder::maxChars, JsonpDeserializer.integerDeserializer(), "max_chars"); op.add(Builder::minChars, JsonpDeserializer.integerDeserializer(), "min_chars"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.maxChars); + result = 31 * result + Integer.hashCode(this.minChars); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TextIndexPrefixes other = (TextIndexPrefixes) o; + return this.maxChars == other.maxChars && this.minChars == other.minChars; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java index 50fa3f6923..7d8676a4d4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/TextProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -46,7 +52,9 @@ // typedef: _types.mapping.TextProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class TextProperty extends CorePropertyBase implements PropertyVariant { + @Nullable private final String analyzer; @@ -93,7 +101,6 @@ public class TextProperty extends CorePropertyBase implements PropertyVariant { private TextProperty(Builder builder) { super(builder); - this.analyzer = builder.analyzer; this.boost = builder.boost; this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals; @@ -108,15 +115,14 @@ private TextProperty(Builder builder) { this.searchAnalyzer = builder.searchAnalyzer; this.searchQuoteAnalyzer = builder.searchQuoteAnalyzer; this.termVector = builder.termVector; - } - public static TextProperty of(Function> fn) { + public static TextProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -236,78 +242,77 @@ public final TermVectorOption termVector() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "text"); super.serializeInternal(generator, mapper); if (this.analyzer != null) { generator.writeKey("analyzer"); generator.write(this.analyzer); - } + if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); - } + if (this.eagerGlobalOrdinals != null) { generator.writeKey("eager_global_ordinals"); generator.write(this.eagerGlobalOrdinals); - } + if (this.fielddata != null) { generator.writeKey("fielddata"); generator.write(this.fielddata); - } + if (this.fielddataFrequencyFilter != null) { generator.writeKey("fielddata_frequency_filter"); this.fielddataFrequencyFilter.serialize(generator, mapper); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.indexOptions != null) { generator.writeKey("index_options"); this.indexOptions.serialize(generator, mapper); } + if (this.indexPhrases != null) { generator.writeKey("index_phrases"); generator.write(this.indexPhrases); - } + if (this.indexPrefixes != null) { generator.writeKey("index_prefixes"); this.indexPrefixes.serialize(generator, mapper); - } + if (this.norms != null) { generator.writeKey("norms"); generator.write(this.norms); - } + if (this.positionIncrementGap != null) { generator.writeKey("position_increment_gap"); generator.write(this.positionIncrementGap); - } + if (this.searchAnalyzer != null) { generator.writeKey("search_analyzer"); generator.write(this.searchAnalyzer); - } + if (this.searchQuoteAnalyzer != null) { generator.writeKey("search_quote_analyzer"); generator.write(this.searchQuoteAnalyzer); - } + if (this.termVector != null) { generator.writeKey("term_vector"); this.termVector.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- @@ -315,47 +320,33 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link TextProperty}. */ - public static class Builder extends CorePropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String analyzer; - @Nullable private Double boost; - @Nullable private Boolean eagerGlobalOrdinals; - @Nullable private Boolean fielddata; - @Nullable private FielddataFrequencyFilter fielddataFrequencyFilter; - @Nullable private Boolean index; - @Nullable private IndexOptions indexOptions; - @Nullable private Boolean indexPhrases; - @Nullable private TextIndexPrefixes indexPrefixes; - @Nullable private Boolean norms; - @Nullable private Integer positionIncrementGap; - @Nullable private String searchAnalyzer; - @Nullable private String searchQuoteAnalyzer; - @Nullable private TermVectorOption termVector; @@ -405,7 +396,7 @@ public final Builder fielddataFrequencyFilter(@Nullable FielddataFrequencyFilter public final Builder fielddataFrequencyFilter( Function> fn ) { - return this.fielddataFrequencyFilter(fn.apply(new FielddataFrequencyFilter.Builder()).build()); + return fielddataFrequencyFilter(fn.apply(new FielddataFrequencyFilter.Builder()).build()); } /** @@ -444,7 +435,7 @@ public final Builder indexPrefixes(@Nullable TextIndexPrefixes value) { * API name: {@code index_prefixes} */ public final Builder indexPrefixes(Function> fn) { - return this.indexPrefixes(fn.apply(new TextIndexPrefixes.Builder()).build()); + return indexPrefixes(fn.apply(new TextIndexPrefixes.Builder()).build()); } /** @@ -495,8 +486,7 @@ protected Builder self() { /** * Builds a {@link TextProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public TextProperty build() { _checkSingleUse(); @@ -516,7 +506,7 @@ public TextProperty build() { ); protected static void setupTextPropertyDeserializer(ObjectDeserializer op) { - CorePropertyBase.setupCorePropertyBaseDeserializer(op); + setupCorePropertyBaseDeserializer(op); op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer"); op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); op.add(Builder::eagerGlobalOrdinals, JsonpDeserializer.booleanDeserializer(), "eager_global_ordinals"); @@ -535,4 +525,47 @@ protected static void setupTextPropertyDeserializer(ObjectDeserializer> fn) { + public static TokenCountProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -102,6 +108,14 @@ public final Double boost() { return this.boost; } + /** + * API name: {@code enable_position_increments} + */ + @Nullable + public final Boolean enablePositionIncrements() { + return this.enablePositionIncrements; + } + /** * API name: {@code index} */ @@ -118,44 +132,33 @@ public final Double nullValue() { return this.nullValue; } - /** - * API name: {@code enable_position_increments} - */ - @Nullable - public final Boolean enablePositionIncrements() { - return this.enablePositionIncrements; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "token_count"); super.serializeInternal(generator, mapper); if (this.analyzer != null) { generator.writeKey("analyzer"); generator.write(this.analyzer); - } + if (this.boost != null) { generator.writeKey("boost"); generator.write(this.boost); + } + if (this.enablePositionIncrements != null) { + generator.writeKey("enable_position_increments"); + generator.write(this.enablePositionIncrements); } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - if (this.enablePositionIncrements != null) { - generator.writeKey("enable_position_increments"); - generator.write(this.enablePositionIncrements); - - } - } // --------------------------------------------------------------------------------------------- @@ -163,23 +166,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link TokenCountProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String analyzer; - @Nullable private Double boost; - + @Nullable + private Boolean enablePositionIncrements; @Nullable private Boolean index; - @Nullable private Double nullValue; - @Nullable - private Boolean enablePositionIncrements; - /** * API name: {@code analyzer} */ @@ -196,6 +194,14 @@ public final Builder boost(@Nullable Double value) { return this; } + /** + * API name: {@code enable_position_increments} + */ + public final Builder enablePositionIncrements(@Nullable Boolean value) { + this.enablePositionIncrements = value; + return this; + } + /** * API name: {@code index} */ @@ -212,14 +218,6 @@ public final Builder nullValue(@Nullable Double value) { return this; } - /** - * API name: {@code enable_position_increments} - */ - public final Builder enablePositionIncrements(@Nullable Boolean value) { - this.enablePositionIncrements = value; - return this; - } - @Override protected Builder self() { return this; @@ -228,8 +226,7 @@ protected Builder self() { /** * Builds a {@link TokenCountProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public TokenCountProperty build() { _checkSingleUse(); @@ -249,14 +246,39 @@ public TokenCountProperty build() { ); protected static void setupTokenCountPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer"); op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); + op.add(Builder::enablePositionIncrements, JsonpDeserializer.booleanDeserializer(), "enable_position_increments"); op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); op.add(Builder::nullValue, JsonpDeserializer.doubleDeserializer(), "null_value"); - op.add(Builder::enablePositionIncrements, JsonpDeserializer.booleanDeserializer(), "enable_position_increments"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.analyzer); + result = 31 * result + Objects.hashCode(this.boost); + result = 31 * result + Objects.hashCode(this.enablePositionIncrements); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TokenCountProperty other = (TokenCountProperty) o; + return Objects.equals(this.analyzer, other.analyzer) + && Objects.equals(this.boost, other.boost) + && Objects.equals(this.enablePositionIncrements, other.enablePositionIncrements) + && Objects.equals(this.index, other.index) + && Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java index 447c267e94..8f2e1613b7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/UnsignedLongNumberProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.UnsignedLongNumberProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class UnsignedLongNumberProperty extends NumberPropertyBase implements PropertyVariant { + @Nullable private final Number nullValue; @@ -53,17 +61,17 @@ public class UnsignedLongNumberProperty extends NumberPropertyBase implements Pr private UnsignedLongNumberProperty(Builder builder) { super(builder); - this.nullValue = builder.nullValue; - } - public static UnsignedLongNumberProperty of(Function> fn) { + public static UnsignedLongNumberProperty of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +87,12 @@ public final Number nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "unsigned_long"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue.doubleValue()); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +100,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link UnsignedLongNumberProperty}. */ - public static class Builder extends NumberPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Number nullValue; @@ -116,8 +120,7 @@ protected Builder self() { /** * Builds a {@link UnsignedLongNumberProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public UnsignedLongNumberProperty build() { _checkSingleUse(); @@ -143,4 +146,21 @@ protected static void setupUnsignedLongNumberPropertyDeserializer(ObjectDeserial op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UnsignedLongNumberProperty other = (UnsignedLongNumberProperty) o; + return Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java index 862bcbd009..70acaf7713 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/VersionProperty.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,20 +49,21 @@ // typedef: _types.mapping.VersionProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class VersionProperty extends DocValuesPropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- private VersionProperty(Builder builder) { super(builder); - } - public static VersionProperty of(Function> fn) { + public static VersionProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -65,10 +71,8 @@ public Property.Kind _propertyKind() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "version"); super.serializeInternal(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -76,8 +80,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link VersionProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -86,8 +90,7 @@ protected Builder self() { /** * Builds a {@link VersionProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public VersionProperty build() { _checkSingleUse(); @@ -107,9 +110,24 @@ public VersionProperty build() { ); protected static void setupVersionPropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + setupDocValuesPropertyBaseDeserializer(op); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java index 1eea6a21f2..99c3adc293 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/WildcardProperty.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +51,9 @@ // typedef: _types.mapping.WildcardProperty @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class WildcardProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final String nullValue; @@ -53,17 +61,15 @@ public class WildcardProperty extends DocValuesPropertyBase implements PropertyV private WildcardProperty(Builder builder) { super(builder); - this.nullValue = builder.nullValue; - } - public static WildcardProperty of(Function> fn) { + public static WildcardProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -79,15 +85,12 @@ public final String nullValue() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "wildcard"); super.serializeInternal(generator, mapper); if (this.nullValue != null) { generator.writeKey("null_value"); generator.write(this.nullValue); - } - } // --------------------------------------------------------------------------------------------- @@ -95,7 +98,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link WildcardProperty}. */ - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private String nullValue; @@ -116,8 +118,7 @@ protected Builder self() { /** * Builds a {@link WildcardProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public WildcardProperty build() { _checkSingleUse(); @@ -143,4 +144,21 @@ protected static void setupWildcardPropertyDeserializer(ObjectDeserializer> fn) { + public static XyPointProperty of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { - return Property.Kind.Point; + return Property.Kind.XyPoint; } /** @@ -98,47 +81,41 @@ public final Boolean ignoreZValue() { * API name: {@code null_value} */ @Nullable - public final String nullValue() { + public final XyLocation nullValue() { return this.nullValue; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "point"); + generator.write("type", "xy_point"); super.serializeInternal(generator, mapper); if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.ignoreZValue != null) { generator.writeKey("ignore_z_value"); generator.write(this.ignoreZValue); - } + if (this.nullValue != null) { generator.writeKey("null_value"); - generator.write(this.nullValue); - + this.nullValue.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link PointProperty}. + * Builder for {@link XyPointProperty}. */ - - public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean ignoreZValue; - @Nullable - private String nullValue; + private XyLocation nullValue; /** * API name: {@code ignore_malformed} @@ -159,46 +136,73 @@ public final Builder ignoreZValue(@Nullable Boolean value) { /** * API name: {@code null_value} */ - public final Builder nullValue(@Nullable String value) { + public final Builder nullValue(@Nullable XyLocation value) { this.nullValue = value; return this; } + /** + * API name: {@code null_value} + */ + public final Builder nullValue(Function> fn) { + return nullValue(fn.apply(new XyLocation.Builder()).build()); + } + @Override protected Builder self() { return this; } /** - * Builds a {@link PointProperty}. + * Builds a {@link XyPointProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ - public PointProperty build() { + public XyPointProperty build() { _checkSingleUse(); - return new PointProperty(this); + return new XyPointProperty(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link PointProperty} + * Json deserializer for {@link XyPointProperty} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - PointProperty::setupPointPropertyDeserializer + XyPointProperty::setupXyPointPropertyDeserializer ); - protected static void setupPointPropertyDeserializer(ObjectDeserializer op) { + protected static void setupXyPointPropertyDeserializer(ObjectDeserializer op) { setupDocValuesPropertyBaseDeserializer(op); op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); op.add(Builder::ignoreZValue, JsonpDeserializer.booleanDeserializer(), "ignore_z_value"); - op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); + op.add(Builder::nullValue, XyLocation._DESERIALIZER, "null_value"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + result = 31 * result + Objects.hashCode(this.ignoreZValue); + result = 31 * result + Objects.hashCode(this.nullValue); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + XyPointProperty other = (XyPointProperty) o; + return Objects.equals(this.ignoreMalformed, other.ignoreMalformed) + && Objects.equals(this.ignoreZValue, other.ignoreZValue) + && Objects.equals(this.nullValue, other.nullValue); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java index 3622ef09e4..4b23ad9f4b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/mapping/XyShapeProperty.java @@ -6,36 +6,16 @@ * compatible open source license. */ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- package org.opensearch.client.opensearch._types.mapping; -// typedef: _types.mapping.XyShapeProperty - import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -44,14 +24,12 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ObjectBuilder; -/** - * The xy_shape data type facilitates the indexing of and searching - * with arbitrary x, y cartesian shapes such as rectangles and - * polygons. - * - */ +// typedef: _types.mapping.XyShapeProperty + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class XyShapeProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable private final Boolean coerce; @@ -66,22 +44,20 @@ public class XyShapeProperty extends DocValuesPropertyBase implements PropertyVa // --------------------------------------------------------------------------------------------- - private XyShapeProperty(XyShapeProperty.Builder builder) { + private XyShapeProperty(Builder builder) { super(builder); - this.coerce = builder.coerce; this.ignoreMalformed = builder.ignoreMalformed; this.ignoreZValue = builder.ignoreZValue; this.orientation = builder.orientation; - } public static XyShapeProperty of(Function> fn) { - return fn.apply(new XyShapeProperty.Builder()).build(); + return fn.apply(new Builder()).build(); } /** - * Property variant kind. + * {@link Property} variant kind. */ @Override public Property.Kind _propertyKind() { @@ -121,29 +97,27 @@ public final GeoOrientation orientation() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "xy_shape"); super.serializeInternal(generator, mapper); if (this.coerce != null) { generator.writeKey("coerce"); generator.write(this.coerce); - } + if (this.ignoreMalformed != null) { generator.writeKey("ignore_malformed"); generator.write(this.ignoreMalformed); - } + if (this.ignoreZValue != null) { generator.writeKey("ignore_z_value"); generator.write(this.ignoreZValue); - } + if (this.orientation != null) { generator.writeKey("orientation"); this.orientation.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- @@ -151,26 +125,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link XyShapeProperty}. */ - - public static class Builder extends DocValuesPropertyBase.AbstractBuilder - implements - ObjectBuilder { + public static class Builder extends DocValuesPropertyBase.AbstractBuilder implements ObjectBuilder { @Nullable private Boolean coerce; - @Nullable private Boolean ignoreMalformed; - @Nullable private Boolean ignoreZValue; - @Nullable private GeoOrientation orientation; /** * API name: {@code coerce} */ - public final XyShapeProperty.Builder coerce(@Nullable Boolean value) { + public final Builder coerce(@Nullable Boolean value) { this.coerce = value; return this; } @@ -178,7 +146,7 @@ public final XyShapeProperty.Builder coerce(@Nullable Boolean value) { /** * API name: {@code ignore_malformed} */ - public final XyShapeProperty.Builder ignoreMalformed(@Nullable Boolean value) { + public final Builder ignoreMalformed(@Nullable Boolean value) { this.ignoreMalformed = value; return this; } @@ -186,7 +154,7 @@ public final XyShapeProperty.Builder ignoreMalformed(@Nullable Boolean value) { /** * API name: {@code ignore_z_value} */ - public final XyShapeProperty.Builder ignoreZValue(@Nullable Boolean value) { + public final Builder ignoreZValue(@Nullable Boolean value) { this.ignoreZValue = value; return this; } @@ -194,21 +162,20 @@ public final XyShapeProperty.Builder ignoreZValue(@Nullable Boolean value) { /** * API name: {@code orientation} */ - public final XyShapeProperty.Builder orientation(@Nullable GeoOrientation value) { + public final Builder orientation(@Nullable GeoOrientation value) { this.orientation = value; return this; } @Override - protected XyShapeProperty.Builder self() { + protected Builder self() { return this; } /** * Builds a {@link XyShapeProperty}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public XyShapeProperty build() { _checkSingleUse(); @@ -223,18 +190,41 @@ public XyShapeProperty build() { * Json deserializer for {@link XyShapeProperty} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - XyShapeProperty.Builder::new, + Builder::new, XyShapeProperty::setupXyShapePropertyDeserializer ); protected static void setupXyShapePropertyDeserializer(ObjectDeserializer op) { - DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); - op.add(XyShapeProperty.Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); - op.add(XyShapeProperty.Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); - op.add(XyShapeProperty.Builder::ignoreZValue, JsonpDeserializer.booleanDeserializer(), "ignore_z_value"); - op.add(XyShapeProperty.Builder::orientation, GeoOrientation._DESERIALIZER, "orientation"); + setupDocValuesPropertyBaseDeserializer(op); + op.add(Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); + op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); + op.add(Builder::ignoreZValue, JsonpDeserializer.booleanDeserializer(), "ignore_z_value"); + op.add(Builder::orientation, GeoOrientation._DESERIALIZER, "orientation"); op.ignore("type"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.coerce); + result = 31 * result + Objects.hashCode(this.ignoreMalformed); + result = 31 * result + Objects.hashCode(this.ignoreZValue); + result = 31 * result + Objects.hashCode(this.orientation); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + XyShapeProperty other = (XyShapeProperty) o; + return Objects.equals(this.coerce, other.coerce) + && Objects.equals(this.ignoreMalformed, other.ignoreMalformed) + && Objects.equals(this.ignoreZValue, other.ignoreZValue) + && Objects.equals(this.orientation, other.orientation); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java index c9e307a46d..167a6a0b9a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/FielddataFrequencyFilter.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,10 +49,12 @@ import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: indices._types.FielddataFrequencyFilter +// typedef: indices.FielddataFrequencyFilter @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class FielddataFrequencyFilter implements PlainJsonSerializable { + private final double max; private final double min; @@ -57,14 +64,12 @@ public class FielddataFrequencyFilter implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private FielddataFrequencyFilter(Builder builder) { - this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); this.minSegmentSize = ApiTypeHelper.requireNonNull(builder.minSegmentSize, this, "minSegmentSize"); - } - public static FielddataFrequencyFilter of(Function> fn) { + public static FielddataFrequencyFilter of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -92,6 +97,7 @@ public final int minSegmentSize() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +105,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("max"); generator.write(this.max); @@ -108,7 +113,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("min_segment_size"); generator.write(this.minSegmentSize); - } // --------------------------------------------------------------------------------------------- @@ -116,12 +120,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link FielddataFrequencyFilter}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Double max; - private Double min; - private Integer minSegmentSize; /** @@ -151,8 +152,7 @@ public final Builder minSegmentSize(int value) { /** * Builds a {@link FielddataFrequencyFilter}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public FielddataFrequencyFilter build() { _checkSingleUse(); @@ -172,11 +172,25 @@ public FielddataFrequencyFilter build() { ); protected static void setupFielddataFrequencyFilterDeserializer(ObjectDeserializer op) { - op.add(Builder::max, JsonpDeserializer.doubleDeserializer(), "max"); op.add(Builder::min, JsonpDeserializer.doubleDeserializer(), "min"); op.add(Builder::minSegmentSize, JsonpDeserializer.integerDeserializer(), "min_segment_size"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.max); + result = 31 * result + Double.hashCode(this.min); + result = 31 * result + Integer.hashCode(this.minSegmentSize); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FielddataFrequencyFilter other = (FielddataFrequencyFilter) o; + return this.max == other.max && this.min == other.min && this.minSegmentSize == other.minSegmentSize; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddata.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddata.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddata.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddata.java index 222a37bea1..403f01c234 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddata.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddata.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,27 +50,29 @@ import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: indices._types.NumericFielddata +// typedef: indices.NumericFielddata @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class NumericFielddata implements PlainJsonSerializable { + + @Nonnull private final NumericFielddataFormat format; // --------------------------------------------------------------------------------------------- private NumericFielddata(Builder builder) { - this.format = ApiTypeHelper.requireNonNull(builder.format, this, "format"); - } - public static NumericFielddata of(Function> fn) { + public static NumericFielddata of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code format} */ + @Nonnull public final NumericFielddataFormat format() { return this.format; } @@ -72,6 +80,7 @@ public final NumericFielddataFormat format() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,10 +88,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("format"); this.format.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -90,7 +97,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link NumericFielddata}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private NumericFielddataFormat format; @@ -105,8 +111,7 @@ public final Builder format(NumericFielddataFormat value) { /** * Builds a {@link NumericFielddata}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public NumericFielddata build() { _checkSingleUse(); @@ -126,9 +131,21 @@ public NumericFielddata build() { ); protected static void setupNumericFielddataDeserializer(ObjectDeserializer op) { - op.add(Builder::format, NumericFielddataFormat._DESERIALIZER, "format"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.format.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NumericFielddata other = (NumericFielddata) o; + return this.format.equals(other.format); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java index 15b2fd64ee..93b603d3e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/NumericFielddataFormat.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: indices.NumericFielddataFormat + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum NumericFielddataFormat implements JsonEnum { Array("array"), - Disabled("disabled"), - - ; + Disabled("disabled"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/OnScriptError.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/OnScriptError.java deleted file mode 100644 index 779fe1c8d1..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/OnScriptError.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types.mapping; - -import org.opensearch.client.json.JsonEnum; -import org.opensearch.client.json.JsonpDeserializable; - -@JsonpDeserializable -public enum OnScriptError implements JsonEnum { - Fail("fail"), - - Continue("continue"), - - ; - - private final String jsonValue; - - OnScriptError(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OnScriptError.values()); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/StandardNumberProperty.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/StandardNumberProperty.java deleted file mode 100644 index 62293a7574..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/StandardNumberProperty.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types.mapping; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.Script; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: _types.mapping.StandardNumberProperty - -public abstract class StandardNumberProperty extends NumberPropertyBase { - @Nullable - private final Boolean coerce; - - @Nullable - private final Script script; - - @Nullable - private final OnScriptError onScriptError; - - // --------------------------------------------------------------------------------------------- - - protected StandardNumberProperty(AbstractBuilder builder) { - super(builder); - - this.coerce = builder.coerce; - this.script = builder.script; - this.onScriptError = builder.onScriptError; - - } - - /** - * API name: {@code coerce} - */ - @Nullable - public final Boolean coerce() { - return this.coerce; - } - - /** - * API name: {@code script} - */ - @Nullable - public final Script script() { - return this.script; - } - - /** - * API name: {@code on_script_error} - */ - @Nullable - public final OnScriptError onScriptError() { - return this.onScriptError; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.coerce != null) { - generator.writeKey("coerce"); - generator.write(this.coerce); - - } - if (this.script != null) { - generator.writeKey("script"); - this.script.serialize(generator, mapper); - - } - if (this.onScriptError != null) { - generator.writeKey("on_script_error"); - this.onScriptError.serialize(generator, mapper); - } - - } - - protected abstract static class AbstractBuilder> extends NumberPropertyBase.AbstractBuilder< - BuilderT> { - @Nullable - private Boolean coerce; - - @Nullable - private Script script; - - @Nullable - private OnScriptError onScriptError; - - /** - * API name: {@code coerce} - */ - public final BuilderT coerce(@Nullable Boolean value) { - this.coerce = value; - return self(); - } - - /** - * API name: {@code script} - */ - public final BuilderT script(@Nullable Script value) { - this.script = value; - return self(); - } - - /** - * API name: {@code script} - */ - public final BuilderT script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - /** - * API name: {@code on_script_error} - */ - public final BuilderT onScriptError(@Nullable OnScriptError value) { - this.onScriptError = value; - return self(); - } - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupStandardNumberPropertyDeserializer( - ObjectDeserializer op - ) { - setupNumberPropertyBaseDeserializer(op); - op.add(AbstractBuilder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); - op.add(AbstractBuilder::script, Script._DESERIALIZER, "script"); - op.add(AbstractBuilder::onScriptError, OnScriptError._DESERIALIZER, "on_script_error"); - - } - -} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index aab9e3afc7..8dd8aab304 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -26130,7 +26130,7 @@ components: The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by OpenSearch. - type: number + type: integer version: $ref: '#/components/schemas/_common___VersionNumber' _meta: @@ -26310,7 +26310,7 @@ components: The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by OpenSearch. - type: number + type: integer version: $ref: '#/components/schemas/_common___VersionNumber' _meta: @@ -38823,8 +38823,6 @@ components: type: array items: type: string - time_series_metric: - $ref: '#/components/schemas/_common.mapping___TimeSeriesMetricType' required: - default_metric - metrics @@ -39027,39 +39025,6 @@ components: - date_range required: - type - _common.mapping___DenseVectorIndexOptions: - type: object - properties: - type: - type: string - m: - type: number - ef_construction: - type: number - required: - - ef_construction - - m - - type - _common.mapping___DenseVectorProperty: - allOf: - - $ref: '#/components/schemas/_common.mapping___PropertyBase' - - type: object - properties: - type: - type: string - enum: - - dense_vector - dims: - type: number - similarity: - type: string - index: - type: boolean - index_options: - $ref: '#/components/schemas/_common.mapping___DenseVectorIndexOptions' - required: - - dims - - type _common.mapping___DocValuesPropertyBase: allOf: - $ref: '#/components/schemas/_common.mapping___CorePropertyBase' @@ -39150,34 +39115,19 @@ components: type: boolean required: - enabled - _common.mapping___FlattenedProperty: + _common.mapping___FlatObjectProperty: allOf: - $ref: '#/components/schemas/_common.mapping___PropertyBase' - type: object properties: - boost: - type: number - format: double - depth_limit: - type: number - doc_values: - type: boolean - eager_global_ordinals: - type: boolean - index: + searchable: type: boolean - index_options: - $ref: '#/components/schemas/_common.mapping___IndexOptions' - null_value: - type: string - similarity: - type: string - split_queries_on_whitespace: + aggregatable: type: boolean type: type: string enum: - - flattened + - flat_object required: - type _common.mapping___FloatNumberProperty: @@ -39210,17 +39160,17 @@ components: - title: left type: string enum: + - left - LEFT - clockwise - cw - - left - title: right type: string enum: + - right - RIGHT - - ccw - counterclockwise - - right + - ccw _common.mapping___GeoPointProperty: allOf: - $ref: '#/components/schemas/_common.mapping___DocValuesPropertyBase' @@ -39296,6 +39246,37 @@ components: - histogram required: - type + _common.mapping___IcuCollationKeywordProperty: + allOf: + - $ref: '#/components/schemas/_common.mapping___DocValuesPropertyBase' + - type: object + properties: + type: + type: string + enum: + - icu_collation_keyword + index: + type: boolean + null_value: + type: string + alternate: + $ref: '#/components/schemas/_common.analysis___IcuCollationAlternate' + case_level: + type: boolean + case_first: + $ref: '#/components/schemas/_common.analysis___IcuCollationCaseFirst' + decomposition: + $ref: '#/components/schemas/_common.analysis___IcuCollationDecomposition' + hiragana_quaternary_mode: + type: boolean + numeric: + type: boolean + strength: + $ref: '#/components/schemas/_common.analysis___IcuCollationStrength' + variable_top: + type: string + required: + - type _common.mapping___IndexField: type: object properties: @@ -39348,13 +39329,6 @@ components: type: boolean null_value: type: string - on_script_error: - $ref: '#/components/schemas/_common.mapping___OnScriptError' - script: - $ref: '#/components/schemas/_common___Script' - time_series_dimension: - description: For internal use by OpenSearch only. Marks the field as a time series dimension. Defaults to false. - type: boolean type: type: string enum: @@ -39415,9 +39389,6 @@ components: type: string split_queries_on_whitespace: type: boolean - time_series_dimension: - description: For internal use by OpenSearch only. Marks the field as a time series dimension. Defaults to false. - type: boolean type: type: string enum: @@ -39559,15 +39530,6 @@ components: type: boolean index: type: boolean - on_script_error: - $ref: '#/components/schemas/_common.mapping___OnScriptError' - script: - $ref: '#/components/schemas/_common___Script' - time_series_metric: - $ref: '#/components/schemas/_common.mapping___TimeSeriesMetricType' - time_series_dimension: - description: For internal use by OpenSearch only. Marks the field as a time series dimension. Defaults to false. - type: boolean _common.mapping___ObjectProperty: allOf: - $ref: '#/components/schemas/_common.mapping___CorePropertyBase' @@ -39579,11 +39541,6 @@ components: type: string enum: - object - _common.mapping___OnScriptError: - type: string - enum: - - continue - - fail _common.mapping___PercolatorProperty: allOf: - $ref: '#/components/schemas/_common.mapping___PropertyBase' @@ -39599,6 +39556,7 @@ components: type: object discriminator: propertyName: type + x-default: object oneOf: - $ref: '#/components/schemas/_common.mapping___BinaryProperty' - $ref: '#/components/schemas/_common.mapping___BooleanProperty' @@ -39615,9 +39573,7 @@ components: - $ref: '#/components/schemas/_common.mapping___DateNanosProperty' - $ref: '#/components/schemas/_common.mapping___DateProperty' - $ref: '#/components/schemas/_common.mapping___AggregateMetricDoubleProperty' - - $ref: '#/components/schemas/_common.mapping___DenseVectorProperty' - - $ref: '#/components/schemas/_common.mapping___SparseVectorProperty' - - $ref: '#/components/schemas/_common.mapping___FlattenedProperty' + - $ref: '#/components/schemas/_common.mapping___FlatObjectProperty' - $ref: '#/components/schemas/_common.mapping___NestedProperty' - $ref: '#/components/schemas/_common.mapping___ObjectProperty' - $ref: '#/components/schemas/_common.mapping___CompletionProperty' @@ -39647,6 +39603,7 @@ components: - $ref: '#/components/schemas/_common.mapping___IpRangeProperty' - $ref: '#/components/schemas/_common.mapping___LongRangeProperty' - $ref: '#/components/schemas/_common.mapping___KnnVectorProperty' + - $ref: '#/components/schemas/_common.mapping___IcuCollationKeywordProperty' _common.mapping___PropertyBase: type: object properties: @@ -39791,17 +39748,6 @@ components: type: array items: type: string - _common.mapping___SparseVectorProperty: - allOf: - - $ref: '#/components/schemas/_common.mapping___PropertyBase' - - type: object - properties: - type: - type: string - enum: - - sparse_vector - required: - - type _common.mapping___SuggestContext: type: object properties: @@ -39878,14 +39824,6 @@ components: - text required: - type - _common.mapping___TimeSeriesMetricType: - type: string - enum: - - counter - - gauge - - histogram - - position - - summary _common.mapping___TokenCountProperty: allOf: - $ref: '#/components/schemas/_common.mapping___DocValuesPropertyBase' @@ -42347,25 +42285,6 @@ components: metadata_field: description: Whether this field is registered as a metadata field. type: boolean - time_series_dimension: - description: Whether this field is used as a time series dimension. - type: boolean - time_series_metric: - $ref: '#/components/schemas/_common.mapping___TimeSeriesMetricType' - non_dimension_indices: - description: |- - If this list is present in the response, then indexes not contained in the list have the - field marked as a dimension. Any indexes contained in the list are not marked as a dimension. - type: array - items: - $ref: '#/components/schemas/_common___IndexName' - metric_conflicts_indices: - description: |- - The list of indexes in which this field is present if the indexes - don't have the same `time_series_metric` value for the field. - type: array - items: - $ref: '#/components/schemas/_common___IndexName' required: - aggregatable - searchable @@ -48809,8 +48728,6 @@ components: $ref: '#/components/schemas/indices._common___IndexSettingsAnalysis' settings: $ref: '#/components/schemas/indices._common___IndexSettings' - time_series: - $ref: '#/components/schemas/indices._common___IndexSettingsTimeSeries' queries: $ref: '#/components/schemas/indices._common___IndexSettingsQueries' similarity: @@ -49147,13 +49064,6 @@ components: type: boolean required: - type - indices._common___IndexSettingsTimeSeries: - type: object - properties: - end_time: - $ref: '#/components/schemas/_common___DateTime' - start_time: - $ref: '#/components/schemas/_common___DateTime' indices._common___IndexState: type: object properties: @@ -49191,7 +49101,8 @@ components: The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by OpenSearch. - type: number + type: integer + format: int64 _meta: $ref: '#/components/schemas/_common___Metadata' allow_auto_create: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java index c33b7da0f8..76fa637262 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java @@ -9,7 +9,7 @@ package org.opensearch.client.codegen.model; import java.util.Collection; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.TreeMap; @@ -41,11 +41,12 @@ public Collection getImplementsTypes() { return List.of(Types.Client.Json.JsonEnum); } - public void addVariant(String value, String description, boolean deprecated) { - var variant = variants.get(value.toLowerCase()); + public void addVariant(String name, String value, String description, boolean deprecated) { + name = name.toLowerCase(); + var variant = variants.get(name); if (variant == null) { variant = new Variant(value, description, deprecated); - variants.put(value.toLowerCase(), variant); + variants.put(name, variant); } else { variant.addAlias(value); variant.setDeprecated(variant.isDeprecated() || deprecated); @@ -65,7 +66,7 @@ public boolean anyHasAliases() { public static class Variant { private final String wireName; - private final Set aliases = new HashSet<>(); + private final Set aliases = new LinkedHashSet<>(); private boolean deprecated; private String description; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index e1e834480f..edf6ba43b4 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -182,10 +182,14 @@ public Set getImports() { } public boolean needsLegacyLicense() { - if ("analysis".equals(parent.getName()) && (className.startsWith("Cjk") || className.startsWith("Smartcn"))) { + var parentName = parent.getName(); + if ("analysis".equals(parentName) && (className.startsWith("Cjk") || className.startsWith("Smartcn"))) { return false; } - return !"ml".equals(parent.getName()); + if (className.startsWith("Xy")) { + return false; + } + return !"ml".equals(parentName); } @Override diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 1a8bd9891f..cd967b869e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -284,7 +284,16 @@ private Shape visit(Namespace parent, String className, String typedefName, Open visitInto(schema, enumShape); } else if (isTaggedUnion) { var discriminatingField = schema.getDiscriminator().flatMap(OpenApiDiscriminator::getPropertyName).orElse(null); - var taggedUnion = new TaggedUnionShape(parent, className, typedefName, description, discriminatingField, shouldGenerate); + var defaultVariant = schema.getDiscriminator().flatMap(OpenApiDiscriminator::getDefaultValue).orElse(null); + var taggedUnion = new TaggedUnionShape( + parent, + className, + typedefName, + description, + discriminatingField, + defaultVariant, + shouldGenerate + ); shape = taggedUnion; visitedSchemas.putIfAbsent(schema, shape); @@ -447,6 +456,7 @@ private static Set collectObjectProperties( } private void visitInto(OpenApiSchema schema, EnumShape shape) { + var title = schema.getTitle(); var isDeprecated = schema.getVersionDeprecated().isPresent(); if (schema.hasOneOf()) { @@ -454,10 +464,10 @@ private void visitInto(OpenApiSchema schema, EnumShape shape) { } else if (schema.hasEnums()) { var enums = schema.getEnums().orElseThrow(); var description = enums.size() == 1 ? schema.getDescription().orElse(null) : null; - enums.forEach(v -> shape.addVariant(v, description, isDeprecated)); + enums.forEach(v -> shape.addVariant(title.orElse(v), v, description, isDeprecated)); } else if (schema.hasConst()) { var value = (String) schema.getConst().orElseThrow(); - shape.addVariant(value, schema.getDescription().orElse(null), isDeprecated); + shape.addVariant(title.orElse(value), value, schema.getDescription().orElse(null), isDeprecated); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java index 7214c6c374..681a19b059 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java @@ -22,6 +22,7 @@ public class TaggedUnionShape extends Shape { private final Map variants = new TreeMap<>(); private final String discriminatingField; + private final String defaultVariant; public TaggedUnionShape( Namespace parent, @@ -29,10 +30,12 @@ public TaggedUnionShape( String typedefName, String description, String discriminatingField, + String defaultVariant, ShouldGenerate shouldGenerate ) { super(parent, className, typedefName, description, shouldGenerate); this.discriminatingField = discriminatingField; + this.defaultVariant = defaultVariant; } public void addVariant(String name, Type type) { @@ -49,7 +52,7 @@ public Collection getNonShapeVariants() { } public Variant getDefaultVariant() { - return variants.get("custom"); + return variants.get(this.defaultVariant != null ? this.defaultVariant : "custom"); } @Override diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index f47eab9331..f637c64995 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -32,11 +32,6 @@ private static JsonPointer schema(String namespace, String name) { .with(schema("_common", "Stringifiedboolean"), so -> so.withMappedType(Types.Primitive.Boolean)) .with(schema("_common", "StringifiedEpochTimeUnitMillis"), so -> so.withMappedType(Types.Primitive.Long)) - // TODO: Remove this to generate property mapping types - .with(schema("_common.mapping", "Property"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.mapping", "PropertyBase"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.mapping", "KnnVectorProperty"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - // TODO: Remove this to generate query types .with( schema("_common.query_dsl", "QueryContainer"), diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiDiscriminator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiDiscriminator.java index 2cf855dbb4..46f3aeff3f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiDiscriminator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiDiscriminator.java @@ -12,18 +12,28 @@ import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.codegen.utils.Maps; public class OpenApiDiscriminator extends OpenApiElement { @Nullable private final String propertyName; + @Nullable + private final String defaultValue; protected OpenApiDiscriminator(@Nullable OpenApiElement parent, @Nonnull JsonPointer pointer, @Nonnull Discriminator discriminator) { super(parent, pointer); this.propertyName = discriminator.getPropertyName(); + var extensions = discriminator.getExtensions(); + this.defaultValue = (String) Maps.tryGet(extensions, "x-default").orElse(null); } @Nonnull public Optional getPropertyName() { return Optional.ofNullable(propertyName); } + + @Nonnull + public Optional getDefaultValue() { + return Optional.ofNullable(defaultValue); + } }