From 949bdd3c02dfc9daacb03215ead12c123d16008a Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Fri, 27 Sep 2024 12:10:35 +0200 Subject: [PATCH] [codegen] update to latest spec --- .../_types/aggregations/Aggregation.java | 31 + .../aggregations/AggregationBuilders.java | 19 + .../RandomSamplerAggregation.java | 244 +++++++ .../_types/analysis/KeywordTokenizer.java | 24 +- .../_types/mapping/CorePropertyBase.java | 29 - .../_types/mapping/KeywordProperty.java | 29 + .../mapping/SearchAsYouTypeProperty.java | 29 + .../_types/mapping/TextProperty.java | 29 + .../_types/query_dsl/RangeQueryBase.java | 12 + .../_types/query_dsl/TermsSetQuery.java | 132 +++- .../core/search/AggregationProfileDebug.java | 116 ++++ .../core/search/DfsKnnProfile.java | 289 ++++++++ .../elasticsearch/core/search/DfsProfile.java | 221 +++++++ .../core/search/DfsStatisticsBreakdown.java | 327 ++++++++++ .../core/search/DfsStatisticsProfile.java | 376 +++++++++++ .../elasticsearch/core/search/Hit.java | 19 +- .../core/search/KnnCollectorResult.java | 297 +++++++++ .../core/search/KnnQueryProfileBreakdown.java | 617 ++++++++++++++++++ .../core/search/KnnQueryProfileResult.java | 377 +++++++++++ .../core/search/QueryBreakdown.java | 48 ++ .../core/search/ShardProfile.java | 182 +++++- .../elasticsearch/doc-files/api-spec.html | 258 ++++---- .../ElasticsearchIngestAsyncClient.java | 14 +- .../ingest/ElasticsearchIngestClient.java | 14 +- .../elasticsearch/ml/CalendarEvent.java | 103 +++ .../ml/DeploymentAssignmentState.java | 18 +- .../ml/TrainedModelDeploymentStats.java | 10 +- .../DeleteBehavioralAnalyticsRequest.java | 3 +- .../DeleteSearchApplicationRequest.java | 3 +- ...ticsearchSearchApplicationAsyncClient.java | 50 +- .../ElasticsearchSearchApplicationClient.java | 50 +- .../GetBehavioralAnalyticsRequest.java | 2 +- .../GetSearchApplicationRequest.java | 2 +- .../PutBehavioralAnalyticsRequest.java | 2 +- .../search_application/PutRequest.java | 2 +- .../SearchApplicationSearchRequest.java | 5 +- .../security/IndicesPrivilegesQuery.java | 226 +++++++ .../IndicesPrivilegesQueryBuilders.java | 68 ++ .../security/PutRoleRequest.java | 63 ++ .../security/RemoteIndicesPrivileges.java | 427 ++++++++++++ .../security/RoleTemplateQuery.java | 189 ++++++ .../ElasticsearchSnapshotAsyncClient.java | 34 + .../snapshot/ElasticsearchSnapshotClient.java | 35 + .../RepositoryVerifyIntegrityRequest.java | 444 +++++++++++++ .../RepositoryVerifyIntegrityResponse.java | 153 +++++ .../snapshot/SnapshotShardFailure.java | 24 + .../elasticsearch/sql/QueryRequest.java | 11 +- .../query/SqlFormat.java} | 37 +- .../elasticsearch/xpack/XpackInfoRequest.java | 15 +- .../xpack/info/XPackCategory.java | 68 ++ 50 files changed, 5480 insertions(+), 297 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RandomSamplerAggregation.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsKnnProfile.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsProfile.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsBreakdown.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsProfile.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnCollectorResult.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileBreakdown.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileResult.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQuery.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQueryBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplateQuery.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityResponse.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{ml/DeploymentState.java => sql/query/SqlFormat.java} (70%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/XPackCategory.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java index b05d03a84..f6287e03f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/Aggregation.java @@ -193,6 +193,8 @@ public enum Kind implements JsonEnum { ReverseNested("reverse_nested"), + RandomSampler("random_sampler"), + Sampler("sampler"), ScriptedMetric("scripted_metric"), @@ -1305,6 +1307,23 @@ public ReverseNestedAggregation reverseNested() { return TaggedUnionUtils.get(this, Kind.ReverseNested); } + /** + * Is this variant instance of kind {@code random_sampler}? + */ + public boolean isRandomSampler() { + return _kind == Kind.RandomSampler; + } + + /** + * Get the {@code random_sampler} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code random_sampler} kind. + */ + public RandomSamplerAggregation randomSampler() { + return TaggedUnionUtils.get(this, Kind.RandomSampler); + } + /** * Is this variant instance of kind {@code sampler}? */ @@ -2379,6 +2398,17 @@ public ContainerBuilder reverseNested( return this.reverseNested(fn.apply(new ReverseNestedAggregation.Builder()).build()); } + public ContainerBuilder randomSampler(RandomSamplerAggregation v) { + this._kind = Kind.RandomSampler; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder randomSampler( + Function> fn) { + return this.randomSampler(fn.apply(new RandomSamplerAggregation.Builder()).build()); + } + public ContainerBuilder sampler(SamplerAggregation v) { this._kind = Kind.Sampler; this._value = v; @@ -2721,6 +2751,7 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o op.add(Builder::rareTerms, RareTermsAggregation._DESERIALIZER, "rare_terms"); op.add(Builder::rate, RateAggregation._DESERIALIZER, "rate"); op.add(Builder::reverseNested, ReverseNestedAggregation._DESERIALIZER, "reverse_nested"); + op.add(Builder::randomSampler, RandomSamplerAggregation._DESERIALIZER, "random_sampler"); op.add(Builder::sampler, SamplerAggregation._DESERIALIZER, "sampler"); op.add(Builder::scriptedMetric, ScriptedMetricAggregation._DESERIALIZER, "scripted_metric"); op.add(Builder::serialDiff, SerialDifferencingAggregation._DESERIALIZER, "serial_diff"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java index f0b63a419..73b70e311 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBuilders.java @@ -1130,6 +1130,25 @@ public static Aggregation reverseNested( return builder.build(); } + /** + * Creates a builder for the {@link RandomSamplerAggregation random_sampler} + * {@code Aggregation} variant. + */ + public static RandomSamplerAggregation.Builder randomSampler() { + return new RandomSamplerAggregation.Builder(); + } + + /** + * Creates a Aggregation of the {@link RandomSamplerAggregation random_sampler} + * {@code Aggregation} variant. + */ + public static Aggregation randomSampler( + Function> fn) { + Aggregation.Builder builder = new Aggregation.Builder(); + builder.randomSampler(fn.apply(new RandomSamplerAggregation.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link SamplerAggregation sampler} * {@code Aggregation} variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RandomSamplerAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RandomSamplerAggregation.java new file mode 100644 index 000000000..efb341ccf --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RandomSamplerAggregation.java @@ -0,0 +1,244 @@ +/* + * 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.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 jakarta.json.stream.JsonGenerator; +import java.lang.Double; +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.aggregations.RandomSamplerAggregation + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RandomSamplerAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { + private final double probability; + + @Nullable + private final Integer seed; + + @Nullable + private final Integer shardSeed; + + // --------------------------------------------------------------------------------------------- + + private RandomSamplerAggregation(Builder builder) { + + this.probability = ApiTypeHelper.requireNonNull(builder.probability, this, "probability"); + this.seed = builder.seed; + this.shardSeed = builder.shardSeed; + + } + + public static RandomSamplerAggregation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Aggregation variant kind. + */ + @Override + public Aggregation.Kind _aggregationKind() { + return Aggregation.Kind.RandomSampler; + } + + /** + * Required - The probability that a document will be included in the aggregated + * data. Must be greater than 0, less than 0.5, or exactly 1. The lower the + * probability, the fewer documents are matched. + *

+ * API name: {@code probability} + */ + public final double probability() { + return this.probability; + } + + /** + * The seed to generate the random sampling of documents. When a seed is + * provided, the random subset of documents is the same between calls. + *

+ * API name: {@code seed} + */ + @Nullable + public final Integer seed() { + return this.seed; + } + + /** + * When combined with seed, setting shard_seed ensures 100% consistent sampling + * over shards where data is exactly the same. + *

+ * API name: {@code shard_seed} + */ + @Nullable + public final Integer shardSeed() { + return this.shardSeed; + } + + /** + * 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) { + + generator.writeKey("probability"); + generator.write(this.probability); + + if (this.seed != null) { + generator.writeKey("seed"); + generator.write(this.seed); + + } + if (this.shardSeed != null) { + generator.writeKey("shard_seed"); + generator.write(this.shardSeed); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RandomSamplerAggregation}. + */ + + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + ObjectBuilder { + private Double probability; + + @Nullable + private Integer seed; + + @Nullable + private Integer shardSeed; + + /** + * Required - The probability that a document will be included in the aggregated + * data. Must be greater than 0, less than 0.5, or exactly 1. The lower the + * probability, the fewer documents are matched. + *

+ * API name: {@code probability} + */ + public final Builder probability(double value) { + this.probability = value; + return this; + } + + /** + * The seed to generate the random sampling of documents. When a seed is + * provided, the random subset of documents is the same between calls. + *

+ * API name: {@code seed} + */ + public final Builder seed(@Nullable Integer value) { + this.seed = value; + return this; + } + + /** + * When combined with seed, setting shard_seed ensures 100% consistent sampling + * over shards where data is exactly the same. + *

+ * API name: {@code shard_seed} + */ + public final Builder shardSeed(@Nullable Integer value) { + this.shardSeed = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RandomSamplerAggregation}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RandomSamplerAggregation build() { + _checkSingleUse(); + + return new RandomSamplerAggregation(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RandomSamplerAggregation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RandomSamplerAggregation::setupRandomSamplerAggregationDeserializer); + + protected static void setupRandomSamplerAggregationDeserializer( + ObjectDeserializer op) { + + op.add(Builder::probability, JsonpDeserializer.doubleDeserializer(), "probability"); + op.add(Builder::seed, JsonpDeserializer.integerDeserializer(), "seed"); + op.add(Builder::shardSeed, JsonpDeserializer.integerDeserializer(), "shard_seed"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/KeywordTokenizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/KeywordTokenizer.java index 539b32d58..55cb23152 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/KeywordTokenizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/KeywordTokenizer.java @@ -24,12 +24,12 @@ 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.Integer; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -56,14 +56,15 @@ */ @JsonpDeserializable public class KeywordTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { - private final int bufferSize; + @Nullable + private final Integer bufferSize; // --------------------------------------------------------------------------------------------- private KeywordTokenizer(Builder builder) { super(builder); - this.bufferSize = ApiTypeHelper.requireNonNull(builder.bufferSize, this, "bufferSize"); + this.bufferSize = builder.bufferSize; } @@ -80,9 +81,10 @@ public TokenizerDefinition.Kind _tokenizerDefinitionKind() { } /** - * Required - API name: {@code buffer_size} + * API name: {@code buffer_size} */ - public final int bufferSize() { + @Nullable + public final Integer bufferSize() { return this.bufferSize; } @@ -90,8 +92,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "keyword"); super.serializeInternal(generator, mapper); - generator.writeKey("buffer_size"); - generator.write(this.bufferSize); + if (this.bufferSize != null) { + generator.writeKey("buffer_size"); + generator.write(this.bufferSize); + + } } @@ -104,12 +109,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenizerBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Integer bufferSize; /** - * Required - API name: {@code buffer_size} + * API name: {@code buffer_size} */ - public final Builder bufferSize(int value) { + public final Builder bufferSize(@Nullable Integer value) { this.bufferSize = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CorePropertyBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CorePropertyBase.java index fef280357..47f15aff0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CorePropertyBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/CorePropertyBase.java @@ -61,9 +61,6 @@ public abstract class CorePropertyBase extends PropertyBase { private final List copyTo; - @Nullable - private final String similarity; - @Nullable private final Boolean store; @@ -73,7 +70,6 @@ protected CorePropertyBase(AbstractBuilder builder) { super(builder); this.copyTo = ApiTypeHelper.unmodifiable(builder.copyTo); - this.similarity = builder.similarity; this.store = builder.store; } @@ -85,14 +81,6 @@ public final List copyTo() { return this.copyTo; } - /** - * API name: {@code similarity} - */ - @Nullable - public final String similarity() { - return this.similarity; - } - /** * API name: {@code store} */ @@ -113,11 +101,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); - } - if (this.similarity != null) { - generator.writeKey("similarity"); - generator.write(this.similarity); - } if (this.store != null) { generator.writeKey("store"); @@ -133,9 +116,6 @@ public abstract static class AbstractBuilder copyTo; - @Nullable - private String similarity; - @Nullable private Boolean store; @@ -159,14 +139,6 @@ public final BuilderT copyTo(String value, String... values) { return self(); } - /** - * API name: {@code similarity} - */ - public final BuilderT similarity(@Nullable String value) { - this.similarity = value; - return self(); - } - /** * API name: {@code store} */ @@ -183,7 +155,6 @@ protected static > void setupCoreProp PropertyBase.setupPropertyBaseDeserializer(op); op.add(AbstractBuilder::copyTo, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "copy_to"); - op.add(AbstractBuilder::similarity, JsonpDeserializer.stringDeserializer(), "similarity"); op.add(AbstractBuilder::store, JsonpDeserializer.booleanDeserializer(), "store"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java index 022376e1c..710c761fa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/KeywordProperty.java @@ -86,6 +86,9 @@ public class KeywordProperty extends DocValuesPropertyBase implements PropertyVa @Nullable private final String nullValue; + @Nullable + private final String similarity; + @Nullable private final Boolean splitQueriesOnWhitespace; @@ -106,6 +109,7 @@ private KeywordProperty(Builder builder) { this.normalizer = builder.normalizer; this.norms = builder.norms; this.nullValue = builder.nullValue; + this.similarity = builder.similarity; this.splitQueriesOnWhitespace = builder.splitQueriesOnWhitespace; this.timeSeriesDimension = builder.timeSeriesDimension; @@ -195,6 +199,14 @@ public final String nullValue() { return this.nullValue; } + /** + * API name: {@code similarity} + */ + @Nullable + public final String similarity() { + return this.similarity; + } + /** * API name: {@code split_queries_on_whitespace} */ @@ -260,6 +272,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("null_value"); generator.write(this.nullValue); + } + if (this.similarity != null) { + generator.writeKey("similarity"); + generator.write(this.similarity); + } if (this.splitQueriesOnWhitespace != null) { generator.writeKey("split_queries_on_whitespace"); @@ -310,6 +327,9 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder @Nullable private String searchQuoteAnalyzer; + @Nullable + private String similarity; + @Nullable private TermVectorOption termVector; @@ -308,6 +328,14 @@ public final Builder searchQuoteAnalyzer(@Nullable String value) { return this; } + /** + * API name: {@code similarity} + */ + public final Builder similarity(@Nullable String value) { + this.similarity = value; + return this; + } + /** * API name: {@code term_vector} */ @@ -352,6 +380,7 @@ protected static void setupSearchAsYouTypePropertyDeserializer( op.add(Builder::norms, JsonpDeserializer.booleanDeserializer(), "norms"); op.add(Builder::searchAnalyzer, JsonpDeserializer.stringDeserializer(), "search_analyzer"); op.add(Builder::searchQuoteAnalyzer, JsonpDeserializer.stringDeserializer(), "search_quote_analyzer"); + op.add(Builder::similarity, JsonpDeserializer.stringDeserializer(), "similarity"); op.add(Builder::termVector, TermVectorOption._DESERIALIZER, "term_vector"); op.ignore("type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/TextProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/TextProperty.java index 057710555..8d5757bff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/TextProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/TextProperty.java @@ -98,6 +98,9 @@ public class TextProperty extends CorePropertyBase implements PropertyVariant { @Nullable private final String searchQuoteAnalyzer; + @Nullable + private final String similarity; + @Nullable private final TermVectorOption termVector; @@ -119,6 +122,7 @@ private TextProperty(Builder builder) { this.positionIncrementGap = builder.positionIncrementGap; this.searchAnalyzer = builder.searchAnalyzer; this.searchQuoteAnalyzer = builder.searchQuoteAnalyzer; + this.similarity = builder.similarity; this.termVector = builder.termVector; } @@ -239,6 +243,14 @@ public final String searchQuoteAnalyzer() { return this.searchQuoteAnalyzer; } + /** + * API name: {@code similarity} + */ + @Nullable + public final String similarity() { + return this.similarity; + } + /** * API name: {@code term_vector} */ @@ -314,6 +326,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("search_quote_analyzer"); generator.write(this.searchQuoteAnalyzer); + } + if (this.similarity != null) { + generator.writeKey("similarity"); + generator.write(this.similarity); + } if (this.termVector != null) { generator.writeKey("term_vector"); @@ -370,6 +387,9 @@ public static class Builder extends CorePropertyBase.AbstractBuilder @Nullable private String searchQuoteAnalyzer; + @Nullable + private String similarity; + @Nullable private TermVectorOption termVector; @@ -492,6 +512,14 @@ public final Builder searchQuoteAnalyzer(@Nullable String value) { return this; } + /** + * API name: {@code similarity} + */ + public final Builder similarity(@Nullable String value) { + this.similarity = value; + return this; + } + /** * API name: {@code term_vector} */ @@ -541,6 +569,7 @@ protected static void setupTextPropertyDeserializer(ObjectDeserializer terms; + private final List terms; // --------------------------------------------------------------------------------------------- @@ -76,6 +81,7 @@ private TermsSetQuery(Builder builder) { super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.minimumShouldMatch = builder.minimumShouldMatch; this.minimumShouldMatchField = builder.minimumShouldMatchField; this.minimumShouldMatchScript = builder.minimumShouldMatchScript; this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms"); @@ -101,6 +107,17 @@ public final String field() { return this.field; } + /** + * Specification describing number of matching terms required to return a + * document. + *

+ * API name: {@code minimum_should_match} + */ + @Nullable + public final String minimumShouldMatch() { + return this.minimumShouldMatch; + } + /** * Numeric field containing the number of matching terms required to return a * document. @@ -128,7 +145,7 @@ public final Script minimumShouldMatchScript() { *

* API name: {@code terms} */ - public final List terms() { + public final List terms() { return this.terms; } @@ -136,6 +153,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(this.field); super.serializeInternal(generator, mapper); + if (this.minimumShouldMatch != null) { + generator.writeKey("minimum_should_match"); + generator.write(this.minimumShouldMatch); + + } if (this.minimumShouldMatchField != null) { generator.writeKey("minimum_should_match_field"); generator.write(this.minimumShouldMatchField); @@ -149,8 +171,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.terms)) { generator.writeKey("terms"); generator.writeStartArray(); - for (String item0 : this.terms) { - generator.write(item0); + for (FieldValue item0 : this.terms) { + item0.serialize(generator, mapper); } generator.writeEnd(); @@ -178,13 +200,27 @@ public final Builder field(String value) { return this; } + @Nullable + private String minimumShouldMatch; + @Nullable private String minimumShouldMatchField; @Nullable private Script minimumShouldMatchScript; - private List terms; + private List terms; + + /** + * Specification describing number of matching terms required to return a + * document. + *

+ * API name: {@code minimum_should_match} + */ + public final Builder minimumShouldMatch(@Nullable String value) { + this.minimumShouldMatch = value; + return this; + } /** * Numeric field containing the number of matching terms required to return a @@ -225,7 +261,7 @@ public final Builder minimumShouldMatchScript(Function * Adds all elements of list to terms. */ - public final Builder terms(List list) { + public final Builder terms(List list) { this.terms = _listAddAll(this.terms, list); return this; } @@ -237,11 +273,90 @@ public final Builder terms(List list) { *

* Adds one or more values to terms. */ - public final Builder terms(String value, String... values) { + public final Builder terms(FieldValue value, FieldValue... values) { this.terms = _listAdd(this.terms, value, values); return this; } + /** + * Required - Array of terms you wish to find in the provided field. + *

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

+ * Adds all passed values to terms. + */ + public final Builder terms(String value, String... values) { + this.terms = _listAdd(this.terms, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.terms = _listAddAll(this.terms, fieldValues); + return this; + } + + /** + * Required - Array of terms you wish to find in the provided field. + *

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

+ * Adds all passed values to terms. + */ + public final Builder terms(long value, long... values) { + this.terms = _listAdd(this.terms, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.terms = _listAddAll(this.terms, fieldValues); + return this; + } + + /** + * Required - Array of terms you wish to find in the provided field. + *

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

+ * Adds all passed values to terms. + */ + public final Builder terms(double value, double... values) { + this.terms = _listAdd(this.terms, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.terms = _listAddAll(this.terms, fieldValues); + return this; + } + + /** + * Required - Array of terms you wish to find in the provided field. + *

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

+ * Adds all passed values to terms. + */ + public final Builder terms(boolean value, boolean... values) { + this.terms = _listAdd(this.terms, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.terms = _listAddAll(this.terms, fieldValues); + return this; + } + + /** + * Required - Array of terms you wish to find in the provided field. + *

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

+ * Adds a value to terms using a builder lambda. + */ + public final Builder terms(Function> fn) { + return terms(fn.apply(new FieldValue.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -270,9 +385,10 @@ public TermsSetQuery build() { protected static void setupTermsSetQueryDeserializer(ObjectDeserializer op) { QueryBase.setupQueryBaseDeserializer(op); + op.add(Builder::minimumShouldMatch, JsonpDeserializer.stringDeserializer(), "minimum_should_match"); op.add(Builder::minimumShouldMatchField, JsonpDeserializer.stringDeserializer(), "minimum_should_match_field"); op.add(Builder::minimumShouldMatchScript, Script._DESERIALIZER, "minimum_should_match_script"); - op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "terms"); + op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "terms"); op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/AggregationProfileDebug.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/AggregationProfileDebug.java index c2610126e..a15a89025 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/AggregationProfileDebug.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/AggregationProfileDebug.java @@ -145,6 +145,18 @@ public class AggregationProfileDebug implements JsonpSerializable { @Nullable private final String mapReducer; + @Nullable + private final Integer bruteForceUsed; + + @Nullable + private final Integer dynamicPruningAttempted; + + @Nullable + private final Integer dynamicPruningUsed; + + @Nullable + private final Integer skippedDueToNoData; + // --------------------------------------------------------------------------------------------- private AggregationProfileDebug(Builder builder) { @@ -177,6 +189,10 @@ private AggregationProfileDebug(Builder builder) { this.segmentsCounted = builder.segmentsCounted; this.segmentsCollected = builder.segmentsCollected; this.mapReducer = builder.mapReducer; + this.bruteForceUsed = builder.bruteForceUsed; + this.dynamicPruningAttempted = builder.dynamicPruningAttempted; + this.dynamicPruningUsed = builder.dynamicPruningUsed; + this.skippedDueToNoData = builder.skippedDueToNoData; } @@ -406,6 +422,38 @@ public final String mapReducer() { return this.mapReducer; } + /** + * API name: {@code brute_force_used} + */ + @Nullable + public final Integer bruteForceUsed() { + return this.bruteForceUsed; + } + + /** + * API name: {@code dynamic_pruning_attempted} + */ + @Nullable + public final Integer dynamicPruningAttempted() { + return this.dynamicPruningAttempted; + } + + /** + * API name: {@code dynamic_pruning_used} + */ + @Nullable + public final Integer dynamicPruningUsed() { + return this.dynamicPruningUsed; + } + + /** + * API name: {@code skipped_due_to_no_data} + */ + @Nullable + public final Integer skippedDueToNoData() { + return this.skippedDueToNoData; + } + /** * Serialize this object to JSON. */ @@ -567,6 +615,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.mapReducer); } + if (this.bruteForceUsed != null) { + generator.writeKey("brute_force_used"); + generator.write(this.bruteForceUsed); + + } + if (this.dynamicPruningAttempted != null) { + generator.writeKey("dynamic_pruning_attempted"); + generator.write(this.dynamicPruningAttempted); + + } + if (this.dynamicPruningUsed != null) { + generator.writeKey("dynamic_pruning_used"); + generator.write(this.dynamicPruningUsed); + + } + if (this.skippedDueToNoData != null) { + generator.writeKey("skipped_due_to_no_data"); + generator.write(this.skippedDueToNoData); + + } } @@ -668,6 +736,18 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String mapReducer; + @Nullable + private Integer bruteForceUsed; + + @Nullable + private Integer dynamicPruningAttempted; + + @Nullable + private Integer dynamicPruningUsed; + + @Nullable + private Integer skippedDueToNoData; + /** * API name: {@code segments_with_multi_valued_ords} */ @@ -935,6 +1015,38 @@ public final Builder mapReducer(@Nullable String value) { return this; } + /** + * API name: {@code brute_force_used} + */ + public final Builder bruteForceUsed(@Nullable Integer value) { + this.bruteForceUsed = value; + return this; + } + + /** + * API name: {@code dynamic_pruning_attempted} + */ + public final Builder dynamicPruningAttempted(@Nullable Integer value) { + this.dynamicPruningAttempted = value; + return this; + } + + /** + * API name: {@code dynamic_pruning_used} + */ + public final Builder dynamicPruningUsed(@Nullable Integer value) { + this.dynamicPruningUsed = value; + return this; + } + + /** + * API name: {@code skipped_due_to_no_data} + */ + public final Builder skippedDueToNoData(@Nullable Integer value) { + this.skippedDueToNoData = value; + return this; + } + @Override protected Builder self() { return this; @@ -999,6 +1111,10 @@ protected static void setupAggregationProfileDebugDeserializer( op.add(Builder::segmentsCounted, JsonpDeserializer.integerDeserializer(), "segments_counted"); op.add(Builder::segmentsCollected, JsonpDeserializer.integerDeserializer(), "segments_collected"); op.add(Builder::mapReducer, JsonpDeserializer.stringDeserializer(), "map_reducer"); + op.add(Builder::bruteForceUsed, JsonpDeserializer.integerDeserializer(), "brute_force_used"); + op.add(Builder::dynamicPruningAttempted, JsonpDeserializer.integerDeserializer(), "dynamic_pruning_attempted"); + op.add(Builder::dynamicPruningUsed, JsonpDeserializer.integerDeserializer(), "dynamic_pruning_used"); + op.add(Builder::skippedDueToNoData, JsonpDeserializer.integerDeserializer(), "skipped_due_to_no_data"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsKnnProfile.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsKnnProfile.java new file mode 100644 index 000000000..1beb52686 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsKnnProfile.java @@ -0,0 +1,289 @@ +/* + * 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.core.search; + +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.lang.Long; +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: _global.search._types.DfsKnnProfile + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DfsKnnProfile implements JsonpSerializable { + @Nullable + private final Long vectorOperationsCount; + + private final List query; + + private final long rewriteTime; + + private final List collector; + + // --------------------------------------------------------------------------------------------- + + private DfsKnnProfile(Builder builder) { + + this.vectorOperationsCount = builder.vectorOperationsCount; + this.query = ApiTypeHelper.unmodifiableRequired(builder.query, this, "query"); + this.rewriteTime = ApiTypeHelper.requireNonNull(builder.rewriteTime, this, "rewriteTime"); + this.collector = ApiTypeHelper.unmodifiableRequired(builder.collector, this, "collector"); + + } + + public static DfsKnnProfile of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code vector_operations_count} + */ + @Nullable + public final Long vectorOperationsCount() { + return this.vectorOperationsCount; + } + + /** + * Required - API name: {@code query} + */ + public final List query() { + return this.query; + } + + /** + * Required - API name: {@code rewrite_time} + */ + public final long rewriteTime() { + return this.rewriteTime; + } + + /** + * Required - API name: {@code collector} + */ + public final List collector() { + return this.collector; + } + + /** + * 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.vectorOperationsCount != null) { + generator.writeKey("vector_operations_count"); + generator.write(this.vectorOperationsCount); + + } + if (ApiTypeHelper.isDefined(this.query)) { + generator.writeKey("query"); + generator.writeStartArray(); + for (KnnQueryProfileResult item0 : this.query) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("rewrite_time"); + generator.write(this.rewriteTime); + + if (ApiTypeHelper.isDefined(this.collector)) { + generator.writeKey("collector"); + generator.writeStartArray(); + for (KnnCollectorResult item0 : this.collector) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DfsKnnProfile}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Long vectorOperationsCount; + + private List query; + + private Long rewriteTime; + + private List collector; + + /** + * API name: {@code vector_operations_count} + */ + public final Builder vectorOperationsCount(@Nullable Long value) { + this.vectorOperationsCount = value; + return this; + } + + /** + * Required - API name: {@code query} + *

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

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

+ * Adds a value to query using a builder lambda. + */ + public final Builder query(Function> fn) { + return query(fn.apply(new KnnQueryProfileResult.Builder()).build()); + } + + /** + * Required - API name: {@code rewrite_time} + */ + public final Builder rewriteTime(long value) { + this.rewriteTime = value; + return this; + } + + /** + * Required - API name: {@code collector} + *

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

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

+ * Adds a value to collector using a builder lambda. + */ + public final Builder collector(Function> fn) { + return collector(fn.apply(new KnnCollectorResult.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DfsKnnProfile}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DfsKnnProfile build() { + _checkSingleUse(); + + return new DfsKnnProfile(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DfsKnnProfile} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DfsKnnProfile::setupDfsKnnProfileDeserializer); + + protected static void setupDfsKnnProfileDeserializer(ObjectDeserializer op) { + + op.add(Builder::vectorOperationsCount, JsonpDeserializer.longDeserializer(), "vector_operations_count"); + op.add(Builder::query, JsonpDeserializer.arrayDeserializer(KnnQueryProfileResult._DESERIALIZER), "query"); + op.add(Builder::rewriteTime, JsonpDeserializer.longDeserializer(), "rewrite_time"); + op.add(Builder::collector, JsonpDeserializer.arrayDeserializer(KnnCollectorResult._DESERIALIZER), "collector"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsProfile.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsProfile.java new file mode 100644 index 000000000..466ceba23 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsProfile.java @@ -0,0 +1,221 @@ +/* + * 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.core.search; + +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: _global.search._types.DfsProfile + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DfsProfile implements JsonpSerializable { + @Nullable + private final DfsStatisticsProfile statistics; + + private final List knn; + + // --------------------------------------------------------------------------------------------- + + private DfsProfile(Builder builder) { + + this.statistics = builder.statistics; + this.knn = ApiTypeHelper.unmodifiable(builder.knn); + + } + + public static DfsProfile of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code statistics} + */ + @Nullable + public final DfsStatisticsProfile statistics() { + return this.statistics; + } + + /** + * API name: {@code knn} + */ + public final List knn() { + return this.knn; + } + + /** + * 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.statistics != null) { + generator.writeKey("statistics"); + this.statistics.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.knn)) { + generator.writeKey("knn"); + generator.writeStartArray(); + for (DfsKnnProfile item0 : this.knn) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DfsProfile}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private DfsStatisticsProfile statistics; + + @Nullable + private List knn; + + /** + * API name: {@code statistics} + */ + public final Builder statistics(@Nullable DfsStatisticsProfile value) { + this.statistics = value; + return this; + } + + /** + * API name: {@code statistics} + */ + public final Builder statistics( + Function> fn) { + return this.statistics(fn.apply(new DfsStatisticsProfile.Builder()).build()); + } + + /** + * API name: {@code knn} + *

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

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

+ * Adds a value to knn using a builder lambda. + */ + public final Builder knn(Function> fn) { + return knn(fn.apply(new DfsKnnProfile.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DfsProfile}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DfsProfile build() { + _checkSingleUse(); + + return new DfsProfile(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DfsProfile} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DfsProfile::setupDfsProfileDeserializer); + + protected static void setupDfsProfileDeserializer(ObjectDeserializer op) { + + op.add(Builder::statistics, DfsStatisticsProfile._DESERIALIZER, "statistics"); + op.add(Builder::knn, JsonpDeserializer.arrayDeserializer(DfsKnnProfile._DESERIALIZER), "knn"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsBreakdown.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsBreakdown.java new file mode 100644 index 000000000..601fc89e1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsBreakdown.java @@ -0,0 +1,327 @@ +/* + * 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.core.search; + +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.lang.Long; +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: _global.search._types.DfsStatisticsBreakdown + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DfsStatisticsBreakdown implements JsonpSerializable { + private final long collectionStatistics; + + private final long collectionStatisticsCount; + + private final long createWeight; + + private final long createWeightCount; + + private final long rewrite; + + private final long rewriteCount; + + private final long termStatistics; + + private final long termStatisticsCount; + + // --------------------------------------------------------------------------------------------- + + private DfsStatisticsBreakdown(Builder builder) { + + this.collectionStatistics = ApiTypeHelper.requireNonNull(builder.collectionStatistics, this, + "collectionStatistics"); + this.collectionStatisticsCount = ApiTypeHelper.requireNonNull(builder.collectionStatisticsCount, this, + "collectionStatisticsCount"); + this.createWeight = ApiTypeHelper.requireNonNull(builder.createWeight, this, "createWeight"); + this.createWeightCount = ApiTypeHelper.requireNonNull(builder.createWeightCount, this, "createWeightCount"); + this.rewrite = ApiTypeHelper.requireNonNull(builder.rewrite, this, "rewrite"); + this.rewriteCount = ApiTypeHelper.requireNonNull(builder.rewriteCount, this, "rewriteCount"); + this.termStatistics = ApiTypeHelper.requireNonNull(builder.termStatistics, this, "termStatistics"); + this.termStatisticsCount = ApiTypeHelper.requireNonNull(builder.termStatisticsCount, this, + "termStatisticsCount"); + + } + + public static DfsStatisticsBreakdown of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code collection_statistics} + */ + public final long collectionStatistics() { + return this.collectionStatistics; + } + + /** + * Required - API name: {@code collection_statistics_count} + */ + public final long collectionStatisticsCount() { + return this.collectionStatisticsCount; + } + + /** + * Required - API name: {@code create_weight} + */ + public final long createWeight() { + return this.createWeight; + } + + /** + * Required - API name: {@code create_weight_count} + */ + public final long createWeightCount() { + return this.createWeightCount; + } + + /** + * Required - API name: {@code rewrite} + */ + public final long rewrite() { + return this.rewrite; + } + + /** + * Required - API name: {@code rewrite_count} + */ + public final long rewriteCount() { + return this.rewriteCount; + } + + /** + * Required - API name: {@code term_statistics} + */ + public final long termStatistics() { + return this.termStatistics; + } + + /** + * Required - API name: {@code term_statistics_count} + */ + public final long termStatisticsCount() { + return this.termStatisticsCount; + } + + /** + * 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) { + + generator.writeKey("collection_statistics"); + generator.write(this.collectionStatistics); + + generator.writeKey("collection_statistics_count"); + generator.write(this.collectionStatisticsCount); + + generator.writeKey("create_weight"); + generator.write(this.createWeight); + + generator.writeKey("create_weight_count"); + generator.write(this.createWeightCount); + + generator.writeKey("rewrite"); + generator.write(this.rewrite); + + generator.writeKey("rewrite_count"); + generator.write(this.rewriteCount); + + generator.writeKey("term_statistics"); + generator.write(this.termStatistics); + + generator.writeKey("term_statistics_count"); + generator.write(this.termStatisticsCount); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DfsStatisticsBreakdown}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long collectionStatistics; + + private Long collectionStatisticsCount; + + private Long createWeight; + + private Long createWeightCount; + + private Long rewrite; + + private Long rewriteCount; + + private Long termStatistics; + + private Long termStatisticsCount; + + /** + * Required - API name: {@code collection_statistics} + */ + public final Builder collectionStatistics(long value) { + this.collectionStatistics = value; + return this; + } + + /** + * Required - API name: {@code collection_statistics_count} + */ + public final Builder collectionStatisticsCount(long value) { + this.collectionStatisticsCount = value; + return this; + } + + /** + * Required - API name: {@code create_weight} + */ + public final Builder createWeight(long value) { + this.createWeight = value; + return this; + } + + /** + * Required - API name: {@code create_weight_count} + */ + public final Builder createWeightCount(long value) { + this.createWeightCount = value; + return this; + } + + /** + * Required - API name: {@code rewrite} + */ + public final Builder rewrite(long value) { + this.rewrite = value; + return this; + } + + /** + * Required - API name: {@code rewrite_count} + */ + public final Builder rewriteCount(long value) { + this.rewriteCount = value; + return this; + } + + /** + * Required - API name: {@code term_statistics} + */ + public final Builder termStatistics(long value) { + this.termStatistics = value; + return this; + } + + /** + * Required - API name: {@code term_statistics_count} + */ + public final Builder termStatisticsCount(long value) { + this.termStatisticsCount = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DfsStatisticsBreakdown}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DfsStatisticsBreakdown build() { + _checkSingleUse(); + + return new DfsStatisticsBreakdown(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DfsStatisticsBreakdown} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DfsStatisticsBreakdown::setupDfsStatisticsBreakdownDeserializer); + + protected static void setupDfsStatisticsBreakdownDeserializer( + ObjectDeserializer op) { + + op.add(Builder::collectionStatistics, JsonpDeserializer.longDeserializer(), "collection_statistics"); + op.add(Builder::collectionStatisticsCount, JsonpDeserializer.longDeserializer(), "collection_statistics_count"); + op.add(Builder::createWeight, JsonpDeserializer.longDeserializer(), "create_weight"); + op.add(Builder::createWeightCount, JsonpDeserializer.longDeserializer(), "create_weight_count"); + op.add(Builder::rewrite, JsonpDeserializer.longDeserializer(), "rewrite"); + op.add(Builder::rewriteCount, JsonpDeserializer.longDeserializer(), "rewrite_count"); + op.add(Builder::termStatistics, JsonpDeserializer.longDeserializer(), "term_statistics"); + op.add(Builder::termStatisticsCount, JsonpDeserializer.longDeserializer(), "term_statistics_count"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsProfile.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsProfile.java new file mode 100644 index 000000000..6c06bafc8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/DfsStatisticsProfile.java @@ -0,0 +1,376 @@ +/* + * 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.core.search; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonData; +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.lang.Long; +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: _global.search._types.DfsStatisticsProfile + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DfsStatisticsProfile implements JsonpSerializable { + private final String type; + + private final String description; + + @Nullable + private final Time time; + + private final long timeInNanos; + + private final DfsStatisticsBreakdown breakdown; + + private final Map debug; + + private final List children; + + // --------------------------------------------------------------------------------------------- + + private DfsStatisticsProfile(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.time = builder.time; + this.timeInNanos = ApiTypeHelper.requireNonNull(builder.timeInNanos, this, "timeInNanos"); + this.breakdown = ApiTypeHelper.requireNonNull(builder.breakdown, this, "breakdown"); + this.debug = ApiTypeHelper.unmodifiable(builder.debug); + this.children = ApiTypeHelper.unmodifiable(builder.children); + + } + + public static DfsStatisticsProfile of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Required - API name: {@code description} + */ + public final String description() { + return this.description; + } + + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final long timeInNanos() { + return this.timeInNanos; + } + + /** + * Required - API name: {@code breakdown} + */ + public final DfsStatisticsBreakdown breakdown() { + return this.breakdown; + } + + /** + * API name: {@code debug} + */ + public final Map debug() { + return this.debug; + } + + /** + * API name: {@code children} + */ + public final List children() { + return this.children; + } + + /** + * 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) { + + generator.writeKey("type"); + generator.write(this.type); + + generator.writeKey("description"); + generator.write(this.description); + + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } + generator.writeKey("time_in_nanos"); + generator.write(this.timeInNanos); + + generator.writeKey("breakdown"); + this.breakdown.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.debug)) { + generator.writeKey("debug"); + generator.writeStartObject(); + for (Map.Entry item0 : this.debug.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.children)) { + generator.writeKey("children"); + generator.writeStartArray(); + for (DfsStatisticsProfile item0 : this.children) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DfsStatisticsProfile}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String type; + + private String description; + + @Nullable + private Time time; + + private Long timeInNanos; + + private DfsStatisticsBreakdown breakdown; + + @Nullable + private Map debug; + + @Nullable + private List children; + + /** + * Required - API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Required - API name: {@code description} + */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final Builder timeInNanos(long value) { + this.timeInNanos = value; + return this; + } + + /** + * Required - API name: {@code breakdown} + */ + public final Builder breakdown(DfsStatisticsBreakdown value) { + this.breakdown = value; + return this; + } + + /** + * Required - API name: {@code breakdown} + */ + public final Builder breakdown( + Function> fn) { + return this.breakdown(fn.apply(new DfsStatisticsBreakdown.Builder()).build()); + } + + /** + * API name: {@code debug} + *

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

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

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

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

+ * Adds a value to children using a builder lambda. + */ + public final Builder children(Function> fn) { + return children(fn.apply(new DfsStatisticsProfile.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DfsStatisticsProfile}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DfsStatisticsProfile build() { + _checkSingleUse(); + + return new DfsStatisticsProfile(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DfsStatisticsProfile} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DfsStatisticsProfile::setupDfsStatisticsProfileDeserializer); + + protected static void setupDfsStatisticsProfileDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::time, Time._DESERIALIZER, "time"); + op.add(Builder::timeInNanos, JsonpDeserializer.longDeserializer(), "time_in_nanos"); + op.add(Builder::breakdown, DfsStatisticsBreakdown._DESERIALIZER, "breakdown"); + op.add(Builder::debug, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "debug"); + op.add(Builder::children, JsonpDeserializer.arrayDeserializer(DfsStatisticsProfile._DESERIALIZER), "children"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Hit.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Hit.java index 970fc9800..9ea85b100 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Hit.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Hit.java @@ -95,7 +95,7 @@ public class Hit implements JsonpSerializable { private final List ignored; - private final Map> ignoredFieldValues; + private final Map> ignoredFieldValues; @Nullable private final String shard; @@ -237,7 +237,7 @@ public final List ignored() { /** * API name: {@code ignored_field_values} */ - public final Map> ignoredFieldValues() { + public final Map> ignoredFieldValues() { return this.ignoredFieldValues; } @@ -408,12 +408,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.ignoredFieldValues)) { generator.writeKey("ignored_field_values"); generator.writeStartObject(); - for (Map.Entry> item0 : this.ignoredFieldValues.entrySet()) { + for (Map.Entry> item0 : this.ignoredFieldValues.entrySet()) { generator.writeKey(item0.getKey()); generator.writeStartArray(); if (item0.getValue() != null) { - for (String item1 : item0.getValue()) { - generator.write(item1); + for (FieldValue item1 : item0.getValue()) { + item1.serialize(generator, mapper); } } @@ -520,7 +520,7 @@ public static class Builder extends WithJsonObjectBuilderBase ignored; @Nullable - private Map> ignoredFieldValues; + private Map> ignoredFieldValues; @Nullable private String shard; @@ -723,7 +723,7 @@ public final Builder ignored(String value, String... values) { *

* Adds all entries of map to ignoredFieldValues. */ - public final Builder ignoredFieldValues(Map> map) { + public final Builder ignoredFieldValues(Map> map) { this.ignoredFieldValues = _mapPutAll(this.ignoredFieldValues, map); return this; } @@ -733,7 +733,7 @@ public final Builder ignoredFieldValues(Map> map *

* Adds an entry to ignoredFieldValues. */ - public final Builder ignoredFieldValues(String key, List value) { + public final Builder ignoredFieldValues(String key, List value) { this.ignoredFieldValues = _mapPut(this.ignoredFieldValues, key, value); return this; } @@ -955,8 +955,7 @@ protected static void setupHitDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class KnnCollectorResult implements JsonpSerializable { + private final String name; + + private final String reason; + + @Nullable + private final Time time; + + private final long timeInNanos; + + private final List children; + + // --------------------------------------------------------------------------------------------- + + private KnnCollectorResult(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.time = builder.time; + this.timeInNanos = ApiTypeHelper.requireNonNull(builder.timeInNanos, this, "timeInNanos"); + this.children = ApiTypeHelper.unmodifiable(builder.children); + + } + + public static KnnCollectorResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code reason} + */ + public final String reason() { + return this.reason; + } + + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final long timeInNanos() { + return this.timeInNanos; + } + + /** + * API name: {@code children} + */ + public final List children() { + return this.children; + } + + /** + * 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) { + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("reason"); + generator.write(this.reason); + + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } + generator.writeKey("time_in_nanos"); + generator.write(this.timeInNanos); + + if (ApiTypeHelper.isDefined(this.children)) { + generator.writeKey("children"); + generator.writeStartArray(); + for (KnnCollectorResult item0 : this.children) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link KnnCollectorResult}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String name; + + private String reason; + + @Nullable + private Time time; + + private Long timeInNanos; + + @Nullable + private List children; + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code reason} + */ + public final Builder reason(String value) { + this.reason = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final Builder timeInNanos(long value) { + this.timeInNanos = value; + return this; + } + + /** + * API name: {@code children} + *

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

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

+ * Adds a value to children using a builder lambda. + */ + public final Builder children(Function> fn) { + return children(fn.apply(new KnnCollectorResult.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link KnnCollectorResult}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public KnnCollectorResult build() { + _checkSingleUse(); + + return new KnnCollectorResult(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link KnnCollectorResult} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, KnnCollectorResult::setupKnnCollectorResultDeserializer); + + protected static void setupKnnCollectorResultDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + op.add(Builder::time, Time._DESERIALIZER, "time"); + op.add(Builder::timeInNanos, JsonpDeserializer.longDeserializer(), "time_in_nanos"); + op.add(Builder::children, JsonpDeserializer.arrayDeserializer(KnnCollectorResult._DESERIALIZER), "children"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileBreakdown.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileBreakdown.java new file mode 100644 index 000000000..d48c3c2c3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileBreakdown.java @@ -0,0 +1,617 @@ +/* + * 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.core.search; + +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.lang.Long; +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: _global.search._types.KnnQueryProfileBreakdown + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class KnnQueryProfileBreakdown implements JsonpSerializable { + private final long advance; + + private final long advanceCount; + + private final long buildScorer; + + private final long buildScorerCount; + + private final long computeMaxScore; + + private final long computeMaxScoreCount; + + private final long countWeight; + + private final long countWeightCount; + + private final long createWeight; + + private final long createWeightCount; + + private final long match; + + private final long matchCount; + + private final long nextDoc; + + private final long nextDocCount; + + private final long score; + + private final long scoreCount; + + private final long setMinCompetitiveScore; + + private final long setMinCompetitiveScoreCount; + + private final long shallowAdvance; + + private final long shallowAdvanceCount; + + // --------------------------------------------------------------------------------------------- + + private KnnQueryProfileBreakdown(Builder builder) { + + this.advance = ApiTypeHelper.requireNonNull(builder.advance, this, "advance"); + this.advanceCount = ApiTypeHelper.requireNonNull(builder.advanceCount, this, "advanceCount"); + this.buildScorer = ApiTypeHelper.requireNonNull(builder.buildScorer, this, "buildScorer"); + this.buildScorerCount = ApiTypeHelper.requireNonNull(builder.buildScorerCount, this, "buildScorerCount"); + this.computeMaxScore = ApiTypeHelper.requireNonNull(builder.computeMaxScore, this, "computeMaxScore"); + this.computeMaxScoreCount = ApiTypeHelper.requireNonNull(builder.computeMaxScoreCount, this, + "computeMaxScoreCount"); + this.countWeight = ApiTypeHelper.requireNonNull(builder.countWeight, this, "countWeight"); + this.countWeightCount = ApiTypeHelper.requireNonNull(builder.countWeightCount, this, "countWeightCount"); + this.createWeight = ApiTypeHelper.requireNonNull(builder.createWeight, this, "createWeight"); + this.createWeightCount = ApiTypeHelper.requireNonNull(builder.createWeightCount, this, "createWeightCount"); + this.match = ApiTypeHelper.requireNonNull(builder.match, this, "match"); + this.matchCount = ApiTypeHelper.requireNonNull(builder.matchCount, this, "matchCount"); + this.nextDoc = ApiTypeHelper.requireNonNull(builder.nextDoc, this, "nextDoc"); + this.nextDocCount = ApiTypeHelper.requireNonNull(builder.nextDocCount, this, "nextDocCount"); + this.score = ApiTypeHelper.requireNonNull(builder.score, this, "score"); + this.scoreCount = ApiTypeHelper.requireNonNull(builder.scoreCount, this, "scoreCount"); + this.setMinCompetitiveScore = ApiTypeHelper.requireNonNull(builder.setMinCompetitiveScore, this, + "setMinCompetitiveScore"); + this.setMinCompetitiveScoreCount = ApiTypeHelper.requireNonNull(builder.setMinCompetitiveScoreCount, this, + "setMinCompetitiveScoreCount"); + this.shallowAdvance = ApiTypeHelper.requireNonNull(builder.shallowAdvance, this, "shallowAdvance"); + this.shallowAdvanceCount = ApiTypeHelper.requireNonNull(builder.shallowAdvanceCount, this, + "shallowAdvanceCount"); + + } + + public static KnnQueryProfileBreakdown of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code advance} + */ + public final long advance() { + return this.advance; + } + + /** + * Required - API name: {@code advance_count} + */ + public final long advanceCount() { + return this.advanceCount; + } + + /** + * Required - API name: {@code build_scorer} + */ + public final long buildScorer() { + return this.buildScorer; + } + + /** + * Required - API name: {@code build_scorer_count} + */ + public final long buildScorerCount() { + return this.buildScorerCount; + } + + /** + * Required - API name: {@code compute_max_score} + */ + public final long computeMaxScore() { + return this.computeMaxScore; + } + + /** + * Required - API name: {@code compute_max_score_count} + */ + public final long computeMaxScoreCount() { + return this.computeMaxScoreCount; + } + + /** + * Required - API name: {@code count_weight} + */ + public final long countWeight() { + return this.countWeight; + } + + /** + * Required - API name: {@code count_weight_count} + */ + public final long countWeightCount() { + return this.countWeightCount; + } + + /** + * Required - API name: {@code create_weight} + */ + public final long createWeight() { + return this.createWeight; + } + + /** + * Required - API name: {@code create_weight_count} + */ + public final long createWeightCount() { + return this.createWeightCount; + } + + /** + * Required - API name: {@code match} + */ + public final long match() { + return this.match; + } + + /** + * Required - API name: {@code match_count} + */ + public final long matchCount() { + return this.matchCount; + } + + /** + * Required - API name: {@code next_doc} + */ + public final long nextDoc() { + return this.nextDoc; + } + + /** + * Required - API name: {@code next_doc_count} + */ + public final long nextDocCount() { + return this.nextDocCount; + } + + /** + * Required - API name: {@code score} + */ + public final long score() { + return this.score; + } + + /** + * Required - API name: {@code score_count} + */ + public final long scoreCount() { + return this.scoreCount; + } + + /** + * Required - API name: {@code set_min_competitive_score} + */ + public final long setMinCompetitiveScore() { + return this.setMinCompetitiveScore; + } + + /** + * Required - API name: {@code set_min_competitive_score_count} + */ + public final long setMinCompetitiveScoreCount() { + return this.setMinCompetitiveScoreCount; + } + + /** + * Required - API name: {@code shallow_advance} + */ + public final long shallowAdvance() { + return this.shallowAdvance; + } + + /** + * Required - API name: {@code shallow_advance_count} + */ + public final long shallowAdvanceCount() { + return this.shallowAdvanceCount; + } + + /** + * 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) { + + generator.writeKey("advance"); + generator.write(this.advance); + + generator.writeKey("advance_count"); + generator.write(this.advanceCount); + + generator.writeKey("build_scorer"); + generator.write(this.buildScorer); + + generator.writeKey("build_scorer_count"); + generator.write(this.buildScorerCount); + + generator.writeKey("compute_max_score"); + generator.write(this.computeMaxScore); + + generator.writeKey("compute_max_score_count"); + generator.write(this.computeMaxScoreCount); + + generator.writeKey("count_weight"); + generator.write(this.countWeight); + + generator.writeKey("count_weight_count"); + generator.write(this.countWeightCount); + + generator.writeKey("create_weight"); + generator.write(this.createWeight); + + generator.writeKey("create_weight_count"); + generator.write(this.createWeightCount); + + generator.writeKey("match"); + generator.write(this.match); + + generator.writeKey("match_count"); + generator.write(this.matchCount); + + generator.writeKey("next_doc"); + generator.write(this.nextDoc); + + generator.writeKey("next_doc_count"); + generator.write(this.nextDocCount); + + generator.writeKey("score"); + generator.write(this.score); + + generator.writeKey("score_count"); + generator.write(this.scoreCount); + + generator.writeKey("set_min_competitive_score"); + generator.write(this.setMinCompetitiveScore); + + generator.writeKey("set_min_competitive_score_count"); + generator.write(this.setMinCompetitiveScoreCount); + + generator.writeKey("shallow_advance"); + generator.write(this.shallowAdvance); + + generator.writeKey("shallow_advance_count"); + generator.write(this.shallowAdvanceCount); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link KnnQueryProfileBreakdown}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long advance; + + private Long advanceCount; + + private Long buildScorer; + + private Long buildScorerCount; + + private Long computeMaxScore; + + private Long computeMaxScoreCount; + + private Long countWeight; + + private Long countWeightCount; + + private Long createWeight; + + private Long createWeightCount; + + private Long match; + + private Long matchCount; + + private Long nextDoc; + + private Long nextDocCount; + + private Long score; + + private Long scoreCount; + + private Long setMinCompetitiveScore; + + private Long setMinCompetitiveScoreCount; + + private Long shallowAdvance; + + private Long shallowAdvanceCount; + + /** + * Required - API name: {@code advance} + */ + public final Builder advance(long value) { + this.advance = value; + return this; + } + + /** + * Required - API name: {@code advance_count} + */ + public final Builder advanceCount(long value) { + this.advanceCount = value; + return this; + } + + /** + * Required - API name: {@code build_scorer} + */ + public final Builder buildScorer(long value) { + this.buildScorer = value; + return this; + } + + /** + * Required - API name: {@code build_scorer_count} + */ + public final Builder buildScorerCount(long value) { + this.buildScorerCount = value; + return this; + } + + /** + * Required - API name: {@code compute_max_score} + */ + public final Builder computeMaxScore(long value) { + this.computeMaxScore = value; + return this; + } + + /** + * Required - API name: {@code compute_max_score_count} + */ + public final Builder computeMaxScoreCount(long value) { + this.computeMaxScoreCount = value; + return this; + } + + /** + * Required - API name: {@code count_weight} + */ + public final Builder countWeight(long value) { + this.countWeight = value; + return this; + } + + /** + * Required - API name: {@code count_weight_count} + */ + public final Builder countWeightCount(long value) { + this.countWeightCount = value; + return this; + } + + /** + * Required - API name: {@code create_weight} + */ + public final Builder createWeight(long value) { + this.createWeight = value; + return this; + } + + /** + * Required - API name: {@code create_weight_count} + */ + public final Builder createWeightCount(long value) { + this.createWeightCount = value; + return this; + } + + /** + * Required - API name: {@code match} + */ + public final Builder match(long value) { + this.match = value; + return this; + } + + /** + * Required - API name: {@code match_count} + */ + public final Builder matchCount(long value) { + this.matchCount = value; + return this; + } + + /** + * Required - API name: {@code next_doc} + */ + public final Builder nextDoc(long value) { + this.nextDoc = value; + return this; + } + + /** + * Required - API name: {@code next_doc_count} + */ + public final Builder nextDocCount(long value) { + this.nextDocCount = value; + return this; + } + + /** + * Required - API name: {@code score} + */ + public final Builder score(long value) { + this.score = value; + return this; + } + + /** + * Required - API name: {@code score_count} + */ + public final Builder scoreCount(long value) { + this.scoreCount = value; + return this; + } + + /** + * Required - API name: {@code set_min_competitive_score} + */ + public final Builder setMinCompetitiveScore(long value) { + this.setMinCompetitiveScore = value; + return this; + } + + /** + * Required - API name: {@code set_min_competitive_score_count} + */ + public final Builder setMinCompetitiveScoreCount(long value) { + this.setMinCompetitiveScoreCount = value; + return this; + } + + /** + * Required - API name: {@code shallow_advance} + */ + public final Builder shallowAdvance(long value) { + this.shallowAdvance = value; + return this; + } + + /** + * Required - API name: {@code shallow_advance_count} + */ + public final Builder shallowAdvanceCount(long value) { + this.shallowAdvanceCount = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link KnnQueryProfileBreakdown}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public KnnQueryProfileBreakdown build() { + _checkSingleUse(); + + return new KnnQueryProfileBreakdown(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link KnnQueryProfileBreakdown} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, KnnQueryProfileBreakdown::setupKnnQueryProfileBreakdownDeserializer); + + protected static void setupKnnQueryProfileBreakdownDeserializer( + ObjectDeserializer op) { + + op.add(Builder::advance, JsonpDeserializer.longDeserializer(), "advance"); + op.add(Builder::advanceCount, JsonpDeserializer.longDeserializer(), "advance_count"); + op.add(Builder::buildScorer, JsonpDeserializer.longDeserializer(), "build_scorer"); + op.add(Builder::buildScorerCount, JsonpDeserializer.longDeserializer(), "build_scorer_count"); + op.add(Builder::computeMaxScore, JsonpDeserializer.longDeserializer(), "compute_max_score"); + op.add(Builder::computeMaxScoreCount, JsonpDeserializer.longDeserializer(), "compute_max_score_count"); + op.add(Builder::countWeight, JsonpDeserializer.longDeserializer(), "count_weight"); + op.add(Builder::countWeightCount, JsonpDeserializer.longDeserializer(), "count_weight_count"); + op.add(Builder::createWeight, JsonpDeserializer.longDeserializer(), "create_weight"); + op.add(Builder::createWeightCount, JsonpDeserializer.longDeserializer(), "create_weight_count"); + op.add(Builder::match, JsonpDeserializer.longDeserializer(), "match"); + op.add(Builder::matchCount, JsonpDeserializer.longDeserializer(), "match_count"); + op.add(Builder::nextDoc, JsonpDeserializer.longDeserializer(), "next_doc"); + op.add(Builder::nextDocCount, JsonpDeserializer.longDeserializer(), "next_doc_count"); + op.add(Builder::score, JsonpDeserializer.longDeserializer(), "score"); + op.add(Builder::scoreCount, JsonpDeserializer.longDeserializer(), "score_count"); + op.add(Builder::setMinCompetitiveScore, JsonpDeserializer.longDeserializer(), "set_min_competitive_score"); + op.add(Builder::setMinCompetitiveScoreCount, JsonpDeserializer.longDeserializer(), + "set_min_competitive_score_count"); + op.add(Builder::shallowAdvance, JsonpDeserializer.longDeserializer(), "shallow_advance"); + op.add(Builder::shallowAdvanceCount, JsonpDeserializer.longDeserializer(), "shallow_advance_count"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileResult.java new file mode 100644 index 000000000..f9f0aa669 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/KnnQueryProfileResult.java @@ -0,0 +1,377 @@ +/* + * 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.core.search; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonData; +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.lang.Long; +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: _global.search._types.KnnQueryProfileResult + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class KnnQueryProfileResult implements JsonpSerializable { + private final String type; + + private final String description; + + @Nullable + private final Time time; + + private final long timeInNanos; + + private final KnnQueryProfileBreakdown breakdown; + + private final Map debug; + + private final List children; + + // --------------------------------------------------------------------------------------------- + + private KnnQueryProfileResult(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.time = builder.time; + this.timeInNanos = ApiTypeHelper.requireNonNull(builder.timeInNanos, this, "timeInNanos"); + this.breakdown = ApiTypeHelper.requireNonNull(builder.breakdown, this, "breakdown"); + this.debug = ApiTypeHelper.unmodifiable(builder.debug); + this.children = ApiTypeHelper.unmodifiable(builder.children); + + } + + public static KnnQueryProfileResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Required - API name: {@code description} + */ + public final String description() { + return this.description; + } + + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final long timeInNanos() { + return this.timeInNanos; + } + + /** + * Required - API name: {@code breakdown} + */ + public final KnnQueryProfileBreakdown breakdown() { + return this.breakdown; + } + + /** + * API name: {@code debug} + */ + public final Map debug() { + return this.debug; + } + + /** + * API name: {@code children} + */ + public final List children() { + return this.children; + } + + /** + * 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) { + + generator.writeKey("type"); + generator.write(this.type); + + generator.writeKey("description"); + generator.write(this.description); + + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } + generator.writeKey("time_in_nanos"); + generator.write(this.timeInNanos); + + generator.writeKey("breakdown"); + this.breakdown.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.debug)) { + generator.writeKey("debug"); + generator.writeStartObject(); + for (Map.Entry item0 : this.debug.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.children)) { + generator.writeKey("children"); + generator.writeStartArray(); + for (KnnQueryProfileResult item0 : this.children) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link KnnQueryProfileResult}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String type; + + private String description; + + @Nullable + private Time time; + + private Long timeInNanos; + + private KnnQueryProfileBreakdown breakdown; + + @Nullable + private Map debug; + + @Nullable + private List children; + + /** + * Required - API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Required - API name: {@code description} + */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code time_in_nanos} + */ + public final Builder timeInNanos(long value) { + this.timeInNanos = value; + return this; + } + + /** + * Required - API name: {@code breakdown} + */ + public final Builder breakdown(KnnQueryProfileBreakdown value) { + this.breakdown = value; + return this; + } + + /** + * Required - API name: {@code breakdown} + */ + public final Builder breakdown( + Function> fn) { + return this.breakdown(fn.apply(new KnnQueryProfileBreakdown.Builder()).build()); + } + + /** + * API name: {@code debug} + *

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

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

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

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

+ * Adds a value to children using a builder lambda. + */ + public final Builder children( + Function> fn) { + return children(fn.apply(new KnnQueryProfileResult.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link KnnQueryProfileResult}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public KnnQueryProfileResult build() { + _checkSingleUse(); + + return new KnnQueryProfileResult(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link KnnQueryProfileResult} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, KnnQueryProfileResult::setupKnnQueryProfileResultDeserializer); + + protected static void setupKnnQueryProfileResultDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::time, Time._DESERIALIZER, "time"); + op.add(Builder::timeInNanos, JsonpDeserializer.longDeserializer(), "time_in_nanos"); + op.add(Builder::breakdown, KnnQueryProfileBreakdown._DESERIALIZER, "breakdown"); + op.add(Builder::debug, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "debug"); + op.add(Builder::children, JsonpDeserializer.arrayDeserializer(KnnQueryProfileResult._DESERIALIZER), "children"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/QueryBreakdown.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/QueryBreakdown.java index f7e5fcd3f..e20b12eff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/QueryBreakdown.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/QueryBreakdown.java @@ -91,6 +91,10 @@ public class QueryBreakdown implements JsonpSerializable { private final long computeMaxScoreCount; + private final long countWeight; + + private final long countWeightCount; + private final long setMinCompetitiveScore; private final long setMinCompetitiveScoreCount; @@ -117,6 +121,8 @@ private QueryBreakdown(Builder builder) { this.computeMaxScore = ApiTypeHelper.requireNonNull(builder.computeMaxScore, this, "computeMaxScore"); this.computeMaxScoreCount = ApiTypeHelper.requireNonNull(builder.computeMaxScoreCount, this, "computeMaxScoreCount"); + this.countWeight = ApiTypeHelper.requireNonNull(builder.countWeight, this, "countWeight"); + this.countWeightCount = ApiTypeHelper.requireNonNull(builder.countWeightCount, this, "countWeightCount"); this.setMinCompetitiveScore = ApiTypeHelper.requireNonNull(builder.setMinCompetitiveScore, this, "setMinCompetitiveScore"); this.setMinCompetitiveScoreCount = ApiTypeHelper.requireNonNull(builder.setMinCompetitiveScoreCount, this, @@ -240,6 +246,20 @@ public final long computeMaxScoreCount() { return this.computeMaxScoreCount; } + /** + * Required - API name: {@code count_weight} + */ + public final long countWeight() { + return this.countWeight; + } + + /** + * Required - API name: {@code count_weight_count} + */ + public final long countWeightCount() { + return this.countWeightCount; + } + /** * Required - API name: {@code set_min_competitive_score} */ @@ -313,6 +333,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("compute_max_score_count"); generator.write(this.computeMaxScoreCount); + generator.writeKey("count_weight"); + generator.write(this.countWeight); + + generator.writeKey("count_weight_count"); + generator.write(this.countWeightCount); + generator.writeKey("set_min_competitive_score"); generator.write(this.setMinCompetitiveScore); @@ -365,6 +391,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long computeMaxScoreCount; + private Long countWeight; + + private Long countWeightCount; + private Long setMinCompetitiveScore; private Long setMinCompetitiveScoreCount; @@ -497,6 +527,22 @@ public final Builder computeMaxScoreCount(long value) { return this; } + /** + * Required - API name: {@code count_weight} + */ + public final Builder countWeight(long value) { + this.countWeight = value; + return this; + } + + /** + * Required - API name: {@code count_weight_count} + */ + public final Builder countWeightCount(long value) { + this.countWeightCount = value; + return this; + } + /** * Required - API name: {@code set_min_competitive_score} */ @@ -557,6 +603,8 @@ protected static void setupQueryBreakdownDeserializer(ObjectDeserializer aggregations; - private final String id; + private final String cluster; - private final List searches; + @Nullable + private final DfsProfile dfs; @Nullable private final FetchProfile fetch; + private final String id; + + private final String index; + + private final String nodeId; + + private final List searches; + + private final long shardId; + // --------------------------------------------------------------------------------------------- private ShardProfile(Builder builder) { this.aggregations = ApiTypeHelper.unmodifiableRequired(builder.aggregations, this, "aggregations"); + this.cluster = ApiTypeHelper.requireNonNull(builder.cluster, this, "cluster"); + this.dfs = builder.dfs; + this.fetch = builder.fetch; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); this.searches = ApiTypeHelper.unmodifiableRequired(builder.searches, this, "searches"); - this.fetch = builder.fetch; + this.shardId = ApiTypeHelper.requireNonNull(builder.shardId, this, "shardId"); } @@ -92,6 +109,29 @@ public final List aggregations() { return this.aggregations; } + /** + * Required - API name: {@code cluster} + */ + public final String cluster() { + return this.cluster; + } + + /** + * API name: {@code dfs} + */ + @Nullable + public final DfsProfile dfs() { + return this.dfs; + } + + /** + * API name: {@code fetch} + */ + @Nullable + public final FetchProfile fetch() { + return this.fetch; + } + /** * Required - API name: {@code id} */ @@ -99,6 +139,20 @@ public final String id() { return this.id; } + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * Required - API name: {@code node_id} + */ + public final String nodeId() { + return this.nodeId; + } + /** * Required - API name: {@code searches} */ @@ -107,11 +161,10 @@ public final List searches() { } /** - * API name: {@code fetch} + * Required - API name: {@code shard_id} */ - @Nullable - public final FetchProfile fetch() { - return this.fetch; + public final long shardId() { + return this.shardId; } /** @@ -134,10 +187,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + generator.writeKey("cluster"); + generator.write(this.cluster); + + if (this.dfs != null) { + generator.writeKey("dfs"); + this.dfs.serialize(generator, mapper); + + } + if (this.fetch != null) { + generator.writeKey("fetch"); + this.fetch.serialize(generator, mapper); + } generator.writeKey("id"); generator.write(this.id); + generator.writeKey("index"); + generator.write(this.index); + + generator.writeKey("node_id"); + generator.write(this.nodeId); + if (ApiTypeHelper.isDefined(this.searches)) { generator.writeKey("searches"); generator.writeStartArray(); @@ -148,11 +220,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.fetch != null) { - generator.writeKey("fetch"); - this.fetch.serialize(generator, mapper); - - } + generator.writeKey("shard_id"); + generator.write(this.shardId); } @@ -170,13 +239,24 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private List aggregations; - private String id; + private String cluster; - private List searches; + @Nullable + private DfsProfile dfs; @Nullable private FetchProfile fetch; + private String id; + + private String index; + + private String nodeId; + + private List searches; + + private Long shardId; + /** * Required - API name: {@code aggregations} *

@@ -206,6 +286,44 @@ public final Builder aggregations(Function> fn) { + return this.dfs(fn.apply(new DfsProfile.Builder()).build()); + } + + /** + * API name: {@code fetch} + */ + public final Builder fetch(@Nullable FetchProfile value) { + this.fetch = value; + return this; + } + + /** + * API name: {@code fetch} + */ + public final Builder fetch(Function> fn) { + return this.fetch(fn.apply(new FetchProfile.Builder()).build()); + } + /** * Required - API name: {@code id} */ @@ -214,6 +332,22 @@ public final Builder id(String value) { return this; } + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * Required - API name: {@code node_id} + */ + public final Builder nodeId(String value) { + this.nodeId = value; + return this; + } + /** * Required - API name: {@code searches} *

@@ -244,20 +378,13 @@ public final Builder searches(Function> fn) { - return this.fetch(fn.apply(new FetchProfile.Builder()).build()); - } - @Override protected Builder self() { return this; @@ -288,9 +415,14 @@ protected static void setupShardProfileDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/a37d0218e4755ffe229c1a0efccc48e8f7d2d44b/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java index b1200cfeb..71c5ab695 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestAsyncClient.java @@ -71,7 +71,7 @@ public ElasticsearchIngestAsyncClient withTransportOptions(@Nullable TransportOp * Deletes a geoip database configuration. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-geoip-database-api.html">Documentation * on elastic.co */ @@ -89,7 +89,7 @@ public CompletableFuture deleteGeoipDatabase(Delete * a function that initializes a builder to create the * {@link DeleteGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-geoip-database-api.html">Documentation * on elastic.co */ @@ -151,7 +151,7 @@ public CompletableFuture geoIpStats() { * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -169,7 +169,7 @@ public CompletableFuture getGeoipDatabase(GetGeoipData * a function that initializes a builder to create the * {@link GetGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -182,7 +182,7 @@ public final CompletableFuture getGeoipDatabase( * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -263,7 +263,7 @@ public CompletableFuture processorGrok() { * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-geoip-database-api.html">Documentation * on elastic.co */ @@ -281,7 +281,7 @@ public CompletableFuture putGeoipDatabase(PutGeoipData * a function that initializes a builder to create the * {@link PutGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-geoip-database-api.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java index d17329c7d..442a89ea9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ElasticsearchIngestClient.java @@ -71,7 +71,7 @@ public ElasticsearchIngestClient withTransportOptions(@Nullable TransportOptions * Deletes a geoip database configuration. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-geoip-database-api.html">Documentation * on elastic.co */ @@ -90,7 +90,7 @@ public DeleteGeoipDatabaseResponse deleteGeoipDatabase(DeleteGeoipDatabaseReques * a function that initializes a builder to create the * {@link DeleteGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-geoip-database-api.html">Documentation * on elastic.co */ @@ -155,7 +155,7 @@ public GeoIpStatsResponse geoIpStats() throws IOException, ElasticsearchExceptio * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -174,7 +174,7 @@ public GetGeoipDatabaseResponse getGeoipDatabase(GetGeoipDatabaseRequest request * a function that initializes a builder to create the * {@link GetGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -188,7 +188,7 @@ public final GetGeoipDatabaseResponse getGeoipDatabase( * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-geoip-database-api.html">Documentation * on elastic.co */ @@ -270,7 +270,7 @@ public ProcessorGrokResponse processorGrok() throws IOException, ElasticsearchEx * Returns information about one or more geoip database configurations. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-geoip-database-api.html">Documentation * on elastic.co */ @@ -289,7 +289,7 @@ public PutGeoipDatabaseResponse putGeoipDatabase(PutGeoipDatabaseRequest request * a function that initializes a builder to create the * {@link PutGeoipDatabaseRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-geoip-database-api.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/CalendarEvent.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/CalendarEvent.java index ebea147de..20c86c0ae 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/CalendarEvent.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/CalendarEvent.java @@ -31,6 +31,8 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -72,6 +74,15 @@ public class CalendarEvent implements JsonpSerializable { private final DateTime startTime; + @Nullable + private final Boolean skipResult; + + @Nullable + private final Boolean skipModelUpdate; + + @Nullable + private final Integer forceTimeShift; + // --------------------------------------------------------------------------------------------- private CalendarEvent(Builder builder) { @@ -81,6 +92,9 @@ private CalendarEvent(Builder builder) { this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); this.endTime = ApiTypeHelper.requireNonNull(builder.endTime, this, "endTime"); this.startTime = ApiTypeHelper.requireNonNull(builder.startTime, this, "startTime"); + this.skipResult = builder.skipResult; + this.skipModelUpdate = builder.skipModelUpdate; + this.forceTimeShift = builder.forceTimeShift; } @@ -135,6 +149,37 @@ public final DateTime startTime() { return this.startTime; } + /** + * When true the model will not create results for this calendar period. + *

+ * API name: {@code skip_result} + */ + @Nullable + public final Boolean skipResult() { + return this.skipResult; + } + + /** + * When true the model will not be updated for this calendar period. + *

+ * API name: {@code skip_model_update} + */ + @Nullable + public final Boolean skipModelUpdate() { + return this.skipModelUpdate; + } + + /** + * Shift time by this many seconds. For example adjust time for daylight savings + * changes + *

+ * API name: {@code force_time_shift} + */ + @Nullable + public final Integer forceTimeShift() { + return this.forceTimeShift; + } + /** * Serialize this object to JSON. */ @@ -163,6 +208,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.endTime.serialize(generator, mapper); generator.writeKey("start_time"); this.startTime.serialize(generator, mapper); + if (this.skipResult != null) { + generator.writeKey("skip_result"); + generator.write(this.skipResult); + + } + if (this.skipModelUpdate != null) { + generator.writeKey("skip_model_update"); + generator.write(this.skipModelUpdate); + + } + if (this.forceTimeShift != null) { + generator.writeKey("force_time_shift"); + generator.write(this.forceTimeShift); + + } } @@ -190,6 +250,15 @@ public static class Builder extends WithJsonObjectBuilderBase implement private DateTime startTime; + @Nullable + private Boolean skipResult; + + @Nullable + private Boolean skipModelUpdate; + + @Nullable + private Integer forceTimeShift; + /** * A string that uniquely identifies a calendar. *

@@ -240,6 +309,37 @@ public final Builder startTime(DateTime value) { return this; } + /** + * When true the model will not create results for this calendar period. + *

+ * API name: {@code skip_result} + */ + public final Builder skipResult(@Nullable Boolean value) { + this.skipResult = value; + return this; + } + + /** + * When true the model will not be updated for this calendar period. + *

+ * API name: {@code skip_model_update} + */ + public final Builder skipModelUpdate(@Nullable Boolean value) { + this.skipModelUpdate = value; + return this; + } + + /** + * Shift time by this many seconds. For example adjust time for daylight savings + * changes + *

+ * API name: {@code force_time_shift} + */ + public final Builder forceTimeShift(@Nullable Integer value) { + this.forceTimeShift = value; + return this; + } + @Override protected Builder self() { return this; @@ -273,6 +373,9 @@ protected static void setupCalendarEventDeserializer(ObjectDeserializer * API name: {@code state} */ - public final DeploymentState state() { + public final DeploymentAssignmentState state() { return this.state; } @@ -373,7 +373,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Long startTime; - private DeploymentState state; + private DeploymentAssignmentState state; private Integer threadsPerAllocation; @@ -552,7 +552,7 @@ public final Builder startTime(long value) { *

* API name: {@code state} */ - public final Builder state(DeploymentState value) { + public final Builder state(DeploymentAssignmentState value) { this.state = value; return this; } @@ -620,7 +620,7 @@ protected static void setupTrainedModelDeploymentStatsDeserializer( op.add(Builder::rejectedExecutionCount, JsonpDeserializer.integerDeserializer(), "rejected_execution_count"); op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); op.add(Builder::startTime, JsonpDeserializer.longDeserializer(), "start_time"); - op.add(Builder::state, DeploymentState._DESERIALIZER, "state"); + op.add(Builder::state, DeploymentAssignmentState._DESERIALIZER, "state"); op.add(Builder::threadsPerAllocation, JsonpDeserializer.integerDeserializer(), "threads_per_allocation"); op.add(Builder::timeoutCount, JsonpDeserializer.integerDeserializer(), "timeout_count"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java index 9edd1b6f4..79307e350 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java @@ -56,7 +56,8 @@ // typedef: search_application.delete_behavioral_analytics.Request /** - * Delete a behavioral analytics collection. + * Delete a behavioral analytics collection. The associated data stream is also + * deleted. * * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteSearchApplicationRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteSearchApplicationRequest.java index f3f31dc19..80b04bdb6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteSearchApplicationRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteSearchApplicationRequest.java @@ -56,7 +56,8 @@ // typedef: search_application.delete.Request /** - * Deletes a search application. + * Delete a search application. Remove a search application and its associated + * alias. Indices attached to the search application are not removed. * * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java index 0b7e599ee..26fb3a549 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java @@ -72,7 +72,8 @@ public ElasticsearchSearchApplicationAsyncClient withTransportOptions(@Nullable // ----- Endpoint: search_application.delete /** - * Deletes a search application. + * Delete a search application. Remove a search application and its associated + * alias. Indices attached to the search application are not removed. * * @see Documentation @@ -87,7 +88,8 @@ public CompletableFuture delete(DeleteSearchApp } /** - * Deletes a search application. + * Delete a search application. Remove a search application and its associated + * alias. Indices attached to the search application are not removed. * * @param fn * a function that initializes a builder to create the @@ -105,7 +107,8 @@ public final CompletableFuture delete( // ----- Endpoint: search_application.delete_behavioral_analytics /** - * Delete a behavioral analytics collection. + * Delete a behavioral analytics collection. The associated data stream is also + * deleted. * * @see Documentation @@ -121,7 +124,8 @@ public CompletableFuture deleteBehavioralAnal } /** - * Delete a behavioral analytics collection. + * Delete a behavioral analytics collection. The associated data stream is also + * deleted. * * @param fn * a function that initializes a builder to create the @@ -139,7 +143,7 @@ public final CompletableFuture deleteBehavior // ----- Endpoint: search_application.get /** - * Returns the details about a search application + * Get search application details. * * @see Documentation @@ -154,7 +158,7 @@ public CompletableFuture get(GetSearchApplicationR } /** - * Returns the details about a search application + * Get search application details. * * @param fn * a function that initializes a builder to create the @@ -172,7 +176,7 @@ public final CompletableFuture get( // ----- Endpoint: search_application.get_behavioral_analytics /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @see Documentation @@ -188,7 +192,7 @@ public CompletableFuture getBehavioralAnalytics( } /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @param fn * a function that initializes a builder to create the @@ -204,7 +208,7 @@ public final CompletableFuture getBehavioralAnal } /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @see Documentation @@ -264,7 +268,7 @@ public CompletableFuture list() { // ----- Endpoint: search_application.put /** - * Creates or updates a search application. + * Create or update a search application. * * @see Documentation @@ -279,7 +283,7 @@ public CompletableFuture put(PutRequest request) { } /** - * Creates or updates a search application. + * Create or update a search application. * * @param fn * a function that initializes a builder to create the @@ -296,7 +300,7 @@ public final CompletableFuture put(FunctionDocumentation @@ -312,7 +316,7 @@ public CompletableFuture putBehavioralAnalytics( } /** - * Creates a behavioral analytics collection. + * Create a behavioral analytics collection. * * @param fn * a function that initializes a builder to create the @@ -330,7 +334,10 @@ public final CompletableFuture putBehavioralAnal // ----- Endpoint: search_application.search /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @see Documentation @@ -349,7 +356,10 @@ public CompletableFuture> } /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @param fn * a function that initializes a builder to create the @@ -366,7 +376,10 @@ public final CompletableFutureDocumentation @@ -385,7 +398,10 @@ public CompletableFuture> } /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @param fn * a function that initializes a builder to create the diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java index 43e0cabcc..9f2713b8e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java @@ -73,7 +73,8 @@ public ElasticsearchSearchApplicationClient withTransportOptions(@Nullable Trans // ----- Endpoint: search_application.delete /** - * Deletes a search application. + * Delete a search application. Remove a search application and its associated + * alias. Indices attached to the search application are not removed. * * @see Documentation @@ -89,7 +90,8 @@ public DeleteSearchApplicationResponse delete(DeleteSearchApplicationRequest req } /** - * Deletes a search application. + * Delete a search application. Remove a search application and its associated + * alias. Indices attached to the search application are not removed. * * @param fn * a function that initializes a builder to create the @@ -108,7 +110,8 @@ public final DeleteSearchApplicationResponse delete( // ----- Endpoint: search_application.delete_behavioral_analytics /** - * Delete a behavioral analytics collection. + * Delete a behavioral analytics collection. The associated data stream is also + * deleted. * * @see Documentation @@ -124,7 +127,8 @@ public DeleteBehavioralAnalyticsResponse deleteBehavioralAnalytics(DeleteBehavio } /** - * Delete a behavioral analytics collection. + * Delete a behavioral analytics collection. The associated data stream is also + * deleted. * * @param fn * a function that initializes a builder to create the @@ -143,7 +147,7 @@ public final DeleteBehavioralAnalyticsResponse deleteBehavioralAnalytics( // ----- Endpoint: search_application.get /** - * Returns the details about a search application + * Get search application details. * * @see Documentation @@ -159,7 +163,7 @@ public GetSearchApplicationResponse get(GetSearchApplicationRequest request) } /** - * Returns the details about a search application + * Get search application details. * * @param fn * a function that initializes a builder to create the @@ -178,7 +182,7 @@ public final GetSearchApplicationResponse get( // ----- Endpoint: search_application.get_behavioral_analytics /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @see Documentation @@ -194,7 +198,7 @@ public GetBehavioralAnalyticsResponse getBehavioralAnalytics(GetBehavioralAnalyt } /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @param fn * a function that initializes a builder to create the @@ -211,7 +215,7 @@ public final GetBehavioralAnalyticsResponse getBehavioralAnalytics( } /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @see Documentation @@ -272,7 +276,7 @@ public ListResponse list() throws IOException, ElasticsearchException { // ----- Endpoint: search_application.put /** - * Creates or updates a search application. + * Create or update a search application. * * @see Documentation @@ -287,7 +291,7 @@ public PutResponse put(PutRequest request) throws IOException, ElasticsearchExce } /** - * Creates or updates a search application. + * Create or update a search application. * * @param fn * a function that initializes a builder to create the @@ -305,7 +309,7 @@ public final PutResponse put(FunctionDocumentation @@ -321,7 +325,7 @@ public PutBehavioralAnalyticsResponse putBehavioralAnalytics(PutBehavioralAnalyt } /** - * Creates a behavioral analytics collection. + * Create a behavioral analytics collection. * * @param fn * a function that initializes a builder to create the @@ -340,7 +344,10 @@ public final PutBehavioralAnalyticsResponse putBehavioralAnalytics( // ----- Endpoint: search_application.search /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @see Documentation @@ -359,7 +366,10 @@ public SearchApplicationSearchResponse search(SearchAppli } /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @param fn * a function that initializes a builder to create the @@ -376,7 +386,10 @@ public final SearchApplicationSearchResponse search( } /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @see Documentation @@ -395,7 +408,10 @@ public SearchApplicationSearchResponse search(SearchAppli } /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @param fn * a function that initializes a builder to create the diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java index acc8a56fd..16e6f5d39 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java @@ -58,7 +58,7 @@ // typedef: search_application.get_behavioral_analytics.Request /** - * Returns the existing behavioral analytics collections. + * Get behavioral analytics collections. * * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetSearchApplicationRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetSearchApplicationRequest.java index 77c829130..2c850ec02 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetSearchApplicationRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetSearchApplicationRequest.java @@ -56,7 +56,7 @@ // typedef: search_application.get.Request /** - * Returns the details about a search application + * Get search application details. * * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.java index 110e36e92..b1aef4001 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.java @@ -56,7 +56,7 @@ // typedef: search_application.put_behavioral_analytics.Request /** - * Creates a behavioral analytics collection. + * Create a behavioral analytics collection. * * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutRequest.java index 57a8ee602..cec4f56f1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutRequest.java @@ -59,7 +59,7 @@ // typedef: search_application.put.Request /** - * Creates or updates a search application. + * Create or update a search application. * * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationSearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationSearchRequest.java index aa6834253..94832cb74 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationSearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationSearchRequest.java @@ -59,7 +59,10 @@ // typedef: search_application.search.Request /** - * Perform a search against a search application. + * Run a search application search. Generate and run an Elasticsearch query that + * uses the specified query parameteter and the search template associated with + * the search application or default template. Unspecified template parameters + * are assigned their default values if applicable. * * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQuery.java new file mode 100644 index 000000000..980756b12 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQuery.java @@ -0,0 +1,226 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch._types.query_dsl.Query; +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.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +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: security._types.IndicesPrivilegesQuery + +/** + * While creating or updating a role you can provide either a JSON structure or + * a string to the API. However, the response provided by Elasticsearch will + * only be string with a json-as-text content. + *

+ * Since this is embedded in IndicesPrivileges, the same structure + * is used for clarity in both contexts. + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndicesPrivilegesQuery implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Query, JsonText, Template + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private IndicesPrivilegesQuery(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private IndicesPrivilegesQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static IndicesPrivilegesQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code query}? + */ + public boolean isQuery() { + return _kind == Kind.Query; + } + + /** + * Get the {@code query} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code query} kind. + */ + public Query query() { + return TaggedUnionUtils.get(this, Kind.Query); + } + + /** + * Is this variant instance of kind {@code json_text}? + */ + public boolean isJsonText() { + return _kind == Kind.JsonText; + } + + /** + * Get the {@code json_text} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code json_text} kind. + */ + public String jsonText() { + return TaggedUnionUtils.get(this, Kind.JsonText); + } + + /** + * Is this variant instance of kind {@code template}? + */ + public boolean isTemplate() { + return _kind == Kind.Template; + } + + /** + * Get the {@code template} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code template} kind. + */ + public RoleTemplateQuery template() { + return TaggedUnionUtils.get(this, Kind.Template); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case JsonText : + generator.write(((String) this._value)); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder query(Query v) { + this._kind = Kind.Query; + this._value = v; + return this; + } + + public ObjectBuilder query(Function> fn) { + return this.query(fn.apply(new Query.Builder()).build()); + } + + public ObjectBuilder jsonText(String v) { + this._kind = Kind.JsonText; + this._value = v; + return this; + } + + public ObjectBuilder template(RoleTemplateQuery v) { + this._kind = Kind.Template; + this._value = v; + return this; + } + + public ObjectBuilder template( + Function> fn) { + return this.template(fn.apply(new RoleTemplateQuery.Builder()).build()); + } + + public IndicesPrivilegesQuery build() { + _checkSingleUse(); + return new IndicesPrivilegesQuery(this); + } + + } + + private static JsonpDeserializer buildIndicesPrivilegesQueryDeserializer() { + return new UnionDeserializer.Builder(IndicesPrivilegesQuery::new, false) + .addMember(Kind.Query, Query._DESERIALIZER) + .addMember(Kind.JsonText, JsonpDeserializer.stringDeserializer()) + .addMember(Kind.Template, RoleTemplateQuery._DESERIALIZER).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(IndicesPrivilegesQuery::buildIndicesPrivilegesQueryDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQueryBuilders.java new file mode 100644 index 000000000..429ef167f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivilegesQueryBuilders.java @@ -0,0 +1,68 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link IndicesPrivilegesQuery} variants. + *

+ * Variants json_text are not available here as they don't have a + * dedicated class. Use {@link IndicesPrivilegesQuery}'s builder for these. + * + */ +public class IndicesPrivilegesQueryBuilders { + private IndicesPrivilegesQueryBuilders() { + } + + /** + * Creates a builder for the {@link Query query} {@code IndicesPrivilegesQuery} + * variant. + */ + public static Query.Builder query() { + return new Query.Builder(); + } + + /** + * Creates a builder for the {@link RoleTemplateQuery template} + * {@code IndicesPrivilegesQuery} variant. + */ + public static RoleTemplateQuery.Builder template() { + return new RoleTemplateQuery.Builder(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java index da79fe67c..30d6fa7b9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java @@ -87,6 +87,8 @@ public class PutRoleRequest extends RequestBase implements JsonpSerializable { @Nullable private final Refresh refresh; + private final List remoteIndices; + private final List runAs; private final Map transientMetadata; @@ -103,6 +105,7 @@ private PutRoleRequest(Builder builder) { this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.refresh = builder.refresh; + this.remoteIndices = ApiTypeHelper.unmodifiable(builder.remoteIndices); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); @@ -193,6 +196,15 @@ public final Refresh refresh() { return this.refresh; } + /** + * A list of remote indices permissions entries. + *

+ * API name: {@code remote_indices} + */ + public final List remoteIndices() { + return this.remoteIndices; + } + /** * A list of users that the owners of this role can impersonate. Note: * in Serverless, the run-as feature is disabled. For API compatibility, you can @@ -286,6 +298,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.remoteIndices)) { + generator.writeKey("remote_indices"); + generator.writeStartArray(); + for (RemoteIndicesPrivileges item0 : this.remoteIndices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.runAs)) { generator.writeKey("run_as"); @@ -341,6 +363,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Refresh refresh; + @Nullable + private List remoteIndices; + @Nullable private List runAs; @@ -531,6 +556,42 @@ public final Builder refresh(@Nullable Refresh value) { return this; } + /** + * A list of remote indices permissions entries. + *

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

+ * Adds all elements of list to remoteIndices. + */ + public final Builder remoteIndices(List list) { + this.remoteIndices = _listAddAll(this.remoteIndices, list); + return this; + } + + /** + * A list of remote indices permissions entries. + *

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

+ * Adds one or more values to remoteIndices. + */ + public final Builder remoteIndices(RemoteIndicesPrivileges value, RemoteIndicesPrivileges... values) { + this.remoteIndices = _listAdd(this.remoteIndices, value, values); + return this; + } + + /** + * A list of remote indices permissions entries. + *

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

+ * Adds a value to remoteIndices using a builder lambda. + */ + public final Builder remoteIndices( + Function> fn) { + return remoteIndices(fn.apply(new RemoteIndicesPrivileges.Builder()).build()); + } + /** * A list of users that the owners of this role can impersonate. Note: * in Serverless, the run-as feature is disabled. For API compatibility, you can @@ -631,6 +692,8 @@ protected static void setupPutRoleRequestDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class RemoteIndicesPrivileges implements JsonpSerializable { + private final List clusters; + + @Nullable + private final FieldSecurity fieldSecurity; + + private final List names; + + private final List privileges; + + @Nullable + private final IndicesPrivilegesQuery query; + + @Nullable + private final Boolean allowRestrictedIndices; + + // --------------------------------------------------------------------------------------------- + + private RemoteIndicesPrivileges(Builder builder) { + + this.clusters = ApiTypeHelper.unmodifiableRequired(builder.clusters, this, "clusters"); + this.fieldSecurity = builder.fieldSecurity; + this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); + this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges"); + this.query = builder.query; + this.allowRestrictedIndices = builder.allowRestrictedIndices; + + } + + public static RemoteIndicesPrivileges of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

+ * API name: {@code clusters} + */ + public final List clusters() { + return this.clusters; + } + + /** + * The document fields that the owners of the role have read access to. + *

+ * API name: {@code field_security} + */ + @Nullable + public final FieldSecurity fieldSecurity() { + return this.fieldSecurity; + } + + /** + * Required - A list of indices (or index name patterns) to which the + * permissions in this entry apply. + *

+ * API name: {@code names} + */ + public final List names() { + return this.names; + } + + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

+ * API name: {@code privileges} + */ + public final List privileges() { + return this.privileges; + } + + /** + * A search query that defines the documents the owners of the role have access + * to. A document within the specified indices must match this query for it to + * be accessible by the owners of the role. + *

+ * API name: {@code query} + */ + @Nullable + public final IndicesPrivilegesQuery query() { + return this.query; + } + + /** + * Set to true if using wildcard or regular expressions for + * patterns that cover restricted indices. Implicitly, restricted indices have + * limited privileges that can cause pattern tests to fail. If restricted + * indices are explicitly included in the names list, Elasticsearch + * checks privileges against these indices regardless of the value set for + * allow_restricted_indices. + *

+ * API name: {@code allow_restricted_indices} + */ + @Nullable + public final Boolean allowRestrictedIndices() { + return this.allowRestrictedIndices; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.clusters)) { + generator.writeKey("clusters"); + generator.writeStartArray(); + for (String item0 : this.clusters) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.fieldSecurity != null) { + generator.writeKey("field_security"); + this.fieldSecurity.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.names)) { + generator.writeKey("names"); + generator.writeStartArray(); + for (String item0 : this.names) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.privileges)) { + generator.writeKey("privileges"); + generator.writeStartArray(); + for (String item0 : this.privileges) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.query != null) { + generator.writeKey("query"); + this.query.serialize(generator, mapper); + + } + if (this.allowRestrictedIndices != null) { + generator.writeKey("allow_restricted_indices"); + generator.write(this.allowRestrictedIndices); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RemoteIndicesPrivileges}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List clusters; + + @Nullable + private FieldSecurity fieldSecurity; + + private List names; + + private List privileges; + + @Nullable + private IndicesPrivilegesQuery query; + + @Nullable + private Boolean allowRestrictedIndices; + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

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

+ * Adds all elements of list to clusters. + */ + public final Builder clusters(List list) { + this.clusters = _listAddAll(this.clusters, list); + return this; + } + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

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

+ * Adds one or more values to clusters. + */ + public final Builder clusters(String value, String... values) { + this.clusters = _listAdd(this.clusters, value, values); + return this; + } + + /** + * The document fields that the owners of the role have read access to. + *

+ * API name: {@code field_security} + */ + public final Builder fieldSecurity(@Nullable FieldSecurity value) { + this.fieldSecurity = value; + return this; + } + + /** + * The document fields that the owners of the role have read access to. + *

+ * API name: {@code field_security} + */ + public final Builder fieldSecurity(Function> fn) { + return this.fieldSecurity(fn.apply(new FieldSecurity.Builder()).build()); + } + + /** + * Required - A list of indices (or index name patterns) to which the + * permissions in this entry apply. + *

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

+ * Adds all elements of list to names. + */ + public final Builder names(List list) { + this.names = _listAddAll(this.names, list); + return this; + } + + /** + * Required - A list of indices (or index name patterns) to which the + * permissions in this entry apply. + *

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

+ * Adds one or more values to names. + */ + public final Builder names(String value, String... values) { + this.names = _listAdd(this.names, value, values); + return this; + } + + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds all elements of list to privileges. + */ + public final Builder privileges(List list) { + this.privileges = _listAddAll(this.privileges, list); + return this; + } + + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds one or more values to privileges. + */ + public final Builder privileges(String value, String... values) { + this.privileges = _listAdd(this.privileges, value, values); + return this; + } + + /** + * A search query that defines the documents the owners of the role have access + * to. A document within the specified indices must match this query for it to + * be accessible by the owners of the role. + *

+ * API name: {@code query} + */ + public final Builder query(@Nullable IndicesPrivilegesQuery value) { + this.query = value; + return this; + } + + /** + * A search query that defines the documents the owners of the role have access + * to. A document within the specified indices must match this query for it to + * be accessible by the owners of the role. + *

+ * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new IndicesPrivilegesQuery.Builder()).build()); + } + + /** + * Set to true if using wildcard or regular expressions for + * patterns that cover restricted indices. Implicitly, restricted indices have + * limited privileges that can cause pattern tests to fail. If restricted + * indices are explicitly included in the names list, Elasticsearch + * checks privileges against these indices regardless of the value set for + * allow_restricted_indices. + *

+ * API name: {@code allow_restricted_indices} + */ + public final Builder allowRestrictedIndices(@Nullable Boolean value) { + this.allowRestrictedIndices = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RemoteIndicesPrivileges}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RemoteIndicesPrivileges build() { + _checkSingleUse(); + + return new RemoteIndicesPrivileges(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteIndicesPrivileges} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RemoteIndicesPrivileges::setupRemoteIndicesPrivilegesDeserializer); + + protected static void setupRemoteIndicesPrivilegesDeserializer( + ObjectDeserializer op) { + + op.add(Builder::clusters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "clusters"); + op.add(Builder::fieldSecurity, FieldSecurity._DESERIALIZER, "field_security"); + op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); + op.add(Builder::privileges, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "privileges"); + op.add(Builder::query, IndicesPrivilegesQuery._DESERIALIZER, "query"); + op.add(Builder::allowRestrictedIndices, JsonpDeserializer.booleanDeserializer(), "allow_restricted_indices"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplateQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplateQuery.java new file mode 100644 index 000000000..0331dc71d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplateQuery.java @@ -0,0 +1,189 @@ +/* + * 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.security; + +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.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +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: security._types.RoleTemplateQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RoleTemplateQuery implements JsonpSerializable { + @Nullable + private final RoleTemplateScript template; + + // --------------------------------------------------------------------------------------------- + + private RoleTemplateQuery(Builder builder) { + + this.template = builder.template; + + } + + public static RoleTemplateQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * When you create a role, you can specify a query that defines the document + * level security permissions. You can optionally use Mustache templates in the + * role query to insert the username of the current authenticated user into the + * role. Like other places in Elasticsearch that support templating or + * scripting, you can specify inline, stored, or file-based templates and define + * custom parameters. You access the details for the current authenticated user + * through the _user parameter. + *

+ * API name: {@code template} + */ + @Nullable + public final RoleTemplateScript template() { + return this.template; + } + + /** + * 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.template != null) { + generator.writeKey("template"); + this.template.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RoleTemplateQuery}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private RoleTemplateScript template; + + /** + * When you create a role, you can specify a query that defines the document + * level security permissions. You can optionally use Mustache templates in the + * role query to insert the username of the current authenticated user into the + * role. Like other places in Elasticsearch that support templating or + * scripting, you can specify inline, stored, or file-based templates and define + * custom parameters. You access the details for the current authenticated user + * through the _user parameter. + *

+ * API name: {@code template} + */ + public final Builder template(@Nullable RoleTemplateScript value) { + this.template = value; + return this; + } + + /** + * When you create a role, you can specify a query that defines the document + * level security permissions. You can optionally use Mustache templates in the + * role query to insert the username of the current authenticated user into the + * role. Like other places in Elasticsearch that support templating or + * scripting, you can specify inline, stored, or file-based templates and define + * custom parameters. You access the details for the current authenticated user + * through the _user parameter. + *

+ * API name: {@code template} + */ + public final Builder template(Function> fn) { + return this.template(fn.apply(new RoleTemplateScript.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RoleTemplateQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RoleTemplateQuery build() { + _checkSingleUse(); + + return new RoleTemplateQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RoleTemplateQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RoleTemplateQuery::setupRoleTemplateQueryDeserializer); + + protected static void setupRoleTemplateQueryDeserializer(ObjectDeserializer op) { + + op.add(Builder::template, RoleTemplateScript._DESERIALIZER, "template"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotAsyncClient.java index cd0bc8335..0b5bdfaca 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotAsyncClient.java @@ -348,6 +348,40 @@ public CompletableFuture getRepository() { GetRepositoryRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: snapshot.repository_verify_integrity + + /** + * Verifies the integrity of the contents of a snapshot repository + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture repositoryVerifyIntegrity( + RepositoryVerifyIntegrityRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) RepositoryVerifyIntegrityRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Verifies the integrity of the contents of a snapshot repository + * + * @param fn + * a function that initializes a builder to create the + * {@link RepositoryVerifyIntegrityRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture repositoryVerifyIntegrity( + Function> fn) { + return repositoryVerifyIntegrity(fn.apply(new RepositoryVerifyIntegrityRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.restore /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotClient.java index 6f5266f9e..8e0b2dee8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ElasticsearchSnapshotClient.java @@ -357,6 +357,41 @@ public GetRepositoryResponse getRepository() throws IOException, ElasticsearchEx this.transportOptions); } + // ----- Endpoint: snapshot.repository_verify_integrity + + /** + * Verifies the integrity of the contents of a snapshot repository + * + * @see Documentation + * on elastic.co + */ + + public RepositoryVerifyIntegrityResponse repositoryVerifyIntegrity(RepositoryVerifyIntegrityRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) RepositoryVerifyIntegrityRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Verifies the integrity of the contents of a snapshot repository + * + * @param fn + * a function that initializes a builder to create the + * {@link RepositoryVerifyIntegrityRequest} + * @see Documentation + * on elastic.co + */ + + public final RepositoryVerifyIntegrityResponse repositoryVerifyIntegrity( + Function> fn) + throws IOException, ElasticsearchException { + return repositoryVerifyIntegrity(fn.apply(new RepositoryVerifyIntegrityRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.restore /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityRequest.java new file mode 100644 index 000000000..a71c3ea66 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityRequest.java @@ -0,0 +1,444 @@ +/* + * 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.snapshot; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +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.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +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: snapshot.repository_verify_integrity.Request + +/** + * Verifies the integrity of the contents of a snapshot repository + * + * @see API + * specification + */ + +public class RepositoryVerifyIntegrityRequest extends RequestBase { + @Nullable + private final Integer blobThreadPoolConcurrency; + + @Nullable + private final Integer indexSnapshotVerificationConcurrency; + + @Nullable + private final Integer indexVerificationConcurrency; + + @Nullable + private final String maxBytesPerSec; + + @Nullable + private final Integer maxFailedShardSnapshots; + + @Nullable + private final Integer metaThreadPoolConcurrency; + + private final List name; + + @Nullable + private final Integer snapshotVerificationConcurrency; + + @Nullable + private final Boolean verifyBlobContents; + + // --------------------------------------------------------------------------------------------- + + private RepositoryVerifyIntegrityRequest(Builder builder) { + + this.blobThreadPoolConcurrency = builder.blobThreadPoolConcurrency; + this.indexSnapshotVerificationConcurrency = builder.indexSnapshotVerificationConcurrency; + this.indexVerificationConcurrency = builder.indexVerificationConcurrency; + this.maxBytesPerSec = builder.maxBytesPerSec; + this.maxFailedShardSnapshots = builder.maxFailedShardSnapshots; + this.metaThreadPoolConcurrency = builder.metaThreadPoolConcurrency; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + this.snapshotVerificationConcurrency = builder.snapshotVerificationConcurrency; + this.verifyBlobContents = builder.verifyBlobContents; + + } + + public static RepositoryVerifyIntegrityRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Number of threads to use for reading blob contents + *

+ * API name: {@code blob_thread_pool_concurrency} + */ + @Nullable + public final Integer blobThreadPoolConcurrency() { + return this.blobThreadPoolConcurrency; + } + + /** + * Number of snapshots to verify concurrently within each index + *

+ * API name: {@code index_snapshot_verification_concurrency} + */ + @Nullable + public final Integer indexSnapshotVerificationConcurrency() { + return this.indexSnapshotVerificationConcurrency; + } + + /** + * Number of indices to verify concurrently + *

+ * API name: {@code index_verification_concurrency} + */ + @Nullable + public final Integer indexVerificationConcurrency() { + return this.indexVerificationConcurrency; + } + + /** + * Rate limit for individual blob verification + *

+ * API name: {@code max_bytes_per_sec} + */ + @Nullable + public final String maxBytesPerSec() { + return this.maxBytesPerSec; + } + + /** + * Maximum permitted number of failed shard snapshots + *

+ * API name: {@code max_failed_shard_snapshots} + */ + @Nullable + public final Integer maxFailedShardSnapshots() { + return this.maxFailedShardSnapshots; + } + + /** + * Number of threads to use for reading metadata + *

+ * API name: {@code meta_thread_pool_concurrency} + */ + @Nullable + public final Integer metaThreadPoolConcurrency() { + return this.metaThreadPoolConcurrency; + } + + /** + * Required - A repository name + *

+ * API name: {@code repository} + */ + public final List name() { + return this.name; + } + + /** + * Number of snapshots to verify concurrently + *

+ * API name: {@code snapshot_verification_concurrency} + */ + @Nullable + public final Integer snapshotVerificationConcurrency() { + return this.snapshotVerificationConcurrency; + } + + /** + * Whether to verify the contents of individual blobs + *

+ * API name: {@code verify_blob_contents} + */ + @Nullable + public final Boolean verifyBlobContents() { + return this.verifyBlobContents; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RepositoryVerifyIntegrityRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Integer blobThreadPoolConcurrency; + + @Nullable + private Integer indexSnapshotVerificationConcurrency; + + @Nullable + private Integer indexVerificationConcurrency; + + @Nullable + private String maxBytesPerSec; + + @Nullable + private Integer maxFailedShardSnapshots; + + @Nullable + private Integer metaThreadPoolConcurrency; + + private List name; + + @Nullable + private Integer snapshotVerificationConcurrency; + + @Nullable + private Boolean verifyBlobContents; + + /** + * Number of threads to use for reading blob contents + *

+ * API name: {@code blob_thread_pool_concurrency} + */ + public final Builder blobThreadPoolConcurrency(@Nullable Integer value) { + this.blobThreadPoolConcurrency = value; + return this; + } + + /** + * Number of snapshots to verify concurrently within each index + *

+ * API name: {@code index_snapshot_verification_concurrency} + */ + public final Builder indexSnapshotVerificationConcurrency(@Nullable Integer value) { + this.indexSnapshotVerificationConcurrency = value; + return this; + } + + /** + * Number of indices to verify concurrently + *

+ * API name: {@code index_verification_concurrency} + */ + public final Builder indexVerificationConcurrency(@Nullable Integer value) { + this.indexVerificationConcurrency = value; + return this; + } + + /** + * Rate limit for individual blob verification + *

+ * API name: {@code max_bytes_per_sec} + */ + public final Builder maxBytesPerSec(@Nullable String value) { + this.maxBytesPerSec = value; + return this; + } + + /** + * Maximum permitted number of failed shard snapshots + *

+ * API name: {@code max_failed_shard_snapshots} + */ + public final Builder maxFailedShardSnapshots(@Nullable Integer value) { + this.maxFailedShardSnapshots = value; + return this; + } + + /** + * Number of threads to use for reading metadata + *

+ * API name: {@code meta_thread_pool_concurrency} + */ + public final Builder metaThreadPoolConcurrency(@Nullable Integer value) { + this.metaThreadPoolConcurrency = value; + return this; + } + + /** + * Required - A repository name + *

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

+ * Adds all elements of list to name. + */ + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Required - A repository name + *

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

+ * Adds one or more values to name. + */ + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); + return this; + } + + /** + * Number of snapshots to verify concurrently + *

+ * API name: {@code snapshot_verification_concurrency} + */ + public final Builder snapshotVerificationConcurrency(@Nullable Integer value) { + this.snapshotVerificationConcurrency = value; + return this; + } + + /** + * Whether to verify the contents of individual blobs + *

+ * API name: {@code verify_blob_contents} + */ + public final Builder verifyBlobContents(@Nullable Boolean value) { + this.verifyBlobContents = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RepositoryVerifyIntegrityRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RepositoryVerifyIntegrityRequest build() { + _checkSingleUse(); + + return new RepositoryVerifyIntegrityRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code snapshot.repository_verify_integrity}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/snapshot.repository_verify_integrity", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_verify_integrity"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.maxFailedShardSnapshots != null) { + params.put("max_failed_shard_snapshots", String.valueOf(request.maxFailedShardSnapshots)); + } + if (request.snapshotVerificationConcurrency != null) { + params.put("snapshot_verification_concurrency", + String.valueOf(request.snapshotVerificationConcurrency)); + } + if (request.metaThreadPoolConcurrency != null) { + params.put("meta_thread_pool_concurrency", String.valueOf(request.metaThreadPoolConcurrency)); + } + if (request.blobThreadPoolConcurrency != null) { + params.put("blob_thread_pool_concurrency", String.valueOf(request.blobThreadPoolConcurrency)); + } + if (request.indexVerificationConcurrency != null) { + params.put("index_verification_concurrency", String.valueOf(request.indexVerificationConcurrency)); + } + if (request.indexSnapshotVerificationConcurrency != null) { + params.put("index_snapshot_verification_concurrency", + String.valueOf(request.indexSnapshotVerificationConcurrency)); + } + if (request.verifyBlobContents != null) { + params.put("verify_blob_contents", String.valueOf(request.verifyBlobContents)); + } + if (request.maxBytesPerSec != null) { + params.put("max_bytes_per_sec", request.maxBytesPerSec); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, RepositoryVerifyIntegrityResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityResponse.java new file mode 100644 index 000000000..a4675354d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVerifyIntegrityResponse.java @@ -0,0 +1,153 @@ +/* + * 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.snapshot; + +import co.elastic.clients.json.JsonData; +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 jakarta.json.stream.JsonParser; +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: snapshot.repository_verify_integrity.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RepositoryVerifyIntegrityResponse implements JsonpSerializable { + private final JsonData valueBody; + + // --------------------------------------------------------------------------------------------- + + private RepositoryVerifyIntegrityResponse(Builder builder) { + + this.valueBody = ApiTypeHelper.requireNonNull(builder.valueBody, this, "valueBody"); + + } + + public static RepositoryVerifyIntegrityResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Response value. + */ + public final JsonData valueBody() { + return this.valueBody; + } + + /** + * Serialize this value to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + this.valueBody.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RepositoryVerifyIntegrityResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private JsonData valueBody; + + /** + * Required - Response value. + */ + public final Builder valueBody(JsonData value) { + this.valueBody = value; + return this; + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + JsonData value = (JsonData) JsonData._DESERIALIZER.deserialize(parser, mapper); + return this.valueBody(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RepositoryVerifyIntegrityResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RepositoryVerifyIntegrityResponse build() { + _checkSingleUse(); + + return new RepositoryVerifyIntegrityResponse(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createRepositoryVerifyIntegrityResponseDeserializer(); + protected static JsonpDeserializer createRepositoryVerifyIntegrityResponseDeserializer() { + + JsonpDeserializer valueDeserializer = JsonData._DESERIALIZER; + + return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() + .valueBody(valueDeserializer.deserialize(parser, mapper, event)).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SnapshotShardFailure.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SnapshotShardFailure.java index 6b17558f6..31817895f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SnapshotShardFailure.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SnapshotShardFailure.java @@ -69,6 +69,8 @@ public class SnapshotShardFailure implements JsonpSerializable { private final String shardId; + private final String indexUuid; + private final String status; // --------------------------------------------------------------------------------------------- @@ -79,6 +81,7 @@ private SnapshotShardFailure(Builder builder) { this.nodeId = builder.nodeId; this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); this.shardId = ApiTypeHelper.requireNonNull(builder.shardId, this, "shardId"); + this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); } @@ -116,6 +119,13 @@ public final String shardId() { return this.shardId; } + /** + * Required - API name: {@code index_uuid} + */ + public final String indexUuid() { + return this.indexUuid; + } + /** * Required - API name: {@code status} */ @@ -148,6 +158,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("shard_id"); generator.write(this.shardId); + generator.writeKey("index_uuid"); + generator.write(this.indexUuid); + generator.writeKey("status"); generator.write(this.status); @@ -176,6 +189,8 @@ public static class Builder extends WithJsonObjectBuilderBase private String shardId; + private String indexUuid; + private String status; /** @@ -210,6 +225,14 @@ public final Builder shardId(String value) { return this; } + /** + * Required - API name: {@code index_uuid} + */ + public final Builder indexUuid(String value) { + this.indexUuid = value; + return this; + } + /** * Required - API name: {@code status} */ @@ -250,6 +273,7 @@ protected static void setupSnapshotShardFailureDeserializer(ObjectDeserializer impleme private Query filter; @Nullable - private String format; + private SqlFormat format; @Nullable private Boolean indexUsingFrozen; @@ -571,7 +572,7 @@ public final Builder filter(Function> fn) { *

* API name: {@code format} */ - public final Builder format(@Nullable String value) { + public final Builder format(@Nullable SqlFormat value) { this.format = value; return this; } @@ -838,7 +839,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); if (request.format != null) { - params.put("format", request.format); + params.put("format", request.format.jsonValue()); } return params; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DeploymentState.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/SqlFormat.java similarity index 70% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DeploymentState.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/SqlFormat.java index 06e6d5aa6..9b7c277d5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DeploymentState.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/query/SqlFormat.java @@ -17,7 +17,7 @@ * under the License. */ -package co.elastic.clients.elasticsearch.ml; +package co.elastic.clients.elasticsearch.sql.query; import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; @@ -40,33 +40,30 @@ /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public enum DeploymentState implements JsonEnum { - /** - * The deployment is usable; at least one node has the model allocated. - */ - Started("started"), +public enum SqlFormat implements JsonEnum { + Csv("csv"), - /** - * The deployment has recently started but is not yet usable; the model is not - * allocated on any nodes. - */ - Starting("starting"), + Json("json"), - /** - * The deployment is preparing to stop and deallocate the model from the - * relevant nodes. - */ - Stopping("stopping"), + Tsv("tsv"), + + Txt("txt"), + + Yaml("yaml"), + + Cbor("cbor"), + + Smile("smile"), ; private final String jsonValue; - DeploymentState(String jsonValue) { + SqlFormat(String jsonValue) { this.jsonValue = jsonValue; } @@ -74,6 +71,6 @@ public String jsonValue() { return this.jsonValue; } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DeploymentState.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + SqlFormat.values()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackInfoRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackInfoRequest.java index 5f83e92e1..09787d0d0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackInfoRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackInfoRequest.java @@ -21,6 +21,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch.xpack.info.XPackCategory; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -31,7 +32,6 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; -import java.lang.String; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -69,7 +69,7 @@ public class XpackInfoRequest extends RequestBase { @Nullable private final Boolean acceptEnterprise; - private final List categories; + private final List categories; @Nullable private final Boolean human; @@ -104,7 +104,7 @@ public final Boolean acceptEnterprise() { *

* API name: {@code categories} */ - public final List categories() { + public final List categories() { return this.categories; } @@ -132,7 +132,7 @@ public static class Builder extends RequestBase.AbstractBuilder private Boolean acceptEnterprise; @Nullable - private List categories; + private List categories; @Nullable private Boolean human; @@ -155,7 +155,7 @@ public final Builder acceptEnterprise(@Nullable Boolean value) { *

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

* Adds one or more values to categories. */ - public final Builder categories(String value, String... values) { + public final Builder categories(XPackCategory value, XPackCategory... values) { this.categories = _listAdd(this.categories, value, values); return this; } @@ -231,7 +231,8 @@ public XpackInfoRequest build() { request -> { Map params = new HashMap<>(); if (ApiTypeHelper.isDefined(request.categories)) { - params.put("categories", request.categories.stream().map(v -> v).collect(Collectors.joining(","))); + params.put("categories", + request.categories.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.human != null) { params.put("human", String.valueOf(request.human)); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/XPackCategory.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/XPackCategory.java new file mode 100644 index 000000000..8abc799d4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/XPackCategory.java @@ -0,0 +1,68 @@ +/* + * 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.xpack.info; + +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. +//---------------------------------------------------------------- +// +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum XPackCategory implements JsonEnum { + Build("build"), + + Features("features"), + + License("license"), + + ; + + private final String jsonValue; + + XPackCategory(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + XPackCategory.values()); +}