diff --git a/UPGRADING.md b/UPGRADING.md index c14f4e0821..d764e68eaf 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -57,4 +57,20 @@ After: - Removed the `Runtime` variant from the `DynamicMapping` enum as it is not supported by OpenSearch. ### TypeMapping -- Removed the `runtime` field, getter and builder methods from `TypeMapping` as it is not supported by OpenSearch. \ No newline at end of file +- Removed the `runtime` field, getter and builder methods from `TypeMapping` as it is not supported by OpenSearch. + +### InlineScript +- The `lang` property now accepts a `ScriptLanguage` enum instead of a `String`. + +### IcuCollationDecomposition enum variants +- The `IcuCollationDecomposition.Identical` variant has been corrected to be `IcuCollationDecomposition.Canonical`. + +### IcuCollationTokenFilter property name casing +- The following fields, getters and builder methods on `IcuCollationTokenFilter` have had their casing corrected: + - `casefirst` -> `caseFirst` + - `caselevel` -> `caseLevel` + - `hiraganaquaternarymode` -> `hiraganaQuaternaryMode` + - `variabletop` -> `variableTop` + +### TokenFilterDefinition +- The `smartcn_stop` Builder method has been renamed to `smartcnStop`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BuiltinScriptLanguage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BuiltinScriptLanguage.java new file mode 100644 index 0000000000..1efa80f968 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BuiltinScriptLanguage.java @@ -0,0 +1,69 @@ +/* + * 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; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: _types.BuiltinScriptLanguage + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum BuiltinScriptLanguage implements JsonEnum { + Expression("expression"), + + Java("java"), + + Mustache("mustache"), + + Painless("painless"); + + private final String jsonValue; + + BuiltinScriptLanguage(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + BuiltinScriptLanguage.values() + ); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/InlineScript.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/InlineScript.java index be2177029b..fd2cde01a6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/InlineScript.java @@ -30,11 +30,18 @@ * 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.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; @@ -47,26 +54,28 @@ // typedef: _types.InlineScript @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class InlineScript extends ScriptBase { + @Nullable - private final String lang; + private final ScriptLanguage lang; + @Nonnull private final Map options; + @Nonnull private final String source; // --------------------------------------------------------------------------------------------- private InlineScript(Builder builder) { super(builder); - this.lang = builder.lang; this.options = ApiTypeHelper.unmodifiable(builder.options); this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - } - public static InlineScript of(Function> fn) { + public static InlineScript of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -74,46 +83,48 @@ public static InlineScript of(Function> fn) * API name: {@code lang} */ @Nullable - public final String lang() { + public final ScriptLanguage lang() { return this.lang; } /** * API name: {@code options} */ + @Nonnull public final Map options() { return this.options; } /** - * Required - API name: {@code source} + * Required - The script source. + *

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

*/ + @Nonnull public final String source() { return this.source; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.lang != null) { generator.writeKey("lang"); - generator.write(this.lang); - + this.lang.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.options)) { generator.writeKey("options"); generator.writeStartObject(); for (Map.Entry item0 : this.options.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - } + generator.writeKey("source"); generator.write(this.source); - } // --------------------------------------------------------------------------------------------- @@ -121,28 +132,34 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link InlineScript}. */ - public static class Builder extends ScriptBase.AbstractBuilder implements ObjectBuilder { @Nullable - private String lang; - + private ScriptLanguage lang; @Nullable private Map options; - private String source; /** * API name: {@code lang} */ - public final Builder lang(@Nullable String value) { + public final Builder lang(@Nullable ScriptLanguage value) { this.lang = value; return this; } + /** + * API name: {@code lang} + */ + public final Builder lang(Function> fn) { + return lang(fn.apply(new ScriptLanguage.Builder()).build()); + } + /** * API name: {@code options} + * *

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

*/ public final Builder options(Map map) { this.options = _mapPutAll(this.options, map); @@ -151,8 +168,10 @@ public final Builder options(Map map) { /** * API name: {@code options} + * *

* Adds an entry to options. + *

*/ public final Builder options(String key, String value) { this.options = _mapPut(this.options, key, value); @@ -160,7 +179,10 @@ public final Builder options(String key, String value) { } /** - * Required - API name: {@code source} + * Required - The script source. + *

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

*/ public final Builder source(String value) { this.source = value; @@ -175,8 +197,7 @@ protected Builder self() { /** * Builds a {@link InlineScript}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public InlineScript build() { _checkSingleUse(); @@ -196,13 +217,31 @@ public InlineScript build() { ); protected static void setupInlineScriptDeserializer(ObjectDeserializer op) { - ScriptBase.setupScriptBaseDeserializer(op); - op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); + setupScriptBaseDeserializer(op); + op.add(Builder::lang, ScriptLanguage._DESERIALIZER, "lang"); op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "options"); op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); op.shortcutProperty("source"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.lang); + result = 31 * result + Objects.hashCode(this.options); + result = 31 * result + this.source.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; + InlineScript other = (InlineScript) o; + return Objects.equals(this.lang, other.lang) && Objects.equals(this.options, other.options) && this.source.equals(other.source); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java index 6f969b8f5a..811438381d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java @@ -30,14 +30,21 @@ * 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.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; @@ -48,12 +55,14 @@ // typedef: _types.Script @JsonpDeserializable -public class Script implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Script implements TaggedUnion, PlainJsonSerializable { + /** + * {@link Script} variant kinds. + */ public enum Kind { Inline, Stored - } private final Kind _kind; @@ -75,13 +84,11 @@ private Script(Kind kind, Object value) { } private Script(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static Script of(Function> fn) { + public static Script of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -95,8 +102,7 @@ public boolean isInline() { /** * Get the {@code inline} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code inline} kind. + * @throws IllegalStateException if the current variant is not the {@code inline} kind. */ public InlineScript inline() { return TaggedUnionUtils.get(this, Kind.Inline); @@ -112,8 +118,7 @@ public boolean isStored() { /** * Get the {@code stored} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code stored} kind. + * @throws IllegalStateException if the current variant is not the {@code stored} kind. */ public StoredScriptId stored() { return TaggedUnionUtils.get(this, Kind.Stored); @@ -124,7 +129,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } - } public static class Builder extends ObjectBuilderBase implements ObjectBuilder