diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java index 7a52d03b1..6562f5312 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java @@ -1668,7 +1668,7 @@ public String toString() { return JsonpUtils.toString(this); } - public static class Builder extends WithJsonObjectBuilderBase { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; private String _customKind; @@ -2557,7 +2557,7 @@ public ContainerBuilder _custom(String name, Object data) { return new ContainerBuilder(); } - protected Aggregation build() { + public Aggregation build() { _checkSingleUse(); return new Aggregation(this); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java index d7826ed49..0a1ff795e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java @@ -29,6 +29,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Double; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -60,13 +61,13 @@ @JsonpDeserializable public class AggregationRange implements JsonpSerializable { @Nullable - private final String from; + private final Double from; @Nullable private final String key; @Nullable - private final String to; + private final Double to; // --------------------------------------------------------------------------------------------- @@ -88,7 +89,7 @@ public static AggregationRange of(Function implements ObjectBuilder { @Nullable - private String from; + private Double from; @Nullable private String key; @Nullable - private String to; + private Double to; /** * Start of the range (inclusive). *

* API name: {@code from} */ - public final Builder from(@Nullable String value) { + public final Builder from(@Nullable Double value) { this.from = value; return this; } @@ -187,7 +188,7 @@ public final Builder key(@Nullable String value) { *

* API name: {@code to} */ - public final Builder to(@Nullable String value) { + public final Builder to(@Nullable Double value) { this.to = value; return this; } @@ -220,9 +221,9 @@ public AggregationRange build() { protected static void setupAggregationRangeDeserializer(ObjectDeserializer op) { - op.add(Builder::from, JsonpDeserializer.stringDeserializer(), "from"); + op.add(Builder::from, JsonpDeserializer.doubleDeserializer(), "from"); op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key"); - op.add(Builder::to, JsonpDeserializer.stringDeserializer(), "to"); + op.add(Builder::to, JsonpDeserializer.doubleDeserializer(), "to"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java index 06ae3293b..d66a4b43b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java @@ -210,7 +210,7 @@ protected static void setupNormalizerDeserializer(ObjectDeserializer op op.add(Builder::custom, CustomNormalizer._DESERIALIZER, "custom"); op.add(Builder::lowercase, LowercaseNormalizer._DESERIALIZER, "lowercase"); - op.setTypeProperty("type", null); + op.setTypeProperty("type", "custom"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplate.java index eb9700547..5fb0f0d86 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplate.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch._types.mapping; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -26,10 +27,15 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Object; import java.lang.String; +import java.util.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -58,39 +64,90 @@ * specification */ @JsonpDeserializable -public class DynamicTemplate implements JsonpSerializable { - @Nullable - private final Property mapping; +public class DynamicTemplate implements TaggedUnion, JsonpSerializable { - @Nullable - private final String match; + /** + * {@link DynamicTemplate} variant kinds. + * + * @see API + * specification + */ - @Nullable - private final String matchMappingType; + public enum Kind implements JsonEnum { + Mapping("mapping"), + + Runtime("runtime"), + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private final List match; + + private final List pathMatch; + + private final List unmatch; + + private final List pathUnmatch; + + private final List matchMappingType; + + private final List unmatchMappingType; @Nullable private final MatchType matchPattern; - @Nullable - private final String pathMatch; + public DynamicTemplate(DynamicTemplateVariant value) { - @Nullable - private final String pathUnmatch; + this._kind = ApiTypeHelper.requireNonNull(value._dynamicTemplateKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); - @Nullable - private final String unmatch; + this.match = null; + this.pathMatch = null; + this.unmatch = null; + this.pathUnmatch = null; + this.matchMappingType = null; + this.unmatchMappingType = null; + this.matchPattern = null; - // --------------------------------------------------------------------------------------------- + } private DynamicTemplate(Builder builder) { - this.mapping = builder.mapping; - this.match = builder.match; - this.matchMappingType = builder.matchMappingType; + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + this.match = ApiTypeHelper.unmodifiable(builder.match); + this.pathMatch = ApiTypeHelper.unmodifiable(builder.pathMatch); + this.unmatch = ApiTypeHelper.unmodifiable(builder.unmatch); + this.pathUnmatch = ApiTypeHelper.unmodifiable(builder.pathUnmatch); + this.matchMappingType = ApiTypeHelper.unmodifiable(builder.matchMappingType); + this.unmatchMappingType = ApiTypeHelper.unmodifiable(builder.unmatchMappingType); this.matchPattern = builder.matchPattern; - this.pathMatch = builder.pathMatch; - this.pathUnmatch = builder.pathUnmatch; - this.unmatch = builder.unmatch; } @@ -99,29 +156,47 @@ public static DynamicTemplate of(Function match() { + return this.match; } /** - * API name: {@code match} + * API name: {@code path_match} */ - @Nullable - public final String match() { - return this.match; + public final List pathMatch() { + return this.pathMatch; + } + + /** + * API name: {@code unmatch} + */ + public final List unmatch() { + return this.unmatch; + } + + /** + * API name: {@code path_unmatch} + */ + public final List pathUnmatch() { + return this.pathUnmatch; } /** * API name: {@code match_mapping_type} */ - @Nullable - public final String matchMappingType() { + public final List matchMappingType() { return this.matchMappingType; } + /** + * API name: {@code unmatch_mapping_type} + */ + public final List unmatchMappingType() { + return this.unmatchMappingType; + } + /** * API name: {@code match_pattern} */ @@ -131,74 +206,116 @@ public final MatchType matchPattern() { } /** - * API name: {@code path_match} + * Is this variant instance of kind {@code mapping}? */ - @Nullable - public final String pathMatch() { - return this.pathMatch; + public boolean isMapping() { + return _kind == Kind.Mapping; } /** - * API name: {@code path_unmatch} + * Get the {@code mapping} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code mapping} kind. */ - @Nullable - public final String pathUnmatch() { - return this.pathUnmatch; + public Property mapping() { + return TaggedUnionUtils.get(this, Kind.Mapping); } /** - * API name: {@code unmatch} + * Is this variant instance of kind {@code runtime}? */ - @Nullable - public final String unmatch() { - return this.unmatch; + public boolean isRuntime() { + return _kind == Kind.Runtime; } /** - * Serialize this object to JSON. + * Get the {@code runtime} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code runtime} kind. */ + public Property runtime() { + return TaggedUnionUtils.get(this, Kind.Runtime); + } + + @Override + @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.match)) { + generator.writeKey("match"); + generator.writeStartArray(); + for (String item0 : this.match) { + generator.write(item0); - if (this.mapping != null) { - generator.writeKey("mapping"); - this.mapping.serialize(generator, mapper); + } + generator.writeEnd(); } - if (this.match != null) { - generator.writeKey("match"); - generator.write(this.match); + if (ApiTypeHelper.isDefined(this.pathMatch)) { + generator.writeKey("path_match"); + generator.writeStartArray(); + for (String item0 : this.pathMatch) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.unmatch)) { + generator.writeKey("unmatch"); + generator.writeStartArray(); + for (String item0 : this.unmatch) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.pathUnmatch)) { + generator.writeKey("path_unmatch"); + generator.writeStartArray(); + for (String item0 : this.pathUnmatch) { + generator.write(item0); + + } + generator.writeEnd(); } - if (this.matchMappingType != null) { + if (ApiTypeHelper.isDefined(this.matchMappingType)) { generator.writeKey("match_mapping_type"); - generator.write(this.matchMappingType); + generator.writeStartArray(); + for (String item0 : this.matchMappingType) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.unmatchMappingType)) { + generator.writeKey("unmatch_mapping_type"); + generator.writeStartArray(); + for (String item0 : this.unmatchMappingType) { + generator.write(item0); + + } + generator.writeEnd(); } if (this.matchPattern != null) { generator.writeKey("match_pattern"); this.matchPattern.serialize(generator, mapper); } - if (this.pathMatch != null) { - generator.writeKey("path_match"); - generator.write(this.pathMatch); + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); } - if (this.pathUnmatch != null) { - generator.writeKey("path_unmatch"); - generator.write(this.pathUnmatch); - } - if (this.unmatch != null) { - generator.writeKey("unmatch"); - generator.write(this.unmatch); - - } + generator.writeEnd(); } @@ -207,133 +324,343 @@ public String toString() { return JsonpUtils.toString(this); } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DynamicTemplate}. - */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + @Nullable - private Property mapping; + private List match; @Nullable - private String match; + private List pathMatch; @Nullable - private String matchMappingType; + private List unmatch; @Nullable - private MatchType matchPattern; + private List pathUnmatch; @Nullable - private String pathMatch; + private List matchMappingType; @Nullable - private String pathUnmatch; + private List unmatchMappingType; @Nullable - private String unmatch; + private MatchType matchPattern; /** - * API name: {@code mapping} + * API name: {@code match} + *

+ * Adds all elements of list to match. */ - public final Builder mapping(@Nullable Property value) { - this.mapping = value; + public final Builder match(List list) { + this.match = _listAddAll(this.match, list); return this; } /** - * API name: {@code mapping} + * API name: {@code match} + *

+ * Adds one or more values to match. */ - public final Builder mapping(Function> fn) { - return this.mapping(fn.apply(new Property.Builder()).build()); + public final Builder match(String value, String... values) { + this.match = _listAdd(this.match, value, values); + return this; } /** - * API name: {@code match} + * API name: {@code path_match} + *

+ * Adds all elements of list to pathMatch. */ - public final Builder match(@Nullable String value) { - this.match = value; + public final Builder pathMatch(List list) { + this.pathMatch = _listAddAll(this.pathMatch, list); return this; } /** - * API name: {@code match_mapping_type} + * API name: {@code path_match} + *

+ * Adds one or more values to pathMatch. */ - public final Builder matchMappingType(@Nullable String value) { - this.matchMappingType = value; + public final Builder pathMatch(String value, String... values) { + this.pathMatch = _listAdd(this.pathMatch, value, values); return this; } /** - * API name: {@code match_pattern} + * API name: {@code unmatch} + *

+ * Adds all elements of list to unmatch. */ - public final Builder matchPattern(@Nullable MatchType value) { - this.matchPattern = value; + public final Builder unmatch(List list) { + this.unmatch = _listAddAll(this.unmatch, list); return this; } /** - * API name: {@code path_match} + * API name: {@code unmatch} + *

+ * Adds one or more values to unmatch. */ - public final Builder pathMatch(@Nullable String value) { - this.pathMatch = value; + public final Builder unmatch(String value, String... values) { + this.unmatch = _listAdd(this.unmatch, value, values); return this; } /** * API name: {@code path_unmatch} + *

+ * Adds all elements of list to pathUnmatch. */ - public final Builder pathUnmatch(@Nullable String value) { - this.pathUnmatch = value; + public final Builder pathUnmatch(List list) { + this.pathUnmatch = _listAddAll(this.pathUnmatch, list); return this; } /** - * API name: {@code unmatch} + * API name: {@code path_unmatch} + *

+ * Adds one or more values to pathUnmatch. */ - public final Builder unmatch(@Nullable String value) { - this.unmatch = value; + public final Builder pathUnmatch(String value, String... values) { + this.pathUnmatch = _listAdd(this.pathUnmatch, value, values); return this; } - @Override - protected Builder self() { + /** + * API name: {@code match_mapping_type} + *

+ * Adds all elements of list to matchMappingType. + */ + public final Builder matchMappingType(List list) { + this.matchMappingType = _listAddAll(this.matchMappingType, list); return this; } /** - * Builds a {@link DynamicTemplate}. - * - * @throws NullPointerException - * if some of the required fields are null. + * API name: {@code match_mapping_type} + *

+ * Adds one or more values to matchMappingType. */ + public final Builder matchMappingType(String value, String... values) { + this.matchMappingType = _listAdd(this.matchMappingType, value, values); + return this; + } + + /** + * API name: {@code unmatch_mapping_type} + *

+ * Adds all elements of list to unmatchMappingType. + */ + public final Builder unmatchMappingType(List list) { + this.unmatchMappingType = _listAddAll(this.unmatchMappingType, list); + return this; + } + + /** + * API name: {@code unmatch_mapping_type} + *

+ * Adds one or more values to unmatchMappingType. + */ + public final Builder unmatchMappingType(String value, String... values) { + this.unmatchMappingType = _listAdd(this.unmatchMappingType, value, values); + return this; + } + + /** + * API name: {@code match_pattern} + */ + public final Builder matchPattern(@Nullable MatchType value) { + this.matchPattern = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + public ContainerBuilder mapping(Property v) { + this._kind = Kind.Mapping; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder mapping(Function> fn) { + return this.mapping(fn.apply(new Property.Builder()).build()); + } + + public ContainerBuilder runtime(Property v) { + this._kind = Kind.Runtime; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder runtime(Function> fn) { + return this.runtime(fn.apply(new Property.Builder()).build()); + } + public DynamicTemplate build() { _checkSingleUse(); - return new DynamicTemplate(this); } - } - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DynamicTemplate} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DynamicTemplate::setupDynamicTemplateDeserializer); + public class ContainerBuilder implements ObjectBuilder { + + /** + * API name: {@code match} + *

+ * Adds all elements of list to match. + */ + public final ContainerBuilder match(List list) { + Builder.this.match = _listAddAll(Builder.this.match, list); + return this; + } + + /** + * API name: {@code match} + *

+ * Adds one or more values to match. + */ + public final ContainerBuilder match(String value, String... values) { + Builder.this.match = _listAdd(Builder.this.match, value, values); + return this; + } + + /** + * API name: {@code path_match} + *

+ * Adds all elements of list to pathMatch. + */ + public final ContainerBuilder pathMatch(List list) { + Builder.this.pathMatch = _listAddAll(Builder.this.pathMatch, list); + return this; + } + + /** + * API name: {@code path_match} + *

+ * Adds one or more values to pathMatch. + */ + public final ContainerBuilder pathMatch(String value, String... values) { + Builder.this.pathMatch = _listAdd(Builder.this.pathMatch, value, values); + return this; + } + + /** + * API name: {@code unmatch} + *

+ * Adds all elements of list to unmatch. + */ + public final ContainerBuilder unmatch(List list) { + Builder.this.unmatch = _listAddAll(Builder.this.unmatch, list); + return this; + } + + /** + * API name: {@code unmatch} + *

+ * Adds one or more values to unmatch. + */ + public final ContainerBuilder unmatch(String value, String... values) { + Builder.this.unmatch = _listAdd(Builder.this.unmatch, value, values); + return this; + } + + /** + * API name: {@code path_unmatch} + *

+ * Adds all elements of list to pathUnmatch. + */ + public final ContainerBuilder pathUnmatch(List list) { + Builder.this.pathUnmatch = _listAddAll(Builder.this.pathUnmatch, list); + return this; + } + + /** + * API name: {@code path_unmatch} + *

+ * Adds one or more values to pathUnmatch. + */ + public final ContainerBuilder pathUnmatch(String value, String... values) { + Builder.this.pathUnmatch = _listAdd(Builder.this.pathUnmatch, value, values); + return this; + } + + /** + * API name: {@code match_mapping_type} + *

+ * Adds all elements of list to matchMappingType. + */ + public final ContainerBuilder matchMappingType(List list) { + Builder.this.matchMappingType = _listAddAll(Builder.this.matchMappingType, list); + return this; + } + + /** + * API name: {@code match_mapping_type} + *

+ * Adds one or more values to matchMappingType. + */ + public final ContainerBuilder matchMappingType(String value, String... values) { + Builder.this.matchMappingType = _listAdd(Builder.this.matchMappingType, value, values); + return this; + } + + /** + * API name: {@code unmatch_mapping_type} + *

+ * Adds all elements of list to unmatchMappingType. + */ + public final ContainerBuilder unmatchMappingType(List list) { + Builder.this.unmatchMappingType = _listAddAll(Builder.this.unmatchMappingType, list); + return this; + } + + /** + * API name: {@code unmatch_mapping_type} + *

+ * Adds one or more values to unmatchMappingType. + */ + public final ContainerBuilder unmatchMappingType(String value, String... values) { + Builder.this.unmatchMappingType = _listAdd(Builder.this.unmatchMappingType, value, values); + return this; + } + + /** + * API name: {@code match_pattern} + */ + public final ContainerBuilder matchPattern(@Nullable MatchType value) { + Builder.this.matchPattern = value; + return this; + } + + public DynamicTemplate build() { + return Builder.this.build(); + } + } + } - protected static void setupDynamicTemplateDeserializer(ObjectDeserializer op) { + protected static void setupDynamicTemplateDeserializer(ObjectDeserializer op) { op.add(Builder::mapping, Property._DESERIALIZER, "mapping"); - op.add(Builder::match, JsonpDeserializer.stringDeserializer(), "match"); - op.add(Builder::matchMappingType, JsonpDeserializer.stringDeserializer(), "match_mapping_type"); + op.add(Builder::runtime, Property._DESERIALIZER, "runtime"); + op.add(Builder::match, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "match"); + op.add(Builder::pathMatch, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "path_match"); + op.add(Builder::unmatch, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "unmatch"); + op.add(Builder::pathUnmatch, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "path_unmatch"); + op.add(Builder::matchMappingType, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "match_mapping_type"); + op.add(Builder::unmatchMappingType, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "unmatch_mapping_type"); op.add(Builder::matchPattern, MatchType._DESERIALIZER, "match_pattern"); - op.add(Builder::pathMatch, JsonpDeserializer.stringDeserializer(), "path_match"); - op.add(Builder::pathUnmatch, JsonpDeserializer.stringDeserializer(), "path_unmatch"); - op.add(Builder::unmatch, JsonpDeserializer.stringDeserializer(), "unmatch"); } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DynamicTemplate::setupDynamicTemplateDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateBuilders.java new file mode 100644 index 000000000..0096d77f0 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateBuilders.java @@ -0,0 +1,83 @@ +/* + * 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.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link DynamicTemplate} variants. + */ +public class DynamicTemplateBuilders { + private DynamicTemplateBuilders() { + } + + /** + * Creates a builder for the {@link Property mapping} {@code DynamicTemplate} + * variant. + */ + public static Property.Builder mapping() { + return new Property.Builder(); + } + + /** + * Creates a DynamicTemplate of the {@link Property mapping} + * {@code DynamicTemplate} variant. + */ + public static DynamicTemplate mapping(Function> fn) { + DynamicTemplate.Builder builder = new DynamicTemplate.Builder(); + builder.mapping(fn.apply(new Property.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link Property runtime} {@code DynamicTemplate} + * variant. + */ + public static Property.Builder runtime() { + return new Property.Builder(); + } + + /** + * Creates a DynamicTemplate of the {@link Property runtime} + * {@code DynamicTemplate} variant. + */ + public static DynamicTemplate runtime(Function> fn) { + DynamicTemplate.Builder builder = new DynamicTemplate.Builder(); + builder.runtime(fn.apply(new Property.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateVariant.java new file mode 100644 index 000000000..553a5b4ef --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicTemplateVariant.java @@ -0,0 +1,48 @@ +/* + * 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; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link DynamicTemplate} variants. + */ +public interface DynamicTemplateVariant { + + DynamicTemplate.Kind _dynamicTemplateKind(); + + default DynamicTemplate _toDynamicTemplate() { + return new DynamicTemplate(this); + } + +} 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 6a42418aa..14597f00f 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 @@ -73,6 +73,8 @@ public enum FieldType implements JsonEnum { Object("object"), + Version("version"), + Murmur3("murmur3"), TokenCount("token_count"), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java index 1442a3279..022376e1c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch._types.mapping; +import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -70,6 +71,12 @@ public class KeywordProperty extends DocValuesPropertyBase implements PropertyVa @Nullable private final IndexOptions indexOptions; + @Nullable + private final Script script; + + @Nullable + private final OnScriptError onScriptError; + @Nullable private final String normalizer; @@ -94,6 +101,8 @@ private KeywordProperty(Builder builder) { this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals; this.index = builder.index; this.indexOptions = builder.indexOptions; + this.script = builder.script; + this.onScriptError = builder.onScriptError; this.normalizer = builder.normalizer; this.norms = builder.norms; this.nullValue = builder.nullValue; @@ -146,6 +155,22 @@ public final IndexOptions indexOptions() { return this.indexOptions; } + /** + * 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; + } + /** * API name: {@code normalizer} */ @@ -212,6 +237,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("index_options"); this.indexOptions.serialize(generator, mapper); } + 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); + } if (this.normalizer != null) { generator.writeKey("normalizer"); generator.write(this.normalizer); @@ -261,6 +295,12 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder> fn) { + return this.script(fn.apply(new Script.Builder()).build()); + } + + /** + * API name: {@code on_script_error} + */ + public final Builder onScriptError(@Nullable OnScriptError value) { + this.onScriptError = value; + return this; + } + /** * API name: {@code normalizer} */ @@ -383,6 +446,8 @@ protected static void setupKeywordPropertyDeserializer(ObjectDeserializer { + public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { private Kind _kind; private Object _value; @@ -263,7 +263,7 @@ public ContainerBuilder docs(List v) { return new ContainerBuilder(); } - protected PinnedQuery build() { + public PinnedQuery build() { _checkSingleUse(); return new PinnedQuery(this); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/FieldSuggester.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/FieldSuggester.java index 769fd4573..8cfb7aae5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/FieldSuggester.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/FieldSuggester.java @@ -295,7 +295,7 @@ public String toString() { return JsonpUtils.toString(this); } - public static class Builder extends WithJsonObjectBuilderBase { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; private String _customKind; @@ -391,7 +391,7 @@ public ContainerBuilder _custom(String name, Object data) { return new ContainerBuilder(); } - protected FieldSuggester build() { + public FieldSuggester build() { _checkSingleUse(); return new FieldSuggester(this); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java index 6ebb23e05..2c98a221b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java @@ -234,7 +234,7 @@ public String toString() { return JsonpUtils.toString(this); } - public static class Builder extends WithJsonObjectBuilderBase { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; private String _customKind; @@ -290,7 +290,7 @@ public ContainerBuilder _custom(String name, Object data) { return new ContainerBuilder(); } - protected Rescore build() { + public Rescore build() { _checkSingleUse(); return new Rescore(this); } 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 41e51ea7b..cc324137e 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 @@ -732,7 +732,7 @@ '_types.mapping.AllField': '_types/mapping/meta-fields.ts#L29-L40', '_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#L164-L167', +'_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.CorePropertyBase': '_types/mapping/core.ts#L39-L43', @@ -743,70 +743,70 @@ '_types.mapping.DenseVectorIndexOptions': '_types/mapping/DenseVectorIndexOptions.ts#L22-L26', '_types.mapping.DenseVectorProperty': '_types/mapping/complex.ts#L52-L59', '_types.mapping.DocValuesPropertyBase': '_types/mapping/core.ts#L45-L47', -'_types.mapping.DoubleNumberProperty': '_types/mapping/core.ts#L144-L147', +'_types.mapping.DoubleNumberProperty': '_types/mapping/core.ts#L146-L149', '_types.mapping.DoubleRangeProperty': '_types/mapping/range.ts#L34-L36', -'_types.mapping.DynamicMapping': '_types/mapping/dynamic-template.ts#L37-L46', -'_types.mapping.DynamicProperty': '_types/mapping/core.ts#L286-L317', -'_types.mapping.DynamicTemplate': '_types/mapping/dynamic-template.ts#L22-L30', +'_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.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-L204', +'_types.mapping.FieldType': '_types/mapping/Property.ts#L160-L205', '_types.mapping.FlattenedProperty': '_types/mapping/complex.ts#L26-L37', -'_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L134-L137', +'_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L136-L139', '_types.mapping.FloatRangeProperty': '_types/mapping/range.ts#L38-L40', '_types.mapping.GeoOrientation': '_types/mapping/geo.ts#L34-L39', '_types.mapping.GeoPointProperty': '_types/mapping/geo.ts#L24-L32', '_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#L139-L142', +'_types.mapping.HalfFloatNumberProperty': '_types/mapping/core.ts#L141-L144', '_types.mapping.HistogramProperty': '_types/mapping/specialized.ts#L54-L57', '_types.mapping.IndexField': '_types/mapping/meta-fields.ts#L46-L48', -'_types.mapping.IndexOptions': '_types/mapping/core.ts#L243-L248', -'_types.mapping.IntegerNumberProperty': '_types/mapping/core.ts#L149-L152', +'_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.IpRangeProperty': '_types/mapping/range.ts#L46-L48', '_types.mapping.JoinProperty': '_types/mapping/core.ts#L83-L87', -'_types.mapping.KeywordProperty': '_types/mapping/core.ts#L89-L105', -'_types.mapping.LongNumberProperty': '_types/mapping/core.ts#L154-L157', +'_types.mapping.KeywordProperty': '_types/mapping/core.ts#L89-L107', +'_types.mapping.LongNumberProperty': '_types/mapping/core.ts#L156-L159', '_types.mapping.LongRangeProperty': '_types/mapping/range.ts#L50-L52', -'_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L216-L241', -'_types.mapping.MatchType': '_types/mapping/dynamic-template.ts#L32-L35', +'_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.NestedProperty': '_types/mapping/complex.ts#L39-L44', -'_types.mapping.NumberPropertyBase': '_types/mapping/core.ts#L107-L127', +'_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#L129-L132', -'_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L180-L182', +'_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.RangePropertyBase': '_types/mapping/range.ts#L23-L27', -'_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L184-L187', -'_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L189-L192', +'_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L186-L189', +'_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L191-L194', '_types.mapping.RoutingField': '_types/mapping/meta-fields.ts#L50-L52', '_types.mapping.RuntimeField': '_types/mapping/RuntimeFields.ts#L26-L48', '_types.mapping.RuntimeFieldFetchFields': '_types/mapping/RuntimeFields.ts#L50-L54', '_types.mapping.RuntimeFieldType': '_types/mapping/RuntimeFields.ts#L56-L66', -'_types.mapping.ScaledFloatNumberProperty': '_types/mapping/core.ts#L174-L178', -'_types.mapping.SearchAsYouTypeProperty': '_types/mapping/core.ts#L198-L208', +'_types.mapping.ScaledFloatNumberProperty': '_types/mapping/core.ts#L176-L180', +'_types.mapping.SearchAsYouTypeProperty': '_types/mapping/core.ts#L200-L210', '_types.mapping.ShapeProperty': '_types/mapping/geo.ts#L73-L85', -'_types.mapping.ShortNumberProperty': '_types/mapping/core.ts#L159-L162', +'_types.mapping.ShortNumberProperty': '_types/mapping/core.ts#L161-L164', '_types.mapping.SizeField': '_types/mapping/meta-fields.ts#L54-L56', '_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#L194-L196', +'_types.mapping.SparseVectorProperty': '_types/mapping/core.ts#L196-L198', '_types.mapping.SuggestContext': '_types/mapping/specialized.ts#L37-L42', '_types.mapping.TermVectorOption': '_types/mapping/TermVectorOption.ts#L20-L28', -'_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L250-L253', -'_types.mapping.TextProperty': '_types/mapping/core.ts#L255-L271', +'_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.TypeMapping': '_types/mapping/TypeMapping.ts#L34-L57', -'_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L169-L172', -'_types.mapping.VersionProperty': '_types/mapping/core.ts#L273-L275', -'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L277-L284', +'_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L171-L174', +'_types.mapping.VersionProperty': '_types/mapping/core.ts#L275-L277', +'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L279-L286', '_types.query_dsl.BoolQuery': '_types/query_dsl/compound.ts#L28-L52', '_types.query_dsl.BoostingQuery': '_types/query_dsl/compound.ts#L54-L67', '_types.query_dsl.ChildScoreMode': '_types/query_dsl/joining.ts#L25-L39', @@ -2720,10 +2720,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/312f5025e3df4ad09086ade5024b3b73566a1496/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/982cc3c7b0c7447b30ef17a9c8813a1d750e7ef0/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyAggregation.java index 3489c2771..bd1996642 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyAggregation.java @@ -402,7 +402,7 @@ public String toString() { return JsonpUtils.toString(this); } - public static class Builder extends WithJsonObjectBuilderBase { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; private String _customKind; @@ -584,7 +584,7 @@ public ContainerBuilder _custom(String name, Object data) { return new ContainerBuilder(); } - protected ApiKeyAggregation build() { + public ApiKeyAggregation build() { _checkSingleUse(); return new ApiKeyAggregation(this); }