diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregate.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregate.java index c4a9b340c..22ad48e02 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregate.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregate.java @@ -196,6 +196,8 @@ public enum Kind implements JsonEnum { TTest("t_test"), + TimeSeries("time_series"), + TopHits("top_hits"), TopMetrics("top_metrics"), @@ -1307,6 +1309,23 @@ public TTestAggregate tTest() { return TaggedUnionUtils.get(this, Kind.TTest); } + /** + * Is this variant instance of kind {@code time_series}? + */ + public boolean isTimeSeries() { + return _kind == Kind.TimeSeries; + } + + /** + * Get the {@code time_series} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code time_series} kind. + */ + public TimeSeriesAggregate timeSeries() { + return TaggedUnionUtils.get(this, Kind.TimeSeries); + } + /** * Is this variant instance of kind {@code top_hits}? */ @@ -2156,6 +2175,17 @@ public ObjectBuilder tTest(Function timeSeries(TimeSeriesAggregate v) { + this._kind = Kind.TimeSeries; + this._value = v; + return this; + } + + public ObjectBuilder timeSeries( + Function> fn) { + return this.timeSeries(fn.apply(new TimeSeriesAggregate.Builder()).build()); + } + public ObjectBuilder topHits(TopHitsAggregate v) { this._kind = Kind.TopHits; this._value = v; @@ -2342,6 +2372,7 @@ public Aggregate build() { deserializers.put("tdigest_percentile_ranks", TDigestPercentileRanksAggregate._DESERIALIZER); deserializers.put("tdigest_percentiles", TDigestPercentilesAggregate._DESERIALIZER); deserializers.put("t_test", TTestAggregate._DESERIALIZER); + deserializers.put("time_series", TimeSeriesAggregate._DESERIALIZER); deserializers.put("top_hits", TopHitsAggregate._DESERIALIZER); deserializers.put("top_metrics", TopMetricsAggregate._DESERIALIZER); deserializers.put("umrareterms", UnmappedRareTermsAggregate._DESERIALIZER); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregateBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregateBuilders.java index ea8787496..97f5bea73 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregateBuilders.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregateBuilders.java @@ -1149,6 +1149,24 @@ public static Aggregate tTest(Function> fn) { + Aggregate.Builder builder = new Aggregate.Builder(); + builder.timeSeries(fn.apply(new TimeSeriesAggregate.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link TopHitsAggregate top_hits} {@code Aggregate} * variant. diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java index 6562f5312..b05d03a84 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java @@ -215,6 +215,8 @@ public enum Kind implements JsonEnum { Terms("terms"), + TimeSeries("time_series"), + TopHits("top_hits"), TTest("t_test"), @@ -1493,6 +1495,23 @@ public TermsAggregation terms() { return TaggedUnionUtils.get(this, Kind.Terms); } + /** + * Is this variant instance of kind {@code time_series}? + */ + public boolean isTimeSeries() { + return _kind == Kind.TimeSeries; + } + + /** + * Get the {@code time_series} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code time_series} kind. + */ + public TimeSeriesAggregation timeSeries() { + return TaggedUnionUtils.get(this, Kind.TimeSeries); + } + /** * Is this variant instance of kind {@code top_hits}? */ @@ -2477,6 +2496,17 @@ public ContainerBuilder terms(Function> fn) { + return this.timeSeries(fn.apply(new TimeSeriesAggregation.Builder()).build()); + } + public ContainerBuilder topHits(TopHitsAggregation v) { this._kind = Kind.TopHits; this._value = v; @@ -2702,6 +2732,7 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o op.add(Builder::sum, SumAggregation._DESERIALIZER, "sum"); op.add(Builder::sumBucket, SumBucketAggregation._DESERIALIZER, "sum_bucket"); op.add(Builder::terms, TermsAggregation._DESERIALIZER, "terms"); + op.add(Builder::timeSeries, TimeSeriesAggregation._DESERIALIZER, "time_series"); op.add(Builder::topHits, TopHitsAggregation._DESERIALIZER, "top_hits"); op.add(Builder::tTest, TTestAggregation._DESERIALIZER, "t_test"); op.add(Builder::topMetrics, TopMetricsAggregation._DESERIALIZER, "top_metrics"); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java index f35032bf6..f0b63a419 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java @@ -1335,6 +1335,25 @@ public static Aggregation terms(Function> fn) { + Aggregation.Builder builder = new Aggregation.Builder(); + builder.timeSeries(fn.apply(new TimeSeriesAggregation.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link TopHitsAggregation top_hits} * {@code Aggregation} variant. diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java index 0a1ff795e..8da244134 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationRange.java @@ -87,6 +87,8 @@ public static AggregationRange of(Function * API name: {@code from} + *

+ * Defaults to {@code 0} if parsed from a JSON {@code null} value. */ @Nullable public final Double from() { @@ -107,6 +109,8 @@ public final String key() { * End of the range (exclusive). *

* API name: {@code to} + *

+ * Defaults to {@code 0} if parsed from a JSON {@code null} value. */ @Nullable public final Double to() { @@ -126,8 +130,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.from != null) { generator.writeKey("from"); - generator.write(this.from); - + JsonpUtils.serializeDoubleOrNull(generator, this.from, 0); } if (this.key != null) { generator.writeKey("key"); @@ -136,8 +139,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.to != null) { generator.writeKey("to"); - generator.write(this.to); - + JsonpUtils.serializeDoubleOrNull(generator, this.to, 0); } } @@ -167,6 +169,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement * Start of the range (inclusive). *

* API name: {@code from} + *

+ * Defaults to {@code 0} if parsed from a JSON {@code null} value. */ public final Builder from(@Nullable Double value) { this.from = value; @@ -187,6 +191,8 @@ public final Builder key(@Nullable String value) { * End of the range (exclusive). *

* API name: {@code to} + *

+ * Defaults to {@code 0} if parsed from a JSON {@code null} value. */ public final Builder to(@Nullable Double value) { this.to = value; @@ -221,9 +227,9 @@ public AggregationRange build() { protected static void setupAggregationRangeDeserializer(ObjectDeserializer op) { - op.add(Builder::from, JsonpDeserializer.doubleDeserializer(), "from"); + op.add(Builder::from, JsonpDeserializer.doubleOrNullDeserializer(0), "from"); op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key"); - op.add(Builder::to, JsonpDeserializer.doubleDeserializer(), "to"); + op.add(Builder::to, JsonpDeserializer.doubleOrNullDeserializer(0), "to"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregate.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregate.java new file mode 100644 index 000000000..aede05314 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregate.java @@ -0,0 +1,116 @@ +/* + * 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.aggregations; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +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.util.Objects; +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. +// +//---------------------------------------------------------------- + +// typedef: _types.aggregations.TimeSeriesAggregate + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TimeSeriesAggregate extends MultiBucketAggregateBase implements AggregateVariant { + // --------------------------------------------------------------------------------------------- + + private TimeSeriesAggregate(Builder builder) { + super(builder); + + } + + public static TimeSeriesAggregate of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Aggregate variant kind. + */ + @Override + public Aggregate.Kind _aggregateKind() { + return Aggregate.Kind.TimeSeries; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TimeSeriesAggregate}. + */ + + public static class Builder extends MultiBucketAggregateBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TimeSeriesAggregate}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TimeSeriesAggregate build() { + _checkSingleUse(); + super.tBucketSerializer(null); + + return new TimeSeriesAggregate(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TimeSeriesAggregate} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TimeSeriesAggregate::setupTimeSeriesAggregateDeserializer); + + protected static void setupTimeSeriesAggregateDeserializer(ObjectDeserializer op) { + MultiBucketAggregateBase.setupMultiBucketAggregateBaseDeserializer(op, TimeSeriesBucket._DESERIALIZER); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregation.java similarity index 55% rename from java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java rename to java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregation.java index 16fcd137c..25dbfb308 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesAggregation.java @@ -17,7 +17,7 @@ * under the License. */ -package co.elastic.clients.elasticsearch._types; +package co.elastic.clients.elasticsearch._types.aggregations; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -28,7 +28,8 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; -import java.lang.Long; +import java.lang.Boolean; +import java.lang.Integer; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -48,61 +49,62 @@ // //---------------------------------------------------------------- -// typedef: _types.RrfRank +// typedef: _types.aggregations.TimeSeriesAggregation /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class RrfRank extends RankBase implements RankVariant, JsonpSerializable { +public class TimeSeriesAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable - private final Long rankConstant; + private final Integer size; @Nullable - private final Long rankWindowSize; + private final Boolean keyed; // --------------------------------------------------------------------------------------------- - private RrfRank(Builder builder) { + private TimeSeriesAggregation(Builder builder) { - this.rankConstant = builder.rankConstant; - this.rankWindowSize = builder.rankWindowSize; + this.size = builder.size; + this.keyed = builder.keyed; } - public static RrfRank of(Function> fn) { + public static TimeSeriesAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Rank variant kind. + * Aggregation variant kind. */ @Override - public Rank.Kind _rankKind() { - return Rank.Kind.Rrf; + public Aggregation.Kind _aggregationKind() { + return Aggregation.Kind.TimeSeries; } /** - * How much influence documents in individual result sets per query have over - * the final ranked result set + * The maximum number of results to return. *

- * API name: {@code rank_constant} + * API name: {@code size} */ @Nullable - public final Long rankConstant() { - return this.rankConstant; + public final Integer size() { + return this.size; } /** - * Size of the individual result sets per query + * Set to true to associate a unique string key with each bucket + * and returns the ranges as a hash rather than an array. *

- * API name: {@code rank_window_size} + * API name: {@code keyed} */ @Nullable - public final Long rankWindowSize() { - return this.rankWindowSize; + public final Boolean keyed() { + return this.keyed; } /** @@ -116,14 +118,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.rankConstant != null) { - generator.writeKey("rank_constant"); - generator.write(this.rankConstant); + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); } - if (this.rankWindowSize != null) { - generator.writeKey("rank_window_size"); - generator.write(this.rankWindowSize); + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } @@ -137,34 +139,36 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link RrfRank}. + * Builder for {@link TimeSeriesAggregation}. */ - public static class Builder extends RankBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + ObjectBuilder { @Nullable - private Long rankConstant; + private Integer size; @Nullable - private Long rankWindowSize; + private Boolean keyed; /** - * How much influence documents in individual result sets per query have over - * the final ranked result set + * The maximum number of results to return. *

- * API name: {@code rank_constant} + * API name: {@code size} */ - public final Builder rankConstant(@Nullable Long value) { - this.rankConstant = value; + public final Builder size(@Nullable Integer value) { + this.size = value; return this; } /** - * Size of the individual result sets per query + * Set to true to associate a unique string key with each bucket + * and returns the ranges as a hash rather than an array. *

- * API name: {@code rank_window_size} + * API name: {@code keyed} */ - public final Builder rankWindowSize(@Nullable Long value) { - this.rankWindowSize = value; + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; return this; } @@ -174,30 +178,30 @@ protected Builder self() { } /** - * Builds a {@link RrfRank}. + * Builds a {@link TimeSeriesAggregation}. * * @throws NullPointerException * if some of the required fields are null. */ - public RrfRank build() { + public TimeSeriesAggregation build() { _checkSingleUse(); - return new RrfRank(this); + return new TimeSeriesAggregation(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link RrfRank} + * Json deserializer for {@link TimeSeriesAggregation} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RrfRank::setupRrfRankDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TimeSeriesAggregation::setupTimeSeriesAggregationDeserializer); - protected static void setupRrfRankDeserializer(ObjectDeserializer op) { + protected static void setupTimeSeriesAggregationDeserializer(ObjectDeserializer op) { - op.add(Builder::rankConstant, JsonpDeserializer.longDeserializer(), "rank_constant"); - op.add(Builder::rankWindowSize, JsonpDeserializer.longDeserializer(), "rank_window_size"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesBucket.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesBucket.java new file mode 100644 index 000000000..a2e88b47e --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TimeSeriesBucket.java @@ -0,0 +1,173 @@ +/* + * 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.aggregations; + +import co.elastic.clients.elasticsearch._types.FieldValue; +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Map; +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.aggregations.TimeSeriesBucket + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TimeSeriesBucket extends MultiBucketBase { + private final Map key; + + // --------------------------------------------------------------------------------------------- + + private TimeSeriesBucket(Builder builder) { + super(builder); + + this.key = ApiTypeHelper.unmodifiableRequired(builder.key, this, "key"); + + } + + public static TimeSeriesBucket of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code key} + */ + public final Map key() { + return this.key; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.key)) { + generator.writeKey("key"); + generator.writeStartObject(); + for (Map.Entry item0 : this.key.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TimeSeriesBucket}. + */ + + public static class Builder extends MultiBucketBase.AbstractBuilder + implements + ObjectBuilder { + private Map key; + + /** + * Required - API name: {@code key} + *

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

+ * Adds an entry to key. + */ + public final Builder key(String key, FieldValue value) { + this.key = _mapPut(this.key, key, value); + return this; + } + + /** + * Required - API name: {@code key} + *

+ * Adds an entry to key using a builder lambda. + */ + public final Builder key(String key, Function> fn) { + return key(key, fn.apply(new FieldValue.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TimeSeriesBucket}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TimeSeriesBucket build() { + _checkSingleUse(); + + return new TimeSeriesBucket(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TimeSeriesBucket} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + TimeSeriesBucket::setupTimeSeriesBucketDeserializer); + + protected static void setupTimeSeriesBucketDeserializer(ObjectDeserializer op) { + MultiBucketBase.setupMultiBucketBaseDeserializer(op); + op.add(Builder::key, JsonpDeserializer.stringMapDeserializer(FieldValue._DESERIALIZER), "key"); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ClassicTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ClassicTokenizer.java new file mode 100644 index 000000000..4d47b9061 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ClassicTokenizer.java @@ -0,0 +1,156 @@ +/* + * 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.analysis; + +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.Integer; +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.analysis.ClassicTokenizer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ClassicTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { + @Nullable + private final Integer maxTokenLength; + + // --------------------------------------------------------------------------------------------- + + private ClassicTokenizer(Builder builder) { + super(builder); + + this.maxTokenLength = builder.maxTokenLength; + + } + + public static ClassicTokenizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * TokenizerDefinition variant kind. + */ + @Override + public TokenizerDefinition.Kind _tokenizerDefinitionKind() { + return TokenizerDefinition.Kind.Classic; + } + + /** + * API name: {@code max_token_length} + */ + @Nullable + public final Integer maxTokenLength() { + return this.maxTokenLength; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "classic"); + super.serializeInternal(generator, mapper); + if (this.maxTokenLength != null) { + generator.writeKey("max_token_length"); + generator.write(this.maxTokenLength); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClassicTokenizer}. + */ + + public static class Builder extends TokenizerBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Integer maxTokenLength; + + /** + * API name: {@code max_token_length} + */ + public final Builder maxTokenLength(@Nullable Integer value) { + this.maxTokenLength = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ClassicTokenizer}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ClassicTokenizer build() { + _checkSingleUse(); + + return new ClassicTokenizer(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClassicTokenizer} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ClassicTokenizer::setupClassicTokenizerDeserializer); + + protected static void setupClassicTokenizerDeserializer(ObjectDeserializer op) { + TokenizerBase.setupTokenizerBaseDeserializer(op); + op.add(Builder::maxTokenLength, JsonpDeserializer.integerDeserializer(), "max_token_length"); + + op.ignore("type"); + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java index be2b72c3a..fa7e1e77c 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenizer.java @@ -76,7 +76,7 @@ private EdgeNGramTokenizer(Builder builder) { this.customTokenChars = builder.customTokenChars; this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram"); this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram"); - this.tokenChars = ApiTypeHelper.unmodifiableRequired(builder.tokenChars, this, "tokenChars"); + this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars); } @@ -115,7 +115,7 @@ public final int minGram() { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} */ public final List tokenChars() { return this.tokenChars; @@ -164,6 +164,7 @@ public static class Builder extends TokenizerBase.AbstractBuilder private Integer minGram; + @Nullable private List tokenChars; /** @@ -191,7 +192,7 @@ public final Builder minGram(int value) { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} *

* Adds all elements of list to tokenChars. */ @@ -201,7 +202,7 @@ public final Builder tokenChars(List list) { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} *

* Adds one or more values to tokenChars. */ diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java index d7b874c81..a9078eada 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NGramTokenizer.java @@ -76,7 +76,7 @@ private NGramTokenizer(Builder builder) { this.customTokenChars = builder.customTokenChars; this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram"); this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram"); - this.tokenChars = ApiTypeHelper.unmodifiableRequired(builder.tokenChars, this, "tokenChars"); + this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars); } @@ -115,7 +115,7 @@ public final int minGram() { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} */ public final List tokenChars() { return this.tokenChars; @@ -164,6 +164,7 @@ public static class Builder extends TokenizerBase.AbstractBuilder private Integer minGram; + @Nullable private List tokenChars; /** @@ -191,7 +192,7 @@ public final Builder minGram(int value) { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} *

* Adds all elements of list to tokenChars. */ @@ -201,7 +202,7 @@ public final Builder tokenChars(List list) { } /** - * Required - API name: {@code token_chars} + * API name: {@code token_chars} *

* Adds one or more values to tokenChars. */ diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternSplitTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternSplitTokenizer.java new file mode 100644 index 000000000..9543b0395 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternSplitTokenizer.java @@ -0,0 +1,157 @@ +/* + * 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.analysis; + +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.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.analysis.SimplePatternSplitTokenizer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SimplePatternSplitTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { + @Nullable + private final String pattern; + + // --------------------------------------------------------------------------------------------- + + private SimplePatternSplitTokenizer(Builder builder) { + super(builder); + + this.pattern = builder.pattern; + + } + + public static SimplePatternSplitTokenizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * TokenizerDefinition variant kind. + */ + @Override + public TokenizerDefinition.Kind _tokenizerDefinitionKind() { + return TokenizerDefinition.Kind.SimplePatternSplit; + } + + /** + * API name: {@code pattern} + */ + @Nullable + public final String pattern() { + return this.pattern; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "simple_pattern_split"); + super.serializeInternal(generator, mapper); + if (this.pattern != null) { + generator.writeKey("pattern"); + generator.write(this.pattern); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SimplePatternSplitTokenizer}. + */ + + public static class Builder extends TokenizerBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String pattern; + + /** + * API name: {@code pattern} + */ + public final Builder pattern(@Nullable String value) { + this.pattern = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SimplePatternSplitTokenizer}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SimplePatternSplitTokenizer build() { + _checkSingleUse(); + + return new SimplePatternSplitTokenizer(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SimplePatternSplitTokenizer} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SimplePatternSplitTokenizer::setupSimplePatternSplitTokenizerDeserializer); + + protected static void setupSimplePatternSplitTokenizerDeserializer( + ObjectDeserializer op) { + TokenizerBase.setupTokenizerBaseDeserializer(op); + op.add(Builder::pattern, JsonpDeserializer.stringDeserializer(), "pattern"); + + op.ignore("type"); + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternTokenizer.java new file mode 100644 index 000000000..255e56e08 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SimplePatternTokenizer.java @@ -0,0 +1,157 @@ +/* + * 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.analysis; + +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.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.analysis.SimplePatternTokenizer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SimplePatternTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { + @Nullable + private final String pattern; + + // --------------------------------------------------------------------------------------------- + + private SimplePatternTokenizer(Builder builder) { + super(builder); + + this.pattern = builder.pattern; + + } + + public static SimplePatternTokenizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * TokenizerDefinition variant kind. + */ + @Override + public TokenizerDefinition.Kind _tokenizerDefinitionKind() { + return TokenizerDefinition.Kind.SimplePattern; + } + + /** + * API name: {@code pattern} + */ + @Nullable + public final String pattern() { + return this.pattern; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "simple_pattern"); + super.serializeInternal(generator, mapper); + if (this.pattern != null) { + generator.writeKey("pattern"); + generator.write(this.pattern); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SimplePatternTokenizer}. + */ + + public static class Builder extends TokenizerBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String pattern; + + /** + * API name: {@code pattern} + */ + public final Builder pattern(@Nullable String value) { + this.pattern = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SimplePatternTokenizer}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SimplePatternTokenizer build() { + _checkSingleUse(); + + return new SimplePatternTokenizer(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SimplePatternTokenizer} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SimplePatternTokenizer::setupSimplePatternTokenizerDeserializer); + + protected static void setupSimplePatternTokenizerDeserializer( + ObjectDeserializer op) { + TokenizerBase.setupTokenizerBaseDeserializer(op); + op.add(Builder::pattern, JsonpDeserializer.stringDeserializer(), "pattern"); + + op.ignore("type"); + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ThaiTokenizer.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ThaiTokenizer.java new file mode 100644 index 000000000..2c7d1ee7a --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ThaiTokenizer.java @@ -0,0 +1,122 @@ +/* + * 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.analysis; + +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.util.Objects; +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. +// +//---------------------------------------------------------------- + +// typedef: _types.analysis.ThaiTokenizer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ThaiTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { + // --------------------------------------------------------------------------------------------- + + private ThaiTokenizer(Builder builder) { + super(builder); + + } + + public static ThaiTokenizer of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * TokenizerDefinition variant kind. + */ + @Override + public TokenizerDefinition.Kind _tokenizerDefinitionKind() { + return TokenizerDefinition.Kind.Thai; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "thai"); + super.serializeInternal(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ThaiTokenizer}. + */ + + public static class Builder extends TokenizerBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ThaiTokenizer}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ThaiTokenizer build() { + _checkSingleUse(); + + return new ThaiTokenizer(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ThaiTokenizer} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ThaiTokenizer::setupThaiTokenizerDeserializer); + + protected static void setupThaiTokenizerDeserializer(ObjectDeserializer op) { + TokenizerBase.setupTokenizerBaseDeserializer(op); + + op.ignore("type"); + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TokenizerDefinition.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TokenizerDefinition.java index 6c1c9e4cf..7e6258f49 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TokenizerDefinition.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TokenizerDefinition.java @@ -76,6 +76,8 @@ public class TokenizerDefinition implements OpenTaggedUnion charGroup( return this.charGroup(fn.apply(new CharGroupTokenizer.Builder()).build()); } + public ObjectBuilder classic(ClassicTokenizer v) { + this._kind = Kind.Classic; + this._value = v; + return this; + } + + public ObjectBuilder classic( + Function> fn) { + return this.classic(fn.apply(new ClassicTokenizer.Builder()).build()); + } + public ObjectBuilder edgeNgram(EdgeNGramTokenizer v) { this._kind = Kind.EdgeNgram; this._value = v; @@ -574,6 +662,28 @@ public ObjectBuilder pattern( return this.pattern(fn.apply(new PatternTokenizer.Builder()).build()); } + public ObjectBuilder simplePatternSplit(SimplePatternSplitTokenizer v) { + this._kind = Kind.SimplePatternSplit; + this._value = v; + return this; + } + + public ObjectBuilder simplePatternSplit( + Function> fn) { + return this.simplePatternSplit(fn.apply(new SimplePatternSplitTokenizer.Builder()).build()); + } + + public ObjectBuilder simplePattern(SimplePatternTokenizer v) { + this._kind = Kind.SimplePattern; + this._value = v; + return this; + } + + public ObjectBuilder simplePattern( + Function> fn) { + return this.simplePattern(fn.apply(new SimplePatternTokenizer.Builder()).build()); + } + public ObjectBuilder standard(StandardTokenizer v) { this._kind = Kind.Standard; this._value = v; @@ -585,6 +695,17 @@ public ObjectBuilder standard( return this.standard(fn.apply(new StandardTokenizer.Builder()).build()); } + public ObjectBuilder thai(ThaiTokenizer v) { + this._kind = Kind.Thai; + this._value = v; + return this; + } + + public ObjectBuilder thai( + Function> fn) { + return this.thai(fn.apply(new ThaiTokenizer.Builder()).build()); + } + public ObjectBuilder uaxUrlEmail(UaxEmailUrlTokenizer v) { this._kind = Kind.UaxUrlEmail; this._value = v; @@ -633,6 +754,7 @@ public TokenizerDefinition build() { protected static void setupTokenizerDefinitionDeserializer(ObjectDeserializer op) { op.add(Builder::charGroup, CharGroupTokenizer._DESERIALIZER, "char_group"); + op.add(Builder::classic, ClassicTokenizer._DESERIALIZER, "classic"); op.add(Builder::edgeNgram, EdgeNGramTokenizer._DESERIALIZER, "edge_ngram"); op.add(Builder::icuTokenizer, IcuTokenizer._DESERIALIZER, "icu_tokenizer"); op.add(Builder::keyword, KeywordTokenizer._DESERIALIZER, "keyword"); @@ -643,7 +765,10 @@ protected static void setupTokenizerDefinitionDeserializer(ObjectDeserializer> fn) { + TokenizerDefinition.Builder builder = new TokenizerDefinition.Builder(); + builder.classic(fn.apply(new ClassicTokenizer.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link EdgeNGramTokenizer edge_ngram} * {@code TokenizerDefinition} variant. @@ -247,6 +265,44 @@ public static TokenizerDefinition pattern(Function> fn) { + TokenizerDefinition.Builder builder = new TokenizerDefinition.Builder(); + builder.simplePatternSplit(fn.apply(new SimplePatternSplitTokenizer.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SimplePatternTokenizer simple_pattern} + * {@code TokenizerDefinition} variant. + */ + public static SimplePatternTokenizer.Builder simplePattern() { + return new SimplePatternTokenizer.Builder(); + } + + /** + * Creates a TokenizerDefinition of the {@link SimplePatternTokenizer + * simple_pattern} {@code TokenizerDefinition} variant. + */ + public static TokenizerDefinition simplePattern( + Function> fn) { + TokenizerDefinition.Builder builder = new TokenizerDefinition.Builder(); + builder.simplePattern(fn.apply(new SimplePatternTokenizer.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link StandardTokenizer standard} * {@code TokenizerDefinition} variant. @@ -266,6 +322,24 @@ public static TokenizerDefinition standard( return builder.build(); } + /** + * Creates a builder for the {@link ThaiTokenizer thai} + * {@code TokenizerDefinition} variant. + */ + public static ThaiTokenizer.Builder thai() { + return new ThaiTokenizer.Builder(); + } + + /** + * Creates a TokenizerDefinition of the {@link ThaiTokenizer thai} + * {@code TokenizerDefinition} variant. + */ + public static TokenizerDefinition thai(Function> fn) { + TokenizerDefinition.Builder builder = new TokenizerDefinition.Builder(); + builder.thai(fn.apply(new ThaiTokenizer.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link UaxEmailUrlTokenizer uax_url_email} * {@code TokenizerDefinition} variant. diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CompositeSubField.java similarity index 50% rename from java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java rename to java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CompositeSubField.java index b1dbca7c3..d738d1851 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CompositeSubField.java @@ -17,9 +17,8 @@ * under the License. */ -package co.elastic.clients.elasticsearch._types; +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; @@ -29,11 +28,8 @@ 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.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -53,100 +49,50 @@ // //---------------------------------------------------------------- -// typedef: _types.RankContainer +// typedef: _types.mapping.CompositeSubField /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class Rank implements TaggedUnion, JsonpSerializable { +public class CompositeSubField implements JsonpSerializable { + private final RuntimeFieldType type; - /** - * {@link Rank} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - Rrf("rrf"), - - ; - - 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; - } - - public Rank(RankVariant value) { + private CompositeSubField(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(value._rankKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); } - private Rank(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Rank of(Function> fn) { + public static CompositeSubField of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Is this variant instance of kind {@code rrf}? + * Required - API name: {@code type} */ - public boolean isRrf() { - return _kind == Kind.Rrf; + public final RuntimeFieldType type() { + return this.type; } /** - * Get the {@code rrf} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code rrf} kind. + * Serialize this object to JSON. */ - public RrfRank rrf() { - return TaggedUnionUtils.get(this, Kind.Rrf); - } - - @Override - @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeEnd(); + generator.writeKey("type"); + this.type.serialize(generator, mapper); } @@ -155,37 +101,53 @@ public String toString() { return JsonpUtils.toString(this); } - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; + // --------------------------------------------------------------------------------------------- - @Override - protected Builder self() { - return this; - } - public ObjectBuilder rrf(RrfRank v) { - this._kind = Kind.Rrf; - this._value = v; + /** + * Builder for {@link CompositeSubField}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private RuntimeFieldType type; + + /** + * Required - API name: {@code type} + */ + public final Builder type(RuntimeFieldType value) { + this.type = value; return this; } - public ObjectBuilder rrf(Function> fn) { - return this.rrf(fn.apply(new RrfRank.Builder()).build()); + @Override + protected Builder self() { + return this; } - public Rank build() { + /** + * Builds a {@link CompositeSubField}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CompositeSubField build() { _checkSingleUse(); - return new Rank(this); - } + return new CompositeSubField(this); + } } - protected static void setupRankDeserializer(ObjectDeserializer op) { + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompositeSubField} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, CompositeSubField::setupCompositeSubFieldDeserializer); + + protected static void setupCompositeSubFieldDeserializer(ObjectDeserializer op) { - op.add(Builder::rrf, RrfRank._DESERIALIZER, "rrf"); + op.add(Builder::type, RuntimeFieldType._DESERIALIZER, "type"); } - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Rank::setupRankDeserializer, Builder::build); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java index 27c57ea8f..c0016ebe2 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -61,6 +62,8 @@ */ @JsonpDeserializable public class RuntimeField implements JsonpSerializable { + private final Map fields; + private final List fetchFields; @Nullable @@ -84,6 +87,7 @@ public class RuntimeField implements JsonpSerializable { private RuntimeField(Builder builder) { + this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.fetchFields = ApiTypeHelper.unmodifiable(builder.fetchFields); this.format = builder.format; this.inputField = builder.inputField; @@ -98,6 +102,15 @@ public static RuntimeField of(Function> fn) return fn.apply(new Builder()).build(); } + /** + * For type composite + *

+ * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + /** * For type lookup *

@@ -180,6 +193,17 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } if (ApiTypeHelper.isDefined(this.fetchFields)) { generator.writeKey("fetch_fields"); generator.writeStartArray(); @@ -232,6 +256,9 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map fields; + @Nullable private List fetchFields; @@ -252,6 +279,42 @@ public static class Builder extends WithJsonObjectBuilderBase implement private RuntimeFieldType type; + /** + * For type composite + *

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

+ * Adds all entries of map to fields. + */ + public final Builder fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return this; + } + + /** + * For type composite + *

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

+ * Adds an entry to fields. + */ + public final Builder fields(String key, CompositeSubField value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * For type composite + *

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

+ * Adds an entry to fields using a builder lambda. + */ + public final Builder fields(String key, + Function> fn) { + return fields(key, fn.apply(new CompositeSubField.Builder()).build()); + } + /** * For type lookup *

@@ -388,6 +451,7 @@ public RuntimeField build() { protected static void setupRuntimeFieldDeserializer(ObjectDeserializer op) { + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(CompositeSubField._DESERIALIZER), "fields"); op.add(Builder::fetchFields, JsonpDeserializer.arrayDeserializer(RuntimeFieldFetchFields._DESERIALIZER), "fetch_fields"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/cat/indices/IndicesRecord.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/cat/indices/IndicesRecord.java index 82fac33f4..533b3b1ee 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/cat/indices/IndicesRecord.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/cat/indices/IndicesRecord.java @@ -94,6 +94,9 @@ public class IndicesRecord implements JsonpSerializable { @Nullable private final String priStoreSize; + @Nullable + private final String datasetSize; + @Nullable private final String completionSize; @@ -497,6 +500,7 @@ private IndicesRecord(Builder builder) { this.creationDateString = builder.creationDateString; this.storeSize = builder.storeSize; this.priStoreSize = builder.priStoreSize; + this.datasetSize = builder.datasetSize; this.completionSize = builder.completionSize; this.priCompletionSize = builder.priCompletionSize; this.fielddataMemorySize = builder.fielddataMemorySize; @@ -753,6 +757,16 @@ public final String priStoreSize() { return this.priStoreSize; } + /** + * total size of dataset (including the cache for partially mounted indices) + *

+ * API name: {@code dataset.size} + */ + @Nullable + public final String datasetSize() { + return this.datasetSize; + } + /** * size of completion *

@@ -2115,6 +2129,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("pri.store.size"); generator.write(this.priStoreSize); + } + if (this.datasetSize != null) { + generator.writeKey("dataset.size"); + generator.write(this.datasetSize); + } if (this.completionSize != null) { generator.writeKey("completion.size"); @@ -2812,6 +2831,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String priStoreSize; + @Nullable + private String datasetSize; + @Nullable private String completionSize; @@ -3319,6 +3341,16 @@ public final Builder priStoreSize(@Nullable String value) { return this; } + /** + * total size of dataset (including the cache for partially mounted indices) + *

+ * API name: {@code dataset.size} + */ + public final Builder datasetSize(@Nullable String value) { + this.datasetSize = value; + return this; + } + /** * size of completion *

@@ -4651,6 +4683,7 @@ protected static void setupIndicesRecordDeserializer(ObjectDeserializerAPI * specification */ - -public class OpenPointInTimeRequest extends RequestBase { +@JsonpDeserializable +public class OpenPointInTimeRequest extends RequestBase implements JsonpSerializable { private final List expandWildcards; @Nullable @@ -82,6 +85,9 @@ public class OpenPointInTimeRequest extends RequestBase { private final List index; + @Nullable + private final Query indexFilter; + private final Time keepAlive; @Nullable @@ -97,6 +103,7 @@ private OpenPointInTimeRequest(Builder builder) { this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); + this.indexFilter = builder.indexFilter; this.keepAlive = ApiTypeHelper.requireNonNull(builder.keepAlive, this, "keepAlive"); this.preference = builder.preference; this.routing = builder.routing; @@ -142,6 +149,17 @@ public final List index() { return this.index; } + /** + * Allows to filter indices if the provided query rewrites to + * match_none on every shard. + *

+ * API name: {@code index_filter} + */ + @Nullable + public final Query indexFilter() { + return this.indexFilter; + } + /** * Required - Extends the time to live of the corresponding point in time. *

@@ -172,6 +190,25 @@ public final String routing() { return this.routing; } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.indexFilter != null) { + generator.writeKey("index_filter"); + this.indexFilter.serialize(generator, mapper); + + } + + } + // --------------------------------------------------------------------------------------------- /** @@ -189,6 +226,9 @@ public static class Builder extends RequestBase.AbstractBuilder private List index; + @Nullable + private Query indexFilter; + private Time keepAlive; @Nullable @@ -268,6 +308,27 @@ public final Builder index(String value, String... values) { return this; } + /** + * Allows to filter indices if the provided query rewrites to + * match_none on every shard. + *

+ * API name: {@code index_filter} + */ + public final Builder indexFilter(@Nullable Query value) { + this.indexFilter = value; + return this; + } + + /** + * Allows to filter indices if the provided query rewrites to + * match_none on every shard. + *

+ * API name: {@code index_filter} + */ + public final Builder indexFilter(Function> fn) { + return this.indexFilter(fn.apply(new Query.Builder()).build()); + } + /** * Required - Extends the time to live of the corresponding point in time. *

@@ -328,6 +389,21 @@ public OpenPointInTimeRequest build() { // --------------------------------------------------------------------------------------------- + /** + * Json deserializer for {@link OpenPointInTimeRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, OpenPointInTimeRequest::setupOpenPointInTimeRequestDeserializer); + + protected static void setupOpenPointInTimeRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::indexFilter, Query._DESERIALIZER, "index_filter"); + + } + + // --------------------------------------------------------------------------------------------- + /** * Endpoint "{@code open_point_in_time}". */ @@ -393,5 +469,5 @@ public OpenPointInTimeRequest build() { params.put("keep_alive", request.keepAlive._toJsonString()); return params; - }, SimpleEndpoint.emptyMap(), false, OpenPointInTimeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, OpenPointInTimeResponse._DESERIALIZER); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeResponse.java index 803742154..72e7f8580 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeResponse.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeResponse.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.core; +import co.elastic.clients.elasticsearch._types.ShardStatistics; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -60,12 +61,15 @@ */ @JsonpDeserializable public class OpenPointInTimeResponse implements JsonpSerializable { + private final ShardStatistics shards; + private final String id; // --------------------------------------------------------------------------------------------- private OpenPointInTimeResponse(Builder builder) { + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); } @@ -74,6 +78,15 @@ public static OpenPointInTimeResponse of(Function + * API name: {@code _shards} + */ + public final ShardStatistics shards() { + return this.shards; + } + /** * Required - API name: {@code id} */ @@ -92,6 +105,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + generator.writeKey("id"); generator.write(this.id); @@ -111,8 +127,29 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private ShardStatistics shards; + private String id; + /** + * Required - Shards used to create the PIT + *

+ * API name: {@code _shards} + */ + public final Builder shards(ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * Required - Shards used to create the PIT + *

+ * API name: {@code _shards} + */ + public final Builder shards(Function> fn) { + return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + } + /** * Required - API name: {@code id} */ @@ -150,6 +187,7 @@ public OpenPointInTimeResponse build() { protected static void setupOpenPointInTimeResponseDeserializer( ObjectDeserializer op) { + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java index b4c8000ca..d73b6a7bf 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java @@ -23,7 +23,6 @@ import co.elastic.clients.elasticsearch._types.ExpandWildcard; import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.elasticsearch._types.KnnSearch; -import co.elastic.clients.elasticsearch._types.Rank; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Retriever; import co.elastic.clients.elasticsearch._types.ScriptField; @@ -190,9 +189,6 @@ public class SearchRequest extends RequestBase implements JsonpSerializable { @Nullable private final Query query; - @Nullable - private final Rank rank; - @Nullable private final Boolean requestCache; @@ -287,7 +283,6 @@ private SearchRequest(Builder builder) { this.profile = builder.profile; this.q = builder.q; this.query = builder.query; - this.rank = builder.rank; this.requestCache = builder.requestCache; this.rescore = ApiTypeHelper.unmodifiable(builder.rescore); this.retriever = builder.retriever; @@ -716,16 +711,6 @@ public final Query query() { return this.query; } - /** - * Defines the Reciprocal Rank Fusion (RRF) to use. - *

- * API name: {@code rank} - */ - @Nullable - public final Rank rank() { - return this.rank; - } - /** * If true, the caching of search results is enabled for requests * where size is 0. Defaults to index level settings. @@ -1093,11 +1078,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("query"); this.query.serialize(generator, mapper); - } - if (this.rank != null) { - generator.writeKey("rank"); - this.rank.serialize(generator, mapper); - } if (ApiTypeHelper.isDefined(this.rescore)) { generator.writeKey("rescore"); @@ -1339,9 +1319,6 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Query query; - @Nullable - private Rank rank; - @Nullable private Boolean requestCache; @@ -2041,25 +2018,6 @@ public final Builder query(Function> fn) { return this.query(fn.apply(new Query.Builder()).build()); } - /** - * Defines the Reciprocal Rank Fusion (RRF) to use. - *

- * API name: {@code rank} - */ - public final Builder rank(@Nullable Rank value) { - this.rank = value; - return this; - } - - /** - * Defines the Reciprocal Rank Fusion (RRF) to use. - *

- * API name: {@code rank} - */ - public final Builder rank(Function> fn) { - return this.rank(fn.apply(new Rank.Builder()).build()); - } - /** * If true, the caching of search results is enabled for requests * where size is 0. Defaults to index level settings. @@ -2648,7 +2606,6 @@ protected static void setupSearchRequestDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/849b48056b38ca2fd576688e9604a7dad0e77c40/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/b2ad2265c9a6469efee4426abbc45df5b0fe1c54/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java index 61ad1fe41..37723bd0e 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -66,10 +67,16 @@ public class CacheStats implements JsonpSerializable { private final int hits; + private final long hitsTimeInMillis; + private final int misses; + private final long missesTimeInMillis; + private final int evictions; + private final long sizeInBytes; + // --------------------------------------------------------------------------------------------- private CacheStats(Builder builder) { @@ -77,8 +84,11 @@ private CacheStats(Builder builder) { this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.hitsTimeInMillis = ApiTypeHelper.requireNonNull(builder.hitsTimeInMillis, this, "hitsTimeInMillis"); this.misses = ApiTypeHelper.requireNonNull(builder.misses, this, "misses"); + this.missesTimeInMillis = ApiTypeHelper.requireNonNull(builder.missesTimeInMillis, this, "missesTimeInMillis"); this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); } @@ -107,6 +117,13 @@ public final int hits() { return this.hits; } + /** + * Required - API name: {@code hits_time_in_millis} + */ + public final long hitsTimeInMillis() { + return this.hitsTimeInMillis; + } + /** * Required - API name: {@code misses} */ @@ -114,6 +131,13 @@ public final int misses() { return this.misses; } + /** + * Required - API name: {@code misses_time_in_millis} + */ + public final long missesTimeInMillis() { + return this.missesTimeInMillis; + } + /** * Required - API name: {@code evictions} */ @@ -121,6 +145,13 @@ public final int evictions() { return this.evictions; } + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; + } + /** * Serialize this object to JSON. */ @@ -141,12 +172,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("hits"); generator.write(this.hits); + generator.writeKey("hits_time_in_millis"); + generator.write(this.hitsTimeInMillis); + generator.writeKey("misses"); generator.write(this.misses); + generator.writeKey("misses_time_in_millis"); + generator.write(this.missesTimeInMillis); + generator.writeKey("evictions"); generator.write(this.evictions); + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + } @Override @@ -167,10 +207,16 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Integer hits; + private Long hitsTimeInMillis; + private Integer misses; + private Long missesTimeInMillis; + private Integer evictions; + private Long sizeInBytes; + /** * Required - API name: {@code node_id} */ @@ -195,6 +241,14 @@ public final Builder hits(int value) { return this; } + /** + * Required - API name: {@code hits_time_in_millis} + */ + public final Builder hitsTimeInMillis(long value) { + this.hitsTimeInMillis = value; + return this; + } + /** * Required - API name: {@code misses} */ @@ -203,6 +257,14 @@ public final Builder misses(int value) { return this; } + /** + * Required - API name: {@code misses_time_in_millis} + */ + public final Builder missesTimeInMillis(long value) { + this.missesTimeInMillis = value; + return this; + } + /** * Required - API name: {@code evictions} */ @@ -211,6 +273,14 @@ public final Builder evictions(int value) { return this; } + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + @Override protected Builder self() { return this; @@ -242,8 +312,11 @@ protected static void setupCacheStatsDeserializer(ObjectDeserializer impleme private Query filter; @Nullable - private String format; + private EsqlFormat format; @Nullable private String locale; @@ -397,7 +398,7 @@ public final Builder filter(Function> fn) { *

* API name: {@code format} */ - public final Builder format(@Nullable String value) { + public final Builder format(@Nullable EsqlFormat value) { this.format = value; return this; } @@ -648,7 +649,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializerAPI + * @see API * specification */ +@JsonpDeserializable +public enum EsqlFormat implements JsonEnum { + Csv("csv"), -public abstract class RankBase { - public RankBase() { - } + Json("json"), + + Tsv("tsv"), + + Txt("txt"), + + Yaml("yaml"), + + Cbor("cbor"), - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - protected abstract BuilderT self(); + Smile("smile"), + + Arrow("arrow"), + + ; + + private final String jsonValue; + + EsqlFormat(String jsonValue) { + this.jsonValue = jsonValue; + } + public String jsonValue() { + return this.jsonValue; } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + EsqlFormat.values()); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java index e2a86b8ea..18fb316d6 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java @@ -77,6 +77,9 @@ public class GetDataStreamRequest extends RequestBase { private final List name; + @Nullable + private final Boolean verbose; + // --------------------------------------------------------------------------------------------- private GetDataStreamRequest(Builder builder) { @@ -85,6 +88,7 @@ private GetDataStreamRequest(Builder builder) { this.includeDefaults = builder.includeDefaults; this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.unmodifiable(builder.name); + this.verbose = builder.verbose; } @@ -134,6 +138,17 @@ public final List name() { return this.name; } + /** + * Whether the maximum timestamp for each data stream should be calculated and + * returned. + *

+ * API name: {@code verbose} + */ + @Nullable + public final Boolean verbose() { + return this.verbose; + } + // --------------------------------------------------------------------------------------------- /** @@ -155,6 +170,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private List name; + @Nullable + private Boolean verbose; + /** * Type of data stream that wildcard patterns can match. Supports * comma-separated values, such as open,hidden. @@ -240,6 +258,17 @@ public final Builder name(String value, String... values) { return this; } + /** + * Whether the maximum timestamp for each data stream should be calculated and + * returned. + *

+ * API name: {@code verbose} + */ + public final Builder verbose(@Nullable Boolean value) { + this.verbose = value; + return this; + } + @Override protected Builder self() { return this; @@ -328,6 +357,9 @@ public GetDataStreamRequest build() { if (request.includeDefaults != null) { params.put("include_defaults", String.valueOf(request.includeDefaults)); } + if (request.verbose != null) { + params.put("verbose", String.valueOf(request.verbose)); + } return params; }, SimpleEndpoint.emptyMap(), false, GetDataStreamResponse._DESERIALIZER); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java index 3ce0ffc59..1e6af297b 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.HashMap; import java.util.List; @@ -66,15 +67,23 @@ */ public class ResolveIndexRequest extends RequestBase { + @Nullable + private final Boolean allowNoIndices; + private final List expandWildcards; + @Nullable + private final Boolean ignoreUnavailable; + private final List name; // --------------------------------------------------------------------------------------------- private ResolveIndexRequest(Builder builder) { + this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.ignoreUnavailable = builder.ignoreUnavailable; this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); } @@ -83,6 +92,21 @@ public static ResolveIndexRequest of(Functionfalse, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. + *

+ * API name: {@code allow_no_indices} + */ + @Nullable + public final Boolean allowNoIndices() { + return this.allowNoIndices; + } + /** * Type of index that wildcard patterns can match. If the request can target * data streams, this argument determines whether wildcard expressions match @@ -97,6 +121,17 @@ public final List expandWildcards() { return this.expandWildcards; } + /** + * If false, the request returns an error if it targets a missing + * or closed index. + *

+ * API name: {@code ignore_unavailable} + */ + @Nullable + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; + } + /** * Required - Comma-separated name(s) or index pattern(s) of the indices, * aliases, and data streams to resolve. Resources on remote clusters can be @@ -118,11 +153,32 @@ public final List name() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean allowNoIndices; + @Nullable private List expandWildcards; + @Nullable + private Boolean ignoreUnavailable; + private List name; + /** + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. + *

+ * API name: {@code allow_no_indices} + */ + public final Builder allowNoIndices(@Nullable Boolean value) { + this.allowNoIndices = value; + return this; + } + /** * Type of index that wildcard patterns can match. If the request can target * data streams, this argument determines whether wildcard expressions match @@ -157,6 +213,17 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val return this; } + /** + * If false, the request returns an error if it targets a missing + * or closed index. + *

+ * API name: {@code ignore_unavailable} + */ + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; + } + /** * Required - Comma-separated name(s) or index pattern(s) of the indices, * aliases, and data streams to resolve. Resources on remote clusters can be @@ -261,6 +328,12 @@ public ResolveIndexRequest build() { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.ignoreUnavailable != null) { + params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); + } + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } return params; }, SimpleEndpoint.emptyMap(), false, ResolveIndexResponse._DESERIALIZER); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/DotExpanderProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/DotExpanderProcessor.java index 8768dba42..05ba4dcef 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/DotExpanderProcessor.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/DotExpanderProcessor.java @@ -27,6 +27,7 @@ import co.elastic.clients.util.ApiTypeHelper; 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; @@ -59,6 +60,9 @@ public class DotExpanderProcessor extends ProcessorBase implements ProcessorVariant { private final String field; + @Nullable + private final Boolean override; + @Nullable private final String path; @@ -68,6 +72,7 @@ private DotExpanderProcessor(Builder builder) { super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.override = builder.override; this.path = builder.path; } @@ -94,6 +99,20 @@ public final String field() { return this.field; } + /** + * Controls the behavior when there is already an existing nested object that + * conflicts with the expanded field. When false, the processor + * will merge conflicts by combining the old and the new values into an array. + * When true, the value from the expanded field will overwrite the + * existing value. + *

+ * API name: {@code override} + */ + @Nullable + public final Boolean override() { + return this.override; + } + /** * The field that contains the field to expand. Only required if the field to * expand is part another object field, because the field option @@ -112,6 +131,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("field"); generator.write(this.field); + if (this.override != null) { + generator.writeKey("override"); + generator.write(this.override); + + } if (this.path != null) { generator.writeKey("path"); generator.write(this.path); @@ -131,6 +155,9 @@ public static class Builder extends ProcessorBase.AbstractBuilder ObjectBuilder { private String field; + @Nullable + private Boolean override; + @Nullable private String path; @@ -145,6 +172,20 @@ public final Builder field(String value) { return this; } + /** + * Controls the behavior when there is already an existing nested object that + * conflicts with the expanded field. When false, the processor + * will merge conflicts by combining the old and the new values into an array. + * When true, the value from the expanded field will overwrite the + * existing value. + *

+ * API name: {@code override} + */ + public final Builder override(@Nullable Boolean value) { + this.override = value; + return this; + } + /** * The field that contains the field to expand. Only required if the field to * expand is part another object field, because the field option @@ -186,6 +227,7 @@ public DotExpanderProcessor build() { protected static void setupDotExpanderProcessorDeserializer(ObjectDeserializer op) { ProcessorBase.setupProcessorBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::override, JsonpDeserializer.booleanDeserializer(), "override"); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java index a5aeaa8e7..4aa683ffe 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java @@ -232,17 +232,4 @@ public final CompletableFuture simulate( return simulate(fn.apply(new SimulateRequest.Builder()).build()); } - /** - * Executes an ingest pipeline against a set of provided documents. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture simulate() { - return this.transport.performRequestAsync(new SimulateRequest.Builder().build(), SimulateRequest._ENDPOINT, - this.transportOptions); - } - } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java index b18f9d55f..b11034562 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java @@ -236,17 +236,4 @@ public final SimulateResponse simulate(FunctionDocumentation - * on elastic.co - */ - - public SimulateResponse simulate() throws IOException, ElasticsearchException { - return this.transport.performRequest(new SimulateRequest.Builder().build(), SimulateRequest._ENDPOINT, - this.transportOptions); - } - } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridProcessor.java new file mode 100644 index 000000000..594eb2339 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridProcessor.java @@ -0,0 +1,421 @@ +/* + * 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.ingest; + +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.ApiTypeHelper; +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: ingest._types.GeoGridProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GeoGridProcessor extends ProcessorBase implements ProcessorVariant { + private final String field; + + private final GeoGridTileType tileType; + + @Nullable + private final String targetField; + + @Nullable + private final String parentField; + + @Nullable + private final String childrenField; + + @Nullable + private final String nonChildrenField; + + @Nullable + private final String precisionField; + + @Nullable + private final Boolean ignoreMissing; + + @Nullable + private final GeoGridTargetFormat targetFormat; + + // --------------------------------------------------------------------------------------------- + + private GeoGridProcessor(Builder builder) { + super(builder); + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.tileType = ApiTypeHelper.requireNonNull(builder.tileType, this, "tileType"); + this.targetField = builder.targetField; + this.parentField = builder.parentField; + this.childrenField = builder.childrenField; + this.nonChildrenField = builder.nonChildrenField; + this.precisionField = builder.precisionField; + this.ignoreMissing = builder.ignoreMissing; + this.targetFormat = builder.targetFormat; + + } + + public static GeoGridProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.GeoGrid; + } + + /** + * Required - The field to interpret as a geo-tile.= The field format is + * determined by the tile_type. + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + /** + * Required - Three tile formats are understood: geohash, geotile and geohex. + *

+ * API name: {@code tile_type} + */ + public final GeoGridTileType tileType() { + return this.tileType; + } + + /** + * The field to assign the polygon shape to, by default, the field + * is updated in-place. + *

+ * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + /** + * If specified and a parent tile exists, save that tile address to this field. + *

+ * API name: {@code parent_field} + */ + @Nullable + public final String parentField() { + return this.parentField; + } + + /** + * If specified and children tiles exist, save those tile addresses to this + * field as an array of strings. + *

+ * API name: {@code children_field} + */ + @Nullable + public final String childrenField() { + return this.childrenField; + } + + /** + * If specified and intersecting non-child tiles exist, save their addresses to + * this field as an array of strings. + *

+ * API name: {@code non_children_field} + */ + @Nullable + public final String nonChildrenField() { + return this.nonChildrenField; + } + + /** + * If specified, save the tile precision (zoom) as an integer to this field. + *

+ * API name: {@code precision_field} + */ + @Nullable + public final String precisionField() { + return this.precisionField; + } + + /** + * If true and field does not exist, the processor + * quietly exits without modifying the document. + *

+ * API name: {@code ignore_missing} + */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * Which format to save the generated polygon in. + *

+ * API name: {@code target_format} + */ + @Nullable + public final GeoGridTargetFormat targetFormat() { + return this.targetFormat; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("field"); + generator.write(this.field); + + generator.writeKey("tile_type"); + this.tileType.serialize(generator, mapper); + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + + } + if (this.parentField != null) { + generator.writeKey("parent_field"); + generator.write(this.parentField); + + } + if (this.childrenField != null) { + generator.writeKey("children_field"); + generator.write(this.childrenField); + + } + if (this.nonChildrenField != null) { + generator.writeKey("non_children_field"); + generator.write(this.nonChildrenField); + + } + if (this.precisionField != null) { + generator.writeKey("precision_field"); + generator.write(this.precisionField); + + } + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + + } + if (this.targetFormat != null) { + generator.writeKey("target_format"); + this.targetFormat.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoGridProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + private GeoGridTileType tileType; + + @Nullable + private String targetField; + + @Nullable + private String parentField; + + @Nullable + private String childrenField; + + @Nullable + private String nonChildrenField; + + @Nullable + private String precisionField; + + @Nullable + private Boolean ignoreMissing; + + @Nullable + private GeoGridTargetFormat targetFormat; + + /** + * Required - The field to interpret as a geo-tile.= The field format is + * determined by the tile_type. + *

+ * API name: {@code field} + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * Required - Three tile formats are understood: geohash, geotile and geohex. + *

+ * API name: {@code tile_type} + */ + public final Builder tileType(GeoGridTileType value) { + this.tileType = value; + return this; + } + + /** + * The field to assign the polygon shape to, by default, the field + * is updated in-place. + *

+ * API name: {@code target_field} + */ + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + /** + * If specified and a parent tile exists, save that tile address to this field. + *

+ * API name: {@code parent_field} + */ + public final Builder parentField(@Nullable String value) { + this.parentField = value; + return this; + } + + /** + * If specified and children tiles exist, save those tile addresses to this + * field as an array of strings. + *

+ * API name: {@code children_field} + */ + public final Builder childrenField(@Nullable String value) { + this.childrenField = value; + return this; + } + + /** + * If specified and intersecting non-child tiles exist, save their addresses to + * this field as an array of strings. + *

+ * API name: {@code non_children_field} + */ + public final Builder nonChildrenField(@Nullable String value) { + this.nonChildrenField = value; + return this; + } + + /** + * If specified, save the tile precision (zoom) as an integer to this field. + *

+ * API name: {@code precision_field} + */ + public final Builder precisionField(@Nullable String value) { + this.precisionField = value; + return this; + } + + /** + * If true and field does not exist, the processor + * quietly exits without modifying the document. + *

+ * API name: {@code ignore_missing} + */ + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * Which format to save the generated polygon in. + *

+ * API name: {@code target_format} + */ + public final Builder targetFormat(@Nullable GeoGridTargetFormat value) { + this.targetFormat = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GeoGridProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoGridProcessor build() { + _checkSingleUse(); + + return new GeoGridProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoGridProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GeoGridProcessor::setupGeoGridProcessorDeserializer); + + protected static void setupGeoGridProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::tileType, GeoGridTileType._DESERIALIZER, "tile_type"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + op.add(Builder::parentField, JsonpDeserializer.stringDeserializer(), "parent_field"); + op.add(Builder::childrenField, JsonpDeserializer.stringDeserializer(), "children_field"); + op.add(Builder::nonChildrenField, JsonpDeserializer.stringDeserializer(), "non_children_field"); + op.add(Builder::precisionField, JsonpDeserializer.stringDeserializer(), "precision_field"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::targetFormat, GeoGridTargetFormat._DESERIALIZER, "target_format"); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTargetFormat.java similarity index 66% rename from java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java rename to java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTargetFormat.java index 296815a42..1ef6b3825 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTargetFormat.java @@ -17,7 +17,11 @@ * under the License. */ -package co.elastic.clients.elasticsearch._types; +package co.elastic.clients.elasticsearch.ingest; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -35,14 +39,29 @@ //---------------------------------------------------------------- /** - * Base interface for {@link Rank} variants. + * + * @see API + * specification */ -public interface RankVariant { +@JsonpDeserializable +public enum GeoGridTargetFormat implements JsonEnum { + Geojson("geojson"), + + Wkt("wkt"), - Rank.Kind _rankKind(); + ; + + private final String jsonValue; + + GeoGridTargetFormat(String jsonValue) { + this.jsonValue = jsonValue; + } - default Rank _toRank() { - return new Rank(this); + public String jsonValue() { + return this.jsonValue; } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + GeoGridTargetFormat.values()); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTileType.java similarity index 66% rename from java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java rename to java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTileType.java index 6e2200c4b..3bbc52e7f 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoGridTileType.java @@ -17,10 +17,11 @@ * under the License. */ -package co.elastic.clients.elasticsearch._types; +package co.elastic.clients.elasticsearch.ingest; -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -38,26 +39,30 @@ //---------------------------------------------------------------- /** - * Builders for {@link Rank} variants. + * + * @see API + * specification */ -public class RankBuilders { - private RankBuilders() { - } +@JsonpDeserializable +public enum GeoGridTileType implements JsonEnum { + Geotile("geotile"), + + Geohex("geohex"), + + Geohash("geohash"), + + ; + + private final String jsonValue; - /** - * Creates a builder for the {@link RrfRank rrf} {@code Rank} variant. - */ - public static RrfRank.Builder rrf() { - return new RrfRank.Builder(); + GeoGridTileType(String jsonValue) { + this.jsonValue = jsonValue; } - /** - * Creates a Rank of the {@link RrfRank rrf} {@code Rank} variant. - */ - public static Rank rrf(Function> fn) { - Rank.Builder builder = new Rank.Builder(); - builder.rrf(fn.apply(new RrfRank.Builder()).build()); - return builder.build(); + public String jsonValue() { + return this.jsonValue; } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + GeoGridTileType.values()); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoIpProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoIpProcessor.java index 3051a3ca6..13a0134f9 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoIpProcessor.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/GeoIpProcessor.java @@ -74,6 +74,9 @@ public class GeoIpProcessor extends ProcessorBase implements ProcessorVariant { @Nullable private final String targetField; + @Nullable + private final Boolean downloadDatabaseOnPipelineCreation; + // --------------------------------------------------------------------------------------------- private GeoIpProcessor(Builder builder) { @@ -85,6 +88,7 @@ private GeoIpProcessor(Builder builder) { this.ignoreMissing = builder.ignoreMissing; this.properties = ApiTypeHelper.unmodifiable(builder.properties); this.targetField = builder.targetField; + this.downloadDatabaseOnPipelineCreation = builder.downloadDatabaseOnPipelineCreation; } @@ -164,6 +168,20 @@ public final String targetField() { return this.targetField; } + /** + * If true (and if + * ingest.geoip.downloader.eager.download is false), + * the missing database is downloaded when the pipeline is created. Else, the + * download is triggered by when the pipeline is used as the + * default_pipeline or final_pipeline in an index. + *

+ * API name: {@code download_database_on_pipeline_creation} + */ + @Nullable + public final Boolean downloadDatabaseOnPipelineCreation() { + return this.downloadDatabaseOnPipelineCreation; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -200,6 +218,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.targetField); } + if (this.downloadDatabaseOnPipelineCreation != null) { + generator.writeKey("download_database_on_pipeline_creation"); + generator.write(this.downloadDatabaseOnPipelineCreation); + + } } @@ -229,6 +252,9 @@ public static class Builder extends ProcessorBase.AbstractBuilder @Nullable private String targetField; + @Nullable + private Boolean downloadDatabaseOnPipelineCreation; + /** * The database filename referring to a database the module ships with * (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom @@ -310,6 +336,20 @@ public final Builder targetField(@Nullable String value) { return this; } + /** + * If true (and if + * ingest.geoip.downloader.eager.download is false), + * the missing database is downloaded when the pipeline is created. Else, the + * download is triggered by when the pipeline is used as the + * default_pipeline or final_pipeline in an index. + *

+ * API name: {@code download_database_on_pipeline_creation} + */ + public final Builder downloadDatabaseOnPipelineCreation(@Nullable Boolean value) { + this.downloadDatabaseOnPipelineCreation = value; + return this; + } + @Override protected Builder self() { return this; @@ -345,6 +385,8 @@ protected static void setupGeoIpProcessorDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class HtmlStripProcessor extends ProcessorBase implements ProcessorVariant { + private final String field; + + @Nullable + private final Boolean ignoreMissing; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private HtmlStripProcessor(Builder builder) { + super(builder); + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreMissing = builder.ignoreMissing; + this.targetField = builder.targetField; + + } + + public static HtmlStripProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.HtmlStrip; + } + + /** + * Required - The string-valued field to remove HTML tags from. + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document, + *

+ * API name: {@code ignore_missing} + */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * The field to assign the converted value to By default, the field + * is updated in-place. + *

+ * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + + } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HtmlStripProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + @Nullable + private Boolean ignoreMissing; + + @Nullable + private String targetField; + + /** + * Required - The string-valued field to remove HTML tags from. + *

+ * API name: {@code field} + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document, + *

+ * API name: {@code ignore_missing} + */ + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * The field to assign the converted value to By default, the field + * is updated in-place. + *

+ * API name: {@code target_field} + */ + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HtmlStripProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HtmlStripProcessor build() { + _checkSingleUse(); + + return new HtmlStripProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HtmlStripProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HtmlStripProcessor::setupHtmlStripProcessorDeserializer); + + protected static void setupHtmlStripProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java index 4b79d2767..3122f6f6b 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.Long; import java.lang.String; import java.util.List; @@ -73,6 +74,9 @@ public class Pipeline implements JsonpSerializable { @Nullable private final Long version; + @Nullable + private final Boolean deprecated; + private final Map meta; // --------------------------------------------------------------------------------------------- @@ -83,6 +87,7 @@ private Pipeline(Builder builder) { this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); this.version = builder.version; + this.deprecated = builder.deprecated; this.meta = ApiTypeHelper.unmodifiable(builder.meta); } @@ -130,6 +135,18 @@ public final Long version() { return this.version; } + /** + * Marks this ingest pipeline as deprecated. When a deprecated ingest pipeline + * is referenced as the default or final pipeline when creating or updating a + * non-deprecated index template, Elasticsearch will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + @Nullable + public final Boolean deprecated() { + return this.deprecated; + } + /** * Arbitrary metadata about the ingest pipeline. This map is not automatically * generated by Elasticsearch. @@ -180,6 +197,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("version"); generator.write(this.version); + } + if (this.deprecated != null) { + generator.writeKey("deprecated"); + generator.write(this.deprecated); + } if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("_meta"); @@ -219,6 +241,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long version; + @Nullable + private Boolean deprecated; + @Nullable private Map meta; @@ -315,6 +340,18 @@ public final Builder version(@Nullable Long value) { return this; } + /** + * Marks this ingest pipeline as deprecated. When a deprecated ingest pipeline + * is referenced as the default or final pipeline when creating or updating a + * non-deprecated index template, Elasticsearch will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + public final Builder deprecated(@Nullable Boolean value) { + this.deprecated = value; + return this; + } + /** * Arbitrary metadata about the ingest pipeline. This map is not automatically * generated by Elasticsearch. @@ -373,6 +410,7 @@ protected static void setupPipelineDeserializer(ObjectDeserializer foreach( return this.foreach(fn.apply(new ForeachProcessor.Builder()).build()); } + public ObjectBuilder geoGrid(GeoGridProcessor v) { + this._kind = Kind.GeoGrid; + this._value = v; + return this; + } + + public ObjectBuilder geoGrid( + Function> fn) { + return this.geoGrid(fn.apply(new GeoGridProcessor.Builder()).build()); + } + public ObjectBuilder geoip(GeoIpProcessor v) { this._kind = Kind.Geoip; this._value = v; @@ -1025,6 +1112,17 @@ public ObjectBuilder gsub(Function htmlStrip(HtmlStripProcessor v) { + this._kind = Kind.HtmlStrip; + this._value = v; + return this; + } + + public ObjectBuilder htmlStrip( + Function> fn) { + return this.htmlStrip(fn.apply(new HtmlStripProcessor.Builder()).build()); + } + public ObjectBuilder inference(InferenceProcessor v) { this._kind = Kind.Inference; this._value = v; @@ -1088,6 +1186,16 @@ public ObjectBuilder pipeline( return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); } + public ObjectBuilder redact(RedactProcessor v) { + this._kind = Kind.Redact; + this._value = v; + return this; + } + + public ObjectBuilder redact(Function> fn) { + return this.redact(fn.apply(new RedactProcessor.Builder()).build()); + } + public ObjectBuilder remove(RemoveProcessor v) { this._kind = Kind.Remove; this._value = v; @@ -1202,6 +1310,17 @@ public ObjectBuilder urldecode( return this.urldecode(fn.apply(new UrlDecodeProcessor.Builder()).build()); } + public ObjectBuilder uriParts(UriPartsProcessor v) { + this._kind = Kind.UriParts; + this._value = v; + return this; + } + + public ObjectBuilder uriParts( + Function> fn) { + return this.uriParts(fn.apply(new UriPartsProcessor.Builder()).build()); + } + public ObjectBuilder userAgent(UserAgentProcessor v) { this._kind = Kind.UserAgent; this._value = v; @@ -1252,15 +1371,18 @@ protected static void setupProcessorDeserializer(ObjectDeserializer op) op.add(Builder::enrich, EnrichProcessor._DESERIALIZER, "enrich"); op.add(Builder::fail, FailProcessor._DESERIALIZER, "fail"); op.add(Builder::foreach, ForeachProcessor._DESERIALIZER, "foreach"); + op.add(Builder::geoGrid, GeoGridProcessor._DESERIALIZER, "geo_grid"); op.add(Builder::geoip, GeoIpProcessor._DESERIALIZER, "geoip"); op.add(Builder::grok, GrokProcessor._DESERIALIZER, "grok"); op.add(Builder::gsub, GsubProcessor._DESERIALIZER, "gsub"); + op.add(Builder::htmlStrip, HtmlStripProcessor._DESERIALIZER, "html_strip"); op.add(Builder::inference, InferenceProcessor._DESERIALIZER, "inference"); op.add(Builder::join, JoinProcessor._DESERIALIZER, "join"); op.add(Builder::json, JsonProcessor._DESERIALIZER, "json"); op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::lowercase, LowercaseProcessor._DESERIALIZER, "lowercase"); op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); + op.add(Builder::redact, RedactProcessor._DESERIALIZER, "redact"); op.add(Builder::remove, RemoveProcessor._DESERIALIZER, "remove"); op.add(Builder::rename, RenameProcessor._DESERIALIZER, "rename"); op.add(Builder::reroute, RerouteProcessor._DESERIALIZER, "reroute"); @@ -1272,6 +1394,7 @@ protected static void setupProcessorDeserializer(ObjectDeserializer op) op.add(Builder::trim, TrimProcessor._DESERIALIZER, "trim"); op.add(Builder::uppercase, UppercaseProcessor._DESERIALIZER, "uppercase"); op.add(Builder::urldecode, UrlDecodeProcessor._DESERIALIZER, "urldecode"); + op.add(Builder::uriParts, UriPartsProcessor._DESERIALIZER, "uri_parts"); op.add(Builder::userAgent, UserAgentProcessor._DESERIALIZER, "user_agent"); op.setUnknownFieldHandler((builder, name, parser, mapper) -> { diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java index 1c13f6724..efcb19263 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java @@ -297,6 +297,24 @@ public static Processor foreach(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.geoGrid(fn.apply(new GeoGridProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link GeoIpProcessor geoip} {@code Processor} * variant. @@ -351,6 +369,24 @@ public static Processor gsub(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.htmlStrip(fn.apply(new HtmlStripProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link InferenceProcessor inference} * {@code Processor} variant. @@ -459,6 +495,24 @@ public static Processor pipeline(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.redact(fn.apply(new RedactProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link RemoveProcessor remove} {@code Processor} * variant. @@ -657,6 +711,24 @@ public static Processor urldecode(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.uriParts(fn.apply(new UriPartsProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link UserAgentProcessor user_agent} * {@code Processor} variant. diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java index 4bace4a41..fc71a6ce2 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java @@ -34,6 +34,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.Long; import java.lang.String; import java.util.HashMap; @@ -71,6 +72,9 @@ public class PutPipelineRequest extends RequestBase implements JsonpSerializable { private final Map meta; + @Nullable + private final Boolean deprecated; + @Nullable private final String description; @@ -97,6 +101,7 @@ public class PutPipelineRequest extends RequestBase implements JsonpSerializable private PutPipelineRequest(Builder builder) { this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.deprecated = builder.deprecated; this.description = builder.description; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.ifVersion = builder.ifVersion; @@ -122,6 +127,18 @@ public final Map meta() { return this.meta; } + /** + * Marks this ingest pipeline as deprecated. When a deprecated ingest pipeline + * is referenced as the default or final pipeline when creating or updating a + * non-deprecated index template, Elasticsearch will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + @Nullable + public final Boolean deprecated() { + return this.deprecated; + } + /** * Description of the ingest pipeline. *

@@ -230,6 +247,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.deprecated != null) { + generator.writeKey("deprecated"); + generator.write(this.deprecated); + } if (this.description != null) { generator.writeKey("description"); @@ -276,6 +298,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Map meta; + @Nullable + private Boolean deprecated; + @Nullable private String description; @@ -325,6 +350,18 @@ public final Builder meta(String key, JsonData value) { return this; } + /** + * Marks this ingest pipeline as deprecated. When a deprecated ingest pipeline + * is referenced as the default or final pipeline when creating or updating a + * non-deprecated index template, Elasticsearch will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + public final Builder deprecated(@Nullable Boolean value) { + this.deprecated = value; + return this; + } + /** * Description of the ingest pipeline. *

@@ -526,6 +563,7 @@ public PutPipelineRequest build() { protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer op) { op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); + op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); op.add(Builder::onFailure, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "on_failure"); op.add(Builder::processors, JsonpDeserializer.arrayDeserializer(Processor._DESERIALIZER), "processors"); diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java new file mode 100644 index 000000000..21a0fb763 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java @@ -0,0 +1,390 @@ +/* + * 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.ingest; + +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Map; +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: ingest._types.RedactProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RedactProcessor extends ProcessorBase implements ProcessorVariant { + private final String field; + + private final List patterns; + + private final Map patternDefinitions; + + @Nullable + private final String prefix; + + @Nullable + private final String suffix; + + @Nullable + private final Boolean ignoreMissing; + + @Nullable + private final Boolean skipIfUnlicensed; + + // --------------------------------------------------------------------------------------------- + + private RedactProcessor(Builder builder) { + super(builder); + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.patterns = ApiTypeHelper.unmodifiableRequired(builder.patterns, this, "patterns"); + this.patternDefinitions = ApiTypeHelper.unmodifiable(builder.patternDefinitions); + this.prefix = builder.prefix; + this.suffix = builder.suffix; + this.ignoreMissing = builder.ignoreMissing; + this.skipIfUnlicensed = builder.skipIfUnlicensed; + + } + + public static RedactProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Redact; + } + + /** + * Required - The field to be redacted + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

+ * API name: {@code patterns} + */ + public final List patterns() { + return this.patterns; + } + + /** + * API name: {@code pattern_definitions} + */ + public final Map patternDefinitions() { + return this.patternDefinitions; + } + + /** + * Start a redacted section with this token + *

+ * API name: {@code prefix} + */ + @Nullable + public final String prefix() { + return this.prefix; + } + + /** + * End a redacted section with this token + *

+ * API name: {@code suffix} + */ + @Nullable + public final String suffix() { + return this.suffix; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document. + *

+ * API name: {@code ignore_missing} + */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * If true and the current license does not support running redact + * processors, then the processor quietly exits without modifying the document + *

+ * API name: {@code skip_if_unlicensed} + */ + @Nullable + public final Boolean skipIfUnlicensed() { + return this.skipIfUnlicensed; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("field"); + generator.write(this.field); + + if (ApiTypeHelper.isDefined(this.patterns)) { + generator.writeKey("patterns"); + generator.writeStartArray(); + for (String item0 : this.patterns) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.patternDefinitions)) { + generator.writeKey("pattern_definitions"); + generator.writeStartObject(); + for (Map.Entry item0 : this.patternDefinitions.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (this.prefix != null) { + generator.writeKey("prefix"); + generator.write(this.prefix); + + } + if (this.suffix != null) { + generator.writeKey("suffix"); + generator.write(this.suffix); + + } + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + + } + if (this.skipIfUnlicensed != null) { + generator.writeKey("skip_if_unlicensed"); + generator.write(this.skipIfUnlicensed); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RedactProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + private List patterns; + + @Nullable + private Map patternDefinitions; + + @Nullable + private String prefix; + + @Nullable + private String suffix; + + @Nullable + private Boolean ignoreMissing; + + @Nullable + private Boolean skipIfUnlicensed; + + /** + * Required - The field to be redacted + *

+ * API name: {@code field} + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

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

+ * Adds all elements of list to patterns. + */ + public final Builder patterns(List list) { + this.patterns = _listAddAll(this.patterns, list); + return this; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

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

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

+ * Adds all entries of map to patternDefinitions. + */ + public final Builder patternDefinitions(Map map) { + this.patternDefinitions = _mapPutAll(this.patternDefinitions, map); + return this; + } + + /** + * API name: {@code pattern_definitions} + *

+ * Adds an entry to patternDefinitions. + */ + public final Builder patternDefinitions(String key, String value) { + this.patternDefinitions = _mapPut(this.patternDefinitions, key, value); + return this; + } + + /** + * Start a redacted section with this token + *

+ * API name: {@code prefix} + */ + public final Builder prefix(@Nullable String value) { + this.prefix = value; + return this; + } + + /** + * End a redacted section with this token + *

+ * API name: {@code suffix} + */ + public final Builder suffix(@Nullable String value) { + this.suffix = value; + return this; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document. + *

+ * API name: {@code ignore_missing} + */ + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * If true and the current license does not support running redact + * processors, then the processor quietly exits without modifying the document + *

+ * API name: {@code skip_if_unlicensed} + */ + public final Builder skipIfUnlicensed(@Nullable Boolean value) { + this.skipIfUnlicensed = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RedactProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RedactProcessor build() { + _checkSingleUse(); + + return new RedactProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RedactProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RedactProcessor::setupRedactProcessorDeserializer); + + protected static void setupRedactProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::patterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "patterns"); + op.add(Builder::patternDefinitions, + JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "pattern_definitions"); + op.add(Builder::prefix, JsonpDeserializer.stringDeserializer(), "prefix"); + op.add(Builder::suffix, JsonpDeserializer.stringDeserializer(), "suffix"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::skipIfUnlicensed, JsonpDeserializer.booleanDeserializer(), "skip_if_unlicensed"); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateRequest.java index 6ee2e9b3b..e38ed19e9 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateRequest.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateRequest.java @@ -82,7 +82,7 @@ public class SimulateRequest extends RequestBase implements JsonpSerializable { private SimulateRequest(Builder builder) { - this.docs = ApiTypeHelper.unmodifiable(builder.docs); + this.docs = ApiTypeHelper.unmodifiableRequired(builder.docs, this, "docs"); this.id = builder.id; this.pipeline = builder.pipeline; this.verbose = builder.verbose; @@ -94,7 +94,7 @@ public static SimulateRequest of(Function * API name: {@code docs} */ @@ -172,7 +172,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable private List docs; @Nullable @@ -185,7 +184,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Boolean verbose; /** - * Sample documents to test in the pipeline. + * Required - Sample documents to test in the pipeline. *

* API name: {@code docs} *

@@ -197,7 +196,7 @@ public final Builder docs(List list) { } /** - * Sample documents to test in the pipeline. + * Required - Sample documents to test in the pipeline. *

* API name: {@code docs} *

@@ -209,7 +208,7 @@ public final Builder docs(Document value, Document... values) { } /** - * Sample documents to test in the pipeline. + * Required - Sample documents to test in the pipeline. *

* API name: {@code docs} *

diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateResponse.java index 1f55ab6dd..de711b3ec 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateResponse.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/SimulateResponse.java @@ -19,7 +19,7 @@ package co.elastic.clients.elasticsearch.ingest; -import co.elastic.clients.elasticsearch.ingest.simulate.PipelineSimulation; +import co.elastic.clients.elasticsearch.ingest.simulate.SimulateDocumentResult; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -60,7 +60,7 @@ */ @JsonpDeserializable public class SimulateResponse implements JsonpSerializable { - private final List docs; + private final List docs; // --------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ public static SimulateResponse of(Function docs() { + public final List docs() { return this.docs; } @@ -95,7 +95,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.docs)) { generator.writeKey("docs"); generator.writeStartArray(); - for (PipelineSimulation item0 : this.docs) { + for (SimulateDocumentResult item0 : this.docs) { item0.serialize(generator, mapper); } @@ -117,14 +117,14 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List docs; + private List docs; /** * Required - API name: {@code docs} *

* Adds all elements of list to docs. */ - public final Builder docs(List list) { + public final Builder docs(List list) { this.docs = _listAddAll(this.docs, list); return this; } @@ -134,7 +134,7 @@ public final Builder docs(List list) { *

* Adds one or more values to docs. */ - public final Builder docs(PipelineSimulation value, PipelineSimulation... values) { + public final Builder docs(SimulateDocumentResult value, SimulateDocumentResult... values) { this.docs = _listAdd(this.docs, value, values); return this; } @@ -144,8 +144,8 @@ public final Builder docs(PipelineSimulation value, PipelineSimulation... values *

* Adds a value to docs using a builder lambda. */ - public final Builder docs(Function> fn) { - return docs(fn.apply(new PipelineSimulation.Builder()).build()); + public final Builder docs(Function> fn) { + return docs(fn.apply(new SimulateDocumentResult.Builder()).build()); } @Override @@ -176,7 +176,7 @@ public SimulateResponse build() { protected static void setupSimulateResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::docs, JsonpDeserializer.arrayDeserializer(PipelineSimulation._DESERIALIZER), "docs"); + op.add(Builder::docs, JsonpDeserializer.arrayDeserializer(SimulateDocumentResult._DESERIALIZER), "docs"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UriPartsProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UriPartsProcessor.java new file mode 100644 index 000000000..d9c01d76a --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UriPartsProcessor.java @@ -0,0 +1,294 @@ +/* + * 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.ingest; + +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.ApiTypeHelper; +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: ingest._types.UriPartsProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class UriPartsProcessor extends ProcessorBase implements ProcessorVariant { + private final String field; + + @Nullable + private final Boolean ignoreMissing; + + @Nullable + private final Boolean keepOriginal; + + @Nullable + private final Boolean removeIfSuccessful; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private UriPartsProcessor(Builder builder) { + super(builder); + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreMissing = builder.ignoreMissing; + this.keepOriginal = builder.keepOriginal; + this.removeIfSuccessful = builder.removeIfSuccessful; + this.targetField = builder.targetField; + + } + + public static UriPartsProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.UriParts; + } + + /** + * Required - Field containing the URI string. + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + /** + * If true and field does not exist, the processor + * quietly exits without modifying the document. + *

+ * API name: {@code ignore_missing} + */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * If true, the processor copies the unparsed URI to + * <target_field>.original. + *

+ * API name: {@code keep_original} + */ + @Nullable + public final Boolean keepOriginal() { + return this.keepOriginal; + } + + /** + * If true, the processor removes the field after + * parsing the URI string. If parsing fails, the processor does not remove the + * field. + *

+ * API name: {@code remove_if_successful} + */ + @Nullable + public final Boolean removeIfSuccessful() { + return this.removeIfSuccessful; + } + + /** + * Output field for the URI object. + *

+ * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + + } + if (this.keepOriginal != null) { + generator.writeKey("keep_original"); + generator.write(this.keepOriginal); + + } + if (this.removeIfSuccessful != null) { + generator.writeKey("remove_if_successful"); + generator.write(this.removeIfSuccessful); + + } + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UriPartsProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + @Nullable + private Boolean ignoreMissing; + + @Nullable + private Boolean keepOriginal; + + @Nullable + private Boolean removeIfSuccessful; + + @Nullable + private String targetField; + + /** + * Required - Field containing the URI string. + *

+ * API name: {@code field} + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * If true and field does not exist, the processor + * quietly exits without modifying the document. + *

+ * API name: {@code ignore_missing} + */ + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * If true, the processor copies the unparsed URI to + * <target_field>.original. + *

+ * API name: {@code keep_original} + */ + public final Builder keepOriginal(@Nullable Boolean value) { + this.keepOriginal = value; + return this; + } + + /** + * If true, the processor removes the field after + * parsing the URI string. If parsing fails, the processor does not remove the + * field. + *

+ * API name: {@code remove_if_successful} + */ + public final Builder removeIfSuccessful(@Nullable Boolean value) { + this.removeIfSuccessful = value; + return this; + } + + /** + * Output field for the URI object. + *

+ * API name: {@code target_field} + */ + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link UriPartsProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public UriPartsProcessor build() { + _checkSingleUse(); + + return new UriPartsProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UriPartsProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, UriPartsProcessor::setupUriPartsProcessorDeserializer); + + protected static void setupUriPartsProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::keepOriginal, JsonpDeserializer.booleanDeserializer(), "keep_original"); + op.add(Builder::removeIfSuccessful, JsonpDeserializer.booleanDeserializer(), "remove_if_successful"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + + } + +} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UserAgentProcessor.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UserAgentProcessor.java index d1ea73a5a..a02eaa72d 100644 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UserAgentProcessor.java +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/UserAgentProcessor.java @@ -64,14 +64,17 @@ public class UserAgentProcessor extends ProcessorBase implements ProcessorVarian @Nullable private final Boolean ignoreMissing; - private final List options; - @Nullable private final String regexFile; @Nullable private final String targetField; + private final List properties; + + @Nullable + private final Boolean extractDeviceType; + // --------------------------------------------------------------------------------------------- private UserAgentProcessor(Builder builder) { @@ -79,9 +82,10 @@ private UserAgentProcessor(Builder builder) { this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.ignoreMissing = builder.ignoreMissing; - this.options = ApiTypeHelper.unmodifiable(builder.options); this.regexFile = builder.regexFile; this.targetField = builder.targetField; + this.properties = ApiTypeHelper.unmodifiable(builder.properties); + this.extractDeviceType = builder.extractDeviceType; } @@ -117,13 +121,6 @@ public final Boolean ignoreMissing() { return this.ignoreMissing; } - /** - * API name: {@code options} - */ - public final List options() { - return this.options; - } - /** * The name of the file in the config/ingest-user-agent directory * containing the regular expressions for parsing the user agent string. Both @@ -148,6 +145,25 @@ public final String targetField() { return this.targetField; } + /** + * Controls what properties are added to target_field. + *

+ * API name: {@code properties} + */ + public final List properties() { + return this.properties; + } + + /** + * Extracts device type from the user agent string on a best-effort basis. + *

+ * API name: {@code extract_device_type} + */ + @Nullable + public final Boolean extractDeviceType() { + return this.extractDeviceType; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -158,15 +174,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("ignore_missing"); generator.write(this.ignoreMissing); - } - if (ApiTypeHelper.isDefined(this.options)) { - generator.writeKey("options"); - generator.writeStartArray(); - for (UserAgentProperty item0 : this.options) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - } if (this.regexFile != null) { generator.writeKey("regex_file"); @@ -178,6 +185,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.targetField); } + if (ApiTypeHelper.isDefined(this.properties)) { + generator.writeKey("properties"); + generator.writeStartArray(); + for (UserAgentProperty item0 : this.properties) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + if (this.extractDeviceType != null) { + generator.writeKey("extract_device_type"); + generator.write(this.extractDeviceType); + + } } @@ -195,15 +216,18 @@ public static class Builder extends ProcessorBase.AbstractBuilder @Nullable private Boolean ignoreMissing; - @Nullable - private List options; - @Nullable private String regexFile; @Nullable private String targetField; + @Nullable + private List properties; + + @Nullable + private Boolean extractDeviceType; + /** * Required - The field containing the user agent string. *

@@ -225,26 +249,6 @@ public final Builder ignoreMissing(@Nullable Boolean value) { return this; } - /** - * API name: {@code options} - *

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

- * Adds one or more values to options. - */ - public final Builder options(UserAgentProperty value, UserAgentProperty... values) { - this.options = _listAdd(this.options, value, values); - return this; - } - /** * The name of the file in the config/ingest-user-agent directory * containing the regular expressions for parsing the user agent string. Both @@ -269,6 +273,40 @@ public final Builder targetField(@Nullable String value) { return this; } + /** + * Controls what properties are added to target_field. + *

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

+ * Adds all elements of list to properties. + */ + public final Builder properties(List list) { + this.properties = _listAddAll(this.properties, list); + return this; + } + + /** + * Controls what properties are added to target_field. + *

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

+ * Adds one or more values to properties. + */ + public final Builder properties(UserAgentProperty value, UserAgentProperty... values) { + this.properties = _listAdd(this.properties, value, values); + return this; + } + + /** + * Extracts device type from the user agent string on a best-effort basis. + *

+ * API name: {@code extract_device_type} + */ + public final Builder extractDeviceType(@Nullable Boolean value) { + this.extractDeviceType = value; + return this; + } + @Override protected Builder self() { return this; @@ -299,9 +337,10 @@ protected static void setupUserAgentProcessorDeserializer(ObjectDeserializer processorResults; - @Nullable private final String tag; @@ -76,15 +73,26 @@ public class PipelineSimulation implements JsonpSerializable { @Nullable private final ActionStatusOptions status; + @Nullable + private final String description; + + @Nullable + private final ErrorCause ignoredError; + + @Nullable + private final ErrorCause error; + // --------------------------------------------------------------------------------------------- private PipelineSimulation(Builder builder) { this.doc = builder.doc; - this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); this.tag = builder.tag; this.processorType = builder.processorType; this.status = builder.status; + this.description = builder.description; + this.ignoredError = builder.ignoredError; + this.error = builder.error; } @@ -100,13 +108,6 @@ public final DocumentSimulation doc() { return this.doc; } - /** - * API name: {@code processor_results} - */ - public final List processorResults() { - return this.processorResults; - } - /** * API name: {@code tag} */ @@ -131,6 +132,30 @@ public final ActionStatusOptions status() { return this.status; } + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignored_error} + */ + @Nullable + public final ErrorCause ignoredError() { + return this.ignoredError; + } + + /** + * API name: {@code error} + */ + @Nullable + public final ErrorCause error() { + return this.error; + } + /** * Serialize this object to JSON. */ @@ -146,16 +171,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("doc"); this.doc.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.processorResults)) { - generator.writeKey("processor_results"); - generator.writeStartArray(); - for (PipelineSimulation item0 : this.processorResults) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - } if (this.tag != null) { generator.writeKey("tag"); @@ -171,6 +186,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("status"); this.status.serialize(generator, mapper); } + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + + } + if (this.ignoredError != null) { + generator.writeKey("ignored_error"); + this.ignoredError.serialize(generator, mapper); + + } + if (this.error != null) { + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + } } @@ -191,9 +221,6 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private DocumentSimulation doc; - @Nullable - private List processorResults; - @Nullable private String tag; @@ -203,6 +230,15 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private ActionStatusOptions status; + @Nullable + private String description; + + @Nullable + private ErrorCause ignoredError; + + @Nullable + private ErrorCause error; + /** * API name: {@code doc} */ @@ -219,59 +255,67 @@ public final Builder doc(Function - * Adds all elements of list to processorResults. + * API name: {@code tag} */ - public final Builder processorResults(List list) { - this.processorResults = _listAddAll(this.processorResults, list); + public final Builder tag(@Nullable String value) { + this.tag = value; return this; } /** - * API name: {@code processor_results} - *

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

- * Adds a value to processorResults using a builder lambda. + * API name: {@code status} */ - public final Builder processorResults( - Function> fn) { - return processorResults(fn.apply(new PipelineSimulation.Builder()).build()); + public final Builder status(@Nullable ActionStatusOptions value) { + this.status = value; + return this; } /** - * API name: {@code tag} + * API name: {@code description} */ - public final Builder tag(@Nullable String value) { - this.tag = value; + public final Builder description(@Nullable String value) { + this.description = value; return this; } /** - * API name: {@code processor_type} + * API name: {@code ignored_error} */ - public final Builder processorType(@Nullable String value) { - this.processorType = value; + public final Builder ignoredError(@Nullable ErrorCause value) { + this.ignoredError = value; return this; } /** - * API name: {@code status} + * API name: {@code ignored_error} */ - public final Builder status(@Nullable ActionStatusOptions value) { - this.status = value; + public final Builder ignoredError(Function> fn) { + return this.ignoredError(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable ErrorCause value) { + this.error = value; return this; } + /** + * API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -301,11 +345,12 @@ public PipelineSimulation build() { protected static void setupPipelineSimulationDeserializer(ObjectDeserializer op) { op.add(Builder::doc, DocumentSimulation._DESERIALIZER, "doc"); - op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(PipelineSimulation._DESERIALIZER), - "processor_results"); op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); op.add(Builder::processorType, JsonpDeserializer.stringDeserializer(), "processor_type"); op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoredError, ErrorCause._DESERIALIZER, "ignored_error"); + op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); } diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/SimulateDocumentResult.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/SimulateDocumentResult.java new file mode 100644 index 000000000..cd51807d4 --- /dev/null +++ b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ingest/simulate/SimulateDocumentResult.java @@ -0,0 +1,262 @@ +/* + * 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.ingest.simulate; + +import co.elastic.clients.elasticsearch._types.ErrorCause; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +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.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +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: ingest.simulate.SimulateDocumentResult + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SimulateDocumentResult implements JsonpSerializable { + @Nullable + private final DocumentSimulation doc; + + @Nullable + private final ErrorCause error; + + private final List processorResults; + + // --------------------------------------------------------------------------------------------- + + private SimulateDocumentResult(Builder builder) { + + this.doc = builder.doc; + this.error = builder.error; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + + } + + public static SimulateDocumentResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code doc} + */ + @Nullable + public final DocumentSimulation doc() { + return this.doc; + } + + /** + * API name: {@code error} + */ + @Nullable + public final ErrorCause error() { + return this.error; + } + + /** + * API name: {@code processor_results} + */ + public final List processorResults() { + return this.processorResults; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.doc != null) { + generator.writeKey("doc"); + this.doc.serialize(generator, mapper); + + } + if (this.error != null) { + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); + generator.writeStartArray(); + for (PipelineSimulation item0 : this.processorResults) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SimulateDocumentResult}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private DocumentSimulation doc; + + @Nullable + private ErrorCause error; + + @Nullable + private List processorResults; + + /** + * API name: {@code doc} + */ + public final Builder doc(@Nullable DocumentSimulation value) { + this.doc = value; + return this; + } + + /** + * API name: {@code doc} + */ + public final Builder doc(Function> fn) { + return this.doc(fn.apply(new DocumentSimulation.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable ErrorCause value) { + this.error = value; + return this; + } + + /** + * API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code processor_results} + *

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

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

+ * Adds a value to processorResults using a builder lambda. + */ + public final Builder processorResults( + Function> fn) { + return processorResults(fn.apply(new PipelineSimulation.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SimulateDocumentResult}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SimulateDocumentResult build() { + _checkSingleUse(); + + return new SimulateDocumentResult(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SimulateDocumentResult} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SimulateDocumentResult::setupSimulateDocumentResultDeserializer); + + protected static void setupSimulateDocumentResultDeserializer( + ObjectDeserializer op) { + + op.add(Builder::doc, DocumentSimulation._DESERIALIZER, "doc"); + op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(PipelineSimulation._DESERIALIZER), + "processor_results"); + + } + +}