From 94dc194a2cffdc188c7df9adebb5cacbf80003ee Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Sat, 8 Jun 2024 11:38:34 +0200 Subject: [PATCH] [codegen] update to latest api spec + fixed unit test --- .../analysis/IcuCollationTokenFilter.java | 104 +-- .../_types/mapping/FieldType.java | 2 + .../_types/mapping/IcuCollationProperty.java | 601 ++++++++++++++++++ .../_types/mapping/Property.java | 32 + .../_types/mapping/PropertyBuilders.java | 19 + .../elasticsearch/doc-files/api-spec.html | 27 +- .../spec_issues/SpecIssuesTest.java | 5 +- 7 files changed, 723 insertions(+), 67 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/IcuCollationProperty.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/IcuCollationTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/IcuCollationTokenFilter.java index 36f9aabca..84d9fcea3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/IcuCollationTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/IcuCollationTokenFilter.java @@ -61,10 +61,10 @@ public class IcuCollationTokenFilter extends TokenFilterBase implements TokenFil private final IcuCollationAlternate alternate; @Nullable - private final IcuCollationCaseFirst casefirst; + private final IcuCollationCaseFirst caseFirst; @Nullable - private final Boolean caselevel; + private final Boolean caseLevel; @Nullable private final String country; @@ -73,7 +73,7 @@ public class IcuCollationTokenFilter extends TokenFilterBase implements TokenFil private final IcuCollationDecomposition decomposition; @Nullable - private final Boolean hiraganaquaternarymode; + private final Boolean hiraganaQuaternaryMode; @Nullable private final String language; @@ -88,7 +88,7 @@ public class IcuCollationTokenFilter extends TokenFilterBase implements TokenFil private final IcuCollationStrength strength; @Nullable - private final String variabletop; + private final String variableTop; @Nullable private final String variant; @@ -99,16 +99,16 @@ private IcuCollationTokenFilter(Builder builder) { super(builder); this.alternate = builder.alternate; - this.casefirst = builder.casefirst; - this.caselevel = builder.caselevel; + this.caseFirst = builder.caseFirst; + this.caseLevel = builder.caseLevel; this.country = builder.country; this.decomposition = builder.decomposition; - this.hiraganaquaternarymode = builder.hiraganaquaternarymode; + this.hiraganaQuaternaryMode = builder.hiraganaQuaternaryMode; this.language = builder.language; this.numeric = builder.numeric; this.rules = builder.rules; this.strength = builder.strength; - this.variabletop = builder.variabletop; + this.variableTop = builder.variableTop; this.variant = builder.variant; } @@ -134,19 +134,19 @@ public final IcuCollationAlternate alternate() { } /** - * API name: {@code caseFirst} + * API name: {@code case_first} */ @Nullable - public final IcuCollationCaseFirst casefirst() { - return this.casefirst; + public final IcuCollationCaseFirst caseFirst() { + return this.caseFirst; } /** - * API name: {@code caseLevel} + * API name: {@code case_level} */ @Nullable - public final Boolean caselevel() { - return this.caselevel; + public final Boolean caseLevel() { + return this.caseLevel; } /** @@ -166,11 +166,11 @@ public final IcuCollationDecomposition decomposition() { } /** - * API name: {@code hiraganaQuaternaryMode} + * API name: {@code hiragana_quaternary_mode} */ @Nullable - public final Boolean hiraganaquaternarymode() { - return this.hiraganaquaternarymode; + public final Boolean hiraganaQuaternaryMode() { + return this.hiraganaQuaternaryMode; } /** @@ -206,11 +206,11 @@ public final IcuCollationStrength strength() { } /** - * API name: {@code variableTop} + * API name: {@code variable_top} */ @Nullable - public final String variabletop() { - return this.variabletop; + public final String variableTop() { + return this.variableTop; } /** @@ -229,13 +229,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("alternate"); this.alternate.serialize(generator, mapper); } - if (this.casefirst != null) { - generator.writeKey("caseFirst"); - this.casefirst.serialize(generator, mapper); + if (this.caseFirst != null) { + generator.writeKey("case_first"); + this.caseFirst.serialize(generator, mapper); } - if (this.caselevel != null) { - generator.writeKey("caseLevel"); - generator.write(this.caselevel); + if (this.caseLevel != null) { + generator.writeKey("case_level"); + generator.write(this.caseLevel); } if (this.country != null) { @@ -247,9 +247,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("decomposition"); this.decomposition.serialize(generator, mapper); } - if (this.hiraganaquaternarymode != null) { - generator.writeKey("hiraganaQuaternaryMode"); - generator.write(this.hiraganaquaternarymode); + if (this.hiraganaQuaternaryMode != null) { + generator.writeKey("hiragana_quaternary_mode"); + generator.write(this.hiraganaQuaternaryMode); } if (this.language != null) { @@ -271,9 +271,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("strength"); this.strength.serialize(generator, mapper); } - if (this.variabletop != null) { - generator.writeKey("variableTop"); - generator.write(this.variabletop); + if (this.variableTop != null) { + generator.writeKey("variable_top"); + generator.write(this.variableTop); } if (this.variant != null) { @@ -297,10 +297,10 @@ public static class Builder extends TokenFilterBase.AbstractBuilder private IcuCollationAlternate alternate; @Nullable - private IcuCollationCaseFirst casefirst; + private IcuCollationCaseFirst caseFirst; @Nullable - private Boolean caselevel; + private Boolean caseLevel; @Nullable private String country; @@ -309,7 +309,7 @@ public static class Builder extends TokenFilterBase.AbstractBuilder private IcuCollationDecomposition decomposition; @Nullable - private Boolean hiraganaquaternarymode; + private Boolean hiraganaQuaternaryMode; @Nullable private String language; @@ -324,7 +324,7 @@ public static class Builder extends TokenFilterBase.AbstractBuilder private IcuCollationStrength strength; @Nullable - private String variabletop; + private String variableTop; @Nullable private String variant; @@ -338,18 +338,18 @@ public final Builder alternate(@Nullable IcuCollationAlternate value) { } /** - * API name: {@code caseFirst} + * API name: {@code case_first} */ - public final Builder casefirst(@Nullable IcuCollationCaseFirst value) { - this.casefirst = value; + public final Builder caseFirst(@Nullable IcuCollationCaseFirst value) { + this.caseFirst = value; return this; } /** - * API name: {@code caseLevel} + * API name: {@code case_level} */ - public final Builder caselevel(@Nullable Boolean value) { - this.caselevel = value; + public final Builder caseLevel(@Nullable Boolean value) { + this.caseLevel = value; return this; } @@ -370,10 +370,10 @@ public final Builder decomposition(@Nullable IcuCollationDecomposition value) { } /** - * API name: {@code hiraganaQuaternaryMode} + * API name: {@code hiragana_quaternary_mode} */ - public final Builder hiraganaquaternarymode(@Nullable Boolean value) { - this.hiraganaquaternarymode = value; + public final Builder hiraganaQuaternaryMode(@Nullable Boolean value) { + this.hiraganaQuaternaryMode = value; return this; } @@ -410,10 +410,10 @@ public final Builder strength(@Nullable IcuCollationStrength value) { } /** - * API name: {@code variableTop} + * API name: {@code variable_top} */ - public final Builder variabletop(@Nullable String value) { - this.variabletop = value; + public final Builder variableTop(@Nullable String value) { + this.variableTop = value; return this; } @@ -455,16 +455,16 @@ protected static void setupIcuCollationTokenFilterDeserializer( ObjectDeserializer op) { TokenFilterBase.setupTokenFilterBaseDeserializer(op); op.add(Builder::alternate, IcuCollationAlternate._DESERIALIZER, "alternate"); - op.add(Builder::casefirst, IcuCollationCaseFirst._DESERIALIZER, "caseFirst"); - op.add(Builder::caselevel, JsonpDeserializer.booleanDeserializer(), "caseLevel"); + op.add(Builder::caseFirst, IcuCollationCaseFirst._DESERIALIZER, "case_first"); + op.add(Builder::caseLevel, JsonpDeserializer.booleanDeserializer(), "case_level"); op.add(Builder::country, JsonpDeserializer.stringDeserializer(), "country"); op.add(Builder::decomposition, IcuCollationDecomposition._DESERIALIZER, "decomposition"); - op.add(Builder::hiraganaquaternarymode, JsonpDeserializer.booleanDeserializer(), "hiraganaQuaternaryMode"); + op.add(Builder::hiraganaQuaternaryMode, JsonpDeserializer.booleanDeserializer(), "hiragana_quaternary_mode"); op.add(Builder::language, JsonpDeserializer.stringDeserializer(), "language"); op.add(Builder::numeric, JsonpDeserializer.booleanDeserializer(), "numeric"); op.add(Builder::rules, JsonpDeserializer.stringDeserializer(), "rules"); op.add(Builder::strength, IcuCollationStrength._DESERIALIZER, "strength"); - op.add(Builder::variabletop, JsonpDeserializer.stringDeserializer(), "variableTop"); + op.add(Builder::variableTop, JsonpDeserializer.stringDeserializer(), "variable_top"); op.add(Builder::variant, JsonpDeserializer.stringDeserializer(), "variant"); op.ignore("type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java index 14597f00f..570268b6b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java @@ -133,6 +133,8 @@ public enum FieldType implements JsonEnum { MatchOnlyText("match_only_text"), + IcuCollationKeyword("icu_collation_keyword"), + ; private final String jsonValue; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/IcuCollationProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/IcuCollationProperty.java new file mode 100644 index 000000000..a4c839f18 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/IcuCollationProperty.java @@ -0,0 +1,601 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch._types.mapping; + +import co.elastic.clients.elasticsearch._types.analysis.IcuCollationAlternate; +import co.elastic.clients.elasticsearch._types.analysis.IcuCollationCaseFirst; +import co.elastic.clients.elasticsearch._types.analysis.IcuCollationDecomposition; +import co.elastic.clients.elasticsearch._types.analysis.IcuCollationStrength; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: _types.mapping.IcuCollationProperty + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IcuCollationProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable + private final Boolean norms; + + @Nullable + private final IndexOptions indexOptions; + + @Nullable + private final Boolean index; + + @Nullable + private final String nullValue; + + @Nullable + private final String rules; + + @Nullable + private final String language; + + @Nullable + private final String country; + + @Nullable + private final String variant; + + @Nullable + private final IcuCollationStrength strength; + + @Nullable + private final IcuCollationDecomposition decomposition; + + @Nullable + private final IcuCollationAlternate alternate; + + @Nullable + private final Boolean caseLevel; + + @Nullable + private final IcuCollationCaseFirst caseFirst; + + @Nullable + private final Boolean numeric; + + @Nullable + private final String variableTop; + + @Nullable + private final Boolean hiraganaQuaternaryMode; + + // --------------------------------------------------------------------------------------------- + + private IcuCollationProperty(Builder builder) { + super(builder); + + this.norms = builder.norms; + this.indexOptions = builder.indexOptions; + this.index = builder.index; + this.nullValue = builder.nullValue; + this.rules = builder.rules; + this.language = builder.language; + this.country = builder.country; + this.variant = builder.variant; + this.strength = builder.strength; + this.decomposition = builder.decomposition; + this.alternate = builder.alternate; + this.caseLevel = builder.caseLevel; + this.caseFirst = builder.caseFirst; + this.numeric = builder.numeric; + this.variableTop = builder.variableTop; + this.hiraganaQuaternaryMode = builder.hiraganaQuaternaryMode; + + } + + public static IcuCollationProperty of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Property variant kind. + */ + @Override + public Property.Kind _propertyKind() { + return Property.Kind.IcuCollationKeyword; + } + + /** + * API name: {@code norms} + */ + @Nullable + public final Boolean norms() { + return this.norms; + } + + /** + * API name: {@code index_options} + */ + @Nullable + public final IndexOptions indexOptions() { + return this.indexOptions; + } + + /** + * Should the field be searchable? + *

+ * API name: {@code index} + */ + @Nullable + public final Boolean index() { + return this.index; + } + + /** + * Accepts a string value which is substituted for any explicit null values. + * Defaults to null, which means the field is treated as missing. + *

+ * API name: {@code null_value} + */ + @Nullable + public final String nullValue() { + return this.nullValue; + } + + /** + * API name: {@code rules} + */ + @Nullable + public final String rules() { + return this.rules; + } + + /** + * API name: {@code language} + */ + @Nullable + public final String language() { + return this.language; + } + + /** + * API name: {@code country} + */ + @Nullable + public final String country() { + return this.country; + } + + /** + * API name: {@code variant} + */ + @Nullable + public final String variant() { + return this.variant; + } + + /** + * API name: {@code strength} + */ + @Nullable + public final IcuCollationStrength strength() { + return this.strength; + } + + /** + * API name: {@code decomposition} + */ + @Nullable + public final IcuCollationDecomposition decomposition() { + return this.decomposition; + } + + /** + * API name: {@code alternate} + */ + @Nullable + public final IcuCollationAlternate alternate() { + return this.alternate; + } + + /** + * API name: {@code case_level} + */ + @Nullable + public final Boolean caseLevel() { + return this.caseLevel; + } + + /** + * API name: {@code case_first} + */ + @Nullable + public final IcuCollationCaseFirst caseFirst() { + return this.caseFirst; + } + + /** + * API name: {@code numeric} + */ + @Nullable + public final Boolean numeric() { + return this.numeric; + } + + /** + * API name: {@code variable_top} + */ + @Nullable + public final String variableTop() { + return this.variableTop; + } + + /** + * API name: {@code hiragana_quaternary_mode} + */ + @Nullable + public final Boolean hiraganaQuaternaryMode() { + return this.hiraganaQuaternaryMode; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "icu_collation_keyword"); + super.serializeInternal(generator, mapper); + if (this.norms != null) { + generator.writeKey("norms"); + generator.write(this.norms); + + } + if (this.indexOptions != null) { + generator.writeKey("index_options"); + this.indexOptions.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); + + } + if (this.rules != null) { + generator.writeKey("rules"); + generator.write(this.rules); + + } + if (this.language != null) { + generator.writeKey("language"); + generator.write(this.language); + + } + if (this.country != null) { + generator.writeKey("country"); + generator.write(this.country); + + } + if (this.variant != null) { + generator.writeKey("variant"); + generator.write(this.variant); + + } + if (this.strength != null) { + generator.writeKey("strength"); + this.strength.serialize(generator, mapper); + } + if (this.decomposition != null) { + generator.writeKey("decomposition"); + this.decomposition.serialize(generator, mapper); + } + if (this.alternate != null) { + generator.writeKey("alternate"); + this.alternate.serialize(generator, mapper); + } + if (this.caseLevel != null) { + generator.writeKey("case_level"); + generator.write(this.caseLevel); + + } + if (this.caseFirst != null) { + generator.writeKey("case_first"); + this.caseFirst.serialize(generator, mapper); + } + if (this.numeric != null) { + generator.writeKey("numeric"); + generator.write(this.numeric); + + } + if (this.variableTop != null) { + generator.writeKey("variable_top"); + generator.write(this.variableTop); + + } + if (this.hiraganaQuaternaryMode != null) { + generator.writeKey("hiragana_quaternary_mode"); + generator.write(this.hiraganaQuaternaryMode); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IcuCollationProperty}. + */ + + public static class Builder extends DocValuesPropertyBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Boolean norms; + + @Nullable + private IndexOptions indexOptions; + + @Nullable + private Boolean index; + + @Nullable + private String nullValue; + + @Nullable + private String rules; + + @Nullable + private String language; + + @Nullable + private String country; + + @Nullable + private String variant; + + @Nullable + private IcuCollationStrength strength; + + @Nullable + private IcuCollationDecomposition decomposition; + + @Nullable + private IcuCollationAlternate alternate; + + @Nullable + private Boolean caseLevel; + + @Nullable + private IcuCollationCaseFirst caseFirst; + + @Nullable + private Boolean numeric; + + @Nullable + private String variableTop; + + @Nullable + private Boolean hiraganaQuaternaryMode; + + /** + * API name: {@code norms} + */ + public final Builder norms(@Nullable Boolean value) { + this.norms = value; + return this; + } + + /** + * API name: {@code index_options} + */ + public final Builder indexOptions(@Nullable IndexOptions value) { + this.indexOptions = value; + return this; + } + + /** + * Should the field be searchable? + *

+ * API name: {@code index} + */ + public final Builder index(@Nullable Boolean value) { + this.index = value; + return this; + } + + /** + * Accepts a string value which is substituted for any explicit null values. + * Defaults to null, which means the field is treated as missing. + *

+ * API name: {@code null_value} + */ + public final Builder nullValue(@Nullable String value) { + this.nullValue = value; + return this; + } + + /** + * API name: {@code rules} + */ + public final Builder rules(@Nullable String value) { + this.rules = value; + return this; + } + + /** + * API name: {@code language} + */ + public final Builder language(@Nullable String value) { + this.language = value; + return this; + } + + /** + * API name: {@code country} + */ + public final Builder country(@Nullable String value) { + this.country = value; + return this; + } + + /** + * API name: {@code variant} + */ + public final Builder variant(@Nullable String value) { + this.variant = value; + return this; + } + + /** + * API name: {@code strength} + */ + public final Builder strength(@Nullable IcuCollationStrength value) { + this.strength = value; + return this; + } + + /** + * API name: {@code decomposition} + */ + public final Builder decomposition(@Nullable IcuCollationDecomposition value) { + this.decomposition = value; + return this; + } + + /** + * API name: {@code alternate} + */ + public final Builder alternate(@Nullable IcuCollationAlternate value) { + this.alternate = value; + return this; + } + + /** + * API name: {@code case_level} + */ + public final Builder caseLevel(@Nullable Boolean value) { + this.caseLevel = value; + return this; + } + + /** + * API name: {@code case_first} + */ + public final Builder caseFirst(@Nullable IcuCollationCaseFirst value) { + this.caseFirst = value; + return this; + } + + /** + * API name: {@code numeric} + */ + public final Builder numeric(@Nullable Boolean value) { + this.numeric = value; + return this; + } + + /** + * API name: {@code variable_top} + */ + public final Builder variableTop(@Nullable String value) { + this.variableTop = value; + return this; + } + + /** + * API name: {@code hiragana_quaternary_mode} + */ + public final Builder hiraganaQuaternaryMode(@Nullable Boolean value) { + this.hiraganaQuaternaryMode = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IcuCollationProperty}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IcuCollationProperty build() { + _checkSingleUse(); + + return new IcuCollationProperty(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IcuCollationProperty} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IcuCollationProperty::setupIcuCollationPropertyDeserializer); + + protected static void setupIcuCollationPropertyDeserializer(ObjectDeserializer op) { + DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + op.add(Builder::norms, JsonpDeserializer.booleanDeserializer(), "norms"); + op.add(Builder::indexOptions, IndexOptions._DESERIALIZER, "index_options"); + op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); + op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value"); + op.add(Builder::rules, JsonpDeserializer.stringDeserializer(), "rules"); + op.add(Builder::language, JsonpDeserializer.stringDeserializer(), "language"); + op.add(Builder::country, JsonpDeserializer.stringDeserializer(), "country"); + op.add(Builder::variant, JsonpDeserializer.stringDeserializer(), "variant"); + op.add(Builder::strength, IcuCollationStrength._DESERIALIZER, "strength"); + op.add(Builder::decomposition, IcuCollationDecomposition._DESERIALIZER, "decomposition"); + 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::numeric, JsonpDeserializer.booleanDeserializer(), "numeric"); + op.add(Builder::variableTop, JsonpDeserializer.stringDeserializer(), "variable_top"); + op.add(Builder::hiraganaQuaternaryMode, JsonpDeserializer.booleanDeserializer(), "hiragana_quaternary_mode"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java index f0f9da125..91c186b6f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java @@ -114,6 +114,8 @@ public enum Kind implements JsonEnum { Histogram("histogram"), + IcuCollationKeyword("icu_collation_keyword"), + Integer("integer"), IntegerRange("integer_range"), @@ -585,6 +587,24 @@ public HistogramProperty histogram() { return TaggedUnionUtils.get(this, Kind.Histogram); } + /** + * Is this variant instance of kind {@code icu_collation_keyword}? + */ + public boolean isIcuCollationKeyword() { + return _kind == Kind.IcuCollationKeyword; + } + + /** + * Get the {@code icu_collation_keyword} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the + * {@code icu_collation_keyword} kind. + */ + public IcuCollationProperty icuCollationKeyword() { + return TaggedUnionUtils.get(this, Kind.IcuCollationKeyword); + } + /** * Is this variant instance of kind {@code integer}? */ @@ -1307,6 +1327,17 @@ public ObjectBuilder histogram( return this.histogram(fn.apply(new HistogramProperty.Builder()).build()); } + public ObjectBuilder icuCollationKeyword(IcuCollationProperty v) { + this._kind = Kind.IcuCollationKeyword; + this._value = v; + return this; + } + + public ObjectBuilder icuCollationKeyword( + Function> fn) { + return this.icuCollationKeyword(fn.apply(new IcuCollationProperty.Builder()).build()); + } + public ObjectBuilder integer(IntegerNumberProperty v) { this._kind = Kind.Integer; this._value = v; @@ -1629,6 +1660,7 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) op.add(Builder::geoShape, GeoShapeProperty._DESERIALIZER, "geo_shape"); op.add(Builder::halfFloat, HalfFloatNumberProperty._DESERIALIZER, "half_float"); op.add(Builder::histogram, HistogramProperty._DESERIALIZER, "histogram"); + op.add(Builder::icuCollationKeyword, IcuCollationProperty._DESERIALIZER, "icu_collation_keyword"); op.add(Builder::integer, IntegerNumberProperty._DESERIALIZER, "integer"); op.add(Builder::integerRange, IntegerRangeProperty._DESERIALIZER, "integer_range"); op.add(Builder::ip, IpProperty._DESERIALIZER, "ip"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java index 7b07b0d0c..ca7678ff9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java @@ -423,6 +423,25 @@ public static Property histogram(Function> fn) { + Property.Builder builder = new Property.Builder(); + builder.icuCollationKeyword(fn.apply(new IcuCollationProperty.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link IntegerNumberProperty integer} * {@code Property} variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index b786afb83..b4162a26a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -733,8 +733,8 @@ '_types.mapping.BinaryProperty': '_types/mapping/core.ts#L49-L51', '_types.mapping.BooleanProperty': '_types/mapping/core.ts#L53-L59', '_types.mapping.ByteNumberProperty': '_types/mapping/core.ts#L166-L169', -'_types.mapping.CompletionProperty': '_types/mapping/specialized.ts#L27-L35', -'_types.mapping.ConstantKeywordProperty': '_types/mapping/specialized.ts#L44-L47', +'_types.mapping.CompletionProperty': '_types/mapping/specialized.ts#L33-L41', +'_types.mapping.ConstantKeywordProperty': '_types/mapping/specialized.ts#L50-L53', '_types.mapping.CorePropertyBase': '_types/mapping/core.ts#L39-L43', '_types.mapping.DataStreamTimestamp': '_types/mapping/TypeMapping.ts#L59-L61', '_types.mapping.DateNanosProperty': '_types/mapping/core.ts#L73-L81', @@ -748,10 +748,10 @@ '_types.mapping.DynamicMapping': '_types/mapping/dynamic-template.ts#L49-L58', '_types.mapping.DynamicProperty': '_types/mapping/core.ts#L288-L319', '_types.mapping.DynamicTemplate': '_types/mapping/dynamic-template.ts#L22-L42', -'_types.mapping.FieldAliasProperty': '_types/mapping/specialized.ts#L49-L52', +'_types.mapping.FieldAliasProperty': '_types/mapping/specialized.ts#L55-L58', '_types.mapping.FieldMapping': '_types/mapping/meta-fields.ts#L24-L27', '_types.mapping.FieldNamesField': '_types/mapping/meta-fields.ts#L42-L44', -'_types.mapping.FieldType': '_types/mapping/Property.ts#L160-L205', +'_types.mapping.FieldType': '_types/mapping/Property.ts#L164-L210', '_types.mapping.FlattenedProperty': '_types/mapping/complex.ts#L26-L37', '_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L136-L139', '_types.mapping.FloatRangeProperty': '_types/mapping/range.ts#L38-L40', @@ -760,12 +760,13 @@ '_types.mapping.GeoShapeProperty': '_types/mapping/geo.ts#L41-L54', '_types.mapping.GeoStrategy': '_types/mapping/geo.ts#L56-L59', '_types.mapping.HalfFloatNumberProperty': '_types/mapping/core.ts#L141-L144', -'_types.mapping.HistogramProperty': '_types/mapping/specialized.ts#L54-L57', +'_types.mapping.HistogramProperty': '_types/mapping/specialized.ts#L60-L63', +'_types.mapping.IcuCollationProperty': '_types/mapping/specialized.ts#L94-L118', '_types.mapping.IndexField': '_types/mapping/meta-fields.ts#L46-L48', '_types.mapping.IndexOptions': '_types/mapping/core.ts#L245-L250', '_types.mapping.IntegerNumberProperty': '_types/mapping/core.ts#L151-L154', '_types.mapping.IntegerRangeProperty': '_types/mapping/range.ts#L42-L44', -'_types.mapping.IpProperty': '_types/mapping/specialized.ts#L59-L73', +'_types.mapping.IpProperty': '_types/mapping/specialized.ts#L65-L79', '_types.mapping.IpRangeProperty': '_types/mapping/range.ts#L46-L48', '_types.mapping.JoinProperty': '_types/mapping/core.ts#L83-L87', '_types.mapping.KeywordProperty': '_types/mapping/core.ts#L89-L107', @@ -773,15 +774,15 @@ '_types.mapping.LongRangeProperty': '_types/mapping/range.ts#L50-L52', '_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L218-L243', '_types.mapping.MatchType': '_types/mapping/dynamic-template.ts#L44-L47', -'_types.mapping.Murmur3HashProperty': '_types/mapping/specialized.ts#L75-L77', +'_types.mapping.Murmur3HashProperty': '_types/mapping/specialized.ts#L81-L83', '_types.mapping.NestedProperty': '_types/mapping/complex.ts#L39-L44', '_types.mapping.NumberPropertyBase': '_types/mapping/core.ts#L109-L129', '_types.mapping.ObjectProperty': '_types/mapping/complex.ts#L46-L50', '_types.mapping.OnScriptError': '_types/mapping/core.ts#L131-L134', '_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L182-L184', '_types.mapping.PointProperty': '_types/mapping/geo.ts#L66-L71', -'_types.mapping.Property': '_types/mapping/Property.ts#L94-L158', -'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L82-L92', +'_types.mapping.Property': '_types/mapping/Property.ts#L95-L162', +'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L83-L93', '_types.mapping.RangePropertyBase': '_types/mapping/range.ts#L23-L27', '_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L186-L189', '_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L191-L194', @@ -797,12 +798,12 @@ '_types.mapping.SourceField': '_types/mapping/meta-fields.ts#L58-L65', '_types.mapping.SourceFieldMode': '_types/mapping/meta-fields.ts#L67-L75', '_types.mapping.SparseVectorProperty': '_types/mapping/core.ts#L196-L198', -'_types.mapping.SuggestContext': '_types/mapping/specialized.ts#L37-L42', +'_types.mapping.SuggestContext': '_types/mapping/specialized.ts#L43-L48', '_types.mapping.TermVectorOption': '_types/mapping/TermVectorOption.ts#L20-L28', '_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L252-L255', '_types.mapping.TextProperty': '_types/mapping/core.ts#L257-L273', '_types.mapping.TimeSeriesMetricType': '_types/mapping/TimeSeriesMetricType.ts#L20-L26', -'_types.mapping.TokenCountProperty': '_types/mapping/specialized.ts#L79-L86', +'_types.mapping.TokenCountProperty': '_types/mapping/specialized.ts#L85-L92', '_types.mapping.TypeMapping': '_types/mapping/TypeMapping.ts#L34-L57', '_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L171-L174', '_types.mapping.VersionProperty': '_types/mapping/core.ts#L275-L277', @@ -2720,10 +2721,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/2a4afb9372742518b1a19ba0ca0829b50ec10926/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/42a458c196b1b8a82a1931f4879ccc17466c6f2c/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java index b38529f9f..e6b3ceac8 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java @@ -164,6 +164,7 @@ public void i0254_suggesterTest() throws Exception { } @Test + // update: icu_collation_keyword has been released and added to the spec public void i0249_variantKind() throws Exception { try (ElasticsearchTestServer server = new ElasticsearchTestServer("analysis-icu").start()) { @@ -198,8 +199,8 @@ public void i0249_variantKind() throws Exception { Property property = fm.get("i0249").mappings().get("name").mapping().get("name").text().fields().get("sort"); - assertTrue(property._isCustom()); - assertEquals("icu_collation_keyword", property._customKind()); + assertFalse(property._isCustom()); + assertEquals(Property.Kind.IcuCollationKeyword, property._kind()); } }