From d78feca1695513c74e3fbfcc6c4be187bee2e38c Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Fri, 9 Feb 2024 18:41:27 +0100 Subject: [PATCH] [codegen] Update to latest API spec --- .../ElasticsearchAsyncClient.java | 15 + .../elasticsearch/ElasticsearchClient.java | 15 + .../elasticsearch/_types/ClusterDetails.java | 322 ++++++++ .../_types/ClusterSearchStatus.java | 72 ++ .../_types/ClusterStatistics.java | 130 ++++ .../elasticsearch/_types/KnnQuery.java | 33 + .../aggregations/FrequentItemSetsField.java | 71 +- .../_types/aggregations/MultiTermsBucket.java | 61 ++ .../SignificantTextAggregation.java | 35 +- .../_types/aggregations/TopMetrics.java | 61 ++ .../analysis/PathHierarchyTokenizer.java | 99 ++- .../_types/mapping/FieldType.java | 2 + .../_types/mapping/Property.java | 31 + .../_types/mapping/PropertyBuilders.java | 19 + .../_types/mapping/SparseVectorProperty.java | 124 +++ .../_types/query_dsl/GeoDistanceQuery.java | 38 + .../elasticsearch/_types/query_dsl/Query.java | 32 + .../_types/query_dsl/QueryBuilders.java | 18 + .../query_dsl/SimpleQueryStringFlags.java | 192 ----- .../SimpleQueryStringFlagsBuilders.java | 41 - .../_types/query_dsl/TextExpansionQuery.java | 43 ++ .../_types/query_dsl/TokenPruningConfig.java | 240 ++++++ .../_types/query_dsl/WeightedTokensQuery.java | 247 ++++++ .../async_search/AsyncSearchResponseBase.java | 65 ++ .../async_search/SubmitRequest.java | 61 ++ .../status/StatusResponseBase.java | 46 ++ .../elasticsearch/core/BulkRequest.java | 109 +-- .../core/ClearScrollRequest.java | 8 +- .../core/ClosePointInTimeRequest.java | 10 +- .../elasticsearch/core/CountRequest.java | 142 ++-- .../elasticsearch/core/CreateRequest.java | 100 +-- .../core/DeleteByQueryRequest.java | 260 ++++--- .../core/DeleteByQueryRethrottleRequest.java | 10 +- .../elasticsearch/core/DeleteRequest.java | 84 +-- .../core/DeleteScriptRequest.java | 24 +- .../elasticsearch/core/ExistsRequest.java | 80 +- .../core/ExistsSourceRequest.java | 68 +- .../elasticsearch/core/ExplainRequest.java | 95 +-- .../elasticsearch/core/GetRequest.java | 16 +- .../elasticsearch/core/GetScriptRequest.java | 6 +- .../elasticsearch/core/IndexRequest.java | 125 ++-- .../core/MsearchTemplateRequest.java | 32 +- .../core/MtermvectorsRequest.java | 111 ++- .../core/OpenPointInTimeRequest.java | 50 +- .../elasticsearch/core/PutScriptRequest.java | 47 +- .../core/ReindexRethrottleRequest.java | 12 +- .../core/RenderSearchTemplateRequest.java | 27 +- .../core/ScriptsPainlessExecuteRequest.java | 18 +- .../elasticsearch/core/SearchRequest.java | 73 ++ .../core/SearchShardsRequest.java | 82 +- .../core/SearchTemplateRequest.java | 95 ++- .../core/TermvectorsRequest.java | 93 ++- .../core/UpdateByQueryRequest.java | 286 ++++--- .../core/UpdateByQueryRethrottleRequest.java | 10 +- .../core/bulk/BulkOperationBase.java | 12 + .../core/bulk/BulkResponseItem.java | 63 +- .../core/bulk/UpdateOperation.java | 4 + .../core/bulk/WriteOperation.java | 34 + .../core/msearch/MultisearchBody.java | 61 ++ .../core/msearch_template/TemplateConfig.java | 19 + .../MultiTermVectorsOperation.java | 73 +- .../reindex_rethrottle/ReindexStatus.java | 116 ++- .../PainlessContextSetup.java | 34 +- .../elasticsearch/core/search/Hit.java | 61 ++ .../core/termvectors/Filter.java | 32 + .../elasticsearch/doc-files/api-spec.html | 703 +++++++++--------- .../elasticsearch/enrich/EnrichPolicy.java | 20 +- .../eql/ElasticsearchEqlAsyncClient.java | 42 +- .../eql/ElasticsearchEqlClient.java | 42 +- .../esql/ElasticsearchEsqlAsyncClient.java | 101 +++ .../esql/ElasticsearchEsqlClient.java | 102 +++ .../elasticsearch/esql/QueryRequest.java | 441 +++++++++++ .../fleet/FleetSearchRequest.java | 61 ++ .../elasticsearch/indices/DataLifecycle.java | 156 ---- .../indices/DataLifecycleWithRollover.java | 233 ------ .../elasticsearch/indices/DataStream.java | 60 ++ .../indices/DataStreamIndex.java | 93 +++ .../indices/DlmRolloverConditions.java | 420 ----------- .../ElasticsearchIndicesAsyncClient.java | 46 +- .../indices/ElasticsearchIndicesClient.java | 46 +- .../elasticsearch/indices/IndexSettings.java | 29 - .../elasticsearch/indices/ManagedBy.java | 68 ++ .../MappingLimitSettingsDimensionFields.java | 12 +- .../DataLifecycleExplain.java | 406 ---------- .../DataStreamLifecycle.java | 183 ----- .../inference/DeleteModelRequest.java | 212 ++++++ .../inference/DeleteModelResponse.java | 107 +++ .../ElasticsearchInferenceAsyncClient.java | 202 +++++ .../ElasticsearchInferenceClient.java | 201 +++++ .../inference/GetModelRequest.java | 210 ++++++ .../inference/GetModelResponse.java | 182 +++++ .../inference/InferenceRequest.java | 325 ++++++++ .../inference/InferenceResponse.java | 155 ++++ .../inference/InferenceResult.java | 278 +++++++ .../inference/InferenceResultBuilders.java | 52 ++ .../inference/InferenceResultVariant.java | 48 ++ .../elasticsearch/inference/ModelConfig.java | 223 ++++++ .../inference/ModelConfigContainer.java | 182 +++++ .../inference/PutModelRequest.java | 265 +++++++ .../inference/PutModelResponse.java | 106 +++ .../inference/SparseEmbeddingResult.java | 180 +++++ .../elasticsearch/inference/TaskType.java | 65 ++ .../inference/TextEmbeddingByteResult.java | 180 +++++ .../TextEmbeddingResult.java} | 92 ++- .../elasticsearch/ingest/Pipeline.java | 55 ++ .../elasticsearch/ingest/Processor.java | 42 +- .../ingest/ProcessorBuilders.java | 33 +- .../ingest/RerouteProcessor.java | 326 ++++++++ .../elasticsearch/ingest/ScriptProcessor.java | 281 +++++++ .../ElasticsearchLogstashAsyncClient.java | 13 + .../logstash/ElasticsearchLogstashClient.java | 13 + .../logstash/GetPipelineRequest.java | 15 +- .../ml/PutTrainedModelRequest.java | 49 ++ .../ml/PutTrainedModelVocabularyRequest.java | 51 ++ .../StartTrainedModelDeploymentRequest.java | 30 + .../elasticsearch/ml/TrainedModelConfig.java | 37 + .../ml/TrainedModelPrefixStrings.java | 189 +++++ .../query_ruleset/PutRequest.java | 99 ++- .../query_ruleset/QueryRuleset.java | 40 +- .../AnalyticsCollection.java | 6 +- ...ticsearchSearchApplicationAsyncClient.java | 4 +- .../ElasticsearchSearchApplicationClient.java | 4 +- .../search_application/ListRequest.java | 12 +- .../PutBehavioralAnalyticsRequest.java | 6 +- .../search_application/PutRequest.java | 12 +- .../search_application/SearchApplication.java | 24 +- .../SearchApplicationSearchRequest.java | 15 +- .../SearchApplicationTemplate.java | 12 +- .../elasticsearch/security/ApiKey.java | 61 ++ .../elasticsearch/security/FieldRule.java | 98 +-- .../security/FieldRuleBuilders.java | 22 +- .../security/GetApiKeyRequest.java | 40 + .../security/PutRoleMappingRequest.java | 54 ++ .../security/QueryApiKeysRequest.java | 69 ++ .../elasticsearch/security/RoleMapping.java | 1 - .../security/{get_role => }/RoleTemplate.java | 7 +- .../{get_role => }/TemplateFormat.java | 5 +- .../security/UpdateApiKeyRequest.java | 43 ++ .../elasticsearch/security/get_role/Role.java | 1 + .../elasticsearch/sql/ClearCursorRequest.java | 8 +- .../elasticsearch/sql/DeleteAsyncRequest.java | 4 +- .../elasticsearch/sql/GetAsyncRequest.java | 4 +- .../sql/GetAsyncStatusRequest.java | 4 +- .../elasticsearch/sql/QueryRequest.java | 28 +- .../elasticsearch/sql/TranslateRequest.java | 22 +- .../synonyms/PutSynonymRuleRequest.java | 40 +- .../elasticsearch/tasks/CancelRequest.java | 34 +- .../elasticsearch/tasks/GetTasksRequest.java | 17 +- .../elasticsearch/tasks/TaskStatus.java | 600 --------------- ...ElasticsearchTextStructureAsyncClient.java | 103 +++ .../ElasticsearchTextStructureClient.java | 106 +++ .../TestGrokPatternRequest.java | 276 +++++++ .../TestGrokPatternResponse.java | 187 +++++ .../test_grok_pattern/MatchedField.java | 203 +++++ .../test_grok_pattern/MatchedText.java | 211 ++++++ .../transform/DeleteTransformRequest.java | 32 + .../watcher/QueryWatchesRequest.java | 69 ++ .../elasticsearch/model/UnionTests.java | 15 - 158 files changed, 10951 insertions(+), 4005 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SparseVectorProperty.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlagsBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TokenPruningConfig.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WeightedTokensQuery.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DlmRolloverConditions.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ManagedBy.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResult.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultVariant.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/SparseEmbeddingResult.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TaskType.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingByteResult.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/{security/Realm.java => inference/TextEmbeddingResult.java} (59%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RerouteProcessor.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ScriptProcessor.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelPrefixStrings.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/security/{get_role => }/RoleTemplate.java (96%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/security/{get_role => }/TemplateFormat.java (92%) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskStatus.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedField.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedText.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java index 88b3e5ef5..5d036bb98 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java @@ -113,11 +113,13 @@ import co.elastic.clients.elasticsearch.dangling_indices.ElasticsearchDanglingIndicesAsyncClient; import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichAsyncClient; import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlAsyncClient; +import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlAsyncClient; import co.elastic.clients.elasticsearch.features.ElasticsearchFeaturesAsyncClient; import co.elastic.clients.elasticsearch.fleet.ElasticsearchFleetAsyncClient; import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphAsyncClient; import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmAsyncClient; import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesAsyncClient; +import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceAsyncClient; import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestAsyncClient; import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseAsyncClient; import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashAsyncClient; @@ -137,6 +139,7 @@ import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslAsyncClient; import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsAsyncClient; import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksAsyncClient; +import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureAsyncClient; import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformAsyncClient; import co.elastic.clients.elasticsearch.watcher.ElasticsearchWatcherAsyncClient; import co.elastic.clients.elasticsearch.xpack.ElasticsearchXpackAsyncClient; @@ -221,6 +224,10 @@ public ElasticsearchEqlAsyncClient eql() { return new ElasticsearchEqlAsyncClient(this.transport, this.transportOptions); } + public ElasticsearchEsqlAsyncClient esql() { + return new ElasticsearchEsqlAsyncClient(this.transport, this.transportOptions); + } + public ElasticsearchFeaturesAsyncClient features() { return new ElasticsearchFeaturesAsyncClient(this.transport, this.transportOptions); } @@ -241,6 +248,10 @@ public ElasticsearchIndicesAsyncClient indices() { return new ElasticsearchIndicesAsyncClient(this.transport, this.transportOptions); } + public ElasticsearchInferenceAsyncClient inference() { + return new ElasticsearchInferenceAsyncClient(this.transport, this.transportOptions); + } + public ElasticsearchIngestAsyncClient ingest() { return new ElasticsearchIngestAsyncClient(this.transport, this.transportOptions); } @@ -317,6 +328,10 @@ public ElasticsearchTasksAsyncClient tasks() { return new ElasticsearchTasksAsyncClient(this.transport, this.transportOptions); } + public ElasticsearchTextStructureAsyncClient textStructure() { + return new ElasticsearchTextStructureAsyncClient(this.transport, this.transportOptions); + } + public ElasticsearchTransformAsyncClient transform() { return new ElasticsearchTransformAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java index 72f80fa2a..10e55792c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java @@ -114,11 +114,13 @@ import co.elastic.clients.elasticsearch.dangling_indices.ElasticsearchDanglingIndicesClient; import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichClient; import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlClient; +import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlClient; import co.elastic.clients.elasticsearch.features.ElasticsearchFeaturesClient; import co.elastic.clients.elasticsearch.fleet.ElasticsearchFleetClient; import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphClient; import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmClient; import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient; +import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceClient; import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestClient; import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseClient; import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashClient; @@ -138,6 +140,7 @@ import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslClient; import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsClient; import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient; +import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureClient; import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformClient; import co.elastic.clients.elasticsearch.watcher.ElasticsearchWatcherClient; import co.elastic.clients.elasticsearch.xpack.ElasticsearchXpackClient; @@ -222,6 +225,10 @@ public ElasticsearchEqlClient eql() { return new ElasticsearchEqlClient(this.transport, this.transportOptions); } + public ElasticsearchEsqlClient esql() { + return new ElasticsearchEsqlClient(this.transport, this.transportOptions); + } + public ElasticsearchFeaturesClient features() { return new ElasticsearchFeaturesClient(this.transport, this.transportOptions); } @@ -242,6 +249,10 @@ public ElasticsearchIndicesClient indices() { return new ElasticsearchIndicesClient(this.transport, this.transportOptions); } + public ElasticsearchInferenceClient inference() { + return new ElasticsearchInferenceClient(this.transport, this.transportOptions); + } + public ElasticsearchIngestClient ingest() { return new ElasticsearchIngestClient(this.transport, this.transportOptions); } @@ -318,6 +329,10 @@ public ElasticsearchTasksClient tasks() { return new ElasticsearchTasksClient(this.transport, this.transportOptions); } + public ElasticsearchTextStructureClient textStructure() { + return new ElasticsearchTextStructureClient(this.transport, this.transportOptions); + } + public ElasticsearchTransformClient transform() { return new ElasticsearchTransformClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java new file mode 100644 index 000000000..d7991c598 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java @@ -0,0 +1,322 @@ +/* + * 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; + +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.Boolean; +import java.lang.Long; +import java.lang.String; +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: _types.ClusterDetails + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ClusterDetails implements JsonpSerializable { + private final ClusterSearchStatus status; + + private final String indices; + + @Nullable + private final Long took; + + private final boolean timedOut; + + @Nullable + private final ShardStatistics shards; + + private final List failures; + + // --------------------------------------------------------------------------------------------- + + private ClusterDetails(Builder builder) { + + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); + this.took = builder.took; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.shards = builder.shards; + this.failures = ApiTypeHelper.unmodifiable(builder.failures); + + } + + public static ClusterDetails of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + public final ClusterSearchStatus status() { + return this.status; + } + + /** + * Required - API name: {@code indices} + */ + public final String indices() { + return this.indices; + } + + /** + * API name: {@code took} + */ + @Nullable + public final Long took() { + return this.took; + } + + /** + * Required - API name: {@code timed_out} + */ + public final boolean timedOut() { + return this.timedOut; + } + + /** + * API name: {@code _shards} + */ + @Nullable + public final ShardStatistics shards() { + return this.shards; + } + + /** + * API name: {@code failures} + */ + public final List failures() { + return this.failures; + } + + /** + * 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("status"); + this.status.serialize(generator, mapper); + generator.writeKey("indices"); + generator.write(this.indices); + + if (this.took != null) { + generator.writeKey("took"); + generator.write(this.took); + + } + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + if (this.shards != null) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.failures)) { + generator.writeKey("failures"); + generator.writeStartArray(); + for (ShardFailure item0 : this.failures) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClusterDetails}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private ClusterSearchStatus status; + + private String indices; + + @Nullable + private Long took; + + private Boolean timedOut; + + @Nullable + private ShardStatistics shards; + + @Nullable + private List failures; + + /** + * Required - API name: {@code status} + */ + public final Builder status(ClusterSearchStatus value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code indices} + */ + public final Builder indices(String value) { + this.indices = value; + return this; + } + + /** + * API name: {@code took} + */ + public final Builder took(@Nullable Long value) { + this.took = value; + return this; + } + + /** + * Required - API name: {@code timed_out} + */ + public final Builder timedOut(boolean value) { + this.timedOut = value; + return this; + } + + /** + * API name: {@code _shards} + */ + public final Builder shards(@Nullable ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * API name: {@code _shards} + */ + public final Builder shards(Function> fn) { + return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code failures} + *

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

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

+ * Adds a value to failures using a builder lambda. + */ + public final Builder failures(Function> fn) { + return failures(fn.apply(new ShardFailure.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ClusterDetails}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ClusterDetails build() { + _checkSingleUse(); + + return new ClusterDetails(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterDetails} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ClusterDetails::setupClusterDetailsDeserializer); + + protected static void setupClusterDetailsDeserializer(ObjectDeserializer op) { + + op.add(Builder::status, ClusterSearchStatus._DESERIALIZER, "status"); + op.add(Builder::indices, JsonpDeserializer.stringDeserializer(), "indices"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); + op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java new file mode 100644 index 000000000..2ba0d100d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java @@ -0,0 +1,72 @@ +/* + * 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; + +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 ClusterSearchStatus implements JsonEnum { + Running("running"), + + Successful("successful"), + + Partial("partial"), + + Skipped("skipped"), + + Failed("failed"), + + ; + + private final String jsonValue; + + ClusterSearchStatus(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ClusterSearchStatus.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java index b02464bd6..40c028dcf 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java @@ -31,8 +31,11 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.String; +import java.util.Map; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -64,6 +67,14 @@ public class ClusterStatistics implements JsonpSerializable { private final int total; + private final int running; + + private final int partial; + + private final int failed; + + private final Map details; + // --------------------------------------------------------------------------------------------- private ClusterStatistics(Builder builder) { @@ -71,6 +82,10 @@ private ClusterStatistics(Builder builder) { this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.running = ApiTypeHelper.requireNonNull(builder.running, this, "running"); + this.partial = ApiTypeHelper.requireNonNull(builder.partial, this, "partial"); + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.details = ApiTypeHelper.unmodifiable(builder.details); } @@ -99,6 +114,34 @@ public final int total() { return this.total; } + /** + * Required - API name: {@code running} + */ + public final int running() { + return this.running; + } + + /** + * Required - API name: {@code partial} + */ + public final int partial() { + return this.partial; + } + + /** + * Required - API name: {@code failed} + */ + public final int failed() { + return this.failed; + } + + /** + * API name: {@code details} + */ + public final Map details() { + return this.details; + } + /** * Serialize this object to JSON. */ @@ -119,6 +162,27 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total"); generator.write(this.total); + generator.writeKey("running"); + generator.write(this.running); + + generator.writeKey("partial"); + generator.write(this.partial); + + generator.writeKey("failed"); + generator.write(this.failed); + + if (ApiTypeHelper.isDefined(this.details)) { + generator.writeKey("details"); + generator.writeStartObject(); + for (Map.Entry item0 : this.details.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + } @Override @@ -139,6 +203,15 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Integer total; + private Integer running; + + private Integer partial; + + private Integer failed; + + @Nullable + private Map details; + /** * Required - API name: {@code skipped} */ @@ -163,6 +236,59 @@ public final Builder total(int value) { return this; } + /** + * Required - API name: {@code running} + */ + public final Builder running(int value) { + this.running = value; + return this; + } + + /** + * Required - API name: {@code partial} + */ + public final Builder partial(int value) { + this.partial = value; + return this; + } + + /** + * Required - API name: {@code failed} + */ + public final Builder failed(int value) { + this.failed = value; + return this; + } + + /** + * API name: {@code details} + *

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

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

+ * Adds an entry to details using a builder lambda. + */ + public final Builder details(String key, Function> fn) { + return details(key, fn.apply(new ClusterDetails.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -194,6 +320,10 @@ protected static void setupClusterStatisticsDeserializer(ObjectDeserializer filter; + @Nullable + private final Float similarity; + // --------------------------------------------------------------------------------------------- private KnnQuery(Builder builder) { @@ -90,6 +93,7 @@ private KnnQuery(Builder builder) { this.numCandidates = ApiTypeHelper.requireNonNull(builder.numCandidates, this, "numCandidates"); this.boost = builder.boost; this.filter = ApiTypeHelper.unmodifiable(builder.filter); + this.similarity = builder.similarity; } @@ -163,6 +167,16 @@ public final List filter() { return this.filter; } + /** + * The minimum similarity for a vector to be considered a match + *

+ * API name: {@code similarity} + */ + @Nullable + public final Float similarity() { + return this.similarity; + } + /** * Serialize this object to JSON. */ @@ -213,6 +227,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.similarity != null) { + generator.writeKey("similarity"); + generator.write(this.similarity); + + } } @@ -246,6 +265,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private List filter; + @Nullable + private Float similarity; + /** * Required - The name of the vector field to search against *

@@ -367,6 +389,16 @@ public final Builder filter(Function> fn) { return filter(fn.apply(new Query.Builder()).build()); } + /** + * The minimum similarity for a vector to be considered a match + *

+ * API name: {@code similarity} + */ + public final Builder similarity(@Nullable Float value) { + this.similarity = value; + return this; + } + @Override protected Builder self() { return this; @@ -403,6 +435,7 @@ protected static void setupKnnQueryDeserializer(ObjectDeserializer exclude; + @Nullable + private final TermsExclude exclude; - private final List include; + @Nullable + private final TermsInclude include; // --------------------------------------------------------------------------------------------- private FrequentItemSetsField(Builder builder) { this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.exclude = ApiTypeHelper.unmodifiable(builder.exclude); - this.include = ApiTypeHelper.unmodifiable(builder.include); + this.exclude = builder.exclude; + this.include = builder.include; } @@ -94,7 +95,8 @@ public final String field() { *

* API name: {@code exclude} */ - public final List exclude() { + @Nullable + public final TermsExclude exclude() { return this.exclude; } @@ -104,7 +106,8 @@ public final List exclude() { *

* API name: {@code include} */ - public final List include() { + @Nullable + public final TermsInclude include() { return this.include; } @@ -122,24 +125,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("field"); generator.write(this.field); - if (ApiTypeHelper.isDefined(this.exclude)) { + if (this.exclude != null) { generator.writeKey("exclude"); - generator.writeStartArray(); - for (String item0 : this.exclude) { - generator.write(item0); - - } - generator.writeEnd(); + this.exclude.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.include)) { + if (this.include != null) { generator.writeKey("include"); - generator.writeStartArray(); - for (String item0 : this.include) { - generator.write(item0); - - } - generator.writeEnd(); + this.include.serialize(generator, mapper); } @@ -162,10 +155,10 @@ public static class Builder extends WithJsonObjectBuilderBase private String field; @Nullable - private List exclude; + private TermsExclude exclude; @Nullable - private List include; + private TermsInclude include; /** * Required - API name: {@code field} @@ -180,11 +173,9 @@ public final Builder field(String value) { * exact terms. *

* API name: {@code exclude} - *

- * Adds all elements of list to exclude. */ - public final Builder exclude(List list) { - this.exclude = _listAddAll(this.exclude, list); + public final Builder exclude(@Nullable TermsExclude value) { + this.exclude = value; return this; } @@ -193,12 +184,9 @@ public final Builder exclude(List list) { * exact terms. *

* API name: {@code exclude} - *

- * Adds one or more values to exclude. */ - public final Builder exclude(String value, String... values) { - this.exclude = _listAdd(this.exclude, value, values); - return this; + public final Builder exclude(Function> fn) { + return this.exclude(fn.apply(new TermsExclude.Builder()).build()); } /** @@ -206,11 +194,9 @@ public final Builder exclude(String value, String... values) { * exact terms. *

* API name: {@code include} - *

- * Adds all elements of list to include. */ - public final Builder include(List list) { - this.include = _listAddAll(this.include, list); + public final Builder include(@Nullable TermsInclude value) { + this.include = value; return this; } @@ -219,12 +205,9 @@ public final Builder include(List list) { * exact terms. *

* API name: {@code include} - *

- * Adds one or more values to include. */ - public final Builder include(String value, String... values) { - this.include = _listAdd(this.include, value, values); - return this; + public final Builder include(Function> fn) { + return this.include(fn.apply(new TermsInclude.Builder()).build()); } @Override @@ -256,10 +239,8 @@ public FrequentItemSetsField build() { protected static void setupFrequentItemSetsFieldDeserializer(ObjectDeserializer op) { op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::exclude, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "exclude"); - op.add(Builder::include, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "include"); + op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); + op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsBucket.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsBucket.java index 0177588c8..8ae2d967f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsBucket.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsBucket.java @@ -30,6 +30,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -169,6 +170,66 @@ public final Builder key(FieldValue value, FieldValue... values) { return this; } + /** + * Required - API name: {@code key} + *

+ * Adds all passed values to key. + */ + public final Builder key(String value, String... values) { + this.key = _listAdd(this.key, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.key = _listAddAll(this.key, fieldValues); + return this; + } + + /** + * Required - API name: {@code key} + *

+ * Adds all passed values to key. + */ + public final Builder key(long value, long... values) { + this.key = _listAdd(this.key, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.key = _listAddAll(this.key, fieldValues); + return this; + } + + /** + * Required - API name: {@code key} + *

+ * Adds all passed values to key. + */ + public final Builder key(double value, double... values) { + this.key = _listAdd(this.key, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.key = _listAddAll(this.key, fieldValues); + return this; + } + + /** + * Required - API name: {@code key} + *

+ * Adds all passed values to key. + */ + public final Builder key(boolean value, boolean... values) { + this.key = _listAdd(this.key, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.key = _listAddAll(this.key, fieldValues); + return this; + } + /** * Required - API name: {@code key} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java index 472828d62..aee184b30 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java @@ -84,7 +84,8 @@ public class SignificantTextAggregation extends BucketAggregationBase implements @Nullable private final GoogleNormalizedDistanceHeuristic gnd; - private final List include; + @Nullable + private final TermsInclude include; @Nullable private final EmptyObject jlh; @@ -124,7 +125,7 @@ private SignificantTextAggregation(Builder builder) { this.field = builder.field; this.filterDuplicateText = builder.filterDuplicateText; this.gnd = builder.gnd; - this.include = ApiTypeHelper.unmodifiable(builder.include); + this.include = builder.include; this.jlh = builder.jlh; this.minDocCount = builder.minDocCount; this.mutualInformation = builder.mutualInformation; @@ -228,7 +229,8 @@ public final GoogleNormalizedDistanceHeuristic gnd() { *

* API name: {@code include} */ - public final List include() { + @Nullable + public final TermsInclude include() { return this.include; } @@ -367,14 +369,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.gnd.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.include)) { + if (this.include != null) { generator.writeKey("include"); - generator.writeStartArray(); - for (String item0 : this.include) { - generator.write(item0); - - } - generator.writeEnd(); + this.include.serialize(generator, mapper); } if (this.jlh != null) { @@ -461,7 +458,7 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder include; + private TermsInclude include; @Nullable private EmptyObject jlh; @@ -608,11 +605,9 @@ public final Builder gnd( * Values to include. *

* API name: {@code include} - *

- * Adds all elements of list to include. */ - public final Builder include(List list) { - this.include = _listAddAll(this.include, list); + public final Builder include(@Nullable TermsInclude value) { + this.include = value; return this; } @@ -620,12 +615,9 @@ public final Builder include(List list) { * Values to include. *

* API name: {@code include} - *

- * Adds one or more values to include. */ - public final Builder include(String value, String... values) { - this.include = _listAdd(this.include, value, values); - return this; + public final Builder include(Function> fn) { + return this.include(fn.apply(new TermsInclude.Builder()).build()); } /** @@ -818,8 +810,7 @@ protected static void setupSignificantTextAggregationDeserializer( op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::filterDuplicateText, JsonpDeserializer.booleanDeserializer(), "filter_duplicate_text"); op.add(Builder::gnd, GoogleNormalizedDistanceHeuristic._DESERIALIZER, "gnd"); - op.add(Builder::include, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "include"); + op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); op.add(Builder::jlh, EmptyObject._DESERIALIZER, "jlh"); op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count"); op.add(Builder::mutualInformation, MutualInformationHeuristic._DESERIALIZER, "mutual_information"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TopMetrics.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TopMetrics.java index ee4ab8858..0b768b3ea 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TopMetrics.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TopMetrics.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -165,6 +166,66 @@ public final Builder sort(FieldValue value, FieldValue... values) { return this; } + /** + * Required - API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(String value, String... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * Required - API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(long value, long... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * Required - API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(double value, double... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * Required - API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(boolean value, boolean... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + /** * Required - API name: {@code sort} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PathHierarchyTokenizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PathHierarchyTokenizer.java index 6c7067bfc..d6df934e0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PathHierarchyTokenizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PathHierarchyTokenizer.java @@ -24,7 +24,6 @@ import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; @@ -59,26 +58,31 @@ */ @JsonpDeserializable public class PathHierarchyTokenizer extends TokenizerBase implements TokenizerDefinitionVariant { - private final int bufferSize; + @Nullable + private final Integer bufferSize; + @Nullable private final String delimiter; + @Nullable private final String replacement; - private final boolean reverse; + @Nullable + private final Boolean reverse; - private final int skip; + @Nullable + private final Integer skip; // --------------------------------------------------------------------------------------------- private PathHierarchyTokenizer(Builder builder) { super(builder); - this.bufferSize = ApiTypeHelper.requireNonNull(builder.bufferSize, this, "bufferSize"); - this.delimiter = ApiTypeHelper.requireNonNull(builder.delimiter, this, "delimiter"); - this.replacement = ApiTypeHelper.requireNonNull(builder.replacement, this, "replacement"); - this.reverse = ApiTypeHelper.requireNonNull(builder.reverse, this, "reverse"); - this.skip = ApiTypeHelper.requireNonNull(builder.skip, this, "skip"); + this.bufferSize = builder.bufferSize; + this.delimiter = builder.delimiter; + this.replacement = builder.replacement; + this.reverse = builder.reverse; + this.skip = builder.skip; } @@ -95,37 +99,42 @@ 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; } /** - * Required - API name: {@code delimiter} + * API name: {@code delimiter} */ + @Nullable public final String delimiter() { return this.delimiter; } /** - * Required - API name: {@code replacement} + * API name: {@code replacement} */ + @Nullable public final String replacement() { return this.replacement; } /** - * Required - API name: {@code reverse} + * API name: {@code reverse} */ - public final boolean reverse() { + @Nullable + public final Boolean reverse() { return this.reverse; } /** - * Required - API name: {@code skip} + * API name: {@code skip} */ - public final int skip() { + @Nullable + public final Integer skip() { return this.skip; } @@ -133,20 +142,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "path_hierarchy"); super.serializeInternal(generator, mapper); - generator.writeKey("buffer_size"); - generator.write(this.bufferSize); + if (this.bufferSize != null) { + generator.writeKey("buffer_size"); + generator.write(this.bufferSize); - generator.writeKey("delimiter"); - generator.write(this.delimiter); + } + if (this.delimiter != null) { + generator.writeKey("delimiter"); + generator.write(this.delimiter); + + } + if (this.replacement != null) { + generator.writeKey("replacement"); + generator.write(this.replacement); - generator.writeKey("replacement"); - generator.write(this.replacement); + } + if (this.reverse != null) { + generator.writeKey("reverse"); + generator.write(this.reverse); - generator.writeKey("reverse"); - generator.write(this.reverse); + } + if (this.skip != null) { + generator.writeKey("skip"); + generator.write(this.skip); - generator.writeKey("skip"); - generator.write(this.skip); + } } @@ -159,52 +179,57 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenizerBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Integer bufferSize; + @Nullable private String delimiter; + @Nullable private String replacement; + @Nullable private Boolean reverse; + @Nullable private Integer skip; /** - * 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; } /** - * Required - API name: {@code delimiter} + * API name: {@code delimiter} */ - public final Builder delimiter(String value) { + public final Builder delimiter(@Nullable String value) { this.delimiter = value; return this; } /** - * Required - API name: {@code replacement} + * API name: {@code replacement} */ - public final Builder replacement(String value) { + public final Builder replacement(@Nullable String value) { this.replacement = value; return this; } /** - * Required - API name: {@code reverse} + * API name: {@code reverse} */ - public final Builder reverse(boolean value) { + public final Builder reverse(@Nullable Boolean value) { this.reverse = value; return this; } /** - * Required - API name: {@code skip} + * API name: {@code skip} */ - public final Builder skip(int value) { + public final Builder skip(@Nullable Integer value) { this.skip = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java index 136f08c3a..6a42418aa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldType.java @@ -127,6 +127,8 @@ public enum FieldType implements JsonEnum { DenseVector("dense_vector"), + SparseVector("sparse_vector"), + MatchOnlyText("match_only_text"), ; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java index 133c0960d..327e9fad0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java @@ -154,6 +154,8 @@ public enum Kind implements JsonEnum { Short("short"), + SparseVector("sparse_vector"), + Text("text"), TokenCount("token_count"), @@ -926,6 +928,23 @@ public ShortNumberProperty short_() { return TaggedUnionUtils.get(this, Kind.Short); } + /** + * Is this variant instance of kind {@code sparse_vector}? + */ + public boolean isSparseVector() { + return _kind == Kind.SparseVector; + } + + /** + * Get the {@code sparse_vector} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code sparse_vector} kind. + */ + public SparseVectorProperty sparseVector() { + return TaggedUnionUtils.get(this, Kind.SparseVector); + } + /** * Is this variant instance of kind {@code text}? */ @@ -1501,6 +1520,17 @@ public ObjectBuilder short_( return this.short_(fn.apply(new ShortNumberProperty.Builder()).build()); } + public ObjectBuilder sparseVector(SparseVectorProperty v) { + this._kind = Kind.SparseVector; + this._value = v; + return this; + } + + public ObjectBuilder sparseVector( + Function> fn) { + return this.sparseVector(fn.apply(new SparseVectorProperty.Builder()).build()); + } + public ObjectBuilder text(TextProperty v) { this._kind = Kind.Text; this._value = v; @@ -1620,6 +1650,7 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) op.add(Builder::searchAsYouType, SearchAsYouTypeProperty._DESERIALIZER, "search_as_you_type"); op.add(Builder::shape, ShapeProperty._DESERIALIZER, "shape"); op.add(Builder::short_, ShortNumberProperty._DESERIALIZER, "short"); + op.add(Builder::sparseVector, SparseVectorProperty._DESERIALIZER, "sparse_vector"); op.add(Builder::text, TextProperty._DESERIALIZER, "text"); op.add(Builder::tokenCount, TokenCountProperty._DESERIALIZER, "token_count"); op.add(Builder::unsignedLong, UnsignedLongNumberProperty._DESERIALIZER, "unsigned_long"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java index 2d7612b93..0c2a12553 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java @@ -784,6 +784,25 @@ public static Property short_(Function> fn) { + Property.Builder builder = new Property.Builder(); + builder.sparseVector(fn.apply(new SparseVectorProperty.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link TextProperty text} {@code Property} variant. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SparseVectorProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SparseVectorProperty.java new file mode 100644 index 000000000..e26496882 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SparseVectorProperty.java @@ -0,0 +1,124 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch._types.mapping; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: _types.mapping.SparseVectorProperty + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SparseVectorProperty extends PropertyBase implements PropertyVariant { + // --------------------------------------------------------------------------------------------- + + private SparseVectorProperty(Builder builder) { + super(builder); + + } + + public static SparseVectorProperty of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Property variant kind. + */ + @Override + public Property.Kind _propertyKind() { + return Property.Kind.SparseVector; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "sparse_vector"); + super.serializeInternal(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SparseVectorProperty}. + */ + + public static class Builder extends PropertyBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SparseVectorProperty}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SparseVectorProperty build() { + _checkSingleUse(); + + return new SparseVectorProperty(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SparseVectorProperty} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SparseVectorProperty::setupSparseVectorPropertyDeserializer); + + protected static void setupSparseVectorPropertyDeserializer(ObjectDeserializer op) { + PropertyBase.setupPropertyBaseDeserializer(op); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceQuery.java index 28bf62bb7..535684ce6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceQuery.java @@ -29,6 +29,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -71,6 +72,9 @@ public class GeoDistanceQuery extends QueryBase implements QueryVariant { @Nullable private final GeoValidationMethod validationMethod; + @Nullable + private final Boolean ignoreUnmapped; + // --------------------------------------------------------------------------------------------- private GeoDistanceQuery(Builder builder) { @@ -81,6 +85,7 @@ private GeoDistanceQuery(Builder builder) { this.distance = ApiTypeHelper.requireNonNull(builder.distance, this, "distance"); this.distanceType = builder.distanceType; this.validationMethod = builder.validationMethod; + this.ignoreUnmapped = builder.ignoreUnmapped; } @@ -143,6 +148,18 @@ public final GeoValidationMethod validationMethod() { return this.validationMethod; } + /** + * Set to true to ignore an unmapped field and not match any + * documents for this query. Set to false to throw an exception if + * the field is not mapped. + *

+ * API name: {@code ignore_unmapped} + */ + @Nullable + public final Boolean ignoreUnmapped() { + return this.ignoreUnmapped; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey(this.field); this.location.serialize(generator, mapper); @@ -159,6 +176,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("validation_method"); this.validationMethod.serialize(generator, mapper); } + if (this.ignoreUnmapped != null) { + generator.writeKey("ignore_unmapped"); + generator.write(this.ignoreUnmapped); + + } } @@ -204,6 +226,9 @@ public final Builder location(Functiontrue to ignore an unmapped field and not match any + * documents for this query. Set to false to throw an exception if + * the field is not mapped. + *

+ * API name: {@code ignore_unmapped} + */ + public final Builder ignoreUnmapped(@Nullable Boolean value) { + this.ignoreUnmapped = value; + return this; + } + @Override protected Builder self() { return this; @@ -269,6 +306,7 @@ protected static void setupGeoDistanceQueryDeserializer(ObjectDeserializer { builder.field(name); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java index 39f97355a..0da95a9ca 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java @@ -185,6 +185,8 @@ public enum Kind implements JsonEnum { TextExpansion("text_expansion"), + WeightedTokens("weighted_tokens"), + Wildcard("wildcard"), Wrapper("wrapper"), @@ -1158,6 +1160,24 @@ public TextExpansionQuery textExpansion() { return TaggedUnionUtils.get(this, Kind.TextExpansion); } + /** + * Is this variant instance of kind {@code weighted_tokens}? + */ + public boolean isWeightedTokens() { + return _kind == Kind.WeightedTokens; + } + + /** + * Get the {@code weighted_tokens} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code weighted_tokens} + * kind. + */ + public WeightedTokensQuery weightedTokens() { + return TaggedUnionUtils.get(this, Kind.WeightedTokens); + } + /** * Is this variant instance of kind {@code wildcard}? */ @@ -1815,6 +1835,17 @@ public ObjectBuilder textExpansion( return this.textExpansion(fn.apply(new TextExpansionQuery.Builder()).build()); } + public ObjectBuilder weightedTokens(WeightedTokensQuery v) { + this._kind = Kind.WeightedTokens; + this._value = v; + return this; + } + + public ObjectBuilder weightedTokens( + Function> fn) { + return this.weightedTokens(fn.apply(new WeightedTokensQuery.Builder()).build()); + } + public ObjectBuilder wildcard(WildcardQuery v) { this._kind = Kind.Wildcard; this._value = v; @@ -1923,6 +1954,7 @@ protected static void setupQueryDeserializer(ObjectDeserializer op) { op.add(Builder::terms, TermsQuery._DESERIALIZER, "terms"); op.add(Builder::termsSet, TermsSetQuery._DESERIALIZER, "terms_set"); op.add(Builder::textExpansion, TextExpansionQuery._DESERIALIZER, "text_expansion"); + op.add(Builder::weightedTokens, WeightedTokensQuery._DESERIALIZER, "weighted_tokens"); op.add(Builder::wildcard, WildcardQuery._DESERIALIZER, "wildcard"); op.add(Builder::wrapper, WrapperQuery._DESERIALIZER, "wrapper"); op.add(Builder::type, TypeQuery._DESERIALIZER, "type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java index 347f8328e..473535e20 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java @@ -959,6 +959,24 @@ public static Query textExpansion(Function> fn) { + Query.Builder builder = new Query.Builder(); + builder.weightedTokens(fn.apply(new WeightedTokensQuery.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link WildcardQuery wildcard} {@code Query} * variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java deleted file mode 100644 index c28ca93b2..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch._types.query_dsl; - -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; - -// typedef: _types.query_dsl.SimpleQueryStringFlags - -/** - * Query flags can be either a single flag or a combination of flags, e.g. - * OR|AND|PREFIX - * - * @see Documentation - * on elastic.co - * @see API - * specification - */ -@JsonpDeserializable -public class SimpleQueryStringFlags implements TaggedUnion, JsonpSerializable { - - public enum Kind { - Single, Multiple - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private SimpleQueryStringFlags(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - public String _toJsonString() { - switch (_kind) { - case Single : - return this.single().jsonValue(); - case Multiple : - return this.multiple(); - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private SimpleQueryStringFlags(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static SimpleQueryStringFlags of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code single}? - */ - public boolean isSingle() { - return _kind == Kind.Single; - } - - /** - * Get the {@code single} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code single} kind. - */ - public SimpleQueryStringFlag single() { - return TaggedUnionUtils.get(this, Kind.Single); - } - - /** - * Is this variant instance of kind {@code multiple}? - */ - public boolean isMultiple() { - return _kind == Kind.Multiple; - } - - /** - * Get the {@code multiple} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code multiple} kind. - */ - public String multiple() { - return TaggedUnionUtils.get(this, Kind.Multiple); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Multiple : - 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 single(SimpleQueryStringFlag v) { - this._kind = Kind.Single; - this._value = v; - return this; - } - - public ObjectBuilder multiple(String v) { - this._kind = Kind.Multiple; - this._value = v; - return this; - } - - public SimpleQueryStringFlags build() { - _checkSingleUse(); - return new SimpleQueryStringFlags(this); - } - - } - - private static JsonpDeserializer buildSimpleQueryStringFlagsDeserializer() { - return new UnionDeserializer.Builder(SimpleQueryStringFlags::new, true) - .addMember(Kind.Single, SimpleQueryStringFlag._DESERIALIZER) - .addMember(Kind.Multiple, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(SimpleQueryStringFlags::buildSimpleQueryStringFlagsDeserializer); -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlagsBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlagsBuilders.java deleted file mode 100644 index 00ae85425..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlagsBuilders.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch._types.query_dsl; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -/** - * Builders for {@link SimpleQueryStringFlags} variants. - *

- * Variants single, multiple are not available here as - * they don't have a dedicated class. Use {@link SimpleQueryStringFlags}'s - * builder for these. - * - */ -public class SimpleQueryStringFlagsBuilders { - private SimpleQueryStringFlagsBuilders() { - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java index 1e7956f76..3131f9a2c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java @@ -64,6 +64,9 @@ public class TextExpansionQuery extends QueryBase implements QueryVariant { private final String modelText; + @Nullable + private final TokenPruningConfig pruningConfig; + // --------------------------------------------------------------------------------------------- private TextExpansionQuery(Builder builder) { @@ -72,6 +75,7 @@ private TextExpansionQuery(Builder builder) { this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); this.modelText = ApiTypeHelper.requireNonNull(builder.modelText, this, "modelText"); + this.pruningConfig = builder.pruningConfig; } @@ -112,6 +116,16 @@ public final String modelText() { return this.modelText; } + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + @Nullable + public final TokenPruningConfig pruningConfig() { + return this.pruningConfig; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(this.field); @@ -122,6 +136,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("model_text"); generator.write(this.modelText); + if (this.pruningConfig != null) { + generator.writeKey("pruning_config"); + this.pruningConfig.serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -149,6 +169,9 @@ public final Builder field(String value) { private String modelText; + @Nullable + private TokenPruningConfig pruningConfig; + /** * Required - The text expansion NLP model to use *

@@ -169,6 +192,25 @@ public final Builder modelText(String value) { return this; } + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + public final Builder pruningConfig(@Nullable TokenPruningConfig value) { + this.pruningConfig = value; + return this; + } + + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + public final Builder pruningConfig(Function> fn) { + return this.pruningConfig(fn.apply(new TokenPruningConfig.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -199,6 +241,7 @@ protected static void setupTextExpansionQueryDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class TokenPruningConfig implements JsonpSerializable { + @Nullable + private final Integer tokensFreqRatioThreshold; + + @Nullable + private final Float tokensWeightThreshold; + + @Nullable + private final Boolean onlyScorePrunedTokens; + + // --------------------------------------------------------------------------------------------- + + private TokenPruningConfig(Builder builder) { + + this.tokensFreqRatioThreshold = builder.tokensFreqRatioThreshold; + this.tokensWeightThreshold = builder.tokensWeightThreshold; + this.onlyScorePrunedTokens = builder.onlyScorePrunedTokens; + + } + + public static TokenPruningConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Tokens whose frequency is more than this threshold times the average + * frequency of all tokens in the specified field are considered outliers and + * pruned. + *

+ * API name: {@code tokens_freq_ratio_threshold} + */ + @Nullable + public final Integer tokensFreqRatioThreshold() { + return this.tokensFreqRatioThreshold; + } + + /** + * Tokens whose weight is less than this threshold are considered nonsignificant + * and pruned. + *

+ * API name: {@code tokens_weight_threshold} + */ + @Nullable + public final Float tokensWeightThreshold() { + return this.tokensWeightThreshold; + } + + /** + * Whether to only score pruned tokens, vs only scoring kept tokens. + *

+ * API name: {@code only_score_pruned_tokens} + */ + @Nullable + public final Boolean onlyScorePrunedTokens() { + return this.onlyScorePrunedTokens; + } + + /** + * 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.tokensFreqRatioThreshold != null) { + generator.writeKey("tokens_freq_ratio_threshold"); + generator.write(this.tokensFreqRatioThreshold); + + } + if (this.tokensWeightThreshold != null) { + generator.writeKey("tokens_weight_threshold"); + generator.write(this.tokensWeightThreshold); + + } + if (this.onlyScorePrunedTokens != null) { + generator.writeKey("only_score_pruned_tokens"); + generator.write(this.onlyScorePrunedTokens); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TokenPruningConfig}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Integer tokensFreqRatioThreshold; + + @Nullable + private Float tokensWeightThreshold; + + @Nullable + private Boolean onlyScorePrunedTokens; + + /** + * Tokens whose frequency is more than this threshold times the average + * frequency of all tokens in the specified field are considered outliers and + * pruned. + *

+ * API name: {@code tokens_freq_ratio_threshold} + */ + public final Builder tokensFreqRatioThreshold(@Nullable Integer value) { + this.tokensFreqRatioThreshold = value; + return this; + } + + /** + * Tokens whose weight is less than this threshold are considered nonsignificant + * and pruned. + *

+ * API name: {@code tokens_weight_threshold} + */ + public final Builder tokensWeightThreshold(@Nullable Float value) { + this.tokensWeightThreshold = value; + return this; + } + + /** + * Whether to only score pruned tokens, vs only scoring kept tokens. + *

+ * API name: {@code only_score_pruned_tokens} + */ + public final Builder onlyScorePrunedTokens(@Nullable Boolean value) { + this.onlyScorePrunedTokens = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TokenPruningConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TokenPruningConfig build() { + _checkSingleUse(); + + return new TokenPruningConfig(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TokenPruningConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TokenPruningConfig::setupTokenPruningConfigDeserializer); + + protected static void setupTokenPruningConfigDeserializer(ObjectDeserializer op) { + + op.add(Builder::tokensFreqRatioThreshold, JsonpDeserializer.integerDeserializer(), + "tokens_freq_ratio_threshold"); + op.add(Builder::tokensWeightThreshold, JsonpDeserializer.floatDeserializer(), "tokens_weight_threshold"); + op.add(Builder::onlyScorePrunedTokens, JsonpDeserializer.booleanDeserializer(), "only_score_pruned_tokens"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WeightedTokensQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WeightedTokensQuery.java new file mode 100644 index 000000000..926cdfa2e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WeightedTokensQuery.java @@ -0,0 +1,247 @@ +/* + * 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.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Float; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: _types.query_dsl.WeightedTokensQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class WeightedTokensQuery extends QueryBase implements QueryVariant { + // Single key dictionary + private final String field; + + private final Map tokens; + + @Nullable + private final TokenPruningConfig pruningConfig; + + // --------------------------------------------------------------------------------------------- + + private WeightedTokensQuery(Builder builder) { + super(builder); + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + + this.tokens = ApiTypeHelper.unmodifiableRequired(builder.tokens, this, "tokens"); + this.pruningConfig = builder.pruningConfig; + + } + + public static WeightedTokensQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Query variant kind. + */ + @Override + public Query.Kind _queryKind() { + return Query.Kind.WeightedTokens; + } + + /** + * Required - The target field + */ + public final String field() { + return this.field; + } + + /** + * Required - The tokens representing this query + *

+ * API name: {@code tokens} + */ + public final Map tokens() { + return this.tokens; + } + + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + @Nullable + public final TokenPruningConfig pruningConfig() { + return this.pruningConfig; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(this.field); + + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.tokens)) { + generator.writeKey("tokens"); + generator.writeStartObject(); + for (Map.Entry item0 : this.tokens.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (this.pruningConfig != null) { + generator.writeKey("pruning_config"); + this.pruningConfig.serialize(generator, mapper); + + } + + generator.writeEnd(); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link WeightedTokensQuery}. + */ + + public static class Builder extends QueryBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + /** + * Required - The target field + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + private Map tokens; + + @Nullable + private TokenPruningConfig pruningConfig; + + /** + * Required - The tokens representing this query + *

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

+ * Adds all entries of map to tokens. + */ + public final Builder tokens(Map map) { + this.tokens = _mapPutAll(this.tokens, map); + return this; + } + + /** + * Required - The tokens representing this query + *

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

+ * Adds an entry to tokens. + */ + public final Builder tokens(String key, Float value) { + this.tokens = _mapPut(this.tokens, key, value); + return this; + } + + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + public final Builder pruningConfig(@Nullable TokenPruningConfig value) { + this.pruningConfig = value; + return this; + } + + /** + * Token pruning configurations + *

+ * API name: {@code pruning_config} + */ + public final Builder pruningConfig(Function> fn) { + return this.pruningConfig(fn.apply(new TokenPruningConfig.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link WeightedTokensQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public WeightedTokensQuery build() { + _checkSingleUse(); + + return new WeightedTokensQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link WeightedTokensQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, WeightedTokensQuery::setupWeightedTokensQueryDeserializer); + + protected static void setupWeightedTokensQueryDeserializer(ObjectDeserializer op) { + QueryBase.setupQueryBaseDeserializer(op); + op.add(Builder::tokens, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.floatDeserializer()), + "tokens"); + op.add(Builder::pruningConfig, TokenPruningConfig._DESERIALIZER, "pruning_config"); + + op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java index 62e6baf9c..42ce2cca4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java @@ -79,6 +79,12 @@ public abstract class AsyncSearchResponseBase implements JsonpSerializable { private final long startTimeInMillis; + @Nullable + private final DateTime completionTime; + + @Nullable + private final Long completionTimeInMillis; + // --------------------------------------------------------------------------------------------- protected AsyncSearchResponseBase(AbstractBuilder builder) { @@ -91,6 +97,8 @@ protected AsyncSearchResponseBase(AbstractBuilder builder) { "expirationTimeInMillis"); this.startTime = builder.startTime; this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); + this.completionTime = builder.completionTime; + this.completionTimeInMillis = builder.completionTimeInMillis; } @@ -158,6 +166,25 @@ public final long startTimeInMillis() { return this.startTimeInMillis; } + /** + * Indicates when the async search completed. Only present when the search has + * completed. + *

+ * API name: {@code completion_time} + */ + @Nullable + public final DateTime completionTime() { + return this.completionTime; + } + + /** + * API name: {@code completion_time_in_millis} + */ + @Nullable + public final Long completionTimeInMillis() { + return this.completionTimeInMillis; + } + /** * Serialize this object to JSON. */ @@ -194,6 +221,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("start_time_in_millis"); generator.write(this.startTimeInMillis); + if (this.completionTime != null) { + generator.writeKey("completion_time"); + this.completionTime.serialize(generator, mapper); + } + if (this.completionTimeInMillis != null) { + generator.writeKey("completion_time_in_millis"); + generator.write(this.completionTimeInMillis); + + } + } @Override @@ -221,6 +258,12 @@ public abstract static class AbstractBuilder + * API name: {@code completion_time} + */ + public final BuilderT completionTime(@Nullable DateTime value) { + this.completionTime = value; + return self(); + } + + /** + * API name: {@code completion_time_in_millis} + */ + public final BuilderT completionTimeInMillis(@Nullable Long value) { + this.completionTimeInMillis = value; + return self(); + } + protected abstract BuilderT self(); } @@ -305,6 +367,9 @@ protected static > void setupAsyncSea "expiration_time_in_millis"); op.add(AbstractBuilder::startTime, DateTime._DESERIALIZER, "start_time"); op.add(AbstractBuilder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); + op.add(AbstractBuilder::completionTime, DateTime._DESERIALIZER, "completion_time"); + op.add(AbstractBuilder::completionTimeInMillis, JsonpDeserializer.longDeserializer(), + "completion_time_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java index 710b397de..4b6ddf5ff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java @@ -58,6 +58,7 @@ import java.lang.Integer; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -2085,6 +2086,66 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * API name: {@code search_after} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/status/StatusResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/status/StatusResponseBase.java index 8e334e888..839aa6767 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/status/StatusResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/status/StatusResponseBase.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.async_search.status; +import co.elastic.clients.elasticsearch._types.ClusterStatistics; import co.elastic.clients.elasticsearch._types.ShardStatistics; import co.elastic.clients.elasticsearch.async_search.AsyncSearchResponseBase; import co.elastic.clients.json.JsonpDeserializable; @@ -62,6 +63,9 @@ public abstract class StatusResponseBase extends AsyncSearchResponseBase { private final ShardStatistics shards; + @Nullable + private final ClusterStatistics clusters; + @Nullable private final Integer completionStatus; @@ -71,6 +75,7 @@ protected StatusResponseBase(AbstractBuilder builder) { super(builder); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.clusters = builder.clusters; this.completionStatus = builder.completionStatus; } @@ -84,6 +89,17 @@ public final ShardStatistics shards() { return this.shards; } + /** + * Metadata about clusters involved in the cross-cluster search. Not shown for + * local-only searches. + *

+ * API name: {@code _clusters} + */ + @Nullable + public final ClusterStatistics clusters() { + return this.clusters; + } + /** * If the async search completed, this field shows the status code of the * search. For example, 200 indicates that the async search was successfully @@ -102,6 +118,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("_shards"); this.shards.serialize(generator, mapper); + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); + + } if (this.completionStatus != null) { generator.writeKey("completion_status"); generator.write(this.completionStatus); @@ -115,6 +136,9 @@ public abstract static class AbstractBuilder { private ShardStatistics shards; + @Nullable + private ClusterStatistics clusters; + @Nullable private Integer completionStatus; @@ -137,6 +161,27 @@ public final BuilderT shards(Function + * API name: {@code _clusters} + */ + public final BuilderT clusters(@Nullable ClusterStatistics value) { + this.clusters = value; + return self(); + } + + /** + * Metadata about clusters involved in the cross-cluster search. Not shown for + * local-only searches. + *

+ * API name: {@code _clusters} + */ + public final BuilderT clusters(Function> fn) { + return this.clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + /** * If the async search completed, this field shows the status code of the * search. For example, 200 indicates that the async search was successfully @@ -156,6 +201,7 @@ protected static > void setupStatusRe ObjectDeserializer op) { AsyncSearchResponseBase.setupAsyncSearchResponseBaseDeserializer(op); op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add(AbstractBuilder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); op.add(AbstractBuilder::completionStatus, JsonpDeserializer.integerDeserializer(), "completion_status"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/BulkRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/BulkRequest.java index ceec7f590..7d42b687e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/BulkRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/BulkRequest.java @@ -67,8 +67,8 @@ // typedef: _global.bulk.Request /** - * Allows to perform multiple index/update/delete operations in a single - * request. + * Performs multiple indexing or delete operations in a single API call. This + * reduces overhead and can greatly increase indexing speed. * * @see API * specification @@ -132,8 +132,8 @@ public Iterator _serializables() { return this.operations.iterator(); } /** - * True or false to return the _source field or not, or default list of fields - * to return, can be overridden on each sub-request + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -143,8 +143,7 @@ public final SourceConfigParam source() { } /** - * Default list of fields to exclude from the returned _source field, can be - * overridden on each sub-request + * A comma-separated list of source fields to exclude from the response. *

* API name: {@code _source_excludes} */ @@ -153,8 +152,7 @@ public final List sourceExcludes() { } /** - * Default list of fields to extract and return from the _source field, can be - * overridden on each sub-request + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} */ @@ -163,7 +161,7 @@ public final List sourceIncludes() { } /** - * Default index for items which don't provide one + * Name of the data stream, index, or index alias to perform bulk actions on. *

* API name: {@code index} */ @@ -173,7 +171,11 @@ public final String index() { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -183,10 +185,11 @@ public final String pipeline() { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -196,7 +199,7 @@ public final Refresh refresh() { } /** - * Sets require_alias for all incoming documents. Defaults to unset (false) + * If true, the request’s actions must target an index alias. *

* API name: {@code require_alias} */ @@ -206,7 +209,7 @@ public final Boolean requireAlias() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -216,7 +219,8 @@ public final String routing() { } /** - * Explicit operation timeout + * Period each action waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -226,11 +230,9 @@ public final Time timeout() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the bulk operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -299,8 +301,8 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private List operations; /** - * True or false to return the _source field or not, or default list of fields - * to return, can be overridden on each sub-request + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -310,8 +312,8 @@ public final Builder source(@Nullable SourceConfigParam value) { } /** - * True or false to return the _source field or not, or default list of fields - * to return, can be overridden on each sub-request + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -320,8 +322,7 @@ public final Builder source(Function * API name: {@code _source_excludes} *

@@ -333,8 +334,7 @@ public final Builder sourceExcludes(List list) { } /** - * Default list of fields to exclude from the returned _source field, can be - * overridden on each sub-request + * A comma-separated list of source fields to exclude from the response. *

* API name: {@code _source_excludes} *

@@ -346,8 +346,7 @@ public final Builder sourceExcludes(String value, String... values) { } /** - * Default list of fields to extract and return from the _source field, can be - * overridden on each sub-request + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -359,8 +358,7 @@ public final Builder sourceIncludes(List list) { } /** - * Default list of fields to extract and return from the _source field, can be - * overridden on each sub-request + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -372,7 +370,7 @@ public final Builder sourceIncludes(String value, String... values) { } /** - * Default index for items which don't provide one + * Name of the data stream, index, or index alias to perform bulk actions on. *

* API name: {@code index} */ @@ -382,7 +380,11 @@ public final Builder index(@Nullable String value) { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -392,10 +394,11 @@ public final Builder pipeline(@Nullable String value) { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -405,7 +408,7 @@ public final Builder refresh(@Nullable Refresh value) { } /** - * Sets require_alias for all incoming documents. Defaults to unset (false) + * If true, the request’s actions must target an index alias. *

* API name: {@code require_alias} */ @@ -415,7 +418,7 @@ public final Builder requireAlias(@Nullable Boolean value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -425,7 +428,8 @@ public final Builder routing(@Nullable String value) { } /** - * Explicit operation timeout + * Period each action waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -435,7 +439,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period each action waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -444,11 +449,9 @@ public final Builder timeout(Function> fn) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the bulk operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -458,11 +461,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the bulk operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClearScrollRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClearScrollRequest.java index 6f700a2b8..31e9ba08f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClearScrollRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClearScrollRequest.java @@ -57,7 +57,7 @@ // typedef: _global.clear_scroll.Request /** - * Explicitly clears the search context for a scroll. + * Clears the search context and results for a scrolling search. * * @see API * specification @@ -79,6 +79,8 @@ public static ClearScrollRequest of(Function_all. + *

* API name: {@code scroll_id} */ public final List scrollId() { @@ -122,6 +124,8 @@ public static class Builder extends RequestBase.AbstractBuilder private List scrollId; /** + * Scroll IDs to clear. To clear all scroll IDs, use _all. + *

* API name: {@code scroll_id} *

* Adds all elements of list to scrollId. @@ -132,6 +136,8 @@ public final Builder scrollId(List list) { } /** + * Scroll IDs to clear. To clear all scroll IDs, use _all. + *

* API name: {@code scroll_id} *

* Adds one or more values to scrollId. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClosePointInTimeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClosePointInTimeRequest.java index 2ecb50d89..b867d3d3c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClosePointInTimeRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ClosePointInTimeRequest.java @@ -56,7 +56,7 @@ // typedef: _global.close_point_in_time.Request /** - * Close a point in time + * Closes a point-in-time. * * @see API @@ -79,7 +79,9 @@ public static ClosePointInTimeRequest of(Function + * API name: {@code id} */ public final String id() { return this.id; @@ -113,7 +115,9 @@ public static class Builder extends RequestBase.AbstractBuilder private String id; /** - * Required - API name: {@code id} + * Required - The ID of the point-in-time. + *

+ * API name: {@code id} */ public final Builder id(String value) { this.id = value; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CountRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CountRequest.java index 4f18d5df6..360897e9b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CountRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CountRequest.java @@ -146,9 +146,10 @@ public static CountRequest of(Function> fn) } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. *

* API name: {@code allow_no_indices} */ @@ -158,8 +159,9 @@ public final Boolean allowNoIndices() { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. This + * parameter can only be used when the q query string parameter is + * specified. *

* API name: {@code analyze_wildcard} */ @@ -169,7 +171,8 @@ public final Boolean analyzeWildcard() { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. This parameter can only be used when + * the q query string parameter is specified. *

* API name: {@code analyzer} */ @@ -179,7 +182,9 @@ public final String analyzer() { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. This parameter can only be used when the q + * query string parameter is specified. *

* API name: {@code default_operator} */ @@ -189,8 +194,9 @@ public final Operator defaultOperator() { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. + * This parameter can only be used when the q query string + * parameter is specified. *

* API name: {@code df} */ @@ -200,8 +206,10 @@ public final String df() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. *

* API name: {@code expand_wildcards} */ @@ -210,8 +218,8 @@ public final List expandWildcards() { } /** - * Whether specified concrete, expanded or aliased indices should be ignored - * when throttled + * If true, concrete, expanded or aliased indices are ignored when + * frozen. *

* API name: {@code ignore_throttled} */ @@ -221,8 +229,8 @@ public final Boolean ignoreThrottled() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -232,7 +240,9 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of indices to restrict the results + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use * or _all. *

* API name: {@code index} */ @@ -241,8 +251,8 @@ public final List index() { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -252,8 +262,8 @@ public final Boolean lenient() { } /** - * Include only documents with a specific _score value in the - * result + * Sets the minimum _score value that documents must have to be + * included in the result. *

* API name: {@code min_score} */ @@ -263,8 +273,8 @@ public final Double minScore() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -274,7 +284,7 @@ public final String preference() { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -284,6 +294,8 @@ public final String q() { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ @Nullable @@ -292,7 +304,7 @@ public final Query query() { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -302,8 +314,9 @@ public final String routing() { } /** - * The maximum count for each shard, upon reaching which the query execution - * will terminate early + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. *

* API name: {@code terminate_after} */ @@ -387,9 +400,10 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Long terminateAfter; /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. *

* API name: {@code allow_no_indices} */ @@ -399,8 +413,9 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. This + * parameter can only be used when the q query string parameter is + * specified. *

* API name: {@code analyze_wildcard} */ @@ -410,7 +425,8 @@ public final Builder analyzeWildcard(@Nullable Boolean value) { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. This parameter can only be used when + * the q query string parameter is specified. *

* API name: {@code analyzer} */ @@ -420,7 +436,9 @@ public final Builder analyzer(@Nullable String value) { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. This parameter can only be used when the q + * query string parameter is specified. *

* API name: {@code default_operator} */ @@ -430,8 +448,9 @@ public final Builder defaultOperator(@Nullable Operator value) { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. + * This parameter can only be used when the q query string + * parameter is specified. *

* API name: {@code df} */ @@ -441,8 +460,10 @@ public final Builder df(@Nullable String value) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. *

* API name: {@code expand_wildcards} *

@@ -454,8 +475,10 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. *

* API name: {@code expand_wildcards} *

@@ -467,8 +490,8 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val } /** - * Whether specified concrete, expanded or aliased indices should be ignored - * when throttled + * If true, concrete, expanded or aliased indices are ignored when + * frozen. *

* API name: {@code ignore_throttled} */ @@ -478,8 +501,8 @@ public final Builder ignoreThrottled(@Nullable Boolean value) { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -489,7 +512,9 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * A comma-separated list of indices to restrict the results + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -501,7 +526,9 @@ public final Builder index(List list) { } /** - * A comma-separated list of indices to restrict the results + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -513,8 +540,8 @@ public final Builder index(String value, String... values) { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -524,8 +551,8 @@ public final Builder lenient(@Nullable Boolean value) { } /** - * Include only documents with a specific _score value in the - * result + * Sets the minimum _score value that documents must have to be + * included in the result. *

* API name: {@code min_score} */ @@ -535,8 +562,8 @@ public final Builder minScore(@Nullable Double value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -546,7 +573,7 @@ public final Builder preference(@Nullable String value) { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -556,6 +583,8 @@ public final Builder q(@Nullable String value) { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(@Nullable Query value) { @@ -564,6 +593,8 @@ public final Builder query(@Nullable Query value) { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(Function> fn) { @@ -571,7 +602,7 @@ public final Builder query(Function> fn) { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -581,8 +612,9 @@ public final Builder routing(@Nullable String value) { } /** - * The maximum count for each shard, upon reaching which the query execution - * will terminate early + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. *

* API name: {@code terminate_after} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CreateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CreateRequest.java index 713142983..61eb92752 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CreateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/CreateRequest.java @@ -67,10 +67,9 @@ // typedef: _global.create.Request /** - * Creates a new document in the index. - *

- * Returns a 409 response when a document with a same ID already exists in the - * index. + * Adds a JSON document to the specified data stream or index and makes it + * searchable. If the target is an index and the document already exists, the + * request updates the document and increments its version. * * @see API * specification @@ -131,7 +130,7 @@ public static CreateRequest of( } /** - * Required - Document ID + * Required - Unique identifier for the document. *

* API name: {@code id} */ @@ -140,7 +139,11 @@ public final String id() { } /** - * Required - The name of the index + * Required - Name of the data stream or index to target. If the target doesn’t + * exist and matches the name or wildcard (*) pattern of an index + * template with a data_stream definition, this request creates the + * data stream. If the target doesn’t exist and doesn’t match a data stream + * template, this request creates the index. *

* API name: {@code index} */ @@ -149,7 +152,11 @@ public final String index() { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -159,10 +166,11 @@ public final String pipeline() { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -172,7 +180,7 @@ public final Refresh refresh() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -182,7 +190,8 @@ public final String routing() { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -192,7 +201,8 @@ public final Time timeout() { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -202,7 +212,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -212,11 +222,9 @@ public final VersionType versionType() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -280,7 +288,7 @@ public static class Builder extends RequestBase.AbstractBuilder tDocumentSerializer; /** - * Required - Document ID + * Required - Unique identifier for the document. *

* API name: {@code id} */ @@ -290,7 +298,11 @@ public final Builder id(String value) { } /** - * Required - The name of the index + * Required - Name of the data stream or index to target. If the target doesn’t + * exist and matches the name or wildcard (*) pattern of an index + * template with a data_stream definition, this request creates the + * data stream. If the target doesn’t exist and doesn’t match a data stream + * template, this request creates the index. *

* API name: {@code index} */ @@ -300,7 +312,11 @@ public final Builder index(String value) { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -310,10 +326,11 @@ public final Builder pipeline(@Nullable String value) { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -323,7 +340,7 @@ public final Builder refresh(@Nullable Refresh value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -333,7 +350,8 @@ public final Builder routing(@Nullable String value) { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -343,7 +361,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -352,7 +371,8 @@ public final Builder timeout(Function * API name: {@code version} */ @@ -362,7 +382,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -372,11 +392,9 @@ public final Builder versionType(@Nullable VersionType value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -386,11 +404,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShard } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java index 66d51fd86..64debabf9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java @@ -71,7 +71,7 @@ // typedef: _global.delete_by_query.Request /** - * Deletes documents matching the provided query. + * Deletes documents that match the specified query. * * @see API * specification @@ -214,9 +214,12 @@ public static DeleteByQueryRequest of(Function_all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -226,8 +229,7 @@ public final Boolean allowNoIndices() { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -237,7 +239,7 @@ public final Boolean analyzeWildcard() { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. *

* API name: {@code analyzer} */ @@ -247,7 +249,8 @@ public final String analyzer() { } /** - * What to do when the delete by query hits version conflicts? + * What to do if delete by query hits version conflicts: abort or + * proceed. *

* API name: {@code conflicts} */ @@ -257,7 +260,8 @@ public final Conflicts conflicts() { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -267,8 +271,7 @@ public final Operator defaultOperator() { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -278,8 +281,12 @@ public final String df() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} */ @@ -298,8 +305,8 @@ public final Long from() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -309,8 +316,9 @@ public final Boolean ignoreUnavailable() { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} */ @@ -319,8 +327,8 @@ public final List index() { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -330,6 +338,8 @@ public final Boolean lenient() { } /** + * The maximum number of documents to delete. + *

* API name: {@code max_docs} */ @Nullable @@ -338,8 +348,8 @@ public final Long maxDocs() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -349,7 +359,7 @@ public final String preference() { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -359,6 +369,8 @@ public final String q() { } /** + * Specifies the documents to delete using the Query DSL. + *

* API name: {@code query} */ @Nullable @@ -367,7 +379,8 @@ public final Query query() { } /** - * Should the affected indexes be refreshed? + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -377,8 +390,8 @@ public final Boolean refresh() { } /** - * Specify if request cache should be used for this request or not, defaults to - * index level setting + * If true, the request cache is used for this request. Defaults to + * the index-level setting. *

* API name: {@code request_cache} */ @@ -388,8 +401,7 @@ public final Boolean requestCache() { } /** - * The throttle for this request in sub-requests per second. -1 means no - * throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -399,7 +411,7 @@ public final Float requestsPerSecond() { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -409,8 +421,7 @@ public final String routing() { } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -420,7 +431,7 @@ public final Time scroll() { } /** - * Size on the scroll request powering the delete by query + * Size of the scroll request that powers the operation. *

* API name: {@code scroll_size} */ @@ -440,7 +451,8 @@ public final Time searchTimeout() { } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ @@ -450,6 +462,9 @@ public final SearchType searchType() { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ @Nullable @@ -458,8 +473,7 @@ public final SlicedScroll slice() { } /** - * The number of slices this task should be divided into. Defaults to 1, meaning - * the task isn't sliced into subtasks. Can be set to auto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -469,7 +483,7 @@ public final Slices slices() { } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} */ @@ -478,7 +492,8 @@ public final List sort() { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} */ @@ -487,8 +502,13 @@ public final List stats() { } /** - * The maximum number of documents to collect for each shard, upon reaching - * which the query execution will terminate early. + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Use with caution. Elasticsearch applies this + * parameter to each shard handling the request. When possible, let + * Elasticsearch perform early termination automatically. Avoid specifying this + * parameter for requests that target data streams with backing indices across + * multiple data tiers. *

* API name: {@code terminate_after} */ @@ -498,8 +518,7 @@ public final Long terminateAfter() { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each deletion request waits for active shards. *

* API name: {@code timeout} */ @@ -509,7 +528,7 @@ public final Time timeout() { } /** - * Specify whether to return document version as part of a hit + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -519,11 +538,9 @@ public final Boolean version() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -533,7 +550,7 @@ public final WaitForActiveShards waitForActiveShards() { } /** - * Should the request should block until the delete by query is complete. + * If true, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} */ @@ -676,9 +693,12 @@ public static class Builder extends RequestBase.AbstractBuilder private Boolean waitForCompletion; /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -688,8 +708,7 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -699,7 +718,7 @@ public final Builder analyzeWildcard(@Nullable Boolean value) { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. *

* API name: {@code analyzer} */ @@ -709,7 +728,8 @@ public final Builder analyzer(@Nullable String value) { } /** - * What to do when the delete by query hits version conflicts? + * What to do if delete by query hits version conflicts: abort or + * proceed. *

* API name: {@code conflicts} */ @@ -719,7 +739,8 @@ public final Builder conflicts(@Nullable Conflicts value) { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -729,8 +750,7 @@ public final Builder defaultOperator(@Nullable Operator value) { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -740,8 +760,12 @@ public final Builder df(@Nullable String value) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -753,8 +777,12 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -776,8 +804,8 @@ public final Builder from(@Nullable Long value) { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -787,8 +815,9 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -800,8 +829,9 @@ public final Builder index(List list) { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -813,8 +843,8 @@ public final Builder index(String value, String... values) { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -824,6 +854,8 @@ public final Builder lenient(@Nullable Boolean value) { } /** + * The maximum number of documents to delete. + *

* API name: {@code max_docs} */ public final Builder maxDocs(@Nullable Long value) { @@ -832,8 +864,8 @@ public final Builder maxDocs(@Nullable Long value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -843,7 +875,7 @@ public final Builder preference(@Nullable String value) { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -853,6 +885,8 @@ public final Builder q(@Nullable String value) { } /** + * Specifies the documents to delete using the Query DSL. + *

* API name: {@code query} */ public final Builder query(@Nullable Query value) { @@ -861,6 +895,8 @@ public final Builder query(@Nullable Query value) { } /** + * Specifies the documents to delete using the Query DSL. + *

* API name: {@code query} */ public final Builder query(Function> fn) { @@ -868,7 +904,8 @@ public final Builder query(Function> fn) { } /** - * Should the affected indexes be refreshed? + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -878,8 +915,8 @@ public final Builder refresh(@Nullable Boolean value) { } /** - * Specify if request cache should be used for this request or not, defaults to - * index level setting + * If true, the request cache is used for this request. Defaults to + * the index-level setting. *

* API name: {@code request_cache} */ @@ -889,8 +926,7 @@ public final Builder requestCache(@Nullable Boolean value) { } /** - * The throttle for this request in sub-requests per second. -1 means no - * throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -900,7 +936,7 @@ public final Builder requestsPerSecond(@Nullable Float value) { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -910,8 +946,7 @@ public final Builder routing(@Nullable String value) { } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -921,8 +956,7 @@ public final Builder scroll(@Nullable Time value) { } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -931,7 +965,7 @@ public final Builder scroll(Function> fn) { } /** - * Size on the scroll request powering the delete by query + * Size of the scroll request that powers the operation. *

* API name: {@code scroll_size} */ @@ -960,7 +994,8 @@ public final Builder searchTimeout(Function> f } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ @@ -970,6 +1005,9 @@ public final Builder searchType(@Nullable SearchType value) { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ public final Builder slice(@Nullable SlicedScroll value) { @@ -978,6 +1016,9 @@ public final Builder slice(@Nullable SlicedScroll value) { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ public final Builder slice(Function> fn) { @@ -985,8 +1026,7 @@ public final Builder slice(Functionauto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -996,8 +1036,7 @@ public final Builder slices(@Nullable Slices value) { } /** - * The number of slices this task should be divided into. Defaults to 1, meaning - * the task isn't sliced into subtasks. Can be set to auto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -1006,7 +1045,7 @@ public final Builder slices(Function> fn) } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} *

@@ -1018,7 +1057,7 @@ public final Builder sort(List list) { } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} *

@@ -1030,7 +1069,8 @@ public final Builder sort(String value, String... values) { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} *

@@ -1042,7 +1082,8 @@ public final Builder stats(List list) { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} *

@@ -1054,8 +1095,13 @@ public final Builder stats(String value, String... values) { } /** - * The maximum number of documents to collect for each shard, upon reaching - * which the query execution will terminate early. + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Use with caution. Elasticsearch applies this + * parameter to each shard handling the request. When possible, let + * Elasticsearch perform early termination automatically. Avoid specifying this + * parameter for requests that target data streams with backing indices across + * multiple data tiers. *

* API name: {@code terminate_after} */ @@ -1065,8 +1111,7 @@ public final Builder terminateAfter(@Nullable Long value) { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each deletion request waits for active shards. *

* API name: {@code timeout} */ @@ -1076,8 +1121,7 @@ public final Builder timeout(@Nullable Time value) { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each deletion request waits for active shards. *

* API name: {@code timeout} */ @@ -1086,7 +1130,7 @@ public final Builder timeout(Function> fn) { } /** - * Specify whether to return document version as part of a hit + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -1096,11 +1140,9 @@ public final Builder version(@Nullable Boolean value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -1110,11 +1152,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -1124,7 +1164,7 @@ public final Builder waitForActiveShards( } /** - * Should the request should block until the delete by query is complete. + * If true, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java index 94b1b2470..30291fc23 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java @@ -85,8 +85,7 @@ public static DeleteByQueryRethrottleRequest of( } /** - * The throttle to set on this request in floating sub-requests per second. -1 - * means set no throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -96,7 +95,7 @@ public final Float requestsPerSecond() { } /** - * Required - The task id to rethrottle + * Required - The ID for the task. *

* API name: {@code task_id} */ @@ -119,8 +118,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String taskId; /** - * The throttle to set on this request in floating sub-requests per second. -1 - * means set no throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -130,7 +128,7 @@ public final Builder requestsPerSecond(@Nullable Float value) { } /** - * Required - The task id to rethrottle + * Required - The ID for the task. *

* API name: {@code task_id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteRequest.java index 0c68bacb3..a1890a672 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteRequest.java @@ -60,7 +60,7 @@ // typedef: _global.delete.Request /** - * Removes a document from the index. + * Removes a JSON document from the specified index. * * @see API * specification @@ -117,7 +117,7 @@ public static DeleteRequest of(Function> f } /** - * Required - The document ID + * Required - Unique identifier for the document. *

* API name: {@code id} */ @@ -126,8 +126,7 @@ public final String id() { } /** - * only perform the delete operation if the last operation that has changed the - * document has the specified primary term + * Only perform the operation if the document has this primary term. *

* API name: {@code if_primary_term} */ @@ -137,8 +136,7 @@ public final Long ifPrimaryTerm() { } /** - * only perform the delete operation if the last operation that has changed the - * document has the specified sequence number + * Only perform the operation if the document has this sequence number. *

* API name: {@code if_seq_no} */ @@ -148,7 +146,7 @@ public final Long ifSeqNo() { } /** - * Required - The name of the index + * Required - Name of the target index. *

* API name: {@code index} */ @@ -157,10 +155,11 @@ public final String index() { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -170,7 +169,7 @@ public final Refresh refresh() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -180,7 +179,7 @@ public final String routing() { } /** - * Explicit operation timeout + * Period to wait for active shards. *

* API name: {@code timeout} */ @@ -190,7 +189,8 @@ public final Time timeout() { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -200,7 +200,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -210,11 +210,9 @@ public final VersionType versionType() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -259,7 +257,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private WaitForActiveShards waitForActiveShards; /** - * Required - The document ID + * Required - Unique identifier for the document. *

* API name: {@code id} */ @@ -269,8 +267,7 @@ public final Builder id(String value) { } /** - * only perform the delete operation if the last operation that has changed the - * document has the specified primary term + * Only perform the operation if the document has this primary term. *

* API name: {@code if_primary_term} */ @@ -280,8 +277,7 @@ public final Builder ifPrimaryTerm(@Nullable Long value) { } /** - * only perform the delete operation if the last operation that has changed the - * document has the specified sequence number + * Only perform the operation if the document has this sequence number. *

* API name: {@code if_seq_no} */ @@ -291,7 +287,7 @@ public final Builder ifSeqNo(@Nullable Long value) { } /** - * Required - The name of the index + * Required - Name of the target index. *

* API name: {@code index} */ @@ -301,10 +297,11 @@ public final Builder index(String value) { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -314,7 +311,7 @@ public final Builder refresh(@Nullable Refresh value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -324,7 +321,7 @@ public final Builder routing(@Nullable String value) { } /** - * Explicit operation timeout + * Period to wait for active shards. *

* API name: {@code timeout} */ @@ -334,7 +331,7 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for active shards. *

* API name: {@code timeout} */ @@ -343,7 +340,8 @@ public final Builder timeout(Function> fn) { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -353,7 +351,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -363,11 +361,9 @@ public final Builder versionType(@Nullable VersionType value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -377,11 +373,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the delete operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteScriptRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteScriptRequest.java index 7630e1800..c943e5841 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteScriptRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteScriptRequest.java @@ -56,7 +56,7 @@ // typedef: _global.delete_script.Request /** - * Deletes a script. + * Deletes a stored script or search template. * * @see API * specification @@ -86,7 +86,7 @@ public static DeleteScriptRequest of(Function * API name: {@code id} */ @@ -95,7 +95,8 @@ public final String id() { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -105,7 +106,8 @@ public final Time masterTimeout() { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -132,7 +134,7 @@ public static class Builder extends RequestBase.AbstractBuilder private Time timeout; /** - * Required - Script ID + * Required - Identifier for the stored script or search template. *

* API name: {@code id} */ @@ -142,7 +144,8 @@ public final Builder id(String value) { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -152,7 +155,8 @@ public final Builder masterTimeout(@Nullable Time value) { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -161,7 +165,8 @@ public final Builder masterTimeout(Function> f } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -171,7 +176,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsRequest.java index c906e15e1..b6713cd70 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsRequest.java @@ -63,7 +63,7 @@ // typedef: _global.exists.Request /** - * Returns information about whether a document exists in an index. + * Checks if a document in an index exists. * * @see API * specification @@ -125,8 +125,8 @@ public static ExistsRequest of(Function> f } /** - * True or false to return the _source field or not, or a list of fields to - * return + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -136,7 +136,7 @@ public final SourceConfigParam source() { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude in the response. *

* API name: {@code _source_excludes} */ @@ -145,7 +145,7 @@ public final List sourceExcludes() { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} */ @@ -154,7 +154,7 @@ public final List sourceIncludes() { } /** - * Required - The document ID + * Required - Identifier of the document. *

* API name: {@code id} */ @@ -163,7 +163,8 @@ public final String id() { } /** - * Required - The name of the index + * Required - Comma-separated list of data streams, indices, and aliases. + * Supports wildcards (*). *

* API name: {@code index} */ @@ -172,8 +173,8 @@ public final String index() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -183,7 +184,7 @@ public final String preference() { } /** - * Specify whether to perform the operation in realtime or search mode + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -193,7 +194,8 @@ public final Boolean realtime() { } /** - * Refresh the shard containing the document before performing the operation + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -203,7 +205,7 @@ public final Boolean refresh() { } /** - * Specific routing value + * Target the specified primary shard. *

* API name: {@code routing} */ @@ -213,7 +215,9 @@ public final String routing() { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} */ @@ -222,7 +226,8 @@ public final List storedFields() { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -232,7 +237,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -283,8 +288,8 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private VersionType versionType; /** - * True or false to return the _source field or not, or a list of fields to - * return + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -294,8 +299,8 @@ public final Builder source(@Nullable SourceConfigParam value) { } /** - * True or false to return the _source field or not, or a list of fields to - * return + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -304,7 +309,7 @@ public final Builder source(Function * API name: {@code _source_excludes} *

@@ -316,7 +321,7 @@ public final Builder sourceExcludes(List list) { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude in the response. *

* API name: {@code _source_excludes} *

@@ -328,7 +333,7 @@ public final Builder sourceExcludes(String value, String... values) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -340,7 +345,7 @@ public final Builder sourceIncludes(List list) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -352,7 +357,7 @@ public final Builder sourceIncludes(String value, String... values) { } /** - * Required - The document ID + * Required - Identifier of the document. *

* API name: {@code id} */ @@ -362,7 +367,8 @@ public final Builder id(String value) { } /** - * Required - The name of the index + * Required - Comma-separated list of data streams, indices, and aliases. + * Supports wildcards (*). *

* API name: {@code index} */ @@ -372,8 +378,8 @@ public final Builder index(String value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -383,7 +389,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specify whether to perform the operation in realtime or search mode + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -393,7 +399,8 @@ public final Builder realtime(@Nullable Boolean value) { } /** - * Refresh the shard containing the document before performing the operation + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -403,7 +410,7 @@ public final Builder refresh(@Nullable Boolean value) { } /** - * Specific routing value + * Target the specified primary shard. *

* API name: {@code routing} */ @@ -413,7 +420,9 @@ public final Builder routing(@Nullable String value) { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} *

@@ -425,7 +434,9 @@ public final Builder storedFields(List list) { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} *

@@ -437,7 +448,8 @@ public final Builder storedFields(String value, String... values) { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -447,7 +459,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsSourceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsSourceRequest.java index 76ade6e75..15c4579b2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsSourceRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExistsSourceRequest.java @@ -63,7 +63,7 @@ // typedef: _global.exists_source.Request /** - * Returns information about whether a document source exists in an index. + * Checks if a document's _source is stored. * * @see API * specification @@ -122,8 +122,8 @@ public static ExistsSourceRequest of(Functiontrue or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -133,7 +133,7 @@ public final SourceConfigParam source() { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude in the response. *

* API name: {@code _source_excludes} */ @@ -142,7 +142,7 @@ public final List sourceExcludes() { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} */ @@ -151,7 +151,7 @@ public final List sourceIncludes() { } /** - * Required - The document ID + * Required - Identifier of the document. *

* API name: {@code id} */ @@ -160,7 +160,8 @@ public final String id() { } /** - * Required - The name of the index + * Required - Comma-separated list of data streams, indices, and aliases. + * Supports wildcards (*). *

* API name: {@code index} */ @@ -169,8 +170,8 @@ public final String index() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -180,7 +181,7 @@ public final String preference() { } /** - * Specify whether to perform the operation in realtime or search mode + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -190,7 +191,8 @@ public final Boolean realtime() { } /** - * Refresh the shard containing the document before performing the operation + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -200,7 +202,7 @@ public final Boolean refresh() { } /** - * Specific routing value + * Target the specified primary shard. *

* API name: {@code routing} */ @@ -210,7 +212,8 @@ public final String routing() { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -220,7 +223,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -270,8 +273,8 @@ public static class Builder extends RequestBase.AbstractBuilder private VersionType versionType; /** - * True or false to return the _source field or not, or a list of fields to - * return + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -281,8 +284,8 @@ public final Builder source(@Nullable SourceConfigParam value) { } /** - * True or false to return the _source field or not, or a list of fields to - * return + * true or false to return the _source + * field or not, or a list of fields to return. *

* API name: {@code _source} */ @@ -291,7 +294,7 @@ public final Builder source(Function * API name: {@code _source_excludes} *

@@ -303,7 +306,7 @@ public final Builder sourceExcludes(List list) { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude in the response. *

* API name: {@code _source_excludes} *

@@ -315,7 +318,7 @@ public final Builder sourceExcludes(String value, String... values) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -327,7 +330,7 @@ public final Builder sourceIncludes(List list) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -339,7 +342,7 @@ public final Builder sourceIncludes(String value, String... values) { } /** - * Required - The document ID + * Required - Identifier of the document. *

* API name: {@code id} */ @@ -349,7 +352,8 @@ public final Builder id(String value) { } /** - * Required - The name of the index + * Required - Comma-separated list of data streams, indices, and aliases. + * Supports wildcards (*). *

* API name: {@code index} */ @@ -359,8 +363,8 @@ public final Builder index(String value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -370,7 +374,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specify whether to perform the operation in realtime or search mode + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -380,7 +384,8 @@ public final Builder realtime(@Nullable Boolean value) { } /** - * Refresh the shard containing the document before performing the operation + * If true, Elasticsearch refreshes all shards involved in the + * delete by query after the request completes. *

* API name: {@code refresh} */ @@ -390,7 +395,7 @@ public final Builder refresh(@Nullable Boolean value) { } /** - * Specific routing value + * Target the specified primary shard. *

* API name: {@code routing} */ @@ -400,7 +405,8 @@ public final Builder routing(@Nullable String value) { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -410,7 +416,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExplainRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExplainRequest.java index ed3c9fa02..4562fdd46 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExplainRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ExplainRequest.java @@ -63,7 +63,8 @@ // typedef: _global.explain.Request /** - * Returns information about why a specific matches (or doesn't match) a query. + * Returns information about why a specific document matches (or doesn’t match) + * a query. * * @see API * specification @@ -137,8 +138,8 @@ public static ExplainRequest of(Function> } /** - * True or false to return the _source field or not, or a list of fields to - * return + * True or false to return the _source field or not, or a list of + * fields to return. *

* API name: {@code _source} */ @@ -148,7 +149,7 @@ public final SourceConfigParam source() { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude from the response. *

* API name: {@code _source_excludes} */ @@ -157,7 +158,7 @@ public final List sourceExcludes() { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} */ @@ -166,8 +167,7 @@ public final List sourceIncludes() { } /** - * Specify whether wildcards and prefix queries in the query string query should - * be analyzed (default: false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -177,7 +177,8 @@ public final Boolean analyzeWildcard() { } /** - * The analyzer for the query string query + * Analyzer to use for the query string. This parameter can only be used when + * the q query string parameter is specified. *

* API name: {@code analyzer} */ @@ -187,7 +188,8 @@ public final String analyzer() { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -197,7 +199,7 @@ public final Operator defaultOperator() { } /** - * The default field for query string query (default: _all) + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -207,7 +209,7 @@ public final String df() { } /** - * Required - The document ID + * Required - Defines the document ID. *

* API name: {@code id} */ @@ -216,7 +218,8 @@ public final String id() { } /** - * Required - The name of the index + * Required - Index names used to limit the request. Only a single index name + * can be provided to this parameter. *

* API name: {@code index} */ @@ -225,8 +228,8 @@ public final String index() { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -236,8 +239,8 @@ public final Boolean lenient() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -247,7 +250,7 @@ public final String preference() { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -257,6 +260,8 @@ public final String q() { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ @Nullable @@ -265,7 +270,7 @@ public final Query query() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -275,7 +280,7 @@ public final String routing() { } /** - * A comma-separated list of stored fields to return in the response + * A comma-separated list of stored fields to return in the response. *

* API name: {@code stored_fields} */ @@ -353,8 +358,8 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private List storedFields; /** - * True or false to return the _source field or not, or a list of fields to - * return + * True or false to return the _source field or not, or a list of + * fields to return. *

* API name: {@code _source} */ @@ -364,8 +369,8 @@ public final Builder source(@Nullable SourceConfigParam value) { } /** - * True or false to return the _source field or not, or a list of fields to - * return + * True or false to return the _source field or not, or a list of + * fields to return. *

* API name: {@code _source} */ @@ -374,7 +379,7 @@ public final Builder source(Function * API name: {@code _source_excludes} *

@@ -386,7 +391,7 @@ public final Builder sourceExcludes(List list) { } /** - * A list of fields to exclude from the returned _source field + * A comma-separated list of source fields to exclude from the response. *

* API name: {@code _source_excludes} *

@@ -398,7 +403,7 @@ public final Builder sourceExcludes(String value, String... values) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -410,7 +415,7 @@ public final Builder sourceIncludes(List list) { } /** - * A list of fields to extract and return from the _source field + * A comma-separated list of source fields to include in the response. *

* API name: {@code _source_includes} *

@@ -422,8 +427,7 @@ public final Builder sourceIncludes(String value, String... values) { } /** - * Specify whether wildcards and prefix queries in the query string query should - * be analyzed (default: false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -433,7 +437,8 @@ public final Builder analyzeWildcard(@Nullable Boolean value) { } /** - * The analyzer for the query string query + * Analyzer to use for the query string. This parameter can only be used when + * the q query string parameter is specified. *

* API name: {@code analyzer} */ @@ -443,7 +448,8 @@ public final Builder analyzer(@Nullable String value) { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -453,7 +459,7 @@ public final Builder defaultOperator(@Nullable Operator value) { } /** - * The default field for query string query (default: _all) + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -463,7 +469,7 @@ public final Builder df(@Nullable String value) { } /** - * Required - The document ID + * Required - Defines the document ID. *

* API name: {@code id} */ @@ -473,7 +479,8 @@ public final Builder id(String value) { } /** - * Required - The name of the index + * Required - Index names used to limit the request. Only a single index name + * can be provided to this parameter. *

* API name: {@code index} */ @@ -483,8 +490,8 @@ public final Builder index(String value) { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -494,8 +501,8 @@ public final Builder lenient(@Nullable Boolean value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -505,7 +512,7 @@ public final Builder preference(@Nullable String value) { } /** - * Query in the Lucene query string syntax + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -515,6 +522,8 @@ public final Builder q(@Nullable String value) { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(@Nullable Query value) { @@ -523,6 +532,8 @@ public final Builder query(@Nullable Query value) { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(Function> fn) { @@ -530,7 +541,7 @@ public final Builder query(Function> fn) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -540,7 +551,7 @@ public final Builder routing(@Nullable String value) { } /** - * A comma-separated list of stored fields to return in the response + * A comma-separated list of stored fields to return in the response. *

* API name: {@code stored_fields} *

@@ -552,7 +563,7 @@ public final Builder storedFields(List list) { } /** - * A comma-separated list of stored fields to return in the response + * A comma-separated list of stored fields to return in the response. *

* API name: {@code stored_fields} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetRequest.java index 9edafa6f8..f576edff6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetRequest.java @@ -181,7 +181,7 @@ public final String preference() { } /** - * Boolean) If true, the request is real-time as opposed to near-real-time. + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -212,7 +212,9 @@ public final String routing() { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} */ @@ -383,7 +385,7 @@ public final Builder preference(@Nullable String value) { } /** - * Boolean) If true, the request is real-time as opposed to near-real-time. + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -414,7 +416,9 @@ public final Builder routing(@Nullable String value) { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} *

@@ -426,7 +430,9 @@ public final Builder storedFields(List list) { } /** - * A comma-separated list of stored fields to return in the response + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. *

* API name: {@code stored_fields} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetScriptRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetScriptRequest.java index f9b45b822..f0a1062c9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetScriptRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/GetScriptRequest.java @@ -56,7 +56,7 @@ // typedef: _global.get_script.Request /** - * Returns a script. + * Retrieves a stored script or search template. * * @see API * specification @@ -82,7 +82,7 @@ public static GetScriptRequest of(Function * API name: {@code id} */ @@ -115,7 +115,7 @@ public static class Builder extends RequestBase.AbstractBuilder private Time masterTimeout; /** - * Required - Script ID + * Required - Identifier for the stored script or search template. *

* API name: {@code id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/IndexRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/IndexRequest.java index 381e77d46..d6ab508fc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/IndexRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/IndexRequest.java @@ -69,7 +69,9 @@ // typedef: _global.index.Request /** - * Creates or updates a document in an index. + * Adds a JSON document to the specified data stream or index and makes it + * searchable. If the target is an index and the document already exists, the + * request updates the document and increments its version. * * @see API * specification @@ -147,7 +149,7 @@ public static IndexRequest of( } /** - * Document ID + * Unique identifier for the document. *

* API name: {@code id} */ @@ -157,8 +159,7 @@ public final String id() { } /** - * only perform the index operation if the last operation that has changed the - * document has the specified primary term + * Only perform the operation if the document has this primary term. *

* API name: {@code if_primary_term} */ @@ -168,8 +169,7 @@ public final Long ifPrimaryTerm() { } /** - * only perform the index operation if the last operation that has changed the - * document has the specified sequence number + * Only perform the operation if the document has this sequence number. *

* API name: {@code if_seq_no} */ @@ -179,7 +179,7 @@ public final Long ifSeqNo() { } /** - * Required - The name of the index + * Required - Name of the data stream or index to target. *

* API name: {@code index} */ @@ -188,9 +188,13 @@ public final String index() { } /** - * Explicit operation type. Defaults to index for requests with an - * explicit document ID, and to createfor requests without an - * explicit document ID + * Set to create to only index the document if it does not already exist (put if + * absent). If a document with the specified _id already exists, + * the indexing operation will fail. Same as using the + * <index>/_create endpoint. Valid values: + * index, create. If document id is specified, it + * defaults to index. Otherwise, it defaults to + * create. *

* API name: {@code op_type} */ @@ -200,7 +204,11 @@ public final OpType opType() { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -210,10 +218,11 @@ public final String pipeline() { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -223,7 +232,7 @@ public final Refresh refresh() { } /** - * When true, requires destination to be an alias. Default is false + * If true, the destination must be an index alias. *

* API name: {@code require_alias} */ @@ -233,7 +242,7 @@ public final Boolean requireAlias() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -243,7 +252,8 @@ public final String routing() { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -253,7 +263,8 @@ public final Time timeout() { } /** - * Explicit version number for concurrency control + * Explicit version number for concurrency control. The specified version must + * match the current version of the document for the request to succeed. *

* API name: {@code version} */ @@ -263,7 +274,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -273,11 +284,9 @@ public final VersionType versionType() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -354,7 +363,7 @@ public static class Builder extends RequestBase.AbstractBuilder tDocumentSerializer; /** - * Document ID + * Unique identifier for the document. *

* API name: {@code id} */ @@ -364,8 +373,7 @@ public final Builder id(@Nullable String value) { } /** - * only perform the index operation if the last operation that has changed the - * document has the specified primary term + * Only perform the operation if the document has this primary term. *

* API name: {@code if_primary_term} */ @@ -375,8 +383,7 @@ public final Builder ifPrimaryTerm(@Nullable Long value) { } /** - * only perform the index operation if the last operation that has changed the - * document has the specified sequence number + * Only perform the operation if the document has this sequence number. *

* API name: {@code if_seq_no} */ @@ -386,7 +393,7 @@ public final Builder ifSeqNo(@Nullable Long value) { } /** - * Required - The name of the index + * Required - Name of the data stream or index to target. *

* API name: {@code index} */ @@ -396,9 +403,13 @@ public final Builder index(String value) { } /** - * Explicit operation type. Defaults to index for requests with an - * explicit document ID, and to createfor requests without an - * explicit document ID + * Set to create to only index the document if it does not already exist (put if + * absent). If a document with the specified _id already exists, + * the indexing operation will fail. Same as using the + * <index>/_create endpoint. Valid values: + * index, create. If document id is specified, it + * defaults to index. Otherwise, it defaults to + * create. *

* API name: {@code op_type} */ @@ -408,7 +419,11 @@ public final Builder opType(@Nullable OpType value) { } /** - * The pipeline id to preprocess incoming documents with + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -418,10 +433,11 @@ public final Builder pipeline(@Nullable String value) { } /** - * If true then refresh the affected shards to make this operation - * visible to search, if wait_for then wait for a refresh to make - * this operation visible to search, if false (the default) then do - * nothing with refreshes. + * If true, Elasticsearch refreshes the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false do + * nothing with refreshes. Valid values: true, false, + * wait_for. *

* API name: {@code refresh} */ @@ -431,7 +447,7 @@ public final Builder refresh(@Nullable Refresh value) { } /** - * When true, requires destination to be an alias. Default is false + * If true, the destination must be an index alias. *

* API name: {@code require_alias} */ @@ -441,7 +457,7 @@ public final Builder requireAlias(@Nullable Boolean value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -451,7 +467,8 @@ public final Builder routing(@Nullable String value) { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -461,7 +478,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period the request waits for the following operations: automatic index + * creation, dynamic mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -470,7 +488,8 @@ public final Builder timeout(Function * API name: {@code version} */ @@ -480,7 +499,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type: external, external_gte. *

* API name: {@code version_type} */ @@ -490,11 +509,9 @@ public final Builder versionType(@Nullable VersionType value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -504,11 +521,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShard } /** - * Sets the number of shard copies that must be active before proceeding with - * the index operation. Defaults to 1, meaning the primary shard only. Set to - * all for all shard copies, otherwise set to any non-negative - * value less than or equal to the total number of copies for the shard (number - * of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total number of + * shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchTemplateRequest.java index 8190ca719..8f023d59d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchTemplateRequest.java @@ -107,8 +107,8 @@ public Iterator _serializables() { return this.searchTemplates.iterator(); } /** - * Indicates whether network round-trips should be minimized as part of - * cross-cluster search requests execution + * If true, network round-trips are minimized for cross-cluster + * search requests. *

* API name: {@code ccs_minimize_roundtrips} */ @@ -118,7 +118,9 @@ public final Boolean ccsMinimizeRoundtrips() { } /** - * A comma-separated list of index names to use as default + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use *. *

* API name: {@code index} */ @@ -127,8 +129,7 @@ public final List index() { } /** - * Controls the maximum number of concurrent searches the multi search api will - * execute + * Maximum number of concurrent searches the API can run. *

* API name: {@code max_concurrent_searches} */ @@ -138,7 +139,8 @@ public final Long maxConcurrentSearches() { } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ @@ -191,8 +193,8 @@ public static class Builder extends RequestBase.AbstractBuilder private List searchTemplates; /** - * Indicates whether network round-trips should be minimized as part of - * cross-cluster search requests execution + * If true, network round-trips are minimized for cross-cluster + * search requests. *

* API name: {@code ccs_minimize_roundtrips} */ @@ -202,7 +204,9 @@ public final Builder ccsMinimizeRoundtrips(@Nullable Boolean value) { } /** - * A comma-separated list of index names to use as default + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use *. *

* API name: {@code index} *

@@ -214,7 +218,9 @@ public final Builder index(List list) { } /** - * A comma-separated list of index names to use as default + * Comma-separated list of data streams, indices, and aliases to search. + * Supports wildcards (*). To search all data streams and indices, + * omit this parameter or use *. *

* API name: {@code index} *

@@ -226,8 +232,7 @@ public final Builder index(String value, String... values) { } /** - * Controls the maximum number of concurrent searches the multi search api will - * execute + * Maximum number of concurrent searches the API can run. *

* API name: {@code max_concurrent_searches} */ @@ -237,7 +242,8 @@ public final Builder maxConcurrentSearches(@Nullable Long value) { } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MtermvectorsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MtermvectorsRequest.java index e85d5c427..3c07cebd5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MtermvectorsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MtermvectorsRequest.java @@ -135,6 +135,8 @@ public static MtermvectorsRequest of(Function * API name: {@code docs} */ public final List docs() { @@ -142,9 +144,8 @@ public final List docs() { } /** - * Specifies if document count, sum of document frequencies and sum of total - * term frequencies should be returned. Applies to all returned documents unless - * otherwise specified in body "params" or "docs". + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. *

* API name: {@code field_statistics} */ @@ -154,8 +155,10 @@ public final Boolean fieldStatistics() { } /** - * A comma-separated list of fields to return. Applies to all returned documents - * unless otherwise specified in body "params" or "docs". + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} */ @@ -164,6 +167,9 @@ public final List fields() { } /** + * Simplified syntax to specify documents by their ID if they're in the same + * index. + *

* API name: {@code ids} */ public final List ids() { @@ -171,7 +177,7 @@ public final List ids() { } /** - * The index in which the document resides. + * Name of the index that contains the documents. *

* API name: {@code index} */ @@ -181,9 +187,7 @@ public final String index() { } /** - * Specifies if term offsets should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term offsets. *

* API name: {@code offsets} */ @@ -193,9 +197,7 @@ public final Boolean offsets() { } /** - * Specifies if term payloads should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term payloads. *

* API name: {@code payloads} */ @@ -205,9 +207,7 @@ public final Boolean payloads() { } /** - * Specifies if term positions should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term positions. *

* API name: {@code positions} */ @@ -217,9 +217,8 @@ public final Boolean positions() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) .Applies to all returned documents unless otherwise specified in body - * "params" or "docs". + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -229,8 +228,7 @@ public final String preference() { } /** - * Specifies if requests are real-time as opposed to near-real-time (default: - * true). + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -240,8 +238,7 @@ public final Boolean realtime() { } /** - * Specific routing value. Applies to all returned documents unless otherwise - * specified in body "params" or "docs". + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -251,9 +248,7 @@ public final String routing() { } /** - * Specifies if total term frequency and document frequency should be returned. - * Applies to all returned documents unless otherwise specified in body - * "params" or "docs". + * If true, the response includes term frequency and document frequency. *

* API name: {@code term_statistics} */ @@ -263,7 +258,7 @@ public final Boolean termStatistics() { } /** - * Explicit version number for concurrency control + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -273,7 +268,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type. *

* API name: {@code version_type} */ @@ -368,6 +363,8 @@ public static class Builder extends RequestBase.AbstractBuilder private VersionType versionType; /** + * Array of existing or artificial documents. + *

* API name: {@code docs} *

* Adds all elements of list to docs. @@ -378,6 +375,8 @@ public final Builder docs(List list) { } /** + * Array of existing or artificial documents. + *

* API name: {@code docs} *

* Adds one or more values to docs. @@ -388,6 +387,8 @@ public final Builder docs(MultiTermVectorsOperation value, MultiTermVectorsOpera } /** + * Array of existing or artificial documents. + *

* API name: {@code docs} *

* Adds a value to docs using a builder lambda. @@ -398,9 +399,8 @@ public final Builder docs( } /** - * Specifies if document count, sum of document frequencies and sum of total - * term frequencies should be returned. Applies to all returned documents unless - * otherwise specified in body "params" or "docs". + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. *

* API name: {@code field_statistics} */ @@ -410,8 +410,10 @@ public final Builder fieldStatistics(@Nullable Boolean value) { } /** - * A comma-separated list of fields to return. Applies to all returned documents - * unless otherwise specified in body "params" or "docs". + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} *

@@ -423,8 +425,10 @@ public final Builder fields(List list) { } /** - * A comma-separated list of fields to return. Applies to all returned documents - * unless otherwise specified in body "params" or "docs". + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} *

@@ -436,6 +440,9 @@ public final Builder fields(String value, String... values) { } /** + * Simplified syntax to specify documents by their ID if they're in the same + * index. + *

* API name: {@code ids} *

* Adds all elements of list to ids. @@ -446,6 +453,9 @@ public final Builder ids(List list) { } /** + * Simplified syntax to specify documents by their ID if they're in the same + * index. + *

* API name: {@code ids} *

* Adds one or more values to ids. @@ -456,7 +466,7 @@ public final Builder ids(String value, String... values) { } /** - * The index in which the document resides. + * Name of the index that contains the documents. *

* API name: {@code index} */ @@ -466,9 +476,7 @@ public final Builder index(@Nullable String value) { } /** - * Specifies if term offsets should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term offsets. *

* API name: {@code offsets} */ @@ -478,9 +486,7 @@ public final Builder offsets(@Nullable Boolean value) { } /** - * Specifies if term payloads should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term payloads. *

* API name: {@code payloads} */ @@ -490,9 +496,7 @@ public final Builder payloads(@Nullable Boolean value) { } /** - * Specifies if term positions should be returned. Applies to all returned - * documents unless otherwise specified in body "params" or - * "docs". + * If true, the response includes term positions. *

* API name: {@code positions} */ @@ -502,9 +506,8 @@ public final Builder positions(@Nullable Boolean value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) .Applies to all returned documents unless otherwise specified in body - * "params" or "docs". + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -514,8 +517,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specifies if requests are real-time as opposed to near-real-time (default: - * true). + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -525,8 +527,7 @@ public final Builder realtime(@Nullable Boolean value) { } /** - * Specific routing value. Applies to all returned documents unless otherwise - * specified in body "params" or "docs". + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -536,9 +537,7 @@ public final Builder routing(@Nullable String value) { } /** - * Specifies if total term frequency and document frequency should be returned. - * Applies to all returned documents unless otherwise specified in body - * "params" or "docs". + * If true, the response includes term frequency and document frequency. *

* API name: {@code term_statistics} */ @@ -548,7 +547,7 @@ public final Builder termStatistics(@Nullable Boolean value) { } /** - * Explicit version number for concurrency control + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -558,7 +557,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type. *

* API name: {@code version_type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeRequest.java index ccae8c324..5b9752c24 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/OpenPointInTimeRequest.java @@ -108,8 +108,12 @@ public static OpenPointInTimeRequest of(Function

* API name: {@code expand_wildcards} */ @@ -118,8 +122,8 @@ public final List expandWildcards() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -139,7 +143,7 @@ public final List index() { } /** - * Required - Specific the time to live for the point in time + * Required - Extends the time to live of the corresponding point in time. *

* API name: {@code keep_alive} */ @@ -148,8 +152,8 @@ public final Time keepAlive() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -159,7 +163,7 @@ public final String preference() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -194,8 +198,12 @@ public static class Builder extends RequestBase.AbstractBuilder private String routing; /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -207,8 +215,12 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -220,8 +232,8 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -257,7 +269,7 @@ public final Builder index(String value, String... values) { } /** - * Required - Specific the time to live for the point in time + * Required - Extends the time to live of the corresponding point in time. *

* API name: {@code keep_alive} */ @@ -267,7 +279,7 @@ public final Builder keepAlive(Time value) { } /** - * Required - Specific the time to live for the point in time + * Required - Extends the time to live of the corresponding point in time. *

* API name: {@code keep_alive} */ @@ -276,8 +288,8 @@ public final Builder keepAlive(Function> fn) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -287,7 +299,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/PutScriptRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/PutScriptRequest.java index 7d70556fe..2acff98fc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/PutScriptRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/PutScriptRequest.java @@ -59,7 +59,7 @@ // typedef: _global.put_script.Request /** - * Creates or updates a script. + * Creates or updates a stored script or search template. * * @see API * specification @@ -96,7 +96,8 @@ public static PutScriptRequest of(Function * API name: {@code context} */ @@ -106,7 +107,8 @@ public final String context() { } /** - * Required - Script ID + * Required - Identifier for the stored script or search template. Must be + * unique within the cluster. *

* API name: {@code id} */ @@ -115,7 +117,8 @@ public final String id() { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -125,14 +128,18 @@ public final Time masterTimeout() { } /** - * Required - API name: {@code script} + * Required - Contains the script or search template, its parameters, and its + * language. + *

+ * API name: {@code script} */ public final StoredScript script() { return this.script; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -180,7 +187,8 @@ public static class Builder extends RequestBase.AbstractBuilder private Time timeout; /** - * Script context + * Context in which the script or search template should run. To prevent errors, + * the API immediately compiles the script or template in this context. *

* API name: {@code context} */ @@ -190,7 +198,8 @@ public final Builder context(@Nullable String value) { } /** - * Required - Script ID + * Required - Identifier for the stored script or search template. Must be + * unique within the cluster. *

* API name: {@code id} */ @@ -200,7 +209,8 @@ public final Builder id(String value) { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -210,7 +220,8 @@ public final Builder masterTimeout(@Nullable Time value) { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. *

* API name: {@code master_timeout} */ @@ -219,7 +230,10 @@ public final Builder masterTimeout(Function> f } /** - * Required - API name: {@code script} + * Required - Contains the script or search template, its parameters, and its + * language. + *

+ * API name: {@code script} */ public final Builder script(StoredScript value) { this.script = value; @@ -227,14 +241,18 @@ public final Builder script(StoredScript value) { } /** - * Required - API name: {@code script} + * Required - Contains the script or search template, its parameters, and its + * language. + *

+ * API name: {@code script} */ public final Builder script(Function> fn) { return this.script(fn.apply(new StoredScript.Builder()).build()); } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -244,7 +262,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRethrottleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRethrottleRequest.java index b5121950f..d8148aa03 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRethrottleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRethrottleRequest.java @@ -56,7 +56,7 @@ // typedef: _global.reindex_rethrottle.Request /** - * Changes the number of requests per second for a particular Reindex operation. + * Copies documents from a source to a destination. * * @see API @@ -83,8 +83,7 @@ public static ReindexRethrottleRequest of(Function * API name: {@code requests_per_second} */ @@ -94,7 +93,7 @@ public final Float requestsPerSecond() { } /** - * Required - The task id to rethrottle + * Required - Identifier for the task. *

* API name: {@code task_id} */ @@ -117,8 +116,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String taskId; /** - * The throttle to set on this request in floating sub-requests per second. -1 - * means set no throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -128,7 +126,7 @@ public final Builder requestsPerSecond(@Nullable Float value) { } /** - * Required - The task id to rethrottle + * Required - Identifier for the task. *

* API name: {@code task_id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/RenderSearchTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/RenderSearchTemplateRequest.java index d2b41f7b6..702555736 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/RenderSearchTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/RenderSearchTemplateRequest.java @@ -59,7 +59,7 @@ // typedef: _global.render_search_template.Request /** - * Allows to use the Mustache language to pre-render a search definition. + * Renders a search template as a search request body. * * @see API @@ -102,7 +102,8 @@ public final String file() { } /** - * The id of the stored search template + * ID of the search template to render. If no source is specified, + * this or the id request body parameter is required. *

* API name: {@code id} */ @@ -112,6 +113,9 @@ public final String id() { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} */ public final Map params() { @@ -119,6 +123,11 @@ public final Map params() { } /** + * An inline search template. Supports the same parameters as the search API's + * request body. These parameters also support Mustache variables. If no + * id or <templated-id> is specified, this + * parameter is required. + *

* API name: {@code source} */ @Nullable @@ -191,7 +200,8 @@ public final Builder file(@Nullable String value) { } /** - * The id of the stored search template + * ID of the search template to render. If no source is specified, + * this or the id request body parameter is required. *

* API name: {@code id} */ @@ -201,6 +211,9 @@ public final Builder id(@Nullable String value) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds all entries of map to params. @@ -211,6 +224,9 @@ public final Builder params(Map map) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds an entry to params. @@ -221,6 +237,11 @@ public final Builder params(String key, JsonData value) { } /** + * An inline search template. Supports the same parameters as the search API's + * request body. These parameters also support Mustache variables. If no + * id or <templated-id> is specified, this + * parameter is required. + *

* API name: {@code source} */ public final Builder source(@Nullable String value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ScriptsPainlessExecuteRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ScriptsPainlessExecuteRequest.java index 439048a47..1f00be2c0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ScriptsPainlessExecuteRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ScriptsPainlessExecuteRequest.java @@ -57,7 +57,7 @@ // typedef: _global.scripts_painless_execute.Request /** - * Allows an arbitrary script to be executed and a result to be returned + * Runs a script and returns a result. * * @see API @@ -89,6 +89,8 @@ public static ScriptsPainlessExecuteRequest of(Function * API name: {@code context} */ @Nullable @@ -97,6 +99,8 @@ public final String context() { } /** + * Additional parameters for the context. + *

* API name: {@code context_setup} */ @Nullable @@ -105,6 +109,8 @@ public final PainlessContextSetup contextSetup() { } /** + * The Painless script to execute. + *

* API name: {@code script} */ @Nullable @@ -160,6 +166,8 @@ public static class Builder extends RequestBase.AbstractBuilder private InlineScript script; /** + * The context that the script should run in. + *

* API name: {@code context} */ public final Builder context(@Nullable String value) { @@ -168,6 +176,8 @@ public final Builder context(@Nullable String value) { } /** + * Additional parameters for the context. + *

* API name: {@code context_setup} */ public final Builder contextSetup(@Nullable PainlessContextSetup value) { @@ -176,6 +186,8 @@ public final Builder contextSetup(@Nullable PainlessContextSetup value) { } /** + * Additional parameters for the context. + *

* API name: {@code context_setup} */ public final Builder contextSetup( @@ -184,6 +196,8 @@ public final Builder contextSetup( } /** + * The Painless script to execute. + *

* API name: {@code script} */ public final Builder script(@Nullable InlineScript value) { @@ -192,6 +206,8 @@ public final Builder script(@Nullable InlineScript value) { } /** + * The Painless script to execute. + *

* API name: {@code script} */ public final Builder script(Function> fn) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java index 728e3b8af..db9894637 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java @@ -59,6 +59,7 @@ import java.lang.Integer; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -2215,6 +2216,78 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * Used to retrieve the next page of hits using a set of sort values from the + * previous page. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Used to retrieve the next page of hits using a set of sort values from the + * previous page. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Used to retrieve the next page of hits using a set of sort values from the + * previous page. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Used to retrieve the next page of hits using a set of sort values from the + * previous page. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * Used to retrieve the next page of hits using a set of sort values from the * previous page. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchShardsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchShardsRequest.java index 24ca604c0..7e57b903c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchShardsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchShardsRequest.java @@ -105,9 +105,12 @@ public static SearchShardsRequest of(Function_all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -117,8 +120,12 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} */ @@ -127,8 +134,8 @@ public final List expandWildcards() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -138,8 +145,8 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names to search; use _all or - * empty string to perform the operation on all indices + * Returns the indices and shards that a search request would be executed + * against. *

* API name: {@code index} */ @@ -148,8 +155,8 @@ public final List index() { } /** - * Return local information, do not retrieve the state from master node - * (default: false) + * If true, the request retrieves information from the local node + * only. *

* API name: {@code local} */ @@ -159,8 +166,8 @@ public final Boolean local() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -170,7 +177,7 @@ public final String preference() { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -210,9 +217,12 @@ public static class Builder extends RequestBase.AbstractBuilder private String routing; /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -222,8 +232,12 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -235,8 +249,12 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -248,8 +266,8 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -259,8 +277,8 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * A comma-separated list of index names to search; use _all or - * empty string to perform the operation on all indices + * Returns the indices and shards that a search request would be executed + * against. *

* API name: {@code index} *

@@ -272,8 +290,8 @@ public final Builder index(List list) { } /** - * A comma-separated list of index names to search; use _all or - * empty string to perform the operation on all indices + * Returns the indices and shards that a search request would be executed + * against. *

* API name: {@code index} *

@@ -285,8 +303,8 @@ public final Builder index(String value, String... values) { } /** - * Return local information, do not retrieve the state from master node - * (default: false) + * If true, the request retrieves information from the local node + * only. *

* API name: {@code local} */ @@ -296,8 +314,8 @@ public final Builder local(@Nullable Boolean value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -307,7 +325,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specific routing value + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchTemplateRequest.java index bc0343119..64bc1b3c8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchTemplateRequest.java @@ -64,7 +64,7 @@ // typedef: _global.search_template.Request /** - * Allows to use the Mustache language to pre-render a search definition. + * Runs a search with a search template. * * @see API * specification @@ -140,9 +140,12 @@ public static SearchTemplateRequest of(Function_all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -152,8 +155,8 @@ public final Boolean allowNoIndices() { } /** - * Indicates whether network round-trips should be minimized as part of - * cross-cluster search requests execution + * If true, network round-trips are minimized for cross-cluster + * search requests. *

* API name: {@code ccs_minimize_roundtrips} */ @@ -163,8 +166,12 @@ public final Boolean ccsMinimizeRoundtrips() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} */ @@ -173,6 +180,9 @@ public final List expandWildcards() { } /** + * If true, returns detailed information about score calculation as + * part of each hit. + *

* API name: {@code explain} */ @Nullable @@ -192,8 +202,8 @@ public final String id() { } /** - * Whether specified concrete, expanded or aliased indices should be ignored - * when throttled + * If true, specified concrete, expanded, or aliased indices are + * not included in the response when throttled. *

* API name: {@code ignore_throttled} */ @@ -203,8 +213,8 @@ public final Boolean ignoreThrottled() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -224,6 +234,9 @@ public final List index() { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} */ public final Map params() { @@ -231,8 +244,8 @@ public final Map params() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -242,6 +255,8 @@ public final String preference() { } /** + * If true, the query execution is profiled. + *

* API name: {@code profile} */ @Nullable @@ -392,9 +407,12 @@ public static class Builder extends RequestBase.AbstractBuilder private String source; /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -404,8 +422,8 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Indicates whether network round-trips should be minimized as part of - * cross-cluster search requests execution + * If true, network round-trips are minimized for cross-cluster + * search requests. *

* API name: {@code ccs_minimize_roundtrips} */ @@ -415,8 +433,12 @@ public final Builder ccsMinimizeRoundtrips(@Nullable Boolean value) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -428,8 +450,12 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -441,6 +467,9 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val } /** + * If true, returns detailed information about score calculation as + * part of each hit. + *

* API name: {@code explain} */ public final Builder explain(@Nullable Boolean value) { @@ -460,8 +489,8 @@ public final Builder id(@Nullable String value) { } /** - * Whether specified concrete, expanded or aliased indices should be ignored - * when throttled + * If true, specified concrete, expanded, or aliased indices are + * not included in the response when throttled. *

* API name: {@code ignore_throttled} */ @@ -471,8 +500,8 @@ public final Builder ignoreThrottled(@Nullable Boolean value) { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -508,6 +537,9 @@ public final Builder index(String value, String... values) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds all entries of map to params. @@ -518,6 +550,9 @@ public final Builder params(Map map) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds an entry to params. @@ -528,8 +563,8 @@ public final Builder params(String key, JsonData value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -539,6 +574,8 @@ public final Builder preference(@Nullable String value) { } /** + * If true, the query execution is profiled. + *

* API name: {@code profile} */ public final Builder profile(@Nullable Boolean value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/TermvectorsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/TermvectorsRequest.java index 9edc6547c..7233b315e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/TermvectorsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/TermvectorsRequest.java @@ -153,6 +153,9 @@ public static TermvectorsRequest of( } /** + * An artificial document (a document not present in the index) for which you + * want to retrieve term vectors. + *

* API name: {@code doc} */ @Nullable @@ -161,8 +164,8 @@ public final TDocument doc() { } /** - * Specifies if document count, sum of document frequencies and sum of total - * term frequencies should be returned. + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. *

* API name: {@code field_statistics} */ @@ -172,7 +175,10 @@ public final Boolean fieldStatistics() { } /** - * A comma-separated list of fields to return. + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} */ @@ -181,6 +187,8 @@ public final List fields() { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ @Nullable @@ -189,7 +197,7 @@ public final Filter filter() { } /** - * The id of the document, when not specified a doc param should be supplied. + * Unique identifier of the document. *

* API name: {@code id} */ @@ -199,7 +207,7 @@ public final String id() { } /** - * Required - The index in which the document resides. + * Required - Name of the index that contains the document. *

* API name: {@code index} */ @@ -208,7 +216,7 @@ public final String index() { } /** - * Specifies if term offsets should be returned. + * If true, the response includes term offsets. *

* API name: {@code offsets} */ @@ -218,7 +226,7 @@ public final Boolean offsets() { } /** - * Specifies if term payloads should be returned. + * If true, the response includes term payloads. *

* API name: {@code payloads} */ @@ -228,6 +236,8 @@ public final Boolean payloads() { } /** + * Overrides the default per-field analyzer. + *

* API name: {@code per_field_analyzer} */ public final Map perFieldAnalyzer() { @@ -235,7 +245,7 @@ public final Map perFieldAnalyzer() { } /** - * Specifies if term positions should be returned. + * If true, the response includes term positions. *

* API name: {@code positions} */ @@ -245,8 +255,8 @@ public final Boolean positions() { } /** - * Specify the node or shard the operation should be performed on (default: - * random). + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -256,8 +266,7 @@ public final String preference() { } /** - * Specifies if request is real-time as opposed to near-real-time (default: - * true). + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -267,7 +276,7 @@ public final Boolean realtime() { } /** - * Specific routing value. + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -277,7 +286,8 @@ public final String routing() { } /** - * Specifies if total term frequency and document frequency should be returned. + * If true, the response includes term frequency and document + * frequency. *

* API name: {@code term_statistics} */ @@ -287,7 +297,7 @@ public final Boolean termStatistics() { } /** - * Explicit version number for concurrency control + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -297,7 +307,7 @@ public final Long version() { } /** - * Specific version type + * Specific version type. *

* API name: {@code version_type} */ @@ -401,6 +411,9 @@ public static class Builder extends RequestBase.AbstractBuilder tDocumentSerializer; /** + * An artificial document (a document not present in the index) for which you + * want to retrieve term vectors. + *

* API name: {@code doc} */ public final Builder doc(@Nullable TDocument value) { @@ -409,8 +422,8 @@ public final Builder doc(@Nullable TDocument value) { } /** - * Specifies if document count, sum of document frequencies and sum of total - * term frequencies should be returned. + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. *

* API name: {@code field_statistics} */ @@ -420,7 +433,10 @@ public final Builder fieldStatistics(@Nullable Boolean value) { } /** - * A comma-separated list of fields to return. + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} *

@@ -432,7 +448,10 @@ public final Builder fields(List list) { } /** - * A comma-separated list of fields to return. + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. *

* API name: {@code fields} *

@@ -444,6 +463,8 @@ public final Builder fields(String value, String... values) { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ public final Builder filter(@Nullable Filter value) { @@ -452,6 +473,8 @@ public final Builder filter(@Nullable Filter value) { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ public final Builder filter(Function> fn) { @@ -459,7 +482,7 @@ public final Builder filter(Function * API name: {@code id} */ @@ -469,7 +492,7 @@ public final Builder id(@Nullable String value) { } /** - * Required - The index in which the document resides. + * Required - Name of the index that contains the document. *

* API name: {@code index} */ @@ -479,7 +502,7 @@ public final Builder index(String value) { } /** - * Specifies if term offsets should be returned. + * If true, the response includes term offsets. *

* API name: {@code offsets} */ @@ -489,7 +512,7 @@ public final Builder offsets(@Nullable Boolean value) { } /** - * Specifies if term payloads should be returned. + * If true, the response includes term payloads. *

* API name: {@code payloads} */ @@ -499,6 +522,8 @@ public final Builder payloads(@Nullable Boolean value) { } /** + * Overrides the default per-field analyzer. + *

* API name: {@code per_field_analyzer} *

* Adds all entries of map to perFieldAnalyzer. @@ -509,6 +534,8 @@ public final Builder perFieldAnalyzer(Map map) { } /** + * Overrides the default per-field analyzer. + *

* API name: {@code per_field_analyzer} *

* Adds an entry to perFieldAnalyzer. @@ -519,7 +546,7 @@ public final Builder perFieldAnalyzer(String key, String value) { } /** - * Specifies if term positions should be returned. + * If true, the response includes term positions. *

* API name: {@code positions} */ @@ -529,8 +556,8 @@ public final Builder positions(@Nullable Boolean value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random). + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -540,8 +567,7 @@ public final Builder preference(@Nullable String value) { } /** - * Specifies if request is real-time as opposed to near-real-time (default: - * true). + * If true, the request is real-time as opposed to near-real-time. *

* API name: {@code realtime} */ @@ -551,7 +577,7 @@ public final Builder realtime(@Nullable Boolean value) { } /** - * Specific routing value. + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -561,7 +587,8 @@ public final Builder routing(@Nullable String value) { } /** - * Specifies if total term frequency and document frequency should be returned. + * If true, the response includes term frequency and document + * frequency. *

* API name: {@code term_statistics} */ @@ -571,7 +598,7 @@ public final Builder termStatistics(@Nullable Boolean value) { } /** - * Explicit version number for concurrency control + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -581,7 +608,7 @@ public final Builder version(@Nullable Long value) { } /** - * Specific version type + * Specific version type. *

* API name: {@code version_type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java index 3ec1d1d82..fb314ace8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java @@ -72,8 +72,9 @@ // typedef: _global.update_by_query.Request /** - * Performs an update on every document in the index without changing the - * source, for example to pick up a mapping change. + * Updates documents that match the specified query. If no query is specified, + * performs an update on every document in the data stream or index without + * modifying the source, which is useful for picking up mapping changes. * * @see API * specification @@ -224,9 +225,12 @@ public static UpdateByQueryRequest of(Function_all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -236,8 +240,7 @@ public final Boolean allowNoIndices() { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -247,7 +250,7 @@ public final Boolean analyzeWildcard() { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. *

* API name: {@code analyzer} */ @@ -257,6 +260,9 @@ public final String analyzer() { } /** + * What to do if update by query hits version conflicts: abort or + * proceed. + *

* API name: {@code conflicts} */ @Nullable @@ -265,7 +271,8 @@ public final Conflicts conflicts() { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -275,8 +282,7 @@ public final Operator defaultOperator() { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -286,8 +292,12 @@ public final String df() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} */ @@ -306,8 +316,8 @@ public final Long from() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -317,8 +327,9 @@ public final Boolean ignoreUnavailable() { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} */ @@ -327,8 +338,8 @@ public final List index() { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -338,6 +349,8 @@ public final Boolean lenient() { } /** + * The maximum number of documents to update. + *

* API name: {@code max_docs} */ @Nullable @@ -346,7 +359,11 @@ public final Long maxDocs() { } /** - * Ingest pipeline to set on index requests made by this action. (default: none) + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -356,8 +373,8 @@ public final String pipeline() { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -367,6 +384,8 @@ public final String preference() { } /** + * Specifies the documents to update using the Query DSL. + *

* API name: {@code query} */ @Nullable @@ -375,7 +394,8 @@ public final Query query() { } /** - * Should the affected indexes be refreshed? + * If true, Elasticsearch refreshes affected shards to make the + * operation visible to search. *

* API name: {@code refresh} */ @@ -385,8 +405,7 @@ public final Boolean refresh() { } /** - * Specify if request cache should be used for this request or not, defaults to - * index level setting + * If true, the request cache is used for this request. *

* API name: {@code request_cache} */ @@ -396,8 +415,7 @@ public final Boolean requestCache() { } /** - * The throttle to set on this request in sub-requests per second. -1 means no - * throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -407,7 +425,7 @@ public final Float requestsPerSecond() { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -417,6 +435,8 @@ public final String routing() { } /** + * The script to run to update the document source or metadata when updating. + *

* API name: {@code script} */ @Nullable @@ -425,8 +445,7 @@ public final Script script() { } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -436,7 +455,7 @@ public final Time scroll() { } /** - * Size on the scroll request powering the update by query + * Size of the scroll request that powers the operation. *

* API name: {@code scroll_size} */ @@ -446,7 +465,7 @@ public final Long scrollSize() { } /** - * Explicit timeout for each search request. Defaults to no timeout. + * Explicit timeout for each search request. *

* API name: {@code search_timeout} */ @@ -456,7 +475,8 @@ public final Time searchTimeout() { } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ @@ -466,6 +486,9 @@ public final SearchType searchType() { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ @Nullable @@ -474,8 +497,7 @@ public final SlicedScroll slice() { } /** - * The number of slices this task should be divided into. Defaults to 1, meaning - * the task isn't sliced into subtasks. Can be set to auto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -485,7 +507,7 @@ public final Slices slices() { } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} */ @@ -494,7 +516,8 @@ public final List sort() { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} */ @@ -503,8 +526,13 @@ public final List stats() { } /** - * The maximum number of documents to collect for each shard, upon reaching - * which the query execution will terminate early. + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Use with caution. Elasticsearch applies this + * parameter to each shard handling the request. When possible, let + * Elasticsearch perform early termination automatically. Avoid specifying this + * parameter for requests that target data streams with backing indices across + * multiple data tiers. *

* API name: {@code terminate_after} */ @@ -514,8 +542,8 @@ public final Long terminateAfter() { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each update request waits for the following operations: dynamic + * mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -525,7 +553,7 @@ public final Time timeout() { } /** - * Specify whether to return document version as part of a hit + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -546,11 +574,9 @@ public final Boolean versionType() { } /** - * Sets the number of shard copies that must be active before proceeding with - * the update by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -560,8 +586,7 @@ public final WaitForActiveShards waitForActiveShards() { } /** - * Should the request should block until the update by query operation is - * complete. + * If true, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} */ @@ -719,9 +744,12 @@ public static class Builder extends RequestBase.AbstractBuilder private Boolean waitForCompletion; /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard + * expression, index alias, or _all value targets only missing or + * closed indices. This behavior applies even if the request targets other open + * indices. For example, a request targeting foo*,bar* returns an + * error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} */ @@ -731,8 +759,7 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Specify whether wildcard and prefix queries should be analyzed (default: - * false) + * If true, wildcard and prefix queries are analyzed. *

* API name: {@code analyze_wildcard} */ @@ -742,7 +769,7 @@ public final Builder analyzeWildcard(@Nullable Boolean value) { } /** - * The analyzer to use for the query string + * Analyzer to use for the query string. *

* API name: {@code analyzer} */ @@ -752,6 +779,9 @@ public final Builder analyzer(@Nullable String value) { } /** + * What to do if update by query hits version conflicts: abort or + * proceed. + *

* API name: {@code conflicts} */ public final Builder conflicts(@Nullable Conflicts value) { @@ -760,7 +790,8 @@ public final Builder conflicts(@Nullable Conflicts value) { } /** - * The default operator for query string query (AND or OR) + * The default operator for query string query: AND or + * OR. *

* API name: {@code default_operator} */ @@ -770,8 +801,7 @@ public final Builder defaultOperator(@Nullable Operator value) { } /** - * The field to use as default where no field prefix is given in the query - * string + * Field to use as default where no field prefix is given in the query string. *

* API name: {@code df} */ @@ -781,8 +811,12 @@ public final Builder df(@Nullable String value) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -794,8 +828,12 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. *

* API name: {@code expand_wildcards} *

@@ -817,8 +855,8 @@ public final Builder from(@Nullable Long value) { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing + * or closed index. *

* API name: {@code ignore_unavailable} */ @@ -828,8 +866,9 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -841,8 +880,9 @@ public final Builder index(List list) { } /** - * Required - A comma-separated list of index names to search; use - * _all or empty string to perform the operation on all indices + * Required - Comma-separated list of data streams, indices, and aliases to + * search. Supports wildcards (*). To search all data streams or + * indices, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -854,8 +894,8 @@ public final Builder index(String value, String... values) { } /** - * Specify whether format-based query failures (such as providing text to a - * numeric field) should be ignored + * If true, format-based query failures (such as providing text to + * a numeric field) in the query string will be ignored. *

* API name: {@code lenient} */ @@ -865,6 +905,8 @@ public final Builder lenient(@Nullable Boolean value) { } /** + * The maximum number of documents to update. + *

* API name: {@code max_docs} */ public final Builder maxDocs(@Nullable Long value) { @@ -873,7 +915,11 @@ public final Builder maxDocs(@Nullable Long value) { } /** - * Ingest pipeline to set on index requests made by this action. (default: none) + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. *

* API name: {@code pipeline} */ @@ -883,8 +929,8 @@ public final Builder pipeline(@Nullable String value) { } /** - * Specify the node or shard the operation should be performed on (default: - * random) + * Specifies the node or shard the operation should be performed on. Random by + * default. *

* API name: {@code preference} */ @@ -894,6 +940,8 @@ public final Builder preference(@Nullable String value) { } /** + * Specifies the documents to update using the Query DSL. + *

* API name: {@code query} */ public final Builder query(@Nullable Query value) { @@ -902,6 +950,8 @@ public final Builder query(@Nullable Query value) { } /** + * Specifies the documents to update using the Query DSL. + *

* API name: {@code query} */ public final Builder query(Function> fn) { @@ -909,7 +959,8 @@ public final Builder query(Function> fn) { } /** - * Should the affected indexes be refreshed? + * If true, Elasticsearch refreshes affected shards to make the + * operation visible to search. *

* API name: {@code refresh} */ @@ -919,8 +970,7 @@ public final Builder refresh(@Nullable Boolean value) { } /** - * Specify if request cache should be used for this request or not, defaults to - * index level setting + * If true, the request cache is used for this request. *

* API name: {@code request_cache} */ @@ -930,8 +980,7 @@ public final Builder requestCache(@Nullable Boolean value) { } /** - * The throttle to set on this request in sub-requests per second. -1 means no - * throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -941,7 +990,7 @@ public final Builder requestsPerSecond(@Nullable Float value) { } /** - * A comma-separated list of specific routing values + * Custom value used to route operations to a specific shard. *

* API name: {@code routing} */ @@ -951,6 +1000,8 @@ public final Builder routing(@Nullable String value) { } /** + * The script to run to update the document source or metadata when updating. + *

* API name: {@code script} */ public final Builder script(@Nullable Script value) { @@ -959,6 +1010,8 @@ public final Builder script(@Nullable Script value) { } /** + * The script to run to update the document source or metadata when updating. + *

* API name: {@code script} */ public final Builder script(Function> fn) { @@ -966,8 +1019,7 @@ public final Builder script(Function> fn) } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -977,8 +1029,7 @@ public final Builder scroll(@Nullable Time value) { } /** - * Specify how long a consistent view of the index should be maintained for - * scrolled search + * Period to retain the search context for scrolling. *

* API name: {@code scroll} */ @@ -987,7 +1038,7 @@ public final Builder scroll(Function> fn) { } /** - * Size on the scroll request powering the update by query + * Size of the scroll request that powers the operation. *

* API name: {@code scroll_size} */ @@ -997,7 +1048,7 @@ public final Builder scrollSize(@Nullable Long value) { } /** - * Explicit timeout for each search request. Defaults to no timeout. + * Explicit timeout for each search request. *

* API name: {@code search_timeout} */ @@ -1007,7 +1058,7 @@ public final Builder searchTimeout(@Nullable Time value) { } /** - * Explicit timeout for each search request. Defaults to no timeout. + * Explicit timeout for each search request. *

* API name: {@code search_timeout} */ @@ -1016,7 +1067,8 @@ public final Builder searchTimeout(Function> f } /** - * Search operation type + * The type of the search operation. Available options: + * query_then_fetch, dfs_query_then_fetch. *

* API name: {@code search_type} */ @@ -1026,6 +1078,9 @@ public final Builder searchType(@Nullable SearchType value) { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ public final Builder slice(@Nullable SlicedScroll value) { @@ -1034,6 +1089,9 @@ public final Builder slice(@Nullable SlicedScroll value) { } /** + * Slice the request manually using the provided slice ID and total number of + * slices. + *

* API name: {@code slice} */ public final Builder slice(Function> fn) { @@ -1041,8 +1099,7 @@ public final Builder slice(Functionauto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -1052,8 +1109,7 @@ public final Builder slices(@Nullable Slices value) { } /** - * The number of slices this task should be divided into. Defaults to 1, meaning - * the task isn't sliced into subtasks. Can be set to auto. + * The number of slices this task should be divided into. *

* API name: {@code slices} */ @@ -1062,7 +1118,7 @@ public final Builder slices(Function> fn) } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} *

@@ -1074,7 +1130,7 @@ public final Builder sort(List list) { } /** - * A comma-separated list of <field>:<direction> pairs + * A comma-separated list of <field>:<direction> pairs. *

* API name: {@code sort} *

@@ -1086,7 +1142,8 @@ public final Builder sort(String value, String... values) { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} *

@@ -1098,7 +1155,8 @@ public final Builder stats(List list) { } /** - * Specific 'tag' of the request for logging and statistical purposes + * Specific tag of the request for logging and statistical + * purposes. *

* API name: {@code stats} *

@@ -1110,8 +1168,13 @@ public final Builder stats(String value, String... values) { } /** - * The maximum number of documents to collect for each shard, upon reaching - * which the query execution will terminate early. + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Use with caution. Elasticsearch applies this + * parameter to each shard handling the request. When possible, let + * Elasticsearch perform early termination automatically. Avoid specifying this + * parameter for requests that target data streams with backing indices across + * multiple data tiers. *

* API name: {@code terminate_after} */ @@ -1121,8 +1184,8 @@ public final Builder terminateAfter(@Nullable Long value) { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each update request waits for the following operations: dynamic + * mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -1132,8 +1195,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Time each individual bulk request should wait for shards that are - * unavailable. + * Period each update request waits for the following operations: dynamic + * mapping updates, waiting for active shards. *

* API name: {@code timeout} */ @@ -1142,7 +1205,7 @@ public final Builder timeout(Function> fn) { } /** - * Specify whether to return document version as part of a hit + * If true, returns the document version as part of a hit. *

* API name: {@code version} */ @@ -1163,11 +1226,9 @@ public final Builder versionType(@Nullable Boolean value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the update by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -1177,11 +1238,9 @@ public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { } /** - * Sets the number of shard copies that must be active before proceeding with - * the update by query operation. Defaults to 1, meaning the primary shard only. - * Set to all for all shard copies, otherwise set to any - * non-negative value less than or equal to the total number of copies for the - * shard (number of replicas + 1) + * The number of shard copies that must be active before proceeding with the + * operation. Set to all or any positive integer up to the total + * number of shards in the index (number_of_replicas+1). *

* API name: {@code wait_for_active_shards} */ @@ -1191,8 +1250,7 @@ public final Builder waitForActiveShards( } /** - * Should the request should block until the update by query operation is - * complete. + * If true, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java index 8330d6c39..e7a920fe3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java @@ -85,8 +85,7 @@ public static UpdateByQueryRethrottleRequest of( } /** - * The throttle to set on this request in floating sub-requests per second. -1 - * means set no throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -96,7 +95,7 @@ public final Float requestsPerSecond() { } /** - * Required - The task id to rethrottle + * Required - The ID for the task. *

* API name: {@code task_id} */ @@ -119,8 +118,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String taskId; /** - * The throttle to set on this request in floating sub-requests per second. -1 - * means set no throttle. + * The throttle for this request in sub-requests per second. *

* API name: {@code requests_per_second} */ @@ -130,7 +128,7 @@ public final Builder requestsPerSecond(@Nullable Float value) { } /** - * Required - The task id to rethrottle + * Required - The ID for the task. *

* API name: {@code task_id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java index 4332c9255..2de061b70 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java @@ -95,6 +95,8 @@ protected BulkOperationBase(AbstractBuilder builder) { } /** + * The document ID. + *

* API name: {@code _id} */ @Nullable @@ -103,6 +105,8 @@ public final String id() { } /** + * Name of the index or index alias to perform the action on. + *

* API name: {@code _index} */ @Nullable @@ -111,6 +115,8 @@ public final String index() { } /** + * Custom value used to route operations to a specific shard. + *

* API name: {@code routing} */ @Nullable @@ -228,6 +234,8 @@ public abstract static class AbstractBuilder * API name: {@code _id} */ public final BuilderT id(@Nullable String value) { @@ -236,6 +244,8 @@ public final BuilderT id(@Nullable String value) { } /** + * Name of the index or index alias to perform the action on. + *

* API name: {@code _index} */ public final BuilderT index(@Nullable String value) { @@ -244,6 +254,8 @@ public final BuilderT index(@Nullable String value) { } /** + * Custom value used to route operations to a specific shard. + *

* API name: {@code routing} */ public final BuilderT routing(@Nullable String value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java index a43fcc4ff..ee9343ad8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java @@ -133,6 +133,8 @@ public final OperationType operationType() { } /** + * The document ID associated with the operation. + *

* API name: {@code _id} */ @Nullable @@ -141,20 +143,29 @@ public final String id() { } /** - * Required - API name: {@code _index} + * Required - Name of the index associated with the operation. If the operation + * targeted a data stream, this is the backing index into which the document was + * written. + *

+ * API name: {@code _index} */ public final String index() { return this.index; } /** - * Required - API name: {@code status} + * Required - HTTP status code returned for the operation. + *

+ * API name: {@code status} */ public final int status() { return this.status; } /** + * Contains additional information about the failed operation. The parameter is + * only returned for failed operations. + *

* API name: {@code error} */ @Nullable @@ -163,6 +174,8 @@ public final ErrorCause error() { } /** + * The primary term assigned to the document for the operation. + *

* API name: {@code _primary_term} */ @Nullable @@ -171,6 +184,9 @@ public final Long primaryTerm() { } /** + * Result of the operation. Successful values are created, + * deleted, and updated. + *

* API name: {@code result} */ @Nullable @@ -179,6 +195,10 @@ public final String result() { } /** + * The sequence number assigned to the document for the operation. Sequence + * numbers are used to ensure an older version of a document doesn’t overwrite a + * newer version. + *

* API name: {@code _seq_no} */ @Nullable @@ -187,6 +207,8 @@ public final Long seqNo() { } /** + * Contains shard information for the operation. + *

* API name: {@code _shards} */ @Nullable @@ -195,6 +217,9 @@ public final ShardStatistics shards() { } /** + * The document version associated with the operation. The document version is + * incremented each time the document is updated. + *

* API name: {@code _version} */ @Nullable @@ -340,6 +365,8 @@ public final Builder operationType(OperationType value) { private InlineGet> get; /** + * The document ID associated with the operation. + *

* API name: {@code _id} */ public final Builder id(@Nullable String value) { @@ -348,7 +375,11 @@ public final Builder id(@Nullable String value) { } /** - * Required - API name: {@code _index} + * Required - Name of the index associated with the operation. If the operation + * targeted a data stream, this is the backing index into which the document was + * written. + *

+ * API name: {@code _index} */ public final Builder index(String value) { this.index = value; @@ -356,7 +387,9 @@ public final Builder index(String value) { } /** - * Required - API name: {@code status} + * Required - HTTP status code returned for the operation. + *

+ * API name: {@code status} */ public final Builder status(int value) { this.status = value; @@ -364,6 +397,9 @@ public final Builder status(int value) { } /** + * Contains additional information about the failed operation. The parameter is + * only returned for failed operations. + *

* API name: {@code error} */ public final Builder error(@Nullable ErrorCause value) { @@ -372,6 +408,9 @@ public final Builder error(@Nullable ErrorCause value) { } /** + * Contains additional information about the failed operation. The parameter is + * only returned for failed operations. + *

* API name: {@code error} */ public final Builder error(Function> fn) { @@ -379,6 +418,8 @@ public final Builder error(Function * API name: {@code _primary_term} */ public final Builder primaryTerm(@Nullable Long value) { @@ -387,6 +428,9 @@ public final Builder primaryTerm(@Nullable Long value) { } /** + * Result of the operation. Successful values are created, + * deleted, and updated. + *

* API name: {@code result} */ public final Builder result(@Nullable String value) { @@ -395,6 +439,10 @@ public final Builder result(@Nullable String value) { } /** + * The sequence number assigned to the document for the operation. Sequence + * numbers are used to ensure an older version of a document doesn’t overwrite a + * newer version. + *

* API name: {@code _seq_no} */ public final Builder seqNo(@Nullable Long value) { @@ -403,6 +451,8 @@ public final Builder seqNo(@Nullable Long value) { } /** + * Contains shard information for the operation. + *

* API name: {@code _shards} */ public final Builder shards(@Nullable ShardStatistics value) { @@ -411,6 +461,8 @@ public final Builder shards(@Nullable ShardStatistics value) { } /** + * Contains shard information for the operation. + *

* API name: {@code _shards} */ public final Builder shards(Function> fn) { @@ -418,6 +470,9 @@ public final Builder shards(Function * API name: {@code _version} */ public final Builder version(@Nullable Long value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java index 0becb3367..bd060c89d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java @@ -137,6 +137,8 @@ public Iterator _serializables() { } /** + * If true, the request’s actions must target an index alias. + *

* API name: {@code require_alias} */ @Nullable @@ -231,6 +233,8 @@ public final Builder binaryAction(@Nullable BinaryD private JsonpSerializer tPartialDocumentSerializer; /** + * If true, the request’s actions must target an index alias. + *

* API name: {@code require_alias} */ public final Builder requireAlias(@Nullable Boolean value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java index edb954583..776d62830 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java @@ -78,6 +78,12 @@ protected WriteOperation(AbstractBuilder builder) { } /** + * A map from the full name of fields to the name of dynamic templates. Defaults + * to an empty map. If a name matches a dynamic template, then that template + * will be applied regardless of other match predicates defined in the template. + * If a field is already defined in the mapping, then this parameter won’t be + * used. + *

* API name: {@code dynamic_templates} */ public final Map dynamicTemplates() { @@ -85,6 +91,12 @@ public final Map dynamicTemplates() { } /** + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. + *

* API name: {@code pipeline} */ @Nullable @@ -93,6 +105,8 @@ public final String pipeline() { } /** + * If true, the request’s actions must target an index alias. + *

* API name: {@code require_alias} */ @Nullable @@ -140,6 +154,12 @@ public abstract static class AbstractBuilder * API name: {@code dynamic_templates} *

* Adds all entries of map to dynamicTemplates. @@ -150,6 +170,12 @@ public final BuilderT dynamicTemplates(Map map) { } /** + * A map from the full name of fields to the name of dynamic templates. Defaults + * to an empty map. If a name matches a dynamic template, then that template + * will be applied regardless of other match predicates defined in the template. + * If a field is already defined in the mapping, then this parameter won’t be + * used. + *

* API name: {@code dynamic_templates} *

* Adds an entry to dynamicTemplates. @@ -160,6 +186,12 @@ public final BuilderT dynamicTemplates(String key, String value) { } /** + * ID of the pipeline to use to preprocess incoming documents. If the index has + * a default ingest pipeline specified, then setting the value to + * _none disables the default ingest pipeline for this request. If + * a final pipeline is configured it will always run, regardless of the value of + * this parameter. + *

* API name: {@code pipeline} */ public final BuilderT pipeline(@Nullable String value) { @@ -168,6 +200,8 @@ public final BuilderT pipeline(@Nullable String value) { } /** + * If true, the request’s actions must target an index alias. + *

* API name: {@code require_alias} */ public final BuilderT requireAlias(@Nullable Boolean value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java index 46a81645b..2eda888ed 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java @@ -51,6 +51,7 @@ import java.lang.Integer; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -1230,6 +1231,66 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * API name: {@code search_after} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch_template/TemplateConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch_template/TemplateConfig.java index 7a47ebb20..10d395201 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch_template/TemplateConfig.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch_template/TemplateConfig.java @@ -94,6 +94,9 @@ public static TemplateConfig of(Function> } /** + * If true, returns detailed information about score calculation as + * part of each hit. + *

* API name: {@code explain} */ @Nullable @@ -113,6 +116,9 @@ public final String id() { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} */ public final Map params() { @@ -120,6 +126,8 @@ public final Map params() { } /** + * If true, the query execution is profiled. + *

* API name: {@code profile} */ @Nullable @@ -212,6 +220,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String source; /** + * If true, returns detailed information about score calculation as + * part of each hit. + *

* API name: {@code explain} */ public final Builder explain(@Nullable Boolean value) { @@ -231,6 +242,9 @@ public final Builder id(@Nullable String value) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds all entries of map to params. @@ -241,6 +255,9 @@ public final Builder params(Map map) { } /** + * Key-value pairs used to replace Mustache variables in the template. The key + * is the variable name. The value is the variable value. + *

* API name: {@code params} *

* Adds an entry to params. @@ -251,6 +268,8 @@ public final Builder params(String key, JsonData value) { } /** + * If true, the query execution is profiled. + *

* API name: {@code profile} */ public final Builder profile(@Nullable Boolean value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsOperation.java index 3460b8d90..74467a91a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsOperation.java @@ -128,13 +128,17 @@ public static MultiTermVectorsOperation of(Function + * API name: {@code _id} */ public final String id() { return this.id; } /** + * The index of the document. + *

* API name: {@code _index} */ @Nullable @@ -143,6 +147,9 @@ public final String index() { } /** + * An artificial document (a document not present in the index) for which you + * want to retrieve term vectors. + *

* API name: {@code doc} */ @Nullable @@ -151,6 +158,11 @@ public final JsonData doc() { } /** + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. + *

* API name: {@code fields} */ public final List fields() { @@ -158,6 +170,9 @@ public final List fields() { } /** + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. + *

* API name: {@code field_statistics} */ @Nullable @@ -166,6 +181,8 @@ public final Boolean fieldStatistics() { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ @Nullable @@ -174,6 +191,8 @@ public final Filter filter() { } /** + * If true, the response includes term offsets. + *

* API name: {@code offsets} */ @Nullable @@ -182,6 +201,8 @@ public final Boolean offsets() { } /** + * If true, the response includes term payloads. + *

* API name: {@code payloads} */ @Nullable @@ -190,6 +211,8 @@ public final Boolean payloads() { } /** + * If true, the response includes term positions. + *

* API name: {@code positions} */ @Nullable @@ -198,6 +221,8 @@ public final Boolean positions() { } /** + * Custom value used to route operations to a specific shard. + *

* API name: {@code routing} */ @Nullable @@ -206,6 +231,8 @@ public final String routing() { } /** + * If true, the response includes term frequency and document frequency. + *

* API name: {@code term_statistics} */ @Nullable @@ -214,6 +241,8 @@ public final Boolean termStatistics() { } /** + * If true, returns the document version as part of a hit. + *

* API name: {@code version} */ @Nullable @@ -222,6 +251,8 @@ public final Long version() { } /** + * Specific version type. + *

* API name: {@code version_type} */ @Nullable @@ -363,7 +394,9 @@ public static class Builder extends WithJsonObjectBuilderBase private VersionType versionType; /** - * Required - API name: {@code _id} + * Required - The ID of the document. + *

+ * API name: {@code _id} */ public final Builder id(String value) { this.id = value; @@ -371,6 +404,8 @@ public final Builder id(String value) { } /** + * The index of the document. + *

* API name: {@code _index} */ public final Builder index(@Nullable String value) { @@ -379,6 +414,9 @@ public final Builder index(@Nullable String value) { } /** + * An artificial document (a document not present in the index) for which you + * want to retrieve term vectors. + *

* API name: {@code doc} */ public final Builder doc(@Nullable JsonData value) { @@ -387,6 +425,11 @@ public final Builder doc(@Nullable JsonData value) { } /** + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. + *

* API name: {@code fields} *

* Adds all elements of list to fields. @@ -397,6 +440,11 @@ public final Builder fields(List list) { } /** + * Comma-separated list or wildcard expressions of fields to include in the + * statistics. Used as the default list unless a specific field list is provided + * in the completion_fields or fielddata_fields + * parameters. + *

* API name: {@code fields} *

* Adds one or more values to fields. @@ -407,6 +455,9 @@ public final Builder fields(String value, String... values) { } /** + * If true, the response includes the document count, sum of + * document frequencies, and sum of total term frequencies. + *

* API name: {@code field_statistics} */ public final Builder fieldStatistics(@Nullable Boolean value) { @@ -415,6 +466,8 @@ public final Builder fieldStatistics(@Nullable Boolean value) { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ public final Builder filter(@Nullable Filter value) { @@ -423,6 +476,8 @@ public final Builder filter(@Nullable Filter value) { } /** + * Filter terms based on their tf-idf scores. + *

* API name: {@code filter} */ public final Builder filter(Function> fn) { @@ -430,6 +485,8 @@ public final Builder filter(Function> fn) } /** + * If true, the response includes term offsets. + *

* API name: {@code offsets} */ public final Builder offsets(@Nullable Boolean value) { @@ -438,6 +495,8 @@ public final Builder offsets(@Nullable Boolean value) { } /** + * If true, the response includes term payloads. + *

* API name: {@code payloads} */ public final Builder payloads(@Nullable Boolean value) { @@ -446,6 +505,8 @@ public final Builder payloads(@Nullable Boolean value) { } /** + * If true, the response includes term positions. + *

* API name: {@code positions} */ public final Builder positions(@Nullable Boolean value) { @@ -454,6 +515,8 @@ public final Builder positions(@Nullable Boolean value) { } /** + * Custom value used to route operations to a specific shard. + *

* API name: {@code routing} */ public final Builder routing(@Nullable String value) { @@ -462,6 +525,8 @@ public final Builder routing(@Nullable String value) { } /** + * If true, the response includes term frequency and document frequency. + *

* API name: {@code term_statistics} */ public final Builder termStatistics(@Nullable Boolean value) { @@ -470,6 +535,8 @@ public final Builder termStatistics(@Nullable Boolean value) { } /** + * If true, returns the document version as part of a hit. + *

* API name: {@code version} */ public final Builder version(@Nullable Long value) { @@ -478,6 +545,8 @@ public final Builder version(@Nullable Long value) { } /** + * Specific version type. + *

* API name: {@code version_type} */ public final Builder versionType(@Nullable VersionType value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java index ed4dee5b5..433f8e8d3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java @@ -117,42 +117,58 @@ public static ReindexStatus of(Function> f } /** - * Required - API name: {@code batches} + * Required - The number of scroll responses pulled back by the reindex. + *

+ * API name: {@code batches} */ public final long batches() { return this.batches; } /** - * Required - API name: {@code created} + * Required - The number of documents that were successfully created. + *

+ * API name: {@code created} */ public final long created() { return this.created; } /** - * Required - API name: {@code deleted} + * Required - The number of documents that were successfully deleted. + *

+ * API name: {@code deleted} */ public final long deleted() { return this.deleted; } /** - * Required - API name: {@code noops} + * Required - The number of documents that were ignored because the script used + * for the reindex returned a noop value for ctx.op. + *

+ * API name: {@code noops} */ public final long noops() { return this.noops; } /** - * Required - API name: {@code requests_per_second} + * Required - The number of requests per second effectively executed during the + * reindex. + *

+ * API name: {@code requests_per_second} */ public final float requestsPerSecond() { return this.requestsPerSecond; } /** - * Required - API name: {@code retries} + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} */ public final Retries retries() { return this.retries; @@ -167,7 +183,10 @@ public final Time throttled() { } /** - * Required - API name: {@code throttled_millis} + * Required - Number of milliseconds the request slept to conform to + * requests_per_second. + *

+ * API name: {@code throttled_millis} */ public final long throttledMillis() { return this.throttledMillis; @@ -182,28 +201,42 @@ public final Time throttledUntil() { } /** - * Required - API name: {@code throttled_until_millis} + * Required - This field should always be equal to zero in a + * _reindex response. It only has meaning when using the Task API, + * where it indicates the next time (in milliseconds since epoch) a throttled + * request will be executed again in order to conform to + * requests_per_second. + *

+ * API name: {@code throttled_until_millis} */ public final long throttledUntilMillis() { return this.throttledUntilMillis; } /** - * Required - API name: {@code total} + * Required - The number of documents that were successfully processed. + *

+ * API name: {@code total} */ public final long total() { return this.total; } /** - * Required - API name: {@code updated} + * Required - The number of documents that were successfully updated, for + * example, a document with same ID already existed prior to reindex updating + * it. + *

+ * API name: {@code updated} */ public final long updated() { return this.updated; } /** - * Required - API name: {@code version_conflicts} + * Required - The number of version conflicts that reindex hits. + *

+ * API name: {@code version_conflicts} */ public final long versionConflicts() { return this.versionConflicts; @@ -306,7 +339,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long versionConflicts; /** - * Required - API name: {@code batches} + * Required - The number of scroll responses pulled back by the reindex. + *

+ * API name: {@code batches} */ public final Builder batches(long value) { this.batches = value; @@ -314,7 +349,9 @@ public final Builder batches(long value) { } /** - * Required - API name: {@code created} + * Required - The number of documents that were successfully created. + *

+ * API name: {@code created} */ public final Builder created(long value) { this.created = value; @@ -322,7 +359,9 @@ public final Builder created(long value) { } /** - * Required - API name: {@code deleted} + * Required - The number of documents that were successfully deleted. + *

+ * API name: {@code deleted} */ public final Builder deleted(long value) { this.deleted = value; @@ -330,7 +369,10 @@ public final Builder deleted(long value) { } /** - * Required - API name: {@code noops} + * Required - The number of documents that were ignored because the script used + * for the reindex returned a noop value for ctx.op. + *

+ * API name: {@code noops} */ public final Builder noops(long value) { this.noops = value; @@ -338,7 +380,10 @@ public final Builder noops(long value) { } /** - * Required - API name: {@code requests_per_second} + * Required - The number of requests per second effectively executed during the + * reindex. + *

+ * API name: {@code requests_per_second} */ public final Builder requestsPerSecond(float value) { this.requestsPerSecond = value; @@ -346,7 +391,11 @@ public final Builder requestsPerSecond(float value) { } /** - * Required - API name: {@code retries} + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} */ public final Builder retries(Retries value) { this.retries = value; @@ -354,7 +403,11 @@ public final Builder retries(Retries value) { } /** - * Required - API name: {@code retries} + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} */ public final Builder retries(Function> fn) { return this.retries(fn.apply(new Retries.Builder()).build()); @@ -376,7 +429,10 @@ public final Builder throttled(Function> fn) { } /** - * Required - API name: {@code throttled_millis} + * Required - Number of milliseconds the request slept to conform to + * requests_per_second. + *

+ * API name: {@code throttled_millis} */ public final Builder throttledMillis(long value) { this.throttledMillis = value; @@ -399,7 +455,13 @@ public final Builder throttledUntil(Function> } /** - * Required - API name: {@code throttled_until_millis} + * Required - This field should always be equal to zero in a + * _reindex response. It only has meaning when using the Task API, + * where it indicates the next time (in milliseconds since epoch) a throttled + * request will be executed again in order to conform to + * requests_per_second. + *

+ * API name: {@code throttled_until_millis} */ public final Builder throttledUntilMillis(long value) { this.throttledUntilMillis = value; @@ -407,7 +469,9 @@ public final Builder throttledUntilMillis(long value) { } /** - * Required - API name: {@code total} + * Required - The number of documents that were successfully processed. + *

+ * API name: {@code total} */ public final Builder total(long value) { this.total = value; @@ -415,7 +479,11 @@ public final Builder total(long value) { } /** - * Required - API name: {@code updated} + * Required - The number of documents that were successfully updated, for + * example, a document with same ID already existed prior to reindex updating + * it. + *

+ * API name: {@code updated} */ public final Builder updated(long value) { this.updated = value; @@ -423,7 +491,9 @@ public final Builder updated(long value) { } /** - * Required - API name: {@code version_conflicts} + * Required - The number of version conflicts that reindex hits. + *

+ * API name: {@code version_conflicts} */ public final Builder versionConflicts(long value) { this.versionConflicts = value; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/scripts_painless_execute/PainlessContextSetup.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/scripts_painless_execute/PainlessContextSetup.java index 787101083..22658f9b7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/scripts_painless_execute/PainlessContextSetup.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/scripts_painless_execute/PainlessContextSetup.java @@ -83,21 +83,30 @@ public static PainlessContextSetup of(Function + * API name: {@code document} */ public final JsonData document() { return this.document; } /** - * Required - API name: {@code index} + * Required - Index containing a mapping that’s compatible with the indexed + * document. You may specify a remote index by prefixing the index with the + * remote cluster alias. + *

+ * API name: {@code index} */ public final String index() { return this.index; } /** - * Required - API name: {@code query} + * Required - Use this parameter to specify a query for computing a score. + *

+ * API name: {@code query} */ public final Query query() { return this.query; @@ -146,7 +155,10 @@ public static class Builder extends WithJsonObjectBuilderBase private Query query; /** - * Required - API name: {@code document} + * Required - Document that’s temporarily indexed in-memory and accessible from + * the script. + *

+ * API name: {@code document} */ public final Builder document(JsonData value) { this.document = value; @@ -154,7 +166,11 @@ public final Builder document(JsonData value) { } /** - * Required - API name: {@code index} + * Required - Index containing a mapping that’s compatible with the indexed + * document. You may specify a remote index by prefixing the index with the + * remote cluster alias. + *

+ * API name: {@code index} */ public final Builder index(String value) { this.index = value; @@ -162,7 +178,9 @@ public final Builder index(String value) { } /** - * Required - API name: {@code query} + * Required - Use this parameter to specify a query for computing a score. + *

+ * API name: {@code query} */ public final Builder query(Query value) { this.query = value; @@ -170,7 +188,9 @@ public final Builder query(Query value) { } /** - * Required - API name: {@code query} + * Required - Use this parameter to specify a query for computing a score. + *

+ * API name: {@code query} */ public final Builder query(Function> fn) { return this.query(fn.apply(new Query.Builder()).build()); 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 cdb68649e..b039a2909 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 @@ -38,6 +38,7 @@ import java.lang.Double; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -787,6 +788,66 @@ public final Builder sort(FieldValue value, FieldValue... values) { return this; } + /** + * API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(String value, String... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(long value, long... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(double value, double... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(boolean value, boolean... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + /** * API name: {@code sort} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Filter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Filter.java index fa072380a..9a363d955 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Filter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Filter.java @@ -98,6 +98,8 @@ public static Filter of(Function> fn) { } /** + * Ignore words which occur in more than this many docs. Defaults to unbounded. + *

* API name: {@code max_doc_freq} */ @Nullable @@ -106,6 +108,8 @@ public final Integer maxDocFreq() { } /** + * Maximum number of terms that must be returned per field. + *

* API name: {@code max_num_terms} */ @Nullable @@ -114,6 +118,9 @@ public final Integer maxNumTerms() { } /** + * Ignore words with more than this frequency in the source doc. Defaults to + * unbounded. + *

* API name: {@code max_term_freq} */ @Nullable @@ -122,6 +129,9 @@ public final Integer maxTermFreq() { } /** + * The maximum word length above which words will be ignored. Defaults to + * unbounded. + *

* API name: {@code max_word_length} */ @Nullable @@ -130,6 +140,8 @@ public final Integer maxWordLength() { } /** + * Ignore terms which do not occur in at least this many docs. + *

* API name: {@code min_doc_freq} */ @Nullable @@ -138,6 +150,8 @@ public final Integer minDocFreq() { } /** + * Ignore words with less than this frequency in the source doc. + *

* API name: {@code min_term_freq} */ @Nullable @@ -146,6 +160,8 @@ public final Integer minTermFreq() { } /** + * The minimum word length below which words will be ignored. + *

* API name: {@code min_word_length} */ @Nullable @@ -236,6 +252,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Integer minWordLength; /** + * Ignore words which occur in more than this many docs. Defaults to unbounded. + *

* API name: {@code max_doc_freq} */ public final Builder maxDocFreq(@Nullable Integer value) { @@ -244,6 +262,8 @@ public final Builder maxDocFreq(@Nullable Integer value) { } /** + * Maximum number of terms that must be returned per field. + *

* API name: {@code max_num_terms} */ public final Builder maxNumTerms(@Nullable Integer value) { @@ -252,6 +272,9 @@ public final Builder maxNumTerms(@Nullable Integer value) { } /** + * Ignore words with more than this frequency in the source doc. Defaults to + * unbounded. + *

* API name: {@code max_term_freq} */ public final Builder maxTermFreq(@Nullable Integer value) { @@ -260,6 +283,9 @@ public final Builder maxTermFreq(@Nullable Integer value) { } /** + * The maximum word length above which words will be ignored. Defaults to + * unbounded. + *

* API name: {@code max_word_length} */ public final Builder maxWordLength(@Nullable Integer value) { @@ -268,6 +294,8 @@ public final Builder maxWordLength(@Nullable Integer value) { } /** + * Ignore terms which do not occur in at least this many docs. + *

* API name: {@code min_doc_freq} */ public final Builder minDocFreq(@Nullable Integer value) { @@ -276,6 +304,8 @@ public final Builder minDocFreq(@Nullable Integer value) { } /** + * Ignore words with less than this frequency in the source doc. + *

* API name: {@code min_term_freq} */ public final Builder minTermFreq(@Nullable Integer value) { @@ -284,6 +314,8 @@ public final Builder minTermFreq(@Nullable Integer value) { } /** + * The minimum word length below which words will be ignored. + *

* API name: {@code min_word_length} */ public final Builder minWordLength(@Nullable Integer value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index f9da24a2b..be68cd217 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -4,47 +4,47 @@ Elasticsearch API specification - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java index e7f99b04f..9030036ee 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.enrich; +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; @@ -67,7 +68,7 @@ public class EnrichPolicy implements JsonpSerializable { private final String matchField; @Nullable - private final String query; + private final Query query; @Nullable private final String name; @@ -117,7 +118,7 @@ public final String matchField() { * API name: {@code query} */ @Nullable - public final String query() { + public final Query query() { return this.query; } @@ -173,7 +174,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.query != null) { generator.writeKey("query"); - generator.write(this.query); + this.query.serialize(generator, mapper); } if (this.name != null) { @@ -208,7 +209,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String matchField; @Nullable - private String query; + private Query query; @Nullable private String name; @@ -267,11 +268,18 @@ public final Builder matchField(String value) { /** * API name: {@code query} */ - public final Builder query(@Nullable String value) { + public final Builder query(@Nullable Query value) { this.query = value; return this; } + /** + * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new Query.Builder()).build()); + } + /** * API name: {@code name} */ @@ -321,7 +329,7 @@ protected static void setupEnrichPolicyDeserializer(ObjectDeserializer delete( * Returns async results from previously executed Event Query Language (EQL) * search * - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public CompletableFuture> get(EqlGetRequest request, Class tEventClass) { @@ -129,10 +128,9 @@ public CompletableFuture> get(EqlGetRequest requ * @param fn * a function that initializes a builder to create the * {@link EqlGetRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public final CompletableFuture> get( @@ -144,10 +142,9 @@ public final CompletableFuture> get( * Returns async results from previously executed Event Query Language (EQL) * search * - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public CompletableFuture> get(EqlGetRequest request, Type tEventType) { @@ -166,10 +163,9 @@ public CompletableFuture> get(EqlGetRequest requ * @param fn * a function that initializes a builder to create the * {@link EqlGetRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public final CompletableFuture> get( @@ -183,10 +179,9 @@ public final CompletableFuture> get( * Returns the status of a previously submitted async or stored Event Query * Language (EQL) search * - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-status-api.html) + * @see Documentation + * on elastic.co */ public CompletableFuture getStatus(GetEqlStatusRequest request) { @@ -203,10 +198,9 @@ public CompletableFuture getStatus(GetEqlStatusRequest req * @param fn * a function that initializes a builder to create the * {@link GetEqlStatusRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-status-api.html) + * @see Documentation + * on elastic.co */ public final CompletableFuture getStatus( diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java index e0645a87c..7cfd2420f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java @@ -108,10 +108,9 @@ public final EqlDeleteResponse delete(Functionhttps://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public EqlGetResponse get(EqlGetRequest request, Class tEventClass) @@ -131,10 +130,9 @@ public EqlGetResponse get(EqlGetRequest request, Class * @param fn * a function that initializes a builder to create the * {@link EqlGetRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public final EqlGetResponse get(Function> fn, @@ -146,10 +144,9 @@ public final EqlGetResponse get(Functionhttps://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public EqlGetResponse get(EqlGetRequest request, Type tEventType) @@ -169,10 +166,9 @@ public EqlGetResponse get(EqlGetRequest request, Type tEventTyp * @param fn * a function that initializes a builder to create the * {@link EqlGetRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-search-api.html) + * @see Documentation + * on elastic.co */ public final EqlGetResponse get(Function> fn, @@ -186,10 +182,9 @@ public final EqlGetResponse get(Functionhttps://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-status-api.html) + * @see Documentation + * on elastic.co */ public GetEqlStatusResponse getStatus(GetEqlStatusRequest request) throws IOException, ElasticsearchException { @@ -206,10 +201,9 @@ public GetEqlStatusResponse getStatus(GetEqlStatusRequest request) throws IOExce * @param fn * a function that initializes a builder to create the * {@link GetEqlStatusRequest} - * @see [Documentation on - * elastic.co](https://www.elastic.co - * https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-async-eql-status-api.html) + * @see Documentation + * on elastic.co */ public final GetEqlStatusResponse getStatus( diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java new file mode 100644 index 000000000..43034ea3e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java @@ -0,0 +1,101 @@ +/* + * 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.esql; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.transport.endpoints.BinaryResponse; +import co.elastic.clients.util.ObjectBuilder; +import java.util.concurrent.CompletableFuture; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the esql namespace. + */ +public class ElasticsearchEsqlAsyncClient extends ApiClient { + + public ElasticsearchEsqlAsyncClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchEsqlAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchEsqlAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchEsqlAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: esql.query + + /** + * Executes an ESQL request + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture query(QueryRequest request) { + @SuppressWarnings("unchecked") + Endpoint endpoint = (Endpoint) QueryRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Executes an ESQL request + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture query( + Function> fn) { + return query(fn.apply(new QueryRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java new file mode 100644 index 000000000..ef7b531d7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java @@ -0,0 +1,102 @@ +/* + * 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.esql; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.transport.endpoints.BinaryResponse; +import co.elastic.clients.util.ObjectBuilder; +import java.io.IOException; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the esql namespace. + */ +public class ElasticsearchEsqlClient extends ApiClient { + + public ElasticsearchEsqlClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchEsqlClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchEsqlClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchEsqlClient(this.transport, transportOptions); + } + + // ----- Endpoint: esql.query + + /** + * Executes an ESQL request + * + * @see Documentation + * on elastic.co + */ + + public BinaryResponse query(QueryRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + Endpoint endpoint = (Endpoint) QueryRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Executes an ESQL request + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryRequest} + * @see Documentation + * on elastic.co + */ + + public final BinaryResponse query(Function> fn) + throws IOException, ElasticsearchException { + return query(fn.apply(new QueryRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java new file mode 100644 index 000000000..68f52f6ae --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java @@ -0,0 +1,441 @@ +/* + * 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.esql; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.FieldValue; +import co.elastic.clients.elasticsearch._types.RequestBase; +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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.BinaryEndpoint; +import co.elastic.clients.transport.endpoints.BinaryResponse; +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.String; +import java.util.Collections; +import java.util.HashMap; +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: esql.query.Request + +/** + * Executes an ES|QL request + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Boolean columnar; + + @Nullable + private final String delimiter; + + @Nullable + private final Query filter; + + @Nullable + private final String format; + + @Nullable + private final String locale; + + private final List params; + + private final String query; + + // --------------------------------------------------------------------------------------------- + + private QueryRequest(Builder builder) { + + this.columnar = builder.columnar; + this.delimiter = builder.delimiter; + this.filter = builder.filter; + this.format = builder.format; + this.locale = builder.locale; + this.params = ApiTypeHelper.unmodifiable(builder.params); + this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); + + } + + public static QueryRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * By default, ES|QL returns results as rows. For example, FROM returns each + * individual document as one row. For the JSON, YAML, CBOR and smile formats, + * ES|QL can return the results in a columnar fashion where one row represents + * all the values of a certain column in the results. + *

+ * API name: {@code columnar} + */ + @Nullable + public final Boolean columnar() { + return this.columnar; + } + + /** + * The character to use between values within a CSV row. Only valid for the CSV + * format. + *

+ * API name: {@code delimiter} + */ + @Nullable + public final String delimiter() { + return this.delimiter; + } + + /** + * Specify a Query DSL query in the filter parameter to filter the set of + * documents that an ES|QL query runs on. + *

+ * API name: {@code filter} + */ + @Nullable + public final Query filter() { + return this.filter; + } + + /** + * A short version of the Accept header, e.g. json, yaml. + *

+ * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * API name: {@code locale} + */ + @Nullable + public final String locale() { + return this.locale; + } + + /** + * To avoid any attempts of hacking or code injection, extract the values in a + * separate list of parameters. Use question mark placeholders (?) in the query + * string for each of the parameters. + *

+ * API name: {@code params} + */ + public final List params() { + return this.params; + } + + /** + * Required - The ES|QL query API accepts an ES|QL query string in the query + * parameter, runs it, and returns the results. + *

+ * API name: {@code query} + */ + public final String query() { + return this.query; + } + + /** + * 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.columnar != null) { + generator.writeKey("columnar"); + generator.write(this.columnar); + + } + if (this.filter != null) { + generator.writeKey("filter"); + this.filter.serialize(generator, mapper); + + } + if (this.locale != null) { + generator.writeKey("locale"); + generator.write(this.locale); + + } + if (ApiTypeHelper.isDefined(this.params)) { + generator.writeKey("params"); + generator.writeStartArray(); + for (FieldValue item0 : this.params) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("query"); + generator.write(this.query); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean columnar; + + @Nullable + private String delimiter; + + @Nullable + private Query filter; + + @Nullable + private String format; + + @Nullable + private String locale; + + @Nullable + private List params; + + private String query; + + /** + * By default, ES|QL returns results as rows. For example, FROM returns each + * individual document as one row. For the JSON, YAML, CBOR and smile formats, + * ES|QL can return the results in a columnar fashion where one row represents + * all the values of a certain column in the results. + *

+ * API name: {@code columnar} + */ + public final Builder columnar(@Nullable Boolean value) { + this.columnar = value; + return this; + } + + /** + * The character to use between values within a CSV row. Only valid for the CSV + * format. + *

+ * API name: {@code delimiter} + */ + public final Builder delimiter(@Nullable String value) { + this.delimiter = value; + return this; + } + + /** + * Specify a Query DSL query in the filter parameter to filter the set of + * documents that an ES|QL query runs on. + *

+ * API name: {@code filter} + */ + public final Builder filter(@Nullable Query value) { + this.filter = value; + return this; + } + + /** + * Specify a Query DSL query in the filter parameter to filter the set of + * documents that an ES|QL query runs on. + *

+ * API name: {@code filter} + */ + public final Builder filter(Function> fn) { + return this.filter(fn.apply(new Query.Builder()).build()); + } + + /** + * A short version of the Accept header, e.g. json, yaml. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * API name: {@code locale} + */ + public final Builder locale(@Nullable String value) { + this.locale = value; + return this; + } + + /** + * To avoid any attempts of hacking or code injection, extract the values in a + * separate list of parameters. Use question mark placeholders (?) in the query + * string for each of the parameters. + *

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

+ * Adds all elements of list to params. + */ + public final Builder params(List list) { + this.params = _listAddAll(this.params, list); + return this; + } + + /** + * To avoid any attempts of hacking or code injection, extract the values in a + * separate list of parameters. Use question mark placeholders (?) in the query + * string for each of the parameters. + *

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

+ * Adds one or more values to params. + */ + public final Builder params(FieldValue value, FieldValue... values) { + this.params = _listAdd(this.params, value, values); + return this; + } + + /** + * To avoid any attempts of hacking or code injection, extract the values in a + * separate list of parameters. Use question mark placeholders (?) in the query + * string for each of the parameters. + *

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

+ * Adds a value to params using a builder lambda. + */ + public final Builder params(Function> fn) { + return params(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * Required - The ES|QL query API accepts an ES|QL query string in the query + * parameter, runs it, and returns the results. + *

+ * API name: {@code query} + */ + public final Builder query(String value) { + this.query = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryRequest build() { + _checkSingleUse(); + + return new QueryRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + QueryRequest::setupQueryRequestDeserializer); + + protected static void setupQueryRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::columnar, JsonpDeserializer.booleanDeserializer(), "columnar"); + op.add(Builder::filter, Query._DESERIALIZER, "filter"); + op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); + op.add(Builder::params, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "params"); + op.add(Builder::query, JsonpDeserializer.stringDeserializer(), "query"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.query}". + */ + public static final Endpoint _ENDPOINT = new BinaryEndpoint<>( + "es/esql.query", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_query"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.delimiter != null) { + params.put("delimiter", request.delimiter); + } + if (request.format != null) { + params.put("format", request.format); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, null); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/fleet/FleetSearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/fleet/FleetSearchRequest.java index 02cc64618..9d6d3654b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/fleet/FleetSearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/fleet/FleetSearchRequest.java @@ -57,6 +57,7 @@ import java.lang.Integer; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -1836,6 +1837,66 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * API name: {@code search_after} + *

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * API name: {@code search_after} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java deleted file mode 100644 index 25ac7f4ae..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -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; - -// typedef: indices._types.DataLifecycle - -/** - * Data lifecycle denotes that a data stream is managed by DLM and contains the - * configuration. - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataLifecycle implements JsonpSerializable { - @Nullable - private final Time dataRetention; - - // --------------------------------------------------------------------------------------------- - - private DataLifecycle(Builder builder) { - - this.dataRetention = builder.dataRetention; - - } - - public static DataLifecycle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code data_retention} - */ - @Nullable - public final Time dataRetention() { - return this.dataRetention; - } - - /** - * 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.dataRetention != null) { - generator.writeKey("data_retention"); - this.dataRetention.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataLifecycle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Time dataRetention; - - /** - * API name: {@code data_retention} - */ - public final Builder dataRetention(@Nullable Time value) { - this.dataRetention = value; - return this; - } - - /** - * API name: {@code data_retention} - */ - public final Builder dataRetention(Function> fn) { - return this.dataRetention(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataLifecycle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataLifecycle build() { - _checkSingleUse(); - - return new DataLifecycle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataLifecycle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DataLifecycle::setupDataLifecycleDeserializer); - - protected static void setupDataLifecycleDeserializer(ObjectDeserializer op) { - - op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java deleted file mode 100644 index b7ada17fb..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -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; - -// typedef: indices._types.DataLifecycleWithRollover - -/** - * Data lifecycle with rollover can be used to display the configuration - * including the default rollover conditions, if asked. - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataLifecycleWithRollover implements JsonpSerializable { - @Nullable - private final Time dataRetention; - - @Nullable - private final DlmRolloverConditions rollover; - - // --------------------------------------------------------------------------------------------- - - private DataLifecycleWithRollover(Builder builder) { - - this.dataRetention = builder.dataRetention; - this.rollover = builder.rollover; - - } - - public static DataLifecycleWithRollover of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * If defined, every document added to this data stream will be stored at least - * for this time frame. Any time after this duration the document could be - * deleted. When empty, every document in this data stream will be stored - * indefinitely. - *

- * API name: {@code data_retention} - */ - @Nullable - public final Time dataRetention() { - return this.dataRetention; - } - - /** - * The conditions which will trigger the rollover of a backing index as - * configured by the cluster setting - * cluster.lifecycle.default.rollover. This property is an - * implementation detail and it will only be retrieved when the query param - * include_defaults is set to true. The contents of this field are - * subject to change. - *

- * API name: {@code rollover} - */ - @Nullable - public final DlmRolloverConditions rollover() { - return this.rollover; - } - - /** - * 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.dataRetention != null) { - generator.writeKey("data_retention"); - this.dataRetention.serialize(generator, mapper); - - } - if (this.rollover != null) { - generator.writeKey("rollover"); - this.rollover.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataLifecycleWithRollover}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time dataRetention; - - @Nullable - private DlmRolloverConditions rollover; - - /** - * If defined, every document added to this data stream will be stored at least - * for this time frame. Any time after this duration the document could be - * deleted. When empty, every document in this data stream will be stored - * indefinitely. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(@Nullable Time value) { - this.dataRetention = value; - return this; - } - - /** - * If defined, every document added to this data stream will be stored at least - * for this time frame. Any time after this duration the document could be - * deleted. When empty, every document in this data stream will be stored - * indefinitely. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(Function> fn) { - return this.dataRetention(fn.apply(new Time.Builder()).build()); - } - - /** - * The conditions which will trigger the rollover of a backing index as - * configured by the cluster setting - * cluster.lifecycle.default.rollover. This property is an - * implementation detail and it will only be retrieved when the query param - * include_defaults is set to true. The contents of this field are - * subject to change. - *

- * API name: {@code rollover} - */ - public final Builder rollover(@Nullable DlmRolloverConditions value) { - this.rollover = value; - return this; - } - - /** - * The conditions which will trigger the rollover of a backing index as - * configured by the cluster setting - * cluster.lifecycle.default.rollover. This property is an - * implementation detail and it will only be retrieved when the query param - * include_defaults is set to true. The contents of this field are - * subject to change. - *

- * API name: {@code rollover} - */ - public final Builder rollover( - Function> fn) { - return this.rollover(fn.apply(new DlmRolloverConditions.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataLifecycleWithRollover}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataLifecycleWithRollover build() { - _checkSingleUse(); - - return new DataLifecycleWithRollover(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataLifecycleWithRollover} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataLifecycleWithRollover::setupDataLifecycleWithRolloverDeserializer); - - protected static void setupDataLifecycleWithRolloverDeserializer( - ObjectDeserializer op) { - - op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); - op.add(Builder::rollover, DlmRolloverConditions._DESERIALIZER, "rollover"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java index eeafd3aed..9515531df 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java @@ -77,6 +77,10 @@ public class DataStream implements JsonpSerializable { @Nullable private final String ilmPolicy; + private final ManagedBy nextGenerationManagedBy; + + private final boolean preferIlm; + private final List indices; @Nullable @@ -105,6 +109,9 @@ private DataStream(Builder builder) { this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); this.hidden = ApiTypeHelper.requireNonNull(builder.hidden, this, "hidden"); this.ilmPolicy = builder.ilmPolicy; + this.nextGenerationManagedBy = ApiTypeHelper.requireNonNull(builder.nextGenerationManagedBy, this, + "nextGenerationManagedBy"); + this.preferIlm = ApiTypeHelper.requireNonNull(builder.preferIlm, this, "preferIlm"); this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.lifecycle = builder.lifecycle; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); @@ -176,6 +183,26 @@ public final String ilmPolicy() { return this.ilmPolicy; } + /** + * Required - Name of the lifecycle system that'll manage the next generation of + * the data stream. + *

+ * API name: {@code next_generation_managed_by} + */ + public final ManagedBy nextGenerationManagedBy() { + return this.nextGenerationManagedBy; + } + + /** + * Required - Indicates if ILM should take precedence over DSL in case both are + * configured to managed this data stream. + *

+ * API name: {@code prefer_ilm} + */ + public final boolean preferIlm() { + return this.preferIlm; + } + /** * Required - Array of objects containing information about the data stream’s * backing indices. The last item in this array contains information about the @@ -299,6 +326,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.ilmPolicy); } + generator.writeKey("next_generation_managed_by"); + this.nextGenerationManagedBy.serialize(generator, mapper); + generator.writeKey("prefer_ilm"); + generator.write(this.preferIlm); + if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); generator.writeStartArray(); @@ -362,6 +394,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String ilmPolicy; + private ManagedBy nextGenerationManagedBy; + + private Boolean preferIlm; + private List indices; @Nullable @@ -456,6 +492,28 @@ public final Builder ilmPolicy(@Nullable String value) { return this; } + /** + * Required - Name of the lifecycle system that'll manage the next generation of + * the data stream. + *

+ * API name: {@code next_generation_managed_by} + */ + public final Builder nextGenerationManagedBy(ManagedBy value) { + this.nextGenerationManagedBy = value; + return this; + } + + /** + * Required - Indicates if ILM should take precedence over DSL in case both are + * configured to managed this data stream. + *

+ * API name: {@code prefer_ilm} + */ + public final Builder preferIlm(boolean value) { + this.preferIlm = value; + return this; + } + /** * Required - Array of objects containing information about the data stream’s * backing indices. The last item in this array contains information about the @@ -630,6 +688,8 @@ protected static void setupDataStreamDeserializer(ObjectDeserializer + * API name: {@code ilm_policy} + */ + @Nullable + public final String ilmPolicy() { + return this.ilmPolicy; + } + + /** + * Required - Name of the lifecycle system that's currently managing this + * backing index. + *

+ * API name: {@code managed_by} + */ + public final ManagedBy managedBy() { + return this.managedBy; + } + + /** + * Required - Indicates if ILM should take precedence over DSL in case both are + * configured to manage this index. + *

+ * API name: {@code prefer_ilm} + */ + public final boolean preferIlm() { + return this.preferIlm; + } + /** * Serialize this object to JSON. */ @@ -111,6 +152,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("index_uuid"); generator.write(this.indexUuid); + if (this.ilmPolicy != null) { + generator.writeKey("ilm_policy"); + generator.write(this.ilmPolicy); + + } + generator.writeKey("managed_by"); + this.managedBy.serialize(generator, mapper); + generator.writeKey("prefer_ilm"); + generator.write(this.preferIlm); + } @Override @@ -129,6 +180,13 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String indexUuid; + @Nullable + private String ilmPolicy; + + private ManagedBy managedBy; + + private Boolean preferIlm; + /** * Required - Name of the backing index. *

@@ -149,6 +207,38 @@ public final Builder indexUuid(String value) { return this; } + /** + * Name of the current ILM lifecycle policy configured for this backing index. + *

+ * API name: {@code ilm_policy} + */ + public final Builder ilmPolicy(@Nullable String value) { + this.ilmPolicy = value; + return this; + } + + /** + * Required - Name of the lifecycle system that's currently managing this + * backing index. + *

+ * API name: {@code managed_by} + */ + public final Builder managedBy(ManagedBy value) { + this.managedBy = value; + return this; + } + + /** + * Required - Indicates if ILM should take precedence over DSL in case both are + * configured to manage this index. + *

+ * API name: {@code prefer_ilm} + */ + public final Builder preferIlm(boolean value) { + this.preferIlm = value; + return this; + } + @Override protected Builder self() { return this; @@ -179,6 +269,9 @@ protected static void setupDataStreamIndexDeserializer(ObjectDeserializerAPI - * specification - */ -@JsonpDeserializable -public class DlmRolloverConditions implements JsonpSerializable { - @Nullable - private final Time minAge; - - @Nullable - private final String maxAge; - - @Nullable - private final Long minDocs; - - @Nullable - private final Long maxDocs; - - @Nullable - private final String minSize; - - @Nullable - private final String maxSize; - - @Nullable - private final String minPrimaryShardSize; - - @Nullable - private final String maxPrimaryShardSize; - - @Nullable - private final Long minPrimaryShardDocs; - - @Nullable - private final Long maxPrimaryShardDocs; - - // --------------------------------------------------------------------------------------------- - - private DlmRolloverConditions(Builder builder) { - - this.minAge = builder.minAge; - this.maxAge = builder.maxAge; - this.minDocs = builder.minDocs; - this.maxDocs = builder.maxDocs; - this.minSize = builder.minSize; - this.maxSize = builder.maxSize; - this.minPrimaryShardSize = builder.minPrimaryShardSize; - this.maxPrimaryShardSize = builder.maxPrimaryShardSize; - this.minPrimaryShardDocs = builder.minPrimaryShardDocs; - this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; - - } - - public static DlmRolloverConditions of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code min_age} - */ - @Nullable - public final Time minAge() { - return this.minAge; - } - - /** - * API name: {@code max_age} - */ - @Nullable - public final String maxAge() { - return this.maxAge; - } - - /** - * API name: {@code min_docs} - */ - @Nullable - public final Long minDocs() { - return this.minDocs; - } - - /** - * API name: {@code max_docs} - */ - @Nullable - public final Long maxDocs() { - return this.maxDocs; - } - - /** - * API name: {@code min_size} - */ - @Nullable - public final String minSize() { - return this.minSize; - } - - /** - * API name: {@code max_size} - */ - @Nullable - public final String maxSize() { - return this.maxSize; - } - - /** - * API name: {@code min_primary_shard_size} - */ - @Nullable - public final String minPrimaryShardSize() { - return this.minPrimaryShardSize; - } - - /** - * API name: {@code max_primary_shard_size} - */ - @Nullable - public final String maxPrimaryShardSize() { - return this.maxPrimaryShardSize; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - @Nullable - public final Long minPrimaryShardDocs() { - return this.minPrimaryShardDocs; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - @Nullable - public final Long maxPrimaryShardDocs() { - return this.maxPrimaryShardDocs; - } - - /** - * 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.minAge != null) { - generator.writeKey("min_age"); - this.minAge.serialize(generator, mapper); - - } - if (this.maxAge != null) { - generator.writeKey("max_age"); - generator.write(this.maxAge); - - } - if (this.minDocs != null) { - generator.writeKey("min_docs"); - generator.write(this.minDocs); - - } - if (this.maxDocs != null) { - generator.writeKey("max_docs"); - generator.write(this.maxDocs); - - } - if (this.minSize != null) { - generator.writeKey("min_size"); - generator.write(this.minSize); - - } - if (this.maxSize != null) { - generator.writeKey("max_size"); - generator.write(this.maxSize); - - } - if (this.minPrimaryShardSize != null) { - generator.writeKey("min_primary_shard_size"); - generator.write(this.minPrimaryShardSize); - - } - if (this.maxPrimaryShardSize != null) { - generator.writeKey("max_primary_shard_size"); - generator.write(this.maxPrimaryShardSize); - - } - if (this.minPrimaryShardDocs != null) { - generator.writeKey("min_primary_shard_docs"); - generator.write(this.minPrimaryShardDocs); - - } - if (this.maxPrimaryShardDocs != null) { - generator.writeKey("max_primary_shard_docs"); - generator.write(this.maxPrimaryShardDocs); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DlmRolloverConditions}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time minAge; - - @Nullable - private String maxAge; - - @Nullable - private Long minDocs; - - @Nullable - private Long maxDocs; - - @Nullable - private String minSize; - - @Nullable - private String maxSize; - - @Nullable - private String minPrimaryShardSize; - - @Nullable - private String maxPrimaryShardSize; - - @Nullable - private Long minPrimaryShardDocs; - - @Nullable - private Long maxPrimaryShardDocs; - - /** - * API name: {@code min_age} - */ - public final Builder minAge(@Nullable Time value) { - this.minAge = value; - return this; - } - - /** - * API name: {@code min_age} - */ - public final Builder minAge(Function> fn) { - return this.minAge(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(@Nullable String value) { - this.maxAge = value; - return this; - } - - /** - * API name: {@code min_docs} - */ - public final Builder minDocs(@Nullable Long value) { - this.minDocs = value; - return this; - } - - /** - * API name: {@code max_docs} - */ - public final Builder maxDocs(@Nullable Long value) { - this.maxDocs = value; - return this; - } - - /** - * API name: {@code min_size} - */ - public final Builder minSize(@Nullable String value) { - this.minSize = value; - return this; - } - - /** - * API name: {@code max_size} - */ - public final Builder maxSize(@Nullable String value) { - this.maxSize = value; - return this; - } - - /** - * API name: {@code min_primary_shard_size} - */ - public final Builder minPrimaryShardSize(@Nullable String value) { - this.minPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code max_primary_shard_size} - */ - public final Builder maxPrimaryShardSize(@Nullable String value) { - this.maxPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - public final Builder minPrimaryShardDocs(@Nullable Long value) { - this.minPrimaryShardDocs = value; - return this; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - public final Builder maxPrimaryShardDocs(@Nullable Long value) { - this.maxPrimaryShardDocs = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DlmRolloverConditions}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DlmRolloverConditions build() { - _checkSingleUse(); - - return new DlmRolloverConditions(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DlmRolloverConditions} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DlmRolloverConditions::setupDlmRolloverConditionsDeserializer); - - protected static void setupDlmRolloverConditionsDeserializer(ObjectDeserializer op) { - - op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); - op.add(Builder::maxAge, JsonpDeserializer.stringDeserializer(), "max_age"); - op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); - op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); - op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); - op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); - op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); - op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); - op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); - op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java index 73949abd1..433316e9b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java @@ -512,7 +512,7 @@ public final CompletableFuture deleteDataStream( * Deletes an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html">Documentation * on elastic.co */ @@ -530,7 +530,7 @@ public CompletableFuture deleteIndexTemplate(Delete * a function that initializes a builder to create the * {@link DeleteIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html">Documentation * on elastic.co */ @@ -545,7 +545,7 @@ public final CompletableFuture deleteIndexTemplate( * Deletes an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html">Documentation * on elastic.co */ @@ -563,7 +563,7 @@ public CompletableFuture deleteTemplate(DeleteTemplateRe * a function that initializes a builder to create the * {@link DeleteTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html">Documentation * on elastic.co */ @@ -710,7 +710,7 @@ public final CompletableFuture existsAlias( * Returns information about whether a particular index template exists. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html">Documentation * on elastic.co */ @@ -728,7 +728,7 @@ public CompletableFuture existsIndexTemplate(ExistsIndexTemplat * a function that initializes a builder to create the * {@link ExistsIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html">Documentation * on elastic.co */ @@ -743,7 +743,7 @@ public final CompletableFuture existsIndexTemplate( * Returns information about whether a particular index template exists. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html">Documentation * on elastic.co */ @@ -761,7 +761,7 @@ public CompletableFuture existsTemplate(ExistsTemplateRequest r * a function that initializes a builder to create the * {@link ExistsTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html">Documentation * on elastic.co */ @@ -1127,7 +1127,7 @@ public final CompletableFuture getFieldMapping( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1145,7 +1145,7 @@ public CompletableFuture getIndexTemplate(GetIndexTemp * a function that initializes a builder to create the * {@link GetIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1158,7 +1158,7 @@ public final CompletableFuture getIndexTemplate( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1265,7 +1265,7 @@ public CompletableFuture getSettings() { * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1283,7 +1283,7 @@ public CompletableFuture getTemplate(GetTemplateRequest req * a function that initializes a builder to create the * {@link GetTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1296,7 +1296,7 @@ public final CompletableFuture getTemplate( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1510,7 +1510,7 @@ public final CompletableFuture putDataLifecycle( * Creates or updates an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html">Documentation * on elastic.co */ @@ -1528,7 +1528,7 @@ public CompletableFuture putIndexTemplate(PutIndexTemp * a function that initializes a builder to create the * {@link PutIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html">Documentation * on elastic.co */ @@ -1622,7 +1622,7 @@ public CompletableFuture putSettings() { * Creates or updates an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html">Documentation * on elastic.co */ @@ -1640,7 +1640,7 @@ public CompletableFuture putTemplate(PutTemplateRequest req * a function that initializes a builder to create the * {@link PutTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html">Documentation * on elastic.co */ @@ -1975,7 +1975,7 @@ public final CompletableFuture shrink( * system * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html">Documentation * on elastic.co */ @@ -1995,7 +1995,7 @@ public CompletableFuture simulateIndexTemplate( * a function that initializes a builder to create the * {@link SimulateIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html">Documentation * on elastic.co */ @@ -2010,7 +2010,7 @@ public final CompletableFuture simulateIndexTempl * Simulate resolving the given template name or body * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ @@ -2028,7 +2028,7 @@ public CompletableFuture simulateTemplate(SimulateTemp * a function that initializes a builder to create the * {@link SimulateTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ @@ -2041,7 +2041,7 @@ public final CompletableFuture simulateTemplate( * Simulate resolving the given template name or body * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java index 3baaab018..219a066a3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java @@ -519,7 +519,7 @@ public final DeleteDataStreamResponse deleteDataStream( * Deletes an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html">Documentation * on elastic.co */ @@ -538,7 +538,7 @@ public DeleteIndexTemplateResponse deleteIndexTemplate(DeleteIndexTemplateReques * a function that initializes a builder to create the * {@link DeleteIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html">Documentation * on elastic.co */ @@ -554,7 +554,7 @@ public final DeleteIndexTemplateResponse deleteIndexTemplate( * Deletes an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html">Documentation * on elastic.co */ @@ -573,7 +573,7 @@ public DeleteTemplateResponse deleteTemplate(DeleteTemplateRequest request) * a function that initializes a builder to create the * {@link DeleteTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template-v1.html">Documentation * on elastic.co */ @@ -721,7 +721,7 @@ public final BooleanResponse existsAlias(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html">Documentation * on elastic.co */ @@ -740,7 +740,7 @@ public BooleanResponse existsIndexTemplate(ExistsIndexTemplateRequest request) * a function that initializes a builder to create the * {@link ExistsIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html">Documentation * on elastic.co */ @@ -756,7 +756,7 @@ public final BooleanResponse existsIndexTemplate( * Returns information about whether a particular index template exists. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html">Documentation * on elastic.co */ @@ -774,7 +774,7 @@ public BooleanResponse existsTemplate(ExistsTemplateRequest request) throws IOEx * a function that initializes a builder to create the * {@link ExistsTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html">Documentation * on elastic.co */ @@ -1151,7 +1151,7 @@ public final GetFieldMappingResponse getFieldMapping( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1170,7 +1170,7 @@ public GetIndexTemplateResponse getIndexTemplate(GetIndexTemplateRequest request * a function that initializes a builder to create the * {@link GetIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1184,7 +1184,7 @@ public final GetIndexTemplateResponse getIndexTemplate( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html">Documentation * on elastic.co */ @@ -1293,7 +1293,7 @@ public GetIndicesSettingsResponse getSettings() throws IOException, Elasticsearc * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1311,7 +1311,7 @@ public GetTemplateResponse getTemplate(GetTemplateRequest request) throws IOExce * a function that initializes a builder to create the * {@link GetTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1325,7 +1325,7 @@ public final GetTemplateResponse getTemplate( * Returns an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html">Documentation * on elastic.co */ @@ -1548,7 +1548,7 @@ public final PutDataLifecycleResponse putDataLifecycle( * Creates or updates an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html">Documentation * on elastic.co */ @@ -1567,7 +1567,7 @@ public PutIndexTemplateResponse putIndexTemplate(PutIndexTemplateRequest request * a function that initializes a builder to create the * {@link PutIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html">Documentation * on elastic.co */ @@ -1664,7 +1664,7 @@ public PutIndicesSettingsResponse putSettings() throws IOException, Elasticsearc * Creates or updates an index template. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html">Documentation * on elastic.co */ @@ -1682,7 +1682,7 @@ public PutTemplateResponse putTemplate(PutTemplateRequest request) throws IOExce * a function that initializes a builder to create the * {@link PutTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html">Documentation * on elastic.co */ @@ -2021,7 +2021,7 @@ public final ShrinkResponse shrink(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html">Documentation * on elastic.co */ @@ -2041,7 +2041,7 @@ public SimulateIndexTemplateResponse simulateIndexTemplate(SimulateIndexTemplate * a function that initializes a builder to create the * {@link SimulateIndexTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html">Documentation * on elastic.co */ @@ -2057,7 +2057,7 @@ public final SimulateIndexTemplateResponse simulateIndexTemplate( * Simulate resolving the given template name or body * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ @@ -2076,7 +2076,7 @@ public SimulateTemplateResponse simulateTemplate(SimulateTemplateRequest request * a function that initializes a builder to create the * {@link SimulateTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ @@ -2090,7 +2090,7 @@ public final SimulateTemplateResponse simulateTemplate( * Simulate resolving the given template name or body * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java index 87a2234c9..edaf0ce75 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java @@ -222,9 +222,6 @@ public class IndexSettings implements JsonpSerializable { @Nullable private final IndexSettingsTimeSeries timeSeries; - @Nullable - private final Integer shards; - @Nullable private final Queries queries; @@ -299,7 +296,6 @@ private IndexSettings(Builder builder) { this.analysis = builder.analysis; this.settings = builder.settings; this.timeSeries = builder.timeSeries; - this.shards = builder.shards; this.queries = builder.queries; this.similarity = builder.similarity; this.mapping = builder.mapping; @@ -725,14 +721,6 @@ public final IndexSettingsTimeSeries timeSeries() { return this.timeSeries; } - /** - * API name: {@code shards} - */ - @Nullable - public final Integer shards() { - return this.shards; - } - /** * API name: {@code queries} */ @@ -1060,11 +1048,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("time_series"); this.timeSeries.serialize(generator, mapper); - } - if (this.shards != null) { - generator.writeKey("shards"); - generator.write(this.shards); - } if (this.queries != null) { generator.writeKey("queries"); @@ -1290,9 +1273,6 @@ public final Builder otherSettings(String key, JsonData value) { @Nullable private IndexSettingsTimeSeries timeSeries; - @Nullable - private Integer shards; - @Nullable private Queries queries; @@ -1858,14 +1838,6 @@ public final Builder timeSeries( return this.timeSeries(fn.apply(new IndexSettingsTimeSeries.Builder()).build()); } - /** - * API name: {@code shards} - */ - public final Builder shards(@Nullable Integer value) { - this.shards = value; - return this; - } - /** * API name: {@code queries} */ @@ -2057,7 +2029,6 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public enum ManagedBy implements JsonEnum { + Ilm("Index Lifecycle Management"), + + Datastream("Data stream lifecycle"), + + Unmanaged("Unmanaged"), + + ; + + private final String jsonValue; + + ManagedBy(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ManagedBy.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java index 782be01d0..a5aea4eff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java @@ -77,9 +77,9 @@ public static MappingLimitSettingsDimensionFields of( /** * [preview] This functionality is in technical preview and may be changed or - * removed in a future release. Elastic will apply best effort to fix any - * issues, but features in technical preview are not subject to the support SLA - * of official GA features. + * removed in a future release. Elastic will work to fix any issues, but + * features in technical preview are not subject to the support SLA of official + * GA features. *

* API name: {@code limit} */ @@ -126,9 +126,9 @@ public static class Builder extends WithJsonObjectBuilderBase /** * [preview] This functionality is in technical preview and may be changed or - * removed in a future release. Elastic will apply best effort to fix any - * issues, but features in technical preview are not subject to the support SLA - * of official GA features. + * removed in a future release. Elastic will work to fix any issues, but + * features in technical preview are not subject to the support SLA of official + * GA features. *

* API name: {@code limit} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java deleted file mode 100644 index 013169b6e..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices.explain_data_lifecycle; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.DataLifecycleWithRollover; -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.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: indices.explain_data_lifecycle.DataLifecycleExplain - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataLifecycleExplain implements JsonpSerializable { - private final String index; - - private final boolean managedByDlm; - - @Nullable - private final Long indexCreationDateMillis; - - @Nullable - private final Time timeSinceIndexCreation; - - @Nullable - private final Long rolloverDateMillis; - - @Nullable - private final Time timeSinceRollover; - - @Nullable - private final DataLifecycleWithRollover lifecycle; - - @Nullable - private final Time generationTime; - - @Nullable - private final String error; - - // --------------------------------------------------------------------------------------------- - - private DataLifecycleExplain(Builder builder) { - - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.managedByDlm = ApiTypeHelper.requireNonNull(builder.managedByDlm, this, "managedByDlm"); - this.indexCreationDateMillis = builder.indexCreationDateMillis; - this.timeSinceIndexCreation = builder.timeSinceIndexCreation; - this.rolloverDateMillis = builder.rolloverDateMillis; - this.timeSinceRollover = builder.timeSinceRollover; - this.lifecycle = builder.lifecycle; - this.generationTime = builder.generationTime; - this.error = builder.error; - - } - - public static DataLifecycleExplain of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code managed_by_dlm} - */ - public final boolean managedByDlm() { - return this.managedByDlm; - } - - /** - * API name: {@code index_creation_date_millis} - */ - @Nullable - public final Long indexCreationDateMillis() { - return this.indexCreationDateMillis; - } - - /** - * API name: {@code time_since_index_creation} - */ - @Nullable - public final Time timeSinceIndexCreation() { - return this.timeSinceIndexCreation; - } - - /** - * API name: {@code rollover_date_millis} - */ - @Nullable - public final Long rolloverDateMillis() { - return this.rolloverDateMillis; - } - - /** - * API name: {@code time_since_rollover} - */ - @Nullable - public final Time timeSinceRollover() { - return this.timeSinceRollover; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataLifecycleWithRollover lifecycle() { - return this.lifecycle; - } - - /** - * API name: {@code generation_time} - */ - @Nullable - public final Time generationTime() { - return this.generationTime; - } - - /** - * API name: {@code error} - */ - @Nullable - public final String error() { - return this.error; - } - - /** - * 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("index"); - generator.write(this.index); - - generator.writeKey("managed_by_dlm"); - generator.write(this.managedByDlm); - - if (this.indexCreationDateMillis != null) { - generator.writeKey("index_creation_date_millis"); - generator.write(this.indexCreationDateMillis); - - } - if (this.timeSinceIndexCreation != null) { - generator.writeKey("time_since_index_creation"); - this.timeSinceIndexCreation.serialize(generator, mapper); - - } - if (this.rolloverDateMillis != null) { - generator.writeKey("rollover_date_millis"); - generator.write(this.rolloverDateMillis); - - } - if (this.timeSinceRollover != null) { - generator.writeKey("time_since_rollover"); - this.timeSinceRollover.serialize(generator, mapper); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - if (this.generationTime != null) { - generator.writeKey("generation_time"); - this.generationTime.serialize(generator, mapper); - - } - if (this.error != null) { - generator.writeKey("error"); - generator.write(this.error); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataLifecycleExplain}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String index; - - private Boolean managedByDlm; - - @Nullable - private Long indexCreationDateMillis; - - @Nullable - private Time timeSinceIndexCreation; - - @Nullable - private Long rolloverDateMillis; - - @Nullable - private Time timeSinceRollover; - - @Nullable - private DataLifecycleWithRollover lifecycle; - - @Nullable - private Time generationTime; - - @Nullable - private String error; - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code managed_by_dlm} - */ - public final Builder managedByDlm(boolean value) { - this.managedByDlm = value; - return this; - } - - /** - * API name: {@code index_creation_date_millis} - */ - public final Builder indexCreationDateMillis(@Nullable Long value) { - this.indexCreationDateMillis = value; - return this; - } - - /** - * API name: {@code time_since_index_creation} - */ - public final Builder timeSinceIndexCreation(@Nullable Time value) { - this.timeSinceIndexCreation = value; - return this; - } - - /** - * API name: {@code time_since_index_creation} - */ - public final Builder timeSinceIndexCreation(Function> fn) { - return this.timeSinceIndexCreation(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code rollover_date_millis} - */ - public final Builder rolloverDateMillis(@Nullable Long value) { - this.rolloverDateMillis = value; - return this; - } - - /** - * API name: {@code time_since_rollover} - */ - public final Builder timeSinceRollover(@Nullable Time value) { - this.timeSinceRollover = value; - return this; - } - - /** - * API name: {@code time_since_rollover} - */ - public final Builder timeSinceRollover(Function> fn) { - return this.timeSinceRollover(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataLifecycleWithRollover value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle( - Function> fn) { - return this.lifecycle(fn.apply(new DataLifecycleWithRollover.Builder()).build()); - } - - /** - * API name: {@code generation_time} - */ - public final Builder generationTime(@Nullable Time value) { - this.generationTime = value; - return this; - } - - /** - * API name: {@code generation_time} - */ - public final Builder generationTime(Function> fn) { - return this.generationTime(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code error} - */ - public final Builder error(@Nullable String value) { - this.error = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataLifecycleExplain}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataLifecycleExplain build() { - _checkSingleUse(); - - return new DataLifecycleExplain(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataLifecycleExplain} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataLifecycleExplain::setupDataLifecycleExplainDeserializer); - - protected static void setupDataLifecycleExplainDeserializer(ObjectDeserializer op) { - - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::managedByDlm, JsonpDeserializer.booleanDeserializer(), "managed_by_dlm"); - op.add(Builder::indexCreationDateMillis, JsonpDeserializer.longDeserializer(), "index_creation_date_millis"); - op.add(Builder::timeSinceIndexCreation, Time._DESERIALIZER, "time_since_index_creation"); - op.add(Builder::rolloverDateMillis, JsonpDeserializer.longDeserializer(), "rollover_date_millis"); - op.add(Builder::timeSinceRollover, Time._DESERIALIZER, "time_since_rollover"); - op.add(Builder::lifecycle, DataLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::generationTime, Time._DESERIALIZER, "generation_time"); - op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java deleted file mode 100644 index 3abac00cc..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.indices.get_data_lifecycle; - -import co.elastic.clients.elasticsearch.indices.DataLifecycle; -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.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: indices.get_data_lifecycle.DataStreamLifecycle - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycle implements JsonpSerializable { - private final String name; - - @Nullable - private final DataLifecycle lifecycle; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycle(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.lifecycle = builder.lifecycle; - - } - - public static DataStreamLifecycle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataLifecycle lifecycle() { - return this.lifecycle; - } - - /** - * 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); - - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - @Nullable - private DataLifecycle lifecycle; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataLifecycle value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(Function> fn) { - return this.lifecycle(fn.apply(new DataLifecycle.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycle build() { - _checkSingleUse(); - - return new DataStreamLifecycle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamLifecycle::setupDataStreamLifecycleDeserializer); - - protected static void setupDataStreamLifecycleDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::lifecycle, DataLifecycle._DESERIALIZER, "lifecycle"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java new file mode 100644 index 000000000..a482dcc80 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java @@ -0,0 +1,212 @@ +/* + * 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.inference; + +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.String; +import java.util.Collections; +import java.util.HashMap; +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: inference.delete_model.Request + +/** + * Delete an inference service model + * + * @see API + * specification + */ + +public class DeleteModelRequest extends RequestBase { + private final String modelId; + + private final TaskType taskType; + + // --------------------------------------------------------------------------------------------- + + private DeleteModelRequest(Builder builder) { + + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + + } + + public static DeleteModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final TaskType taskType() { + return this.taskType; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private String modelId; + + private TaskType taskType; + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final Builder taskType(TaskType value) { + this.taskType = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteModelRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteModelRequest build() { + _checkSingleUse(); + + return new DeleteModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.delete_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.delete_model", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + params.put("taskType", request.taskType.jsonValue()); + params.put("modelId", request.modelId); + } + return params; + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, DeleteModelResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java new file mode 100644 index 000000000..b479ad40b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java @@ -0,0 +1,107 @@ +/* + * 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.inference; + +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference.delete_model.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteModelResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteModelResponse(Builder builder) { + super(builder); + + } + + public static DeleteModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteModelResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteModelResponse build() { + _checkSingleUse(); + + return new DeleteModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteModelResponse::setupDeleteModelResponseDeserializer); + + protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java new file mode 100644 index 000000000..5a6fac587 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java @@ -0,0 +1,202 @@ +/* + * 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.inference; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.util.concurrent.CompletableFuture; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the inference namespace. + */ +public class ElasticsearchInferenceAsyncClient + extends + ApiClient { + + public ElasticsearchInferenceAsyncClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchInferenceAsyncClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchInferenceAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchInferenceAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: inference.delete_model + + /** + * Delete model in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteModel(DeleteModelRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Delete model in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteModelRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteModel( + Function> fn) { + return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + } + + // ----- Endpoint: inference.get_model + + /** + * Get a model in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getModel(GetModelRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Get a model in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link GetModelRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getModel( + Function> fn) { + return getModel(fn.apply(new GetModelRequest.Builder()).build()); + } + + // ----- Endpoint: inference.inference + + /** + * Perform inference on a model + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture inference(InferenceRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) InferenceRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Perform inference on a model + * + * @param fn + * a function that initializes a builder to create the + * {@link InferenceRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture inference( + Function> fn) { + return inference(fn.apply(new InferenceRequest.Builder()).build()); + } + + // ----- Endpoint: inference.put_model + + /** + * Configure a model for use in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putModel(PutModelRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Configure a model for use in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link PutModelRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putModel( + Function> fn) { + return putModel(fn.apply(new PutModelRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java new file mode 100644 index 000000000..c46cc5480 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java @@ -0,0 +1,201 @@ +/* + * 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.inference; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.io.IOException; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the inference namespace. + */ +public class ElasticsearchInferenceClient extends ApiClient { + + public ElasticsearchInferenceClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchInferenceClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchInferenceClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchInferenceClient(this.transport, transportOptions); + } + + // ----- Endpoint: inference.delete_model + + /** + * Delete model in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public DeleteModelResponse deleteModel(DeleteModelRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Delete model in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteModelRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteModelResponse deleteModel( + Function> fn) + throws IOException, ElasticsearchException { + return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + } + + // ----- Endpoint: inference.get_model + + /** + * Get a model in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public GetModelResponse getModel(GetModelRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Get a model in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link GetModelRequest} + * @see Documentation + * on elastic.co + */ + + public final GetModelResponse getModel(Function> fn) + throws IOException, ElasticsearchException { + return getModel(fn.apply(new GetModelRequest.Builder()).build()); + } + + // ----- Endpoint: inference.inference + + /** + * Perform inference on a model + * + * @see Documentation + * on elastic.co + */ + + public InferenceResponse inference(InferenceRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) InferenceRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Perform inference on a model + * + * @param fn + * a function that initializes a builder to create the + * {@link InferenceRequest} + * @see Documentation + * on elastic.co + */ + + public final InferenceResponse inference(Function> fn) + throws IOException, ElasticsearchException { + return inference(fn.apply(new InferenceRequest.Builder()).build()); + } + + // ----- Endpoint: inference.put_model + + /** + * Configure a model for use in the Inference API + * + * @see Documentation + * on elastic.co + */ + + public PutModelResponse putModel(PutModelRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Configure a model for use in the Inference API + * + * @param fn + * a function that initializes a builder to create the + * {@link PutModelRequest} + * @see Documentation + * on elastic.co + */ + + public final PutModelResponse putModel(Function> fn) + throws IOException, ElasticsearchException { + return putModel(fn.apply(new PutModelRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java new file mode 100644 index 000000000..54ef93edc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java @@ -0,0 +1,210 @@ +/* + * 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.inference; + +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.String; +import java.util.Collections; +import java.util.HashMap; +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: inference.get_model.Request + +/** + * Get an inference service model + * + * @see API + * specification + */ + +public class GetModelRequest extends RequestBase { + private final String modelId; + + private final TaskType taskType; + + // --------------------------------------------------------------------------------------------- + + private GetModelRequest(Builder builder) { + + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + + } + + public static GetModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final TaskType taskType() { + return this.taskType; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + private String modelId; + + private TaskType taskType; + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final Builder taskType(TaskType value) { + this.taskType = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetModelRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetModelRequest build() { + _checkSingleUse(); + + return new GetModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.get_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.get_model", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + params.put("taskType", request.taskType.jsonValue()); + params.put("modelId", request.modelId); + } + return params; + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, GetModelResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java new file mode 100644 index 000000000..1d02e083a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java @@ -0,0 +1,182 @@ +/* + * 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.inference; + +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: inference.get_model.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetModelResponse implements JsonpSerializable { + private final List models; + + // --------------------------------------------------------------------------------------------- + + private GetModelResponse(Builder builder) { + + this.models = ApiTypeHelper.unmodifiableRequired(builder.models, this, "models"); + + } + + public static GetModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code models} + */ + public final List models() { + return this.models; + } + + /** + * 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.models)) { + generator.writeKey("models"); + generator.writeStartArray(); + for (ModelConfigContainer item0 : this.models) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private List models; + + /** + * Required - API name: {@code models} + *

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

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

+ * Adds a value to models using a builder lambda. + */ + public final Builder models(Function> fn) { + return models(fn.apply(new ModelConfigContainer.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetModelResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetModelResponse build() { + _checkSingleUse(); + + return new GetModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GetModelResponse::setupGetModelResponseDeserializer); + + protected static void setupGetModelResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::models, JsonpDeserializer.arrayDeserializer(ModelConfigContainer._DESERIALIZER), "models"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java new file mode 100644 index 000000000..681895e6b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java @@ -0,0 +1,325 @@ +/* + * 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.inference; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +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.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.String; +import java.util.Collections; +import java.util.HashMap; +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: inference.inference.Request + +/** + * Perform inference on the service + * + * @see API + * specification + */ +@JsonpDeserializable +public class InferenceRequest extends RequestBase implements JsonpSerializable { + private final List input; + + private final String modelId; + + @Nullable + private final JsonData taskSettings; + + private final TaskType taskType; + + // --------------------------------------------------------------------------------------------- + + private InferenceRequest(Builder builder) { + + this.input = ApiTypeHelper.unmodifiableRequired(builder.input, this, "input"); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.taskSettings = builder.taskSettings; + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + + } + + public static InferenceRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Text input to the model. Either a string or an array of strings. + *

+ * API name: {@code input} + */ + public final List input() { + return this.input; + } + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Optional task settings + *

+ * API name: {@code task_settings} + */ + @Nullable + public final JsonData taskSettings() { + return this.taskSettings; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final TaskType taskType() { + return this.taskType; + } + + /** + * 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.input)) { + generator.writeKey("input"); + generator.writeStartArray(); + for (String item0 : this.input) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.taskSettings != null) { + generator.writeKey("task_settings"); + this.taskSettings.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InferenceRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private List input; + + private String modelId; + + @Nullable + private JsonData taskSettings; + + private TaskType taskType; + + /** + * Required - Text input to the model. Either a string or an array of strings. + *

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

+ * Adds all elements of list to input. + */ + public final Builder input(List list) { + this.input = _listAddAll(this.input, list); + return this; + } + + /** + * Required - Text input to the model. Either a string or an array of strings. + *

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

+ * Adds one or more values to input. + */ + public final Builder input(String value, String... values) { + this.input = _listAdd(this.input, value, values); + return this; + } + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Optional task settings + *

+ * API name: {@code task_settings} + */ + public final Builder taskSettings(@Nullable JsonData value) { + this.taskSettings = value; + return this; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final Builder taskType(TaskType value) { + this.taskType = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InferenceRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InferenceRequest build() { + _checkSingleUse(); + + return new InferenceRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link InferenceRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + InferenceRequest::setupInferenceRequestDeserializer); + + protected static void setupInferenceRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::input, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "input"); + op.add(Builder::taskSettings, JsonData._DESERIALIZER, "task_settings"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.inference}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.inference", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + params.put("taskType", request.taskType.jsonValue()); + params.put("modelId", request.modelId); + } + return params; + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, InferenceResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResponse.java new file mode 100644 index 000000000..3eba0b8fa --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResponse.java @@ -0,0 +1,155 @@ +/* + * 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.inference; + +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: inference.inference.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class InferenceResponse implements JsonpSerializable { + private final InferenceResult valueBody; + + // --------------------------------------------------------------------------------------------- + + private InferenceResponse(Builder builder) { + + this.valueBody = ApiTypeHelper.requireNonNull(builder.valueBody, this, "valueBody"); + + } + + public static InferenceResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Response value. + */ + public final InferenceResult 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 InferenceResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private InferenceResult valueBody; + + /** + * Required - Response value. + */ + public final Builder valueBody(InferenceResult value) { + this.valueBody = value; + return this; + } + + /** + * Required - Response value. + */ + public final Builder valueBody(Function> fn) { + return this.valueBody(fn.apply(new InferenceResult.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + InferenceResult value = (InferenceResult) InferenceResult._DESERIALIZER.deserialize(parser, mapper); + return this.valueBody(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InferenceResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InferenceResponse build() { + _checkSingleUse(); + + return new InferenceResponse(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createInferenceResponseDeserializer(); + protected static JsonpDeserializer createInferenceResponseDeserializer() { + + JsonpDeserializer valueDeserializer = InferenceResult._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/inference/InferenceResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResult.java new file mode 100644 index 000000000..616d2ea5b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResult.java @@ -0,0 +1,278 @@ +/* + * 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.inference; + +import co.elastic.clients.json.JsonEnum; +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.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +import java.util.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: inference._types.InferenceResult + +/** + * InferenceResult is an aggregation of mutually exclusive variants + * + * @see API + * specification + */ +@JsonpDeserializable +public class InferenceResult implements TaggedUnion, JsonpSerializable { + + /** + * {@link InferenceResult} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + TextEmbeddingBytes("text_embedding_bytes"), + + TextEmbedding("text_embedding"), + + SparseEmbedding("sparse_embedding"), + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public InferenceResult(InferenceResultVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._inferenceResultKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private InferenceResult(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static InferenceResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code text_embedding_bytes}? + */ + public boolean isTextEmbeddingBytes() { + return _kind == Kind.TextEmbeddingBytes; + } + + /** + * Get the {@code text_embedding_bytes} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text_embedding_bytes} + * kind. + */ + public List textEmbeddingBytes() { + return TaggedUnionUtils.get(this, Kind.TextEmbeddingBytes); + } + + /** + * Is this variant instance of kind {@code text_embedding}? + */ + public boolean isTextEmbedding() { + return _kind == Kind.TextEmbedding; + } + + /** + * Get the {@code text_embedding} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text_embedding} kind. + */ + public List textEmbedding() { + return TaggedUnionUtils.get(this, Kind.TextEmbedding); + } + + /** + * Is this variant instance of kind {@code sparse_embedding}? + */ + public boolean isSparseEmbedding() { + return _kind == Kind.SparseEmbedding; + } + + /** + * Get the {@code sparse_embedding} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code sparse_embedding} + * kind. + */ + public List sparseEmbedding() { + return TaggedUnionUtils.get(this, Kind.SparseEmbedding); + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); + + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case TextEmbeddingBytes : + generator.writeStartArray(); + for (TextEmbeddingByteResult item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + case TextEmbedding : + generator.writeStartArray(); + for (TextEmbeddingResult item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + case SparseEmbedding : + generator.writeStartArray(); + for (SparseEmbeddingResult item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + } + } + + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + @Override + protected Builder self() { + return this; + } + public ObjectBuilder textEmbeddingBytes(List v) { + this._kind = Kind.TextEmbeddingBytes; + this._value = v; + return this; + } + + public ObjectBuilder textEmbedding(List v) { + this._kind = Kind.TextEmbedding; + this._value = v; + return this; + } + + public ObjectBuilder sparseEmbedding(List v) { + this._kind = Kind.SparseEmbedding; + this._value = v; + return this; + } + + public InferenceResult build() { + _checkSingleUse(); + return new InferenceResult(this); + } + + } + + protected static void setupInferenceResultDeserializer(ObjectDeserializer op) { + + op.add(Builder::textEmbeddingBytes, JsonpDeserializer.arrayDeserializer(TextEmbeddingByteResult._DESERIALIZER), + "text_embedding_bytes"); + op.add(Builder::textEmbedding, JsonpDeserializer.arrayDeserializer(TextEmbeddingResult._DESERIALIZER), + "text_embedding"); + op.add(Builder::sparseEmbedding, JsonpDeserializer.arrayDeserializer(SparseEmbeddingResult._DESERIALIZER), + "sparse_embedding"); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + InferenceResult::setupInferenceResultDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultBuilders.java new file mode 100644 index 000000000..4bc8aca15 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultBuilders.java @@ -0,0 +1,52 @@ +/* + * 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.inference; + +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 InferenceResult} variants. + *

+ * Variants text_embedding_bytes, text_embedding, + * sparse_embedding are not available here as they don't have a + * dedicated class. Use {@link InferenceResult}'s builder for these. + * + */ +public class InferenceResultBuilders { + private InferenceResultBuilders() { + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultVariant.java new file mode 100644 index 000000000..c9aa04b52 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceResultVariant.java @@ -0,0 +1,48 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.inference; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link InferenceResult} variants. + */ +public interface InferenceResultVariant { + + InferenceResult.Kind _inferenceResultKind(); + + default InferenceResult _toInferenceResult() { + return new InferenceResult(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java new file mode 100644 index 000000000..f7a219e29 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java @@ -0,0 +1,223 @@ +/* + * 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.inference; + +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.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: inference._types.ModelConfig + +/** + * Configuration options when storing the model config + * + * @see API + * specification + */ +@JsonpDeserializable +public class ModelConfig implements JsonpSerializable { + private final String service; + + private final JsonData serviceSettings; + + private final JsonData taskSettings; + + // --------------------------------------------------------------------------------------------- + + protected ModelConfig(AbstractBuilder builder) { + + this.service = ApiTypeHelper.requireNonNull(builder.service, this, "service"); + this.serviceSettings = ApiTypeHelper.requireNonNull(builder.serviceSettings, this, "serviceSettings"); + this.taskSettings = ApiTypeHelper.requireNonNull(builder.taskSettings, this, "taskSettings"); + + } + + public static ModelConfig modelConfigOf(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The service type + *

+ * API name: {@code service} + */ + public final String service() { + return this.service; + } + + /** + * Required - Settings specific to the service + *

+ * API name: {@code service_settings} + */ + public final JsonData serviceSettings() { + return this.serviceSettings; + } + + /** + * Required - Task settings specific to the service and model + *

+ * API name: {@code task_settings} + */ + public final JsonData taskSettings() { + return this.taskSettings; + } + + /** + * 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("service"); + generator.write(this.service); + + generator.writeKey("service_settings"); + this.serviceSettings.serialize(generator, mapper); + + generator.writeKey("task_settings"); + this.taskSettings.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ModelConfig}. + */ + + public static class Builder extends ModelConfig.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ModelConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ModelConfig build() { + _checkSingleUse(); + + return new ModelConfig(this); + } + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + private String service; + + private JsonData serviceSettings; + + private JsonData taskSettings; + + /** + * Required - The service type + *

+ * API name: {@code service} + */ + public final BuilderT service(String value) { + this.service = value; + return self(); + } + + /** + * Required - Settings specific to the service + *

+ * API name: {@code service_settings} + */ + public final BuilderT serviceSettings(JsonData value) { + this.serviceSettings = value; + return self(); + } + + /** + * Required - Task settings specific to the service and model + *

+ * API name: {@code task_settings} + */ + public final BuilderT taskSettings(JsonData value) { + this.taskSettings = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ModelConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ModelConfig::setupModelConfigDeserializer); + + protected static > void setupModelConfigDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::service, JsonpDeserializer.stringDeserializer(), "service"); + op.add(AbstractBuilder::serviceSettings, JsonData._DESERIALIZER, "service_settings"); + op.add(AbstractBuilder::taskSettings, JsonData._DESERIALIZER, "task_settings"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java new file mode 100644 index 000000000..10677d187 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java @@ -0,0 +1,182 @@ +/* + * 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.inference; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference._types.ModelConfigContainer + +/** + * Represents a model as returned by the GET API + * + * @see API + * specification + */ +@JsonpDeserializable +public class ModelConfigContainer extends ModelConfig { + private final String modelId; + + private final TaskType taskType; + + // --------------------------------------------------------------------------------------------- + + protected ModelConfigContainer(AbstractBuilder builder) { + super(builder); + + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + + } + + public static ModelConfigContainer modelConfigContainerOf( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The model Id + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Required - The model's task type + *

+ * API name: {@code task_type} + */ + public final TaskType taskType() { + return this.taskType; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("model_id"); + generator.write(this.modelId); + + generator.writeKey("task_type"); + this.taskType.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ModelConfigContainer}. + */ + + public static class Builder extends ModelConfigContainer.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ModelConfigContainer}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ModelConfigContainer build() { + _checkSingleUse(); + + return new ModelConfigContainer(this); + } + } + + public abstract static class AbstractBuilder> + extends + ModelConfig.AbstractBuilder { + private String modelId; + + private TaskType taskType; + + /** + * Required - The model Id + *

+ * API name: {@code model_id} + */ + public final BuilderT modelId(String value) { + this.modelId = value; + return self(); + } + + /** + * Required - The model's task type + *

+ * API name: {@code task_type} + */ + public final BuilderT taskType(TaskType value) { + this.taskType = value; + return self(); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ModelConfigContainer} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ModelConfigContainer::setupModelConfigContainerDeserializer); + + protected static > void setupModelConfigContainerDeserializer( + ObjectDeserializer op) { + ModelConfig.setupModelConfigDeserializer(op); + op.add(AbstractBuilder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(AbstractBuilder::taskType, TaskType._DESERIALIZER, "task_type"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java new file mode 100644 index 000000000..a1fd000f8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java @@ -0,0 +1,265 @@ +/* + * 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.inference; + +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.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +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 jakarta.json.stream.JsonParser; +import java.lang.String; +import java.util.Collections; +import java.util.HashMap; +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: inference.put_model.Request + +/** + * Create an inference service model + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutModelRequest extends RequestBase implements JsonpSerializable { + private final String modelId; + + private final TaskType taskType; + + private final ModelConfig modelConfig; + + // --------------------------------------------------------------------------------------------- + + private PutModelRequest(Builder builder) { + + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + this.modelConfig = ApiTypeHelper.requireNonNull(builder.modelConfig, this, "modelConfig"); + + } + + public static PutModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final TaskType taskType() { + return this.taskType; + } + + /** + * Required - Request body. + */ + public final ModelConfig modelConfig() { + return this.modelConfig; + } + + /** + * Serialize this value to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + this.modelConfig.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutModelRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + private String modelId; + + private TaskType taskType; + + private ModelConfig modelConfig; + + /** + * Required - The unique identifier of the inference model. + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Required - The model task type + *

+ * API name: {@code task_type} + */ + public final Builder taskType(TaskType value) { + this.taskType = value; + return this; + } + + /** + * Required - Request body. + */ + public final Builder modelConfig(ModelConfig value) { + this.modelConfig = value; + return this; + } + + /** + * Required - Request body. + */ + public final Builder modelConfig(Function> fn) { + return this.modelConfig(fn.apply(new ModelConfig.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + ModelConfig value = (ModelConfig) ModelConfig._DESERIALIZER.deserialize(parser, mapper); + return this.modelConfig(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutModelRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutModelRequest build() { + _checkSingleUse(); + + return new PutModelRequest(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createPutModelRequestDeserializer(); + protected static JsonpDeserializer createPutModelRequestDeserializer() { + + JsonpDeserializer valueDeserializer = ModelConfig._DESERIALIZER; + + return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() + .modelConfig(valueDeserializer.deserialize(parser, mapper, event)).build()); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.put_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.put_model", + + // Request method + request -> { + return "PUT"; + + }, + + // Request path + request -> { + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _modelId = 1 << 0; + final int _taskType = 1 << 1; + + int propsSet = 0; + + propsSet |= _modelId; + propsSet |= _taskType; + + if (propsSet == (_taskType | _modelId)) { + params.put("taskType", request.taskType.jsonValue()); + params.put("modelId", request.modelId); + } + return params; + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, PutModelResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java new file mode 100644 index 000000000..1d25f7476 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java @@ -0,0 +1,106 @@ +/* + * 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.inference; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference.put_model.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutModelResponse extends ModelConfigContainer { + // --------------------------------------------------------------------------------------------- + + private PutModelResponse(Builder builder) { + super(builder); + + } + + public static PutModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutModelResponse}. + */ + + public static class Builder extends ModelConfigContainer.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutModelResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutModelResponse build() { + _checkSingleUse(); + + return new PutModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PutModelResponse::setupPutModelResponseDeserializer); + + protected static void setupPutModelResponseDeserializer(ObjectDeserializer op) { + ModelConfigContainer.setupModelConfigContainerDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/SparseEmbeddingResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/SparseEmbeddingResult.java new file mode 100644 index 000000000..7538e4951 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/SparseEmbeddingResult.java @@ -0,0 +1,180 @@ +/* + * 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.inference; + +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.Float; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference._types.SparseEmbeddingResult + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SparseEmbeddingResult implements JsonpSerializable { + private final Map embedding; + + // --------------------------------------------------------------------------------------------- + + private SparseEmbeddingResult(Builder builder) { + + this.embedding = ApiTypeHelper.unmodifiableRequired(builder.embedding, this, "embedding"); + + } + + public static SparseEmbeddingResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code embedding} + */ + public final Map embedding() { + return this.embedding; + } + + /** + * 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.embedding)) { + generator.writeKey("embedding"); + generator.writeStartObject(); + for (Map.Entry item0 : this.embedding.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SparseEmbeddingResult}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Map embedding; + + /** + * Required - API name: {@code embedding} + *

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

+ * Adds an entry to embedding. + */ + public final Builder embedding(String key, Float value) { + this.embedding = _mapPut(this.embedding, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SparseEmbeddingResult}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SparseEmbeddingResult build() { + _checkSingleUse(); + + return new SparseEmbeddingResult(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SparseEmbeddingResult} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SparseEmbeddingResult::setupSparseEmbeddingResultDeserializer); + + protected static void setupSparseEmbeddingResultDeserializer(ObjectDeserializer op) { + + op.add(Builder::embedding, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.floatDeserializer()), + "embedding"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TaskType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TaskType.java new file mode 100644 index 000000000..f64455e15 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TaskType.java @@ -0,0 +1,65 @@ +/* + * 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.inference; + +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 TaskType implements JsonEnum { + SparseEmbedding("sparse_embedding"), + + TextEmbedding("text_embedding"), + + ; + + private final String jsonValue; + + TaskType(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(TaskType.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingByteResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingByteResult.java new file mode 100644 index 000000000..2143fa6c4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingByteResult.java @@ -0,0 +1,180 @@ +/* + * 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.inference; + +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.Number; +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: inference._types.TextEmbeddingByteResult + +/** + * The text embedding result object for byte representation + * + * @see API + * specification + */ +@JsonpDeserializable +public class TextEmbeddingByteResult implements JsonpSerializable { + private final List embedding; + + // --------------------------------------------------------------------------------------------- + + private TextEmbeddingByteResult(Builder builder) { + + this.embedding = ApiTypeHelper.unmodifiableRequired(builder.embedding, this, "embedding"); + + } + + public static TextEmbeddingByteResult of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code embedding} + */ + public final List embedding() { + return this.embedding; + } + + /** + * 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.embedding)) { + generator.writeKey("embedding"); + generator.writeStartArray(); + for (Number item0 : this.embedding) { + generator.write(item0.doubleValue()); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TextEmbeddingByteResult}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List embedding; + + /** + * Required - API name: {@code embedding} + *

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

+ * Adds one or more values to embedding. + */ + public final Builder embedding(Number value, Number... values) { + this.embedding = _listAdd(this.embedding, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TextEmbeddingByteResult}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TextEmbeddingByteResult build() { + _checkSingleUse(); + + return new TextEmbeddingByteResult(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TextEmbeddingByteResult} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TextEmbeddingByteResult::setupTextEmbeddingByteResultDeserializer); + + protected static void setupTextEmbeddingByteResultDeserializer( + ObjectDeserializer op) { + + op.add(Builder::embedding, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.numberDeserializer()), + "embedding"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Realm.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingResult.java similarity index 59% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/security/Realm.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingResult.java index 43165f689..a237a6945 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Realm.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextEmbeddingResult.java @@ -17,7 +17,7 @@ * under the License. */ -package co.elastic.clients.elasticsearch.security; +package co.elastic.clients.elasticsearch.inference; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -30,7 +30,8 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.String; +import java.lang.Float; +import java.util.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -50,42 +51,36 @@ // //---------------------------------------------------------------- -// typedef: security._types.Realm +// typedef: inference._types.TextEmbeddingResult /** - * - * @see API + * The text embedding result object + * + * @see API * specification */ @JsonpDeserializable -public class Realm implements FieldRuleVariant, JsonpSerializable { - private final String name; +public class TextEmbeddingResult implements JsonpSerializable { + private final List embedding; // --------------------------------------------------------------------------------------------- - private Realm(Builder builder) { + private TextEmbeddingResult(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.embedding = ApiTypeHelper.unmodifiableRequired(builder.embedding, this, "embedding"); } - public static Realm of(Function> fn) { + public static TextEmbeddingResult of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * FieldRule variant kind. + * Required - API name: {@code embedding} */ - @Override - public FieldRule.Kind _fieldRuleKind() { - return FieldRule.Kind.Realm; - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; + public final List embedding() { + return this.embedding; } /** @@ -99,8 +94,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("name"); - generator.write(this.name); + if (ApiTypeHelper.isDefined(this.embedding)) { + generator.writeKey("embedding"); + generator.writeStartArray(); + for (Float item0 : this.embedding) { + generator.write(item0); + + } + generator.writeEnd(); + + } } @@ -112,17 +115,31 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Realm}. + * Builder for {@link TextEmbeddingResult}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List embedding; + + /** + * Required - API name: {@code embedding} + *

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

+ * Adds one or more values to embedding. */ - public final Builder name(String value) { - this.name = value; + public final Builder embedding(Float value, Float... values) { + this.embedding = _listAdd(this.embedding, value, values); return this; } @@ -132,29 +149,30 @@ protected Builder self() { } /** - * Builds a {@link Realm}. + * Builds a {@link TextEmbeddingResult}. * * @throws NullPointerException * if some of the required fields are null. */ - public Realm build() { + public TextEmbeddingResult build() { _checkSingleUse(); - return new Realm(this); + return new TextEmbeddingResult(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Realm} + * Json deserializer for {@link TextEmbeddingResult} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Realm::setupRealmDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TextEmbeddingResult::setupTextEmbeddingResultDeserializer); - protected static void setupRealmDeserializer(ObjectDeserializer op) { + protected static void setupTextEmbeddingResultDeserializer(ObjectDeserializer op) { - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::embedding, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()), + "embedding"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java index b3e877465..1ec9cc9c2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.ingest; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -33,6 +34,7 @@ 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; @@ -71,6 +73,8 @@ public class Pipeline implements JsonpSerializable { @Nullable private final Long version; + private final Map meta; + // --------------------------------------------------------------------------------------------- private Pipeline(Builder builder) { @@ -79,6 +83,7 @@ private Pipeline(Builder builder) { this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); this.version = builder.version; + this.meta = ApiTypeHelper.unmodifiableRequired(builder.meta, this, "meta"); } @@ -125,6 +130,16 @@ public final Long version() { return this.version; } + /** + * Required - Arbitrary metadata about the ingest pipeline. This map is not + * automatically generated by Elasticsearch. + *

+ * API name: {@code _meta} + */ + public final Map meta() { + return this.meta; + } + /** * Serialize this object to JSON. */ @@ -166,6 +181,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.version); } + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -193,6 +219,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long version; + private Map meta; + /** * Description of the ingest pipeline. *

@@ -286,6 +314,32 @@ public final Builder version(@Nullable Long value) { return this; } + /** + * Required - Arbitrary metadata about the ingest pipeline. This map is not + * automatically generated by Elasticsearch. + *

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

+ * Adds all entries of map to meta. + */ + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; + } + + /** + * Required - Arbitrary metadata about the ingest pipeline. This map is not + * automatically generated by Elasticsearch. + *

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

+ * Adds an entry to meta. + */ + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + @Override protected Builder self() { return this; @@ -318,6 +372,7 @@ protected static void setupPipelineDeserializer(ObjectDeserializer rename(Function script(Script v) { + public ObjectBuilder reroute(RerouteProcessor v) { + this._kind = Kind.Reroute; + this._value = v; + return this; + } + + public ObjectBuilder reroute( + Function> fn) { + return this.reroute(fn.apply(new RerouteProcessor.Builder()).build()); + } + + public ObjectBuilder script(ScriptProcessor v) { this._kind = Kind.Script; this._value = v; return this; } - public ObjectBuilder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + public ObjectBuilder script(Function> fn) { + return this.script(fn.apply(new ScriptProcessor.Builder()).build()); } public ObjectBuilder set(SetProcessor v) { @@ -1229,7 +1258,8 @@ protected static void setupProcessorDeserializer(ObjectDeserializer op) op.add(Builder::lowercase, LowercaseProcessor._DESERIALIZER, "lowercase"); op.add(Builder::remove, RemoveProcessor._DESERIALIZER, "remove"); op.add(Builder::rename, RenameProcessor._DESERIALIZER, "rename"); - op.add(Builder::script, Script._DESERIALIZER, "script"); + op.add(Builder::reroute, RerouteProcessor._DESERIALIZER, "reroute"); + op.add(Builder::script, ScriptProcessor._DESERIALIZER, "script"); op.add(Builder::set, SetProcessor._DESERIALIZER, "set"); op.add(Builder::sort, SortProcessor._DESERIALIZER, "sort"); op.add(Builder::split, SplitProcessor._DESERIALIZER, "split"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java index 1a1376e82..f5d4c5074 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch.ingest; -import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.util.ObjectBuilder; import java.util.function.Function; @@ -407,18 +406,38 @@ public static Processor rename(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.reroute(fn.apply(new RerouteProcessor.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ScriptProcessor script} {@code Processor} + * variant. */ - public static Script.Builder script() { - return new Script.Builder(); + public static ScriptProcessor.Builder script() { + return new ScriptProcessor.Builder(); } /** - * Creates a Processor of the {@link Script script} {@code Processor} variant. + * Creates a Processor of the {@link ScriptProcessor script} {@code Processor} + * variant. */ - public static Processor script(Function> fn) { + public static Processor script(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.script(fn.apply(new Script.Builder()).build()); + builder.script(fn.apply(new ScriptProcessor.Builder()).build()); return builder.build(); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RerouteProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RerouteProcessor.java new file mode 100644 index 000000000..89ea39274 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RerouteProcessor.java @@ -0,0 +1,326 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest._types.RerouteProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RerouteProcessor extends ProcessorBase implements ProcessorVariant { + @Nullable + private final String destination; + + private final List dataset; + + private final List namespace; + + // --------------------------------------------------------------------------------------------- + + private RerouteProcessor(Builder builder) { + super(builder); + + this.destination = builder.destination; + this.dataset = ApiTypeHelper.unmodifiable(builder.dataset); + this.namespace = ApiTypeHelper.unmodifiable(builder.namespace); + + } + + public static RerouteProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Reroute; + } + + /** + * A static value for the target. Can’t be set when the dataset or namespace + * option is set. + *

+ * API name: {@code destination} + */ + @Nullable + public final String destination() { + return this.destination; + } + + /** + * Field references or a static value for the dataset part of the data stream + * name. In addition to the criteria for index names, cannot contain - and must + * be no longer than 100 characters. Example values are nginx.access and + * nginx.error. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <dataset> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.dataset}} + *

+ * API name: {@code dataset} + */ + public final List dataset() { + return this.dataset; + } + + /** + * Field references or a static value for the namespace part of the data stream + * name. See the criteria for index names for allowed characters. Must be no + * longer than 100 characters. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <namespace> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.namespace}} + *

+ * API name: {@code namespace} + */ + public final List namespace() { + return this.namespace; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.destination != null) { + generator.writeKey("destination"); + generator.write(this.destination); + + } + if (ApiTypeHelper.isDefined(this.dataset)) { + generator.writeKey("dataset"); + generator.writeStartArray(); + for (String item0 : this.dataset) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.namespace)) { + generator.writeKey("namespace"); + generator.writeStartArray(); + for (String item0 : this.namespace) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RerouteProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String destination; + + @Nullable + private List dataset; + + @Nullable + private List namespace; + + /** + * A static value for the target. Can’t be set when the dataset or namespace + * option is set. + *

+ * API name: {@code destination} + */ + public final Builder destination(@Nullable String value) { + this.destination = value; + return this; + } + + /** + * Field references or a static value for the dataset part of the data stream + * name. In addition to the criteria for index names, cannot contain - and must + * be no longer than 100 characters. Example values are nginx.access and + * nginx.error. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <dataset> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.dataset}} + *

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

+ * Adds all elements of list to dataset. + */ + public final Builder dataset(List list) { + this.dataset = _listAddAll(this.dataset, list); + return this; + } + + /** + * Field references or a static value for the dataset part of the data stream + * name. In addition to the criteria for index names, cannot contain - and must + * be no longer than 100 characters. Example values are nginx.access and + * nginx.error. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <dataset> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.dataset}} + *

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

+ * Adds one or more values to dataset. + */ + public final Builder dataset(String value, String... values) { + this.dataset = _listAdd(this.dataset, value, values); + return this; + } + + /** + * Field references or a static value for the namespace part of the data stream + * name. See the criteria for index names for allowed characters. Must be no + * longer than 100 characters. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <namespace> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.namespace}} + *

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

+ * Adds all elements of list to namespace. + */ + public final Builder namespace(List list) { + this.namespace = _listAddAll(this.namespace, list); + return this; + } + + /** + * Field references or a static value for the namespace part of the data stream + * name. See the criteria for index names for allowed characters. Must be no + * longer than 100 characters. + *

+ * Supports field references with a mustache-like syntax (denoted as {{double}} + * or {{{triple}}} curly braces). When resolving field references, the processor + * replaces invalid characters with _. Uses the <namespace> part of the + * index name as a fallback if all field references resolve to a null, missing, + * or non-string value. + *

+ * default {{data_stream.namespace}} + *

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

+ * Adds one or more values to namespace. + */ + public final Builder namespace(String value, String... values) { + this.namespace = _listAdd(this.namespace, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RerouteProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RerouteProcessor build() { + _checkSingleUse(); + + return new RerouteProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RerouteProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RerouteProcessor::setupRerouteProcessorDeserializer); + + protected static void setupRerouteProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::destination, JsonpDeserializer.stringDeserializer(), "destination"); + op.add(Builder::dataset, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "dataset"); + op.add(Builder::namespace, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "namespace"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ScriptProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ScriptProcessor.java new file mode 100644 index 000000000..ff8ca34db --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ScriptProcessor.java @@ -0,0 +1,281 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest; + +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest._types.ScriptProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ScriptProcessor extends ProcessorBase implements ProcessorVariant { + @Nullable + private final String id; + + @Nullable + private final String lang; + + private final Map params; + + @Nullable + private final String source; + + // --------------------------------------------------------------------------------------------- + + private ScriptProcessor(Builder builder) { + super(builder); + + this.id = builder.id; + this.lang = builder.lang; + this.params = ApiTypeHelper.unmodifiable(builder.params); + this.source = builder.source; + + } + + public static ScriptProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Script; + } + + /** + * ID of a stored script. If no source is specified, this parameter + * is required. + *

+ * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + + /** + * Script language. + *

+ * API name: {@code lang} + */ + @Nullable + public final String lang() { + return this.lang; + } + + /** + * Object containing parameters for the script. + *

+ * API name: {@code params} + */ + public final Map params() { + return this.params; + } + + /** + * Inline script. If no id is specified, this parameter is + * required. + *

+ * API name: {@code source} + */ + @Nullable + public final String source() { + return this.source; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + + } + if (ApiTypeHelper.isDefined(this.params)) { + generator.writeKey("params"); + generator.writeStartObject(); + for (Map.Entry item0 : this.params.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.source != null) { + generator.writeKey("source"); + generator.write(this.source); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ScriptProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String id; + + @Nullable + private String lang; + + @Nullable + private Map params; + + @Nullable + private String source; + + /** + * ID of a stored script. If no source is specified, this parameter + * is required. + *

+ * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * Script language. + *

+ * API name: {@code lang} + */ + public final Builder lang(@Nullable String value) { + this.lang = value; + return this; + } + + /** + * Object containing parameters for the script. + *

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

+ * Adds all entries of map to params. + */ + public final Builder params(Map map) { + this.params = _mapPutAll(this.params, map); + return this; + } + + /** + * Object containing parameters for the script. + *

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

+ * Adds an entry to params. + */ + public final Builder params(String key, JsonData value) { + this.params = _mapPut(this.params, key, value); + return this; + } + + /** + * Inline script. If no id is specified, this parameter is + * required. + *

+ * API name: {@code source} + */ + public final Builder source(@Nullable String value) { + this.source = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ScriptProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ScriptProcessor build() { + _checkSingleUse(); + + return new ScriptProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ScriptProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ScriptProcessor::setupScriptProcessorDeserializer); + + protected static void setupScriptProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); + op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); + op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashAsyncClient.java index 933ca1a7e..148fd4e9d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashAsyncClient.java @@ -134,6 +134,19 @@ public final CompletableFuture getPipeline( return getPipeline(fn.apply(new GetPipelineRequest.Builder()).build()); } + /** + * Retrieves Logstash Pipelines used by Central Management + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getPipeline() { + return this.transport.performRequestAsync(new GetPipelineRequest.Builder().build(), + GetPipelineRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: logstash.put_pipeline /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashClient.java index 226ce0313..5b762f278 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/ElasticsearchLogstashClient.java @@ -134,6 +134,19 @@ public final GetPipelineResponse getPipeline( return getPipeline(fn.apply(new GetPipelineRequest.Builder()).build()); } + /** + * Retrieves Logstash Pipelines used by Central Management + * + * @see Documentation + * on elastic.co + */ + + public GetPipelineResponse getPipeline() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetPipelineRequest.Builder().build(), GetPipelineRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: logstash.put_pipeline /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/GetPipelineRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/GetPipelineRequest.java index 953b6a522..bedf522d9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/GetPipelineRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/logstash/GetPipelineRequest.java @@ -71,7 +71,7 @@ public class GetPipelineRequest extends RequestBase { private GetPipelineRequest(Builder builder) { - this.id = ApiTypeHelper.unmodifiableRequired(builder.id, this, "id"); + this.id = ApiTypeHelper.unmodifiable(builder.id); } @@ -80,7 +80,7 @@ public static GetPipelineRequest of(Function * API name: {@code id} */ @@ -97,10 +97,11 @@ public final List id() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable private List id; /** - * Required - Comma-separated list of pipeline identifiers. + * Comma-separated list of pipeline identifiers. *

* API name: {@code id} *

@@ -112,7 +113,7 @@ public final Builder id(List list) { } /** - * Required - Comma-separated list of pipeline identifiers. + * Comma-separated list of pipeline identifiers. *

* API name: {@code id} *

@@ -161,7 +162,8 @@ public GetPipelineRequest build() { int propsSet = 0; - propsSet |= _id; + if (ApiTypeHelper.isDefined(request.id())) + propsSet |= _id; if (propsSet == 0) { StringBuilder buf = new StringBuilder(); @@ -188,7 +190,8 @@ public GetPipelineRequest build() { int propsSet = 0; - propsSet |= _id; + if (ApiTypeHelper.isDefined(request.id())) + propsSet |= _id; if (propsSet == 0) { } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelRequest.java index 7424f0532..933adbbc7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelRequest.java @@ -100,6 +100,9 @@ public class PutTrainedModelRequest extends RequestBase implements JsonpSerializ @Nullable private final TrainedModelType modelType; + @Nullable + private final String platformArchitecture; + private final List tags; // --------------------------------------------------------------------------------------------- @@ -116,6 +119,7 @@ private PutTrainedModelRequest(Builder builder) { this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); this.modelSizeBytes = builder.modelSizeBytes; this.modelType = builder.modelType; + this.platformArchitecture = builder.platformArchitecture; this.tags = ApiTypeHelper.unmodifiable(builder.tags); } @@ -233,6 +237,24 @@ public final TrainedModelType modelType() { return this.modelType; } + /** + * The platform architecture (if applicable) of the trained mode. If the model + * only works on one platform, because it is heavily optimized for a particular + * processor architecture and OS combination, then this field specifies which. + * The format of the string must match the platform identifiers used by + * Elasticsearch, so one of, linux-x86_64, + * linux-aarch64, darwin-x86_64, + * darwin-aarch64, or windows-x86_64. For portable + * models (those that work independent of processor architecture or OS + * features), leave this field unset. + *

+ * API name: {@code platform_architecture} + */ + @Nullable + public final String platformArchitecture() { + return this.platformArchitecture; + } + /** * An array of tags to organize the model. *

@@ -292,6 +314,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("model_type"); this.modelType.serialize(generator, mapper); } + if (this.platformArchitecture != null) { + generator.writeKey("platform_architecture"); + generator.write(this.platformArchitecture); + + } if (ApiTypeHelper.isDefined(this.tags)) { generator.writeKey("tags"); generator.writeStartArray(); @@ -343,6 +370,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private TrainedModelType modelType; + @Nullable + private String platformArchitecture; + @Nullable private List tags; @@ -488,6 +518,24 @@ public final Builder modelType(@Nullable TrainedModelType value) { return this; } + /** + * The platform architecture (if applicable) of the trained mode. If the model + * only works on one platform, because it is heavily optimized for a particular + * processor architecture and OS combination, then this field specifies which. + * The format of the string must match the platform identifiers used by + * Elasticsearch, so one of, linux-x86_64, + * linux-aarch64, darwin-x86_64, + * darwin-aarch64, or windows-x86_64. For portable + * models (those that work independent of processor architecture or OS + * features), leave this field unset. + *

+ * API name: {@code platform_architecture} + */ + public final Builder platformArchitecture(@Nullable String value) { + this.platformArchitecture = value; + return this; + } + /** * An array of tags to organize the model. *

@@ -549,6 +597,7 @@ protected static void setupPutTrainedModelRequestDeserializer( op.add(Builder::metadata, JsonData._DESERIALIZER, "metadata"); op.add(Builder::modelSizeBytes, JsonpDeserializer.longDeserializer(), "model_size_bytes"); op.add(Builder::modelType, TrainedModelType._DESERIALIZER, "model_type"); + op.add(Builder::platformArchitecture, JsonpDeserializer.stringDeserializer(), "platform_architecture"); op.add(Builder::tags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "tags"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java index 8c9fc72ee..04b60e764 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Double; import java.lang.String; import java.util.Collections; import java.util.HashMap; @@ -74,6 +75,8 @@ public class PutTrainedModelVocabularyRequest extends RequestBase implements Jso private final String modelId; + private final List scores; + private final List vocabulary; // --------------------------------------------------------------------------------------------- @@ -82,6 +85,7 @@ private PutTrainedModelVocabularyRequest(Builder builder) { this.merges = ApiTypeHelper.unmodifiable(builder.merges); this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.scores = ApiTypeHelper.unmodifiable(builder.scores); this.vocabulary = ApiTypeHelper.unmodifiableRequired(builder.vocabulary, this, "vocabulary"); } @@ -109,6 +113,15 @@ public final String modelId() { return this.modelId; } + /** + * The optional vocabulary value scores if required by the tokenizer. + *

+ * API name: {@code scores} + */ + public final List scores() { + return this.scores; + } + /** * Required - The model vocabulary, which must not be empty. *

@@ -138,6 +151,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.scores)) { + generator.writeKey("scores"); + generator.writeStartArray(); + for (Double item0 : this.scores) { + generator.write(item0); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.vocabulary)) { generator.writeKey("vocabulary"); @@ -166,6 +189,9 @@ public static class Builder extends RequestBase.AbstractBuilder private String modelId; + @Nullable + private List scores; + private List vocabulary; /** @@ -202,6 +228,30 @@ public final Builder modelId(String value) { return this; } + /** + * The optional vocabulary value scores if required by the tokenizer. + *

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

+ * Adds all elements of list to scores. + */ + public final Builder scores(List list) { + this.scores = _listAddAll(this.scores, list); + return this; + } + + /** + * The optional vocabulary value scores if required by the tokenizer. + *

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

+ * Adds one or more values to scores. + */ + public final Builder scores(Double value, Double... values) { + this.scores = _listAdd(this.scores, value, values); + return this; + } + /** * Required - The model vocabulary, which must not be empty. *

@@ -256,6 +306,7 @@ protected static void setupPutTrainedModelVocabularyRequestDeserializer( ObjectDeserializer op) { op.add(Builder::merges, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "merges"); + op.add(Builder::scores, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "scores"); op.add(Builder::vocabulary, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "vocabulary"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartTrainedModelDeploymentRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartTrainedModelDeploymentRequest.java index 695b6ea56..416988bac 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartTrainedModelDeploymentRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartTrainedModelDeploymentRequest.java @@ -69,6 +69,9 @@ public class StartTrainedModelDeploymentRequest extends RequestBase { @Nullable private final String cacheSize; + @Nullable + private final String deploymentId; + private final String modelId; @Nullable @@ -94,6 +97,7 @@ public class StartTrainedModelDeploymentRequest extends RequestBase { private StartTrainedModelDeploymentRequest(Builder builder) { this.cacheSize = builder.cacheSize; + this.deploymentId = builder.deploymentId; this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); this.numberOfAllocations = builder.numberOfAllocations; this.priority = builder.priority; @@ -122,6 +126,16 @@ public final String cacheSize() { return this.cacheSize; } + /** + * A unique identifier for the deployment of the model. + *

+ * API name: {@code deployment_id} + */ + @Nullable + public final String deploymentId() { + return this.deploymentId; + } + /** * Required - The unique identifier of the trained model. Currently, only * PyTorch models are supported. @@ -216,6 +230,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private String cacheSize; + @Nullable + private String deploymentId; + private String modelId; @Nullable @@ -249,6 +266,16 @@ public final Builder cacheSize(@Nullable String value) { return this; } + /** + * A unique identifier for the deployment of the model. + *

+ * API name: {@code deployment_id} + */ + public final Builder deploymentId(@Nullable String value) { + this.deploymentId = value; + return this; + } + /** * Required - The unique identifier of the trained model. Currently, only * PyTorch models are supported. @@ -419,6 +446,9 @@ public StartTrainedModelDeploymentRequest build() { if (request.threadsPerAllocation != null) { params.put("threads_per_allocation", String.valueOf(request.threadsPerAllocation)); } + if (request.deploymentId != null) { + params.put("deployment_id", request.deploymentId); + } if (request.waitFor != null) { params.put("wait_for", request.waitFor.jsonValue()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java index 3f4d746c5..7340a8e2f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java @@ -114,6 +114,9 @@ public class TrainedModelConfig implements JsonpSerializable { @Nullable private final TrainedModelLocation location; + @Nullable + private final TrainedModelPrefixStrings prefixStrings; + // --------------------------------------------------------------------------------------------- protected TrainedModelConfig(AbstractBuilder builder) { @@ -136,6 +139,7 @@ protected TrainedModelConfig(AbstractBuilder builder) { this.metadata = builder.metadata; this.modelSizeBytes = builder.modelSizeBytes; this.location = builder.location; + this.prefixStrings = builder.prefixStrings; } @@ -318,6 +322,14 @@ public final TrainedModelLocation location() { return this.location; } + /** + * API name: {@code prefix_strings} + */ + @Nullable + public final TrainedModelPrefixStrings prefixStrings() { + return this.prefixStrings; + } + /** * Serialize this object to JSON. */ @@ -424,6 +436,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.location.serialize(generator, mapper); } + if (this.prefixStrings != null) { + generator.writeKey("prefix_strings"); + this.prefixStrings.serialize(generator, mapper); + + } } @@ -513,6 +530,9 @@ public abstract static class AbstractBuilder @@ -762,6 +782,22 @@ public final BuilderT location(Function> fn) { + return this.prefixStrings(fn.apply(new TrainedModelPrefixStrings.Builder()).build()); + } + protected abstract BuilderT self(); } @@ -798,6 +834,7 @@ protected static > void setupTrainedM op.add(AbstractBuilder::metadata, TrainedModelConfigMetadata._DESERIALIZER, "metadata"); op.add(AbstractBuilder::modelSizeBytes, JsonpDeserializer.stringDeserializer(), "model_size_bytes"); op.add(AbstractBuilder::location, TrainedModelLocation._DESERIALIZER, "location"); + op.add(AbstractBuilder::prefixStrings, TrainedModelPrefixStrings._DESERIALIZER, "prefix_strings"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelPrefixStrings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelPrefixStrings.java new file mode 100644 index 000000000..4055149d4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelPrefixStrings.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.ml; + +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.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: ml._types.TrainedModelPrefixStrings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TrainedModelPrefixStrings implements JsonpSerializable { + private final String ingest; + + private final String search; + + // --------------------------------------------------------------------------------------------- + + private TrainedModelPrefixStrings(Builder builder) { + + this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest"); + this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); + + } + + public static TrainedModelPrefixStrings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - String prepended to input at ingest + *

+ * API name: {@code ingest} + */ + public final String ingest() { + return this.ingest; + } + + /** + * Required - String prepended to input at search + *

+ * API name: {@code search} + */ + public final String search() { + return this.search; + } + + /** + * 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("ingest"); + generator.write(this.ingest); + + generator.writeKey("search"); + generator.write(this.search); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TrainedModelPrefixStrings}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String ingest; + + private String search; + + /** + * Required - String prepended to input at ingest + *

+ * API name: {@code ingest} + */ + public final Builder ingest(String value) { + this.ingest = value; + return this; + } + + /** + * Required - String prepended to input at search + *

+ * API name: {@code search} + */ + public final Builder search(String value) { + this.search = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TrainedModelPrefixStrings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TrainedModelPrefixStrings build() { + _checkSingleUse(); + + return new TrainedModelPrefixStrings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TrainedModelPrefixStrings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TrainedModelPrefixStrings::setupTrainedModelPrefixStringsDeserializer); + + protected static void setupTrainedModelPrefixStringsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::ingest, JsonpDeserializer.stringDeserializer(), "ingest"); + op.add(Builder::search, JsonpDeserializer.stringDeserializer(), "search"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/PutRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/PutRequest.java index 9d2035f34..986b3f087 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/PutRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/PutRequest.java @@ -32,10 +32,10 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; import java.lang.String; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -66,16 +66,16 @@ */ @JsonpDeserializable public class PutRequest extends RequestBase implements JsonpSerializable { - private final String rulesetId; + private final List rules; - private final QueryRuleset queryRuleset; + private final String rulesetId; // --------------------------------------------------------------------------------------------- private PutRequest(Builder builder) { + this.rules = ApiTypeHelper.unmodifiableRequired(builder.rules, this, "rules"); this.rulesetId = ApiTypeHelper.requireNonNull(builder.rulesetId, this, "rulesetId"); - this.queryRuleset = ApiTypeHelper.requireNonNull(builder.queryRuleset, this, "queryRuleset"); } @@ -83,6 +83,13 @@ public static PutRequest of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - API name: {@code rules} + */ + public final List rules() { + return this.rules; + } + /** * Required - The unique identifier of the query ruleset to be created or * updated @@ -94,17 +101,26 @@ public final String rulesetId() { } /** - * Required - Request body. + * Serialize this object to JSON. */ - public final QueryRuleset queryRuleset() { - return this.queryRuleset; + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); } - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - this.queryRuleset.serialize(generator, mapper); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.rules)) { + generator.writeKey("rules"); + generator.writeStartArray(); + for (QueryRule item0 : this.rules) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -115,42 +131,48 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String rulesetId; + private List rules; - private QueryRuleset queryRuleset; + private String rulesetId; /** - * Required - The unique identifier of the query ruleset to be created or - * updated + * Required - API name: {@code rules} *

- * API name: {@code ruleset_id} + * Adds all elements of list to rules. */ - public final Builder rulesetId(String value) { - this.rulesetId = value; + public final Builder rules(List list) { + this.rules = _listAddAll(this.rules, list); return this; } /** - * Required - Request body. + * Required - API name: {@code rules} + *

+ * Adds one or more values to rules. */ - public final Builder queryRuleset(QueryRuleset value) { - this.queryRuleset = value; + public final Builder rules(QueryRule value, QueryRule... values) { + this.rules = _listAdd(this.rules, value, values); return this; } /** - * Required - Request body. + * Required - API name: {@code rules} + *

+ * Adds a value to rules using a builder lambda. */ - public final Builder queryRuleset(Function> fn) { - return this.queryRuleset(fn.apply(new QueryRuleset.Builder()).build()); + public final Builder rules(Function> fn) { + return rules(fn.apply(new QueryRule.Builder()).build()); } - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - QueryRuleset value = (QueryRuleset) QueryRuleset._DESERIALIZER.deserialize(parser, mapper); - return this.queryRuleset(value); + /** + * Required - The unique identifier of the query ruleset to be created or + * updated + *

+ * API name: {@code ruleset_id} + */ + public final Builder rulesetId(String value) { + this.rulesetId = value; + return this; } @Override @@ -171,13 +193,18 @@ public PutRequest build() { } } - public static final JsonpDeserializer _DESERIALIZER = createPutRequestDeserializer(); - protected static JsonpDeserializer createPutRequestDeserializer() { + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PutRequest::setupPutRequestDeserializer); + + protected static void setupPutRequestDeserializer(ObjectDeserializer op) { - JsonpDeserializer valueDeserializer = QueryRuleset._DESERIALIZER; + op.add(Builder::rules, JsonpDeserializer.arrayDeserializer(QueryRule._DESERIALIZER), "rules"); - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .queryRuleset(valueDeserializer.deserialize(parser, mapper, event)).build()); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/QueryRuleset.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/QueryRuleset.java index c395945ab..6292a7ae5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/QueryRuleset.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_ruleset/QueryRuleset.java @@ -59,8 +59,8 @@ * "../doc-files/api-spec.html#query_ruleset._types.QueryRuleset">API * specification */ -@JsonpDeserializable -public class QueryRuleset implements JsonpSerializable { + +public abstract class QueryRuleset implements JsonpSerializable { private final String rulesetId; private final List rules; @@ -74,10 +74,6 @@ protected QueryRuleset(AbstractBuilder builder) { } - public static QueryRuleset queryRulesetOf(Function> fn) { - return fn.apply(new Builder()).build(); - } - /** * Required - Query Ruleset unique identifier *

@@ -128,31 +124,6 @@ public String toString() { return JsonpUtils.toString(this); } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link QueryRuleset}. - */ - - public static class Builder extends QueryRuleset.AbstractBuilder implements ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link QueryRuleset}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public QueryRuleset build() { - _checkSingleUse(); - - return new QueryRuleset(this); - } - } - public abstract static class AbstractBuilder> extends WithJsonObjectBuilderBase { @@ -210,13 +181,6 @@ public final BuilderT rules(Function } // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link QueryRuleset} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - QueryRuleset::setupQueryRulesetDeserializer); - protected static > void setupQueryRulesetDeserializer( ObjectDeserializer op) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/AnalyticsCollection.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/AnalyticsCollection.java index 7cca7673f..2ed833b94 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/AnalyticsCollection.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/AnalyticsCollection.java @@ -74,7 +74,7 @@ public static AnalyticsCollection of(Function * API name: {@code event_data_stream} */ @@ -115,7 +115,7 @@ public static class Builder extends WithJsonObjectBuilderBase private EventDataStream eventDataStream; /** - * Required - Data stream for the collection + * Required - Data stream for the collection. *

* API name: {@code event_data_stream} */ @@ -125,7 +125,7 @@ public final Builder eventDataStream(EventDataStream value) { } /** - * Required - Data stream for the collection + * Required - Data stream for the collection. *

* API name: {@code event_data_stream} */ 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 75253d33f..60e770e46 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 @@ -75,7 +75,7 @@ public ElasticsearchSearchApplicationAsyncClient withTransportOptions(@Nullable * Deletes a search application. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html">Documentation * on elastic.co */ @@ -93,7 +93,7 @@ public CompletableFuture delete(DeleteSearchApp * a function that initializes a builder to create the * {@link DeleteSearchApplicationRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html">Documentation * on elastic.co */ 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 996756435..56b722362 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 @@ -76,7 +76,7 @@ public ElasticsearchSearchApplicationClient withTransportOptions(@Nullable Trans * Deletes a search application. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html">Documentation * on elastic.co */ @@ -95,7 +95,7 @@ public DeleteSearchApplicationResponse delete(DeleteSearchApplicationRequest req * a function that initializes a builder to create the * {@link DeleteSearchApplicationRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-search-application.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ListRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ListRequest.java index cf83cc73a..4ed4c98e7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ListRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ListRequest.java @@ -87,7 +87,7 @@ public static ListRequest of(Function> fn) { } /** - * Starting offset (default: 0) + * Starting offset. *

* API name: {@code from} */ @@ -97,7 +97,7 @@ public final Integer from() { } /** - * Query in the Lucene query string syntax" + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -107,7 +107,7 @@ public final String q() { } /** - * specifies a max number of results to get + * Specifies a max number of results to get. *

* API name: {@code size} */ @@ -133,7 +133,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Integer size; /** - * Starting offset (default: 0) + * Starting offset. *

* API name: {@code from} */ @@ -143,7 +143,7 @@ public final Builder from(@Nullable Integer value) { } /** - * Query in the Lucene query string syntax" + * Query in the Lucene query string syntax. *

* API name: {@code q} */ @@ -153,7 +153,7 @@ public final Builder q(@Nullable String value) { } /** - * specifies a max number of results to get + * Specifies a max number of results to get. *

* API name: {@code size} */ 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 6473703b6..110e36e92 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 + * Creates a behavioral analytics collection. * * @see API @@ -79,7 +79,7 @@ public static PutBehavioralAnalyticsRequest of(Function * API name: {@code name} */ @@ -99,7 +99,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; /** - * Required - The name of the analytics collection to be created or updated + * Required - The name of the analytics collection to be created or updated. *

* API name: {@code name} */ 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 182f2c878..57a8ee602 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 @@ -88,8 +88,8 @@ public static PutRequest of(Function> fn) { } /** - * If true, requires that a search application with the specified resource_id - * does not already exist. (default: false) + * If true, this request cannot replace or update existing Search + * Applications. *

* API name: {@code create} */ @@ -99,7 +99,7 @@ public final Boolean create() { } /** - * Required - The name of the search application to be created or updated + * Required - The name of the search application to be created or updated. *

* API name: {@code name} */ @@ -137,8 +137,8 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private SearchApplication searchApplication; /** - * If true, requires that a search application with the specified resource_id - * does not already exist. (default: false) + * If true, this request cannot replace or update existing Search + * Applications. *

* API name: {@code create} */ @@ -148,7 +148,7 @@ public final Builder create(@Nullable Boolean value) { } /** - * Required - The name of the search application to be created or updated + * Required - The name of the search application to be created or updated. *

* API name: {@code name} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplication.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplication.java index 3b58e5b15..0e34c6ab7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplication.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplication.java @@ -91,7 +91,7 @@ public static SearchApplication searchApplicationOf(Function * API name: {@code name} */ @@ -100,7 +100,7 @@ public final String name() { } /** - * Required - Indices that are part of the Search Application + * Required - Indices that are part of the Search Application. *

* API name: {@code indices} */ @@ -109,7 +109,7 @@ public final List indices() { } /** - * Required - Last time the Search Application was updated + * Required - Last time the Search Application was updated. *

* API name: {@code updated_at_millis} */ @@ -118,7 +118,7 @@ public final long updatedAtMillis() { } /** - * Analytics collection associated to the Search Application + * Analytics collection associated to the Search Application. *

* API name: {@code analytics_collection_name} */ @@ -128,7 +128,7 @@ public final String analyticsCollectionName() { } /** - * Search template to use on search operations + * Search template to use on search operations. *

* API name: {@code template} */ @@ -225,7 +225,7 @@ public abstract static class AbstractBuilder * API name: {@code name} */ @@ -235,7 +235,7 @@ public final BuilderT name(String value) { } /** - * Required - Indices that are part of the Search Application + * Required - Indices that are part of the Search Application. *

* API name: {@code indices} *

@@ -247,7 +247,7 @@ public final BuilderT indices(List list) { } /** - * Required - Indices that are part of the Search Application + * Required - Indices that are part of the Search Application. *

* API name: {@code indices} *

@@ -259,7 +259,7 @@ public final BuilderT indices(String value, String... values) { } /** - * Required - Last time the Search Application was updated + * Required - Last time the Search Application was updated. *

* API name: {@code updated_at_millis} */ @@ -269,7 +269,7 @@ public final BuilderT updatedAtMillis(long value) { } /** - * Analytics collection associated to the Search Application + * Analytics collection associated to the Search Application. *

* API name: {@code analytics_collection_name} */ @@ -279,7 +279,7 @@ public final BuilderT analyticsCollectionName(@Nullable String value) { } /** - * Search template to use on search operations + * Search template to use on search operations. *

* API name: {@code template} */ @@ -289,7 +289,7 @@ public final BuilderT template(@Nullable SearchApplicationTemplate value) { } /** - * Search template to use on search operations + * Search template to use on search operations. *

* API name: {@code template} */ 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 1bbe47ba0..aa6834253 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,7 @@ // typedef: search_application.search.Request /** - * Perform a search against a search application + * Perform a search against a search application. * * @see API @@ -86,7 +86,7 @@ public static SearchApplicationSearchRequest of( } /** - * Required - The name of the search application to be searched + * Required - The name of the search application to be searched. *

* API name: {@code name} */ @@ -95,6 +95,9 @@ public final String name() { } /** + * Query parameters specific to this request, which will override any defaults + * specified in the template. + *

* API name: {@code params} */ public final Map params() { @@ -141,7 +144,7 @@ public static class Builder extends RequestBase.AbstractBuilder private Map params; /** - * Required - The name of the search application to be searched + * Required - The name of the search application to be searched. *

* API name: {@code name} */ @@ -151,6 +154,9 @@ public final Builder name(String value) { } /** + * Query parameters specific to this request, which will override any defaults + * specified in the template. + *

* API name: {@code params} *

* Adds all entries of map to params. @@ -161,6 +167,9 @@ public final Builder params(Map map) { } /** + * Query parameters specific to this request, which will override any defaults + * specified in the template. + *

* API name: {@code params} *

* Adds an entry to params. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationTemplate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationTemplate.java index 84e8c1500..eb23a20d2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationTemplate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/SearchApplicationTemplate.java @@ -75,7 +75,9 @@ public static SearchApplicationTemplate of(Function + * API name: {@code script} */ public final InlineScript script() { return this.script; @@ -114,7 +116,9 @@ public static class Builder extends WithJsonObjectBuilderBase private InlineScript script; /** - * Required - API name: {@code script} + * Required - The associated mustache template. + *

+ * API name: {@code script} */ public final Builder script(InlineScript value) { this.script = value; @@ -122,7 +126,9 @@ public final Builder script(InlineScript value) { } /** - * Required - API name: {@code script} + * Required - The associated mustache template. + *

+ * API name: {@code script} */ public final Builder script(Function> fn) { return this.script(fn.apply(new InlineScript.Builder()).build()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKey.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKey.java index 0d29c1b2f..f0b08b58c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKey.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKey.java @@ -35,6 +35,7 @@ import java.lang.Boolean; import java.lang.Long; import java.lang.String; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -547,6 +548,66 @@ public final Builder sort(FieldValue value, FieldValue... values) { return this; } + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(String value, String... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(long value, long... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(double value, double... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(boolean value, boolean... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + /** * API name: {@code _sort} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRule.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRule.java index 1c4346e0f..2fd224224 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRule.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRule.java @@ -30,7 +30,7 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.OpenTaggedUnion; import co.elastic.clients.util.TaggedUnionUtils; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -64,7 +64,7 @@ * specification */ @JsonpDeserializable -public class FieldRule implements TaggedUnion, RoleMappingRuleVariant, JsonpSerializable { +public class FieldRule implements OpenTaggedUnion, RoleMappingRuleVariant, JsonpSerializable { /** * {@link FieldRule} variant kinds. @@ -80,9 +80,8 @@ public enum Kind implements JsonEnum { Groups("groups"), - Metadata("metadata"), - - Realm("realm"), + /** A custom {@code FieldRule} defined by a plugin */ + _Custom(null) ; @@ -123,6 +122,7 @@ public FieldRule(FieldRuleVariant value) { this._kind = ApiTypeHelper.requireNonNull(value._fieldRuleKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; } @@ -130,6 +130,7 @@ private FieldRule(Builder builder) { this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; } @@ -150,7 +151,7 @@ public boolean isUsername() { * @throws IllegalStateException * if the current variant is not of the {@code username} kind. */ - public String username() { + public List username() { return TaggedUnionUtils.get(this, Kind.Username); } @@ -188,38 +189,33 @@ public List groups() { return TaggedUnionUtils.get(this, Kind.Groups); } - /** - * Is this variant instance of kind {@code metadata}? - */ - public boolean isMetadata() { - return _kind == Kind.Metadata; - } + @Nullable + private final String _customKind; /** - * Get the {@code metadata} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code metadata} kind. + * Is this a custom {@code FieldRule} defined by a plugin? */ - public JsonData metadata() { - return TaggedUnionUtils.get(this, Kind.Metadata); + public boolean _isCustom() { + return _kind == Kind._Custom; } /** - * Is this variant instance of kind {@code realm}? + * Get the actual kind when {@code _kind()} equals {@link Kind#_Custom} + * (plugin-defined variant). */ - public boolean isRealm() { - return _kind == Kind.Realm; + @Nullable + public final String _customKind() { + return _customKind; } /** - * Get the {@code realm} variant value. + * Get the custom plugin-defined variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code realm} kind. + * if the current variant is not {@link Kind#_Custom}. */ - public Realm realm() { - return TaggedUnionUtils.get(this, Kind.Realm); + public JsonData _custom() { + return TaggedUnionUtils.get(this, Kind._Custom); } @Override @@ -228,13 +224,18 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); - generator.writeKey(_kind.jsonValue()); + generator.writeKey(_kind == Kind._Custom ? _customKind : _kind.jsonValue()); if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } else { switch (_kind) { case Username : - generator.write(((String) this._value)); + generator.writeStartArray(); + for (String item0 : ((List) this._value)) { + generator.write(item0); + + } + generator.writeEnd(); break; case Dn : @@ -254,10 +255,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); - break; - case Metadata : - ((JsonData) this._value).serialize(generator, mapper); - break; } } @@ -274,12 +271,13 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + private String _customKind; @Override protected Builder self() { return this; } - public ObjectBuilder username(String v) { + public ObjectBuilder username(List v) { this._kind = Kind.Username; this._value = v; return this; @@ -297,22 +295,22 @@ public ObjectBuilder groups(List v) { return this; } - public ObjectBuilder metadata(JsonData v) { - this._kind = Kind.Metadata; - this._value = v; + /** + * Define this {@code FieldRule} as a plugin-defined variant. + * + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code FieldRule}. It is converted + * internally to {@link JsonData}. + */ + public ObjectBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); return this; } - public ObjectBuilder realm(Realm v) { - this._kind = Kind.Realm; - this._value = v; - return this; - } - - public ObjectBuilder realm(Function> fn) { - return this.realm(fn.apply(new Realm.Builder()).build()); - } - public FieldRule build() { _checkSingleUse(); return new FieldRule(this); @@ -322,11 +320,15 @@ public FieldRule build() { protected static void setupFieldRuleDeserializer(ObjectDeserializer op) { - op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); + op.add(Builder::username, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "username"); op.add(Builder::dn, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "dn"); op.add(Builder::groups, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "groups"); - op.add(Builder::metadata, JsonData._DESERIALIZER, "metadata"); - op.add(Builder::realm, Realm._DESERIALIZER, "realm"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRuleBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRuleBuilders.java index 45f1de17f..a0296ff7e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRuleBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/FieldRuleBuilders.java @@ -41,29 +41,13 @@ /** * Builders for {@link FieldRule} variants. *

- * Variants username, dn, groups, - * metadata are not available here as they don't have a dedicated - * class. Use {@link FieldRule}'s builder for these. + * Variants username, dn, groups are not + * available here as they don't have a dedicated class. Use {@link FieldRule}'s + * builder for these. * */ public class FieldRuleBuilders { private FieldRuleBuilders() { } - /** - * Creates a builder for the {@link Realm realm} {@code FieldRule} variant. - */ - public static Realm.Builder realm() { - return new Realm.Builder(); - } - - /** - * Creates a FieldRule of the {@link Realm realm} {@code FieldRule} variant. - */ - public static FieldRule realm(Function> fn) { - FieldRule.Builder builder = new FieldRule.Builder(); - builder.realm(fn.apply(new Realm.Builder()).build()); - return builder.build(); - } - } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetApiKeyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetApiKeyRequest.java index 10d1f1df5..4c2b575e8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetApiKeyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetApiKeyRequest.java @@ -68,6 +68,9 @@ */ public class GetApiKeyRequest extends RequestBase { + @Nullable + private final Boolean activeOnly; + @Nullable private final String id; @@ -90,6 +93,7 @@ public class GetApiKeyRequest extends RequestBase { private GetApiKeyRequest(Builder builder) { + this.activeOnly = builder.activeOnly; this.id = builder.id; this.name = builder.name; this.owner = builder.owner; @@ -103,6 +107,21 @@ public static GetApiKeyRequest of(Functionowner or name. If active_only is + * false, the response will include both active and inactive (expired or + * invalidated) keys. + *

+ * API name: {@code active_only} + */ + @Nullable + public final Boolean activeOnly() { + return this.activeOnly; + } + /** * An API key id. This parameter cannot be used with any of name, * realm_name or username. @@ -184,6 +203,9 @@ public final Boolean withLimitedBy() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean activeOnly; + @Nullable private String id; @@ -202,6 +224,21 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean withLimitedBy; + /** + * A boolean flag that can be used to query API keys that are currently active. + * An API key is considered active if it is neither invalidated, nor expired at + * query time. You can specify this together with other parameters such as + * owner or name. If active_only is + * false, the response will include both active and inactive (expired or + * invalidated) keys. + *

+ * API name: {@code active_only} + */ + public final Builder activeOnly(@Nullable Boolean value) { + this.activeOnly = value; + return this; + } + /** * An API key id. This parameter cannot be used with any of name, * realm_name or username. @@ -323,6 +360,9 @@ public GetApiKeyRequest build() { if (request.owner != null) { params.put("owner", String.valueOf(request.owner)); } + if (request.activeOnly != null) { + params.put("active_only", String.valueOf(request.activeOnly)); + } if (request.name != null) { params.put("name", request.name); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleMappingRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleMappingRequest.java index c3ecab999..392e380eb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleMappingRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleMappingRequest.java @@ -79,6 +79,8 @@ public class PutRoleMappingRequest extends RequestBase implements JsonpSerializa @Nullable private final Refresh refresh; + private final List roleTemplates; + private final List roles; @Nullable @@ -94,6 +96,7 @@ private PutRoleMappingRequest(Builder builder) { this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.refresh = builder.refresh; + this.roleTemplates = ApiTypeHelper.unmodifiable(builder.roleTemplates); this.roles = ApiTypeHelper.unmodifiable(builder.roles); this.rules = builder.rules; this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); @@ -141,6 +144,13 @@ public final Refresh refresh() { return this.refresh; } + /** + * API name: {@code role_templates} + */ + public final List roleTemplates() { + return this.roleTemplates; + } + /** * API name: {@code roles} */ @@ -189,6 +199,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.roleTemplates)) { + generator.writeKey("role_templates"); + generator.writeStartArray(); + for (RoleTemplate item0 : this.roleTemplates) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.roles)) { generator.writeKey("roles"); @@ -238,6 +258,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Refresh refresh; + @Nullable + private List roleTemplates; + @Nullable private List roles; @@ -298,6 +321,35 @@ public final Builder refresh(@Nullable Refresh value) { return this; } + /** + * API name: {@code role_templates} + *

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

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

+ * Adds a value to roleTemplates using a builder lambda. + */ + public final Builder roleTemplates(Function> fn) { + return roleTemplates(fn.apply(new RoleTemplate.Builder()).build()); + } + /** * API name: {@code roles} *

@@ -383,6 +435,8 @@ protected static void setupPutRoleMappingRequestDeserializer(ObjectDeserializer< op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); + op.add(Builder::roleTemplates, JsonpDeserializer.arrayDeserializer(RoleTemplate._DESERIALIZER), + "role_templates"); op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "roles"); op.add(Builder::rules, RoleMappingRule._DESERIALIZER, "rules"); op.add(Builder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "run_as"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryApiKeysRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryApiKeysRequest.java index f526fc835..954a534f6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryApiKeysRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryApiKeysRequest.java @@ -37,6 +37,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -313,6 +314,74 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * Search after definition *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleMapping.java index 943f61b6e..7dbedb5b9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleMapping.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleMapping.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch.security; -import co.elastic.clients.elasticsearch.security.get_role.RoleTemplate; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/RoleTemplate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplate.java similarity index 96% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/RoleTemplate.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplate.java index b74c2225f..7bca0e042 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/RoleTemplate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleTemplate.java @@ -17,7 +17,7 @@ * under the License. */ -package co.elastic.clients.elasticsearch.security.get_role; +package co.elastic.clients.elasticsearch.security; import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.json.JsonpDeserializable; @@ -50,12 +50,11 @@ // //---------------------------------------------------------------- -// typedef: security.get_role.RoleTemplate +// typedef: security._types.RoleTemplate /** * - * @see API + * @see API * specification */ @JsonpDeserializable diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/TemplateFormat.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/TemplateFormat.java similarity index 92% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/TemplateFormat.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/security/TemplateFormat.java index e9db04577..e2cd9dd33 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/TemplateFormat.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/TemplateFormat.java @@ -17,7 +17,7 @@ * under the License. */ -package co.elastic.clients.elasticsearch.security.get_role; +package co.elastic.clients.elasticsearch.security; import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; @@ -40,8 +40,7 @@ /** * - * @see API + * @see API * specification */ @JsonpDeserializable diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateApiKeyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateApiKeyRequest.java index 621267e6b..fbaff3b85 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateApiKeyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateApiKeyRequest.java @@ -21,6 +21,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; +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; @@ -83,6 +84,9 @@ */ @JsonpDeserializable public class UpdateApiKeyRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Time expiration; + private final String id; private final Map metadata; @@ -93,6 +97,7 @@ public class UpdateApiKeyRequest extends RequestBase implements JsonpSerializabl private UpdateApiKeyRequest(Builder builder) { + this.expiration = builder.expiration; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.roleDescriptors = ApiTypeHelper.unmodifiable(builder.roleDescriptors); @@ -103,6 +108,16 @@ public static UpdateApiKeyRequest of(Function + * API name: {@code expiration} + */ + @Nullable + public final Time expiration() { + return this.expiration; + } + /** * Required - The ID of the API key to update. *

@@ -150,6 +165,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.expiration != null) { + generator.writeKey("expiration"); + this.expiration.serialize(generator, mapper); + + } if (ApiTypeHelper.isDefined(this.metadata)) { generator.writeKey("metadata"); generator.writeStartObject(); @@ -184,6 +204,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Time expiration; + private String id; @Nullable @@ -192,6 +215,25 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Map roleDescriptors; + /** + * Expiration time for the API key. + *

+ * API name: {@code expiration} + */ + public final Builder expiration(@Nullable Time value) { + this.expiration = value; + return this; + } + + /** + * Expiration time for the API key. + *

+ * API name: {@code expiration} + */ + public final Builder expiration(Function> fn) { + return this.expiration(fn.apply(new Time.Builder()).build()); + } + /** * Required - The ID of the API key to update. *

@@ -315,6 +357,7 @@ public UpdateApiKeyRequest build() { protected static void setupUpdateApiKeyRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::expiration, Time._DESERIALIZER, "expiration"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); op.add(Builder::roleDescriptors, JsonpDeserializer.stringMapDeserializer(RoleDescriptor._DESERIALIZER), "role_descriptors"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/Role.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/Role.java index b67b3b16d..19f0f93e4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/Role.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/get_role/Role.java @@ -21,6 +21,7 @@ import co.elastic.clients.elasticsearch.security.ApplicationPrivileges; import co.elastic.clients.elasticsearch.security.IndicesPrivileges; +import co.elastic.clients.elasticsearch.security.RoleTemplate; import co.elastic.clients.elasticsearch.security.TransientMetadataConfig; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ClearCursorRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ClearCursorRequest.java index 237741864..b2de6cd73 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ClearCursorRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/ClearCursorRequest.java @@ -78,7 +78,9 @@ public static ClearCursorRequest of(Function + * API name: {@code cursor} */ public final String cursor() { return this.cursor; @@ -112,7 +114,9 @@ public static class Builder extends RequestBase.AbstractBuilder private String cursor; /** - * Required - API name: {@code cursor} + * Required - Cursor to clear. + *

+ * API name: {@code cursor} */ public final Builder cursor(String value) { this.cursor = value; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java index 80ac5e499..2563c40b6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/DeleteAsyncRequest.java @@ -79,7 +79,7 @@ public static DeleteAsyncRequest of(Function * API name: {@code id} */ @@ -99,7 +99,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String id; /** - * Required - The async search ID + * Required - Identifier for the search. *

* API name: {@code id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java index cb83acdd6..7f5ed8074 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncRequest.java @@ -117,7 +117,7 @@ public final String format() { } /** - * Required - The async search ID + * Required - Identifier for the search. *

* API name: {@code id} */ @@ -191,7 +191,7 @@ public final Builder format(@Nullable String value) { } /** - * Required - The async search ID + * Required - Identifier for the search. *

* API name: {@code id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java index 70223bb9f..f8a91c105 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/GetAsyncStatusRequest.java @@ -79,7 +79,7 @@ public static GetAsyncStatusRequest of(Function * API name: {@code id} */ @@ -99,7 +99,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String id; /** - * Required - The async search ID + * Required - Identifier for the search. *

* API name: {@code id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryRequest.java index e301687b9..3b8400706 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/QueryRequest.java @@ -171,6 +171,10 @@ public final Boolean columnar() { } /** + * Cursor used to retrieve a set of paginated results. If you specify a cursor, + * the API only uses the columnar and time_zone + * request body parameters. It ignores other request body parameters. + *

* API name: {@code cursor} */ @Nullable @@ -201,7 +205,7 @@ public final Boolean fieldMultiValueLeniency() { } /** - * Optional Elasticsearch query DSL for additional filtering. + * Elasticsearch query DSL for additional filtering. *

* API name: {@code filter} */ @@ -211,7 +215,7 @@ public final Query filter() { } /** - * a short version of the Accept header, e.g. json, yaml + * Format for the response. *

* API name: {@code format} */ @@ -272,7 +276,7 @@ public final Map params() { } /** - * SQL query to execute + * SQL query to run. *

* API name: {@code query} */ @@ -302,8 +306,7 @@ public final Map runtimeMappings() { } /** - * Time-zone in ISO 8601 used for executing the query on the server. More - * information available here. + * ISO-8601 time zone ID for the search. *

* API name: {@code time_zone} */ @@ -511,6 +514,10 @@ public final Builder columnar(@Nullable Boolean value) { } /** + * Cursor used to retrieve a set of paginated results. If you specify a cursor, + * the API only uses the columnar and time_zone + * request body parameters. It ignores other request body parameters. + *

* API name: {@code cursor} */ public final Builder cursor(@Nullable String value) { @@ -541,7 +548,7 @@ public final Builder fieldMultiValueLeniency(@Nullable Boolean value) { } /** - * Optional Elasticsearch query DSL for additional filtering. + * Elasticsearch query DSL for additional filtering. *

* API name: {@code filter} */ @@ -551,7 +558,7 @@ public final Builder filter(@Nullable Query value) { } /** - * Optional Elasticsearch query DSL for additional filtering. + * Elasticsearch query DSL for additional filtering. *

* API name: {@code filter} */ @@ -560,7 +567,7 @@ public final Builder filter(Function> fn) { } /** - * a short version of the Accept header, e.g. json, yaml + * Format for the response. *

* API name: {@code format} */ @@ -654,7 +661,7 @@ public final Builder params(String key, JsonData value) { } /** - * SQL query to execute + * SQL query to run. *

* API name: {@code query} */ @@ -722,8 +729,7 @@ public final Builder runtimeMappings(String key, } /** - * Time-zone in ISO 8601 used for executing the query on the server. More - * information available here. + * ISO-8601 time zone ID for the search. *

* API name: {@code time_zone} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateRequest.java index 577558214..f43365497 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateRequest.java @@ -92,6 +92,8 @@ public static TranslateRequest of(Function * API name: {@code fetch_size} */ @Nullable @@ -100,6 +102,8 @@ public final Integer fetchSize() { } /** + * Elasticsearch query DSL for additional filtering. + *

* API name: {@code filter} */ @Nullable @@ -108,13 +112,17 @@ public final Query filter() { } /** - * Required - API name: {@code query} + * Required - SQL query to run. + *

+ * API name: {@code query} */ public final String query() { return this.query; } /** + * ISO-8601 time zone ID for the search. + *

* API name: {@code time_zone} */ @Nullable @@ -175,6 +183,8 @@ public static class Builder extends RequestBase.AbstractBuilder private String timeZone; /** + * The maximum number of rows (or entries) to return in one response. + *

* API name: {@code fetch_size} */ public final Builder fetchSize(@Nullable Integer value) { @@ -183,6 +193,8 @@ public final Builder fetchSize(@Nullable Integer value) { } /** + * Elasticsearch query DSL for additional filtering. + *

* API name: {@code filter} */ public final Builder filter(@Nullable Query value) { @@ -191,6 +203,8 @@ public final Builder filter(@Nullable Query value) { } /** + * Elasticsearch query DSL for additional filtering. + *

* API name: {@code filter} */ public final Builder filter(Function> fn) { @@ -198,7 +212,9 @@ public final Builder filter(Function> fn) { } /** - * Required - API name: {@code query} + * Required - SQL query to run. + *

+ * API name: {@code query} */ public final Builder query(String value) { this.query = value; @@ -206,6 +222,8 @@ public final Builder query(String value) { } /** + * ISO-8601 time zone ID for the search. + *

* API name: {@code time_zone} */ public final Builder timeZone(@Nullable String value) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/PutSynonymRuleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/PutSynonymRuleRequest.java index 3a18ea662..89802a028 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/PutSynonymRuleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/PutSynonymRuleRequest.java @@ -35,7 +35,6 @@ import java.lang.String; import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -71,7 +70,7 @@ public class PutSynonymRuleRequest extends RequestBase implements JsonpSerializa private final String setId; - private final List synonyms; + private final String synonyms; // --------------------------------------------------------------------------------------------- @@ -79,7 +78,7 @@ private PutSynonymRuleRequest(Builder builder) { this.ruleId = ApiTypeHelper.requireNonNull(builder.ruleId, this, "ruleId"); this.setId = ApiTypeHelper.requireNonNull(builder.setId, this, "setId"); - this.synonyms = ApiTypeHelper.unmodifiableRequired(builder.synonyms, this, "synonyms"); + this.synonyms = ApiTypeHelper.requireNonNull(builder.synonyms, this, "synonyms"); } @@ -108,7 +107,7 @@ public final String setId() { /** * Required - API name: {@code synonyms} */ - public final List synonyms() { + public final String synonyms() { return this.synonyms; } @@ -123,16 +122,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.synonyms)) { - generator.writeKey("synonyms"); - generator.writeStartArray(); - for (String item0 : this.synonyms) { - generator.write(item0); - - } - generator.writeEnd(); - - } + generator.writeKey("synonyms"); + generator.write(this.synonyms); } @@ -149,7 +140,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String setId; - private List synonyms; + private String synonyms; /** * Required - The id of the synonym rule to be updated or created @@ -173,21 +164,9 @@ public final Builder setId(String value) { /** * Required - API name: {@code synonyms} - *

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

- * Adds one or more values to synonyms. */ - public final Builder synonyms(String value, String... values) { - this.synonyms = _listAdd(this.synonyms, value, values); + public final Builder synonyms(String value) { + this.synonyms = value; return this; } @@ -219,8 +198,7 @@ public PutSynonymRuleRequest build() { protected static void setupPutSynonymRuleRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::synonyms, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "synonyms"); + op.add(Builder::synonyms, JsonpDeserializer.stringDeserializer(), "synonyms"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/CancelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/CancelRequest.java index 91aa2393b..f9d5ba574 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/CancelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/CancelRequest.java @@ -95,8 +95,8 @@ public static CancelRequest of(Function> f } /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the + * request. *

* API name: {@code actions} */ @@ -105,9 +105,7 @@ public final List actions() { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} */ @@ -116,8 +114,7 @@ public final List nodes() { } /** - * Cancel tasks with specified parent task id (node_id:task_number). Set to -1 - * to cancel all. + * Parent task ID used to limit the tasks. *

* API name: {@code parent_task_id} */ @@ -127,7 +124,7 @@ public final String parentTaskId() { } /** - * Cancel the task with specified task id (node_id:task_number) + * ID of the task. *

* API name: {@code task_id} */ @@ -170,8 +167,8 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Boolean waitForCompletion; /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the + * request. *

* API name: {@code actions} *

@@ -183,8 +180,8 @@ public final Builder actions(List list) { } /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the + * request. *

* API name: {@code actions} *

@@ -196,9 +193,7 @@ public final Builder actions(String value, String... values) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} *

@@ -210,9 +205,7 @@ public final Builder nodes(List list) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} *

@@ -224,8 +217,7 @@ public final Builder nodes(String value, String... values) { } /** - * Cancel tasks with specified parent task id (node_id:task_number). Set to -1 - * to cancel all. + * Parent task ID used to limit the tasks. *

* API name: {@code parent_task_id} */ @@ -235,7 +227,7 @@ public final Builder parentTaskId(@Nullable String value) { } /** - * Cancel the task with specified task id (node_id:task_number) + * ID of the task. *

* API name: {@code task_id} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/GetTasksRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/GetTasksRequest.java index 92ac73a70..b5fcabfd0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/GetTasksRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/GetTasksRequest.java @@ -87,7 +87,7 @@ public static GetTasksRequest of(Function * API name: {@code task_id} */ @@ -96,7 +96,8 @@ public final String taskId() { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -106,7 +107,7 @@ public final Time timeout() { } /** - * Wait for the matching tasks to complete (default: false) + * If true, the request blocks until the task has completed. *

* API name: {@code wait_for_completion} */ @@ -131,7 +132,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Boolean waitForCompletion; /** - * Required - Return the task with specified id (node_id:task_number) + * Required - ID of the task. *

* API name: {@code task_id} */ @@ -141,7 +142,8 @@ public final Builder taskId(String value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -151,7 +153,8 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. *

* API name: {@code timeout} */ @@ -160,7 +163,7 @@ public final Builder timeout(Function> fn) { } /** - * Wait for the matching tasks to complete (default: false) + * If true, the request blocks until the task has completed. *

* API name: {@code wait_for_completion} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskStatus.java deleted file mode 100644 index b63c341f6..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskStatus.java +++ /dev/null @@ -1,600 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.tasks; - -import co.elastic.clients.elasticsearch._types.Retries; -import co.elastic.clients.elasticsearch._types.Time; -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.Boolean; -import java.lang.Float; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -// typedef: tasks._types.TaskStatus - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TaskStatus implements JsonpSerializable { - private final long batches; - - @Nullable - private final String canceled; - - private final long created; - - private final long deleted; - - private final long noops; - - private final List failures; - - private final float requestsPerSecond; - - private final Retries retries; - - @Nullable - private final Time throttled; - - private final long throttledMillis; - - @Nullable - private final Time throttledUntil; - - private final long throttledUntilMillis; - - @Nullable - private final Boolean timedOut; - - @Nullable - private final Long took; - - private final long total; - - private final long updated; - - private final long versionConflicts; - - // --------------------------------------------------------------------------------------------- - - private TaskStatus(Builder builder) { - - this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches"); - this.canceled = builder.canceled; - this.created = ApiTypeHelper.requireNonNull(builder.created, this, "created"); - this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); - this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops"); - this.failures = ApiTypeHelper.unmodifiable(builder.failures); - this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond"); - this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); - this.throttled = builder.throttled; - this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); - this.throttledUntil = builder.throttledUntil; - this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, - "throttledUntilMillis"); - this.timedOut = builder.timedOut; - this.took = builder.took; - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.updated = ApiTypeHelper.requireNonNull(builder.updated, this, "updated"); - this.versionConflicts = ApiTypeHelper.requireNonNull(builder.versionConflicts, this, "versionConflicts"); - - } - - public static TaskStatus of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code batches} - */ - public final long batches() { - return this.batches; - } - - /** - * API name: {@code canceled} - */ - @Nullable - public final String canceled() { - return this.canceled; - } - - /** - * Required - API name: {@code created} - */ - public final long created() { - return this.created; - } - - /** - * Required - API name: {@code deleted} - */ - public final long deleted() { - return this.deleted; - } - - /** - * Required - API name: {@code noops} - */ - public final long noops() { - return this.noops; - } - - /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - API name: {@code requests_per_second} - */ - public final float requestsPerSecond() { - return this.requestsPerSecond; - } - - /** - * Required - API name: {@code retries} - */ - public final Retries retries() { - return this.retries; - } - - /** - * API name: {@code throttled} - */ - @Nullable - public final Time throttled() { - return this.throttled; - } - - /** - * Required - API name: {@code throttled_millis} - */ - public final long throttledMillis() { - return this.throttledMillis; - } - - /** - * API name: {@code throttled_until} - */ - @Nullable - public final Time throttledUntil() { - return this.throttledUntil; - } - - /** - * Required - API name: {@code throttled_until_millis} - */ - public final long throttledUntilMillis() { - return this.throttledUntilMillis; - } - - /** - * API name: {@code timed_out} - */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; - } - - /** - * API name: {@code took} - */ - @Nullable - public final Long took() { - return this.took; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * Required - API name: {@code updated} - */ - public final long updated() { - return this.updated; - } - - /** - * Required - API name: {@code version_conflicts} - */ - public final long versionConflicts() { - return this.versionConflicts; - } - - /** - * 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("batches"); - generator.write(this.batches); - - if (this.canceled != null) { - generator.writeKey("canceled"); - generator.write(this.canceled); - - } - generator.writeKey("created"); - generator.write(this.created); - - generator.writeKey("deleted"); - generator.write(this.deleted); - - generator.writeKey("noops"); - generator.write(this.noops); - - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (String item0 : this.failures) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("requests_per_second"); - generator.write(this.requestsPerSecond); - - generator.writeKey("retries"); - this.retries.serialize(generator, mapper); - - if (this.throttled != null) { - generator.writeKey("throttled"); - this.throttled.serialize(generator, mapper); - - } - generator.writeKey("throttled_millis"); - generator.write(this.throttledMillis); - - if (this.throttledUntil != null) { - generator.writeKey("throttled_until"); - this.throttledUntil.serialize(generator, mapper); - - } - generator.writeKey("throttled_until_millis"); - generator.write(this.throttledUntilMillis); - - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - - } - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("updated"); - generator.write(this.updated); - - generator.writeKey("version_conflicts"); - generator.write(this.versionConflicts); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link TaskStatus}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long batches; - - @Nullable - private String canceled; - - private Long created; - - private Long deleted; - - private Long noops; - - @Nullable - private List failures; - - private Float requestsPerSecond; - - private Retries retries; - - @Nullable - private Time throttled; - - private Long throttledMillis; - - @Nullable - private Time throttledUntil; - - private Long throttledUntilMillis; - - @Nullable - private Boolean timedOut; - - @Nullable - private Long took; - - private Long total; - - private Long updated; - - private Long versionConflicts; - - /** - * Required - API name: {@code batches} - */ - public final Builder batches(long value) { - this.batches = value; - return this; - } - - /** - * API name: {@code canceled} - */ - public final Builder canceled(@Nullable String value) { - this.canceled = value; - return this; - } - - /** - * Required - API name: {@code created} - */ - public final Builder created(long value) { - this.created = value; - return this; - } - - /** - * Required - API name: {@code deleted} - */ - public final Builder deleted(long value) { - this.deleted = value; - return this; - } - - /** - * Required - API name: {@code noops} - */ - public final Builder noops(long value) { - this.noops = value; - return this; - } - - /** - * API name: {@code failures} - *

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

- * Adds one or more values to failures. - */ - public final Builder failures(String value, String... values) { - this.failures = _listAdd(this.failures, value, values); - return this; - } - - /** - * Required - API name: {@code requests_per_second} - */ - public final Builder requestsPerSecond(float value) { - this.requestsPerSecond = value; - return this; - } - - /** - * Required - API name: {@code retries} - */ - public final Builder retries(Retries value) { - this.retries = value; - return this; - } - - /** - * Required - API name: {@code retries} - */ - public final Builder retries(Function> fn) { - return this.retries(fn.apply(new Retries.Builder()).build()); - } - - /** - * API name: {@code throttled} - */ - public final Builder throttled(@Nullable Time value) { - this.throttled = value; - return this; - } - - /** - * API name: {@code throttled} - */ - public final Builder throttled(Function> fn) { - return this.throttled(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - API name: {@code throttled_millis} - */ - public final Builder throttledMillis(long value) { - this.throttledMillis = value; - return this; - } - - /** - * API name: {@code throttled_until} - */ - public final Builder throttledUntil(@Nullable Time value) { - this.throttledUntil = value; - return this; - } - - /** - * API name: {@code throttled_until} - */ - public final Builder throttledUntil(Function> fn) { - return this.throttledUntil(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - API name: {@code throttled_until_millis} - */ - public final Builder throttledUntilMillis(long value) { - this.throttledUntilMillis = value; - return this; - } - - /** - * API name: {@code timed_out} - */ - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; - return this; - } - - /** - * API name: {@code took} - */ - public final Builder took(@Nullable Long value) { - this.took = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * Required - API name: {@code updated} - */ - public final Builder updated(long value) { - this.updated = value; - return this; - } - - /** - * Required - API name: {@code version_conflicts} - */ - public final Builder versionConflicts(long value) { - this.versionConflicts = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link TaskStatus}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public TaskStatus build() { - _checkSingleUse(); - - return new TaskStatus(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link TaskStatus} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - TaskStatus::setupTaskStatusDeserializer); - - protected static void setupTaskStatusDeserializer(ObjectDeserializer op) { - - op.add(Builder::batches, JsonpDeserializer.longDeserializer(), "batches"); - op.add(Builder::canceled, JsonpDeserializer.stringDeserializer(), "canceled"); - op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); - op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); - op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "failures"); - op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); - op.add(Builder::retries, Retries._DESERIALIZER, "retries"); - op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); - op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); - op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); - op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); - op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); - op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java new file mode 100644 index 000000000..a36d05e99 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java @@ -0,0 +1,103 @@ +/* + * 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.text_structure; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.util.concurrent.CompletableFuture; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the text_structure namespace. + */ +public class ElasticsearchTextStructureAsyncClient + extends + ApiClient { + + public ElasticsearchTextStructureAsyncClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchTextStructureAsyncClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchTextStructureAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchTextStructureAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: text_structure.test_grok_pattern + + /** + * Tests a Grok pattern on some text. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture testGrokPattern(TestGrokPatternRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) TestGrokPatternRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Tests a Grok pattern on some text. + * + * @param fn + * a function that initializes a builder to create the + * {@link TestGrokPatternRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture testGrokPattern( + Function> fn) { + return testGrokPattern(fn.apply(new TestGrokPatternRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java new file mode 100644 index 000000000..c74243504 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java @@ -0,0 +1,106 @@ +/* + * 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.text_structure; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.io.IOException; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the text_structure namespace. + */ +public class ElasticsearchTextStructureClient + extends + ApiClient { + + public ElasticsearchTextStructureClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchTextStructureClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchTextStructureClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchTextStructureClient(this.transport, transportOptions); + } + + // ----- Endpoint: text_structure.test_grok_pattern + + /** + * Tests a Grok pattern on some text. + * + * @see Documentation + * on elastic.co + */ + + public TestGrokPatternResponse testGrokPattern(TestGrokPatternRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) TestGrokPatternRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Tests a Grok pattern on some text. + * + * @param fn + * a function that initializes a builder to create the + * {@link TestGrokPatternRequest} + * @see Documentation + * on elastic.co + */ + + public final TestGrokPatternResponse testGrokPattern( + Function> fn) + throws IOException, ElasticsearchException { + return testGrokPattern(fn.apply(new TestGrokPatternRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternRequest.java new file mode 100644 index 000000000..991d6a88c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternRequest.java @@ -0,0 +1,276 @@ +/* + * 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.text_structure; + +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.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +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.String; +import java.util.Collections; +import java.util.HashMap; +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: text_structure.test_grok_pattern.Request + +/** + * Tests a Grok pattern on some text. + * + * @see API + * specification + */ +@JsonpDeserializable +public class TestGrokPatternRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String ecsCompatibility; + + private final String grokPattern; + + private final List text; + + // --------------------------------------------------------------------------------------------- + + private TestGrokPatternRequest(Builder builder) { + + this.ecsCompatibility = builder.ecsCompatibility; + this.grokPattern = ApiTypeHelper.requireNonNull(builder.grokPattern, this, "grokPattern"); + this.text = ApiTypeHelper.unmodifiableRequired(builder.text, this, "text"); + + } + + public static TestGrokPatternRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The mode of compatibility with ECS compliant Grok patterns (disabled or v1, + * default: disabled). + *

+ * API name: {@code ecs_compatibility} + */ + @Nullable + public final String ecsCompatibility() { + return this.ecsCompatibility; + } + + /** + * Required - Grok pattern to run on the text. + *

+ * API name: {@code grok_pattern} + */ + public final String grokPattern() { + return this.grokPattern; + } + + /** + * Required - Lines of text to run the Grok pattern on. + *

+ * API name: {@code text} + */ + public final List text() { + return this.text; + } + + /** + * 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("grok_pattern"); + generator.write(this.grokPattern); + + if (ApiTypeHelper.isDefined(this.text)) { + generator.writeKey("text"); + generator.writeStartArray(); + for (String item0 : this.text) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TestGrokPatternRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String ecsCompatibility; + + private String grokPattern; + + private List text; + + /** + * The mode of compatibility with ECS compliant Grok patterns (disabled or v1, + * default: disabled). + *

+ * API name: {@code ecs_compatibility} + */ + public final Builder ecsCompatibility(@Nullable String value) { + this.ecsCompatibility = value; + return this; + } + + /** + * Required - Grok pattern to run on the text. + *

+ * API name: {@code grok_pattern} + */ + public final Builder grokPattern(String value) { + this.grokPattern = value; + return this; + } + + /** + * Required - Lines of text to run the Grok pattern on. + *

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

+ * Adds all elements of list to text. + */ + public final Builder text(List list) { + this.text = _listAddAll(this.text, list); + return this; + } + + /** + * Required - Lines of text to run the Grok pattern on. + *

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

+ * Adds one or more values to text. + */ + public final Builder text(String value, String... values) { + this.text = _listAdd(this.text, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TestGrokPatternRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TestGrokPatternRequest build() { + _checkSingleUse(); + + return new TestGrokPatternRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TestGrokPatternRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TestGrokPatternRequest::setupTestGrokPatternRequestDeserializer); + + protected static void setupTestGrokPatternRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::grokPattern, JsonpDeserializer.stringDeserializer(), "grok_pattern"); + op.add(Builder::text, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "text"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code text_structure.test_grok_pattern}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/text_structure.test_grok_pattern", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_text_structure/test_grok_pattern"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.ecsCompatibility != null) { + params.put("ecs_compatibility", request.ecsCompatibility); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, TestGrokPatternResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternResponse.java new file mode 100644 index 000000000..02f05f36a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/TestGrokPatternResponse.java @@ -0,0 +1,187 @@ +/* + * 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.text_structure; + +import co.elastic.clients.elasticsearch.text_structure.test_grok_pattern.MatchedText; +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: text_structure.test_grok_pattern.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TestGrokPatternResponse implements JsonpSerializable { + private final List matches; + + // --------------------------------------------------------------------------------------------- + + private TestGrokPatternResponse(Builder builder) { + + this.matches = ApiTypeHelper.unmodifiableRequired(builder.matches, this, "matches"); + + } + + public static TestGrokPatternResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code matches} + */ + public final List matches() { + return this.matches; + } + + /** + * 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.matches)) { + generator.writeKey("matches"); + generator.writeStartArray(); + for (MatchedText item0 : this.matches) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TestGrokPatternResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List matches; + + /** + * Required - API name: {@code matches} + *

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

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

+ * Adds a value to matches using a builder lambda. + */ + public final Builder matches(Function> fn) { + return matches(fn.apply(new MatchedText.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TestGrokPatternResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TestGrokPatternResponse build() { + _checkSingleUse(); + + return new TestGrokPatternResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TestGrokPatternResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TestGrokPatternResponse::setupTestGrokPatternResponseDeserializer); + + protected static void setupTestGrokPatternResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::matches, JsonpDeserializer.arrayDeserializer(MatchedText._DESERIALIZER), "matches"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedField.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedField.java new file mode 100644 index 000000000..503466904 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedField.java @@ -0,0 +1,203 @@ +/* + * 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.text_structure.test_grok_pattern; + +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.Integer; +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: text_structure.test_grok_pattern.MatchedField + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class MatchedField implements JsonpSerializable { + private final String match; + + private final int offset; + + private final int length; + + // --------------------------------------------------------------------------------------------- + + private MatchedField(Builder builder) { + + this.match = ApiTypeHelper.requireNonNull(builder.match, this, "match"); + this.offset = ApiTypeHelper.requireNonNull(builder.offset, this, "offset"); + this.length = ApiTypeHelper.requireNonNull(builder.length, this, "length"); + + } + + public static MatchedField of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code match} + */ + public final String match() { + return this.match; + } + + /** + * Required - API name: {@code offset} + */ + public final int offset() { + return this.offset; + } + + /** + * Required - API name: {@code length} + */ + public final int length() { + return this.length; + } + + /** + * 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("match"); + generator.write(this.match); + + generator.writeKey("offset"); + generator.write(this.offset); + + generator.writeKey("length"); + generator.write(this.length); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MatchedField}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String match; + + private Integer offset; + + private Integer length; + + /** + * Required - API name: {@code match} + */ + public final Builder match(String value) { + this.match = value; + return this; + } + + /** + * Required - API name: {@code offset} + */ + public final Builder offset(int value) { + this.offset = value; + return this; + } + + /** + * Required - API name: {@code length} + */ + public final Builder length(int value) { + this.length = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link MatchedField}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MatchedField build() { + _checkSingleUse(); + + return new MatchedField(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MatchedField} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + MatchedField::setupMatchedFieldDeserializer); + + protected static void setupMatchedFieldDeserializer(ObjectDeserializer op) { + + op.add(Builder::match, JsonpDeserializer.stringDeserializer(), "match"); + op.add(Builder::offset, JsonpDeserializer.integerDeserializer(), "offset"); + op.add(Builder::length, JsonpDeserializer.integerDeserializer(), "length"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedText.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedText.java new file mode 100644 index 000000000..eb573b86e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/test_grok_pattern/MatchedText.java @@ -0,0 +1,211 @@ +/* + * 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.text_structure.test_grok_pattern; + +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.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: text_structure.test_grok_pattern.MatchedText + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class MatchedText implements JsonpSerializable { + private final boolean matched; + + private final Map> fields; + + // --------------------------------------------------------------------------------------------- + + private MatchedText(Builder builder) { + + this.matched = ApiTypeHelper.requireNonNull(builder.matched, this, "matched"); + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + + } + + public static MatchedText of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code matched} + */ + public final boolean matched() { + return this.matched; + } + + /** + * API name: {@code fields} + */ + public final Map> fields() { + return this.fields; + } + + /** + * 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("matched"); + generator.write(this.matched); + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (MatchedField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MatchedText}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Boolean matched; + + @Nullable + private Map> fields; + + /** + * Required - API name: {@code matched} + */ + public final Builder matched(boolean value) { + this.matched = value; + return this; + } + + /** + * API name: {@code fields} + *

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

+ * Adds an entry to fields. + */ + public final Builder fields(String key, List value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link MatchedText}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MatchedText build() { + _checkSingleUse(); + + return new MatchedText(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MatchedText} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + MatchedText::setupMatchedTextDeserializer); + + protected static void setupMatchedTextDeserializer(ObjectDeserializer op) { + + op.add(Builder::matched, JsonpDeserializer.booleanDeserializer(), "matched"); + op.add(Builder::fields, JsonpDeserializer + .stringMapDeserializer(JsonpDeserializer.arrayDeserializer(MatchedField._DESERIALIZER)), "fields"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/DeleteTransformRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/DeleteTransformRequest.java index 577d3b989..c8368e0f5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/DeleteTransformRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/DeleteTransformRequest.java @@ -65,6 +65,9 @@ */ public class DeleteTransformRequest extends RequestBase { + @Nullable + private final Boolean deleteDestIndex; + @Nullable private final Boolean force; @@ -77,6 +80,7 @@ public class DeleteTransformRequest extends RequestBase { private DeleteTransformRequest(Builder builder) { + this.deleteDestIndex = builder.deleteDestIndex; this.force = builder.force; this.timeout = builder.timeout; this.transformId = ApiTypeHelper.requireNonNull(builder.transformId, this, "transformId"); @@ -87,6 +91,17 @@ public static DeleteTransformRequest of(Function + * API name: {@code delete_dest_index} + */ + @Nullable + public final Boolean deleteDestIndex() { + return this.deleteDestIndex; + } + /** * If this value is false, the transform must be stopped before it can be * deleted. If true, the transform is deleted regardless of its current state. @@ -127,6 +142,9 @@ public final String transformId() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean deleteDestIndex; + @Nullable private Boolean force; @@ -135,6 +153,17 @@ public static class Builder extends RequestBase.AbstractBuilder private String transformId; + /** + * If this value is true, the destination index is deleted together with the + * transform. If false, the destination index will not be deleted + *

+ * API name: {@code delete_dest_index} + */ + public final Builder deleteDestIndex(@Nullable Boolean value) { + this.deleteDestIndex = value; + return this; + } + /** * If this value is false, the transform must be stopped before it can be * deleted. If true, the transform is deleted regardless of its current state. @@ -246,6 +275,9 @@ public DeleteTransformRequest build() { // Request parameters request -> { Map params = new HashMap<>(); + if (request.deleteDestIndex != null) { + params.put("delete_dest_index", String.valueOf(request.deleteDestIndex)); + } if (request.force != null) { params.put("force", String.valueOf(request.force)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/QueryWatchesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/QueryWatchesRequest.java index 21fbb0a57..f9f2a8da9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/QueryWatchesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/QueryWatchesRequest.java @@ -36,6 +36,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -270,6 +271,74 @@ public final Builder searchAfter(FieldValue value, FieldValue... values) { return this; } + /** + * Optional search After to do pagination using last hit’s sort values. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Optional search After to do pagination using last hit’s sort values. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Optional search After to do pagination using last hit’s sort values. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Optional search After to do pagination using last hit’s sort values. + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + /** * Optional search After to do pagination using last hit’s sort values. *

diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java index 71807dd73..1e1b299b9 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java @@ -23,8 +23,6 @@ import co.elastic.clients.elasticsearch._types.aggregations.Aggregate; import co.elastic.clients.elasticsearch._types.mapping.Property; import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringFlag; -import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringFlags; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.testkit.ModelTestCase; import jakarta.json.Json; @@ -66,19 +64,6 @@ public void testScriptDeserializer() { } } - @Test - public void testSimpleQueryStringFlag() { - // Ambiguous union on strings - - SimpleQueryStringFlags f; - - f= fromJson("\"OR\"", SimpleQueryStringFlags.class); - assertEquals(SimpleQueryStringFlag.Or, f.single()); - - f = fromJson("\"OR|AND\"", SimpleQueryStringFlags.class); - assertEquals("OR|AND", f.multiple()); - } - @Test public void testOpenContainer() { String json = "{\"foo\":{\"bar\":42}}";