From 0b45ccce8602c3e8966e51ef26c2644aa0627747 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 7 Apr 2026 10:10:28 +0000 Subject: [PATCH 1/3] [codegen] update to latest spec --- .../cluster/ComponentTemplateSummary.java | 17 +- .../cluster/PutComponentTemplateRequest.java | 16 +- .../core/bulk/BulkResponseItem.java | 10 +- .../elasticsearch/doc-files/api-spec.html | 51 ++-- .../elasticsearch/esql/ESQLParams.java | 224 ++++++++++++++++++ .../esql/ESQLParamsBuilders.java | 55 +++++ .../elasticsearch/esql/QueryRequest.java | 117 +-------- .../indices/IndexTemplateSummary.java | 15 +- .../security/RemoteUserIndicesPrivileges.java | 91 ++++--- .../elasticsearch/transform/Settings.java | 48 ++++ 10 files changed, 442 insertions(+), 202 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java index 9cb227c73b..ec71d0adaa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.AliasDefinition; import co.elastic.clients.elasticsearch.indices.DataStreamLifecycleWithRollover; -import co.elastic.clients.elasticsearch.indices.DataStreamOptionsTemplate; +import co.elastic.clients.elasticsearch.indices.DataStreamOptions; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -39,6 +39,7 @@ import java.lang.Long; import java.lang.String; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -83,7 +84,7 @@ public class ComponentTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptionsTemplate dataStreamOptions; + private final DataStreamOptions dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -152,7 +153,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptionsTemplate dataStreamOptions() { + public final DataStreamOptions dataStreamOptions() { return this.dataStreamOptions; } @@ -256,7 +257,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptionsTemplate dataStreamOptions; + private DataStreamOptions dataStreamOptions; public Builder() { } @@ -390,7 +391,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { this.dataStreamOptions = value; return this; } @@ -399,8 +400,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); } @Override @@ -444,7 +445,7 @@ protected static void setupComponentTemplateSummaryDeserializer( op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::dataStreamOptions, DataStreamOptionsTemplate._DESERIALIZER, "data_stream_options"); + op.add(Builder::dataStreamOptions, DataStreamOptions._DESERIALIZER, "data_stream_options"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java index 17a0c4b2bd..e722a0079e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java @@ -22,7 +22,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.elasticsearch.indices.IndexState; +import co.elastic.clients.elasticsearch.indices.put_index_template.IndexTemplateMapping; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -112,7 +112,7 @@ public class PutComponentTemplateRequest extends RequestBase implements JsonpSer private final String name; - private final IndexState template; + private final IndexTemplateMapping template; @Nullable private final Long version; @@ -218,7 +218,7 @@ public final String name() { *

* API name: {@code template} */ - public final IndexState template() { + public final IndexTemplateMapping template() { return this.template; } @@ -298,7 +298,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; - private IndexState template; + private IndexTemplateMapping template; @Nullable private Long version; @@ -428,7 +428,7 @@ public final Builder name(String value) { *

* API name: {@code template} */ - public final Builder template(IndexState value) { + public final Builder template(IndexTemplateMapping value) { this.template = value; return this; } @@ -439,8 +439,8 @@ public final Builder template(IndexState value) { *

* API name: {@code template} */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexState.Builder()).build()); + public final Builder template(Function> fn) { + return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); } /** @@ -492,7 +492,7 @@ protected static void setupPutComponentTemplateRequestDeserializer( op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::template, IndexState._DESERIALIZER, "template"); + op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); } 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 6fe24823d2..ea5ad24ae3 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 @@ -197,8 +197,9 @@ public final Long primaryTerm() { } /** - * The result of the operation. Successful values are created, - * deleted, and updated. + * The result of the operation. Possible values are created, + * updated, deleted, noop, and + * not_found. *

* API name: {@code result} */ @@ -475,8 +476,9 @@ public final Builder primaryTerm(@Nullable Long value) { } /** - * The result of the operation. Successful values are created, - * deleted, and updated. + * The result of the operation. Possible values are created, + * updated, deleted, noop, and + * not_found. *

* API name: {@code result} */ 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 92e862680e..a8c9c32ef2 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 @@ -1448,9 +1448,10 @@ 'eql.search.Request': 'eql/search/EqlSearchRequest.ts#L28-L173', 'eql.search.Response': 'eql/search/EqlSearchResponse.ts#L22-L24', 'eql.search.ResultPosition': 'eql/search/types.ts#L20-L32', +'esql._types.ESQLParams': 'esql/_types/types.ts#L23-L26', 'esql._types.TableValuesContainer': 'esql/_types/TableValuesContainer.ts#L22-L28', 'esql.query.EsqlFormat': 'esql/query/QueryParameters.ts#L20-L29', -'esql.query.Request': 'esql/query/QueryRequest.ts#L27-L118', +'esql.query.Request': 'esql/query/QueryRequest.ts#L28-L119', 'esql.query.Response': 'esql/query/QueryResponse.ts#L22-L25', 'features._types.Feature': 'features/_types/Feature.ts#L20-L23', 'features.get_features.Request': 'features/get_features/GetFeaturesRequest.ts#L24-L55', @@ -2752,26 +2753,26 @@ 'security._types.Access': 'security/_types/Access.ts#L22-L31', 'security._types.ApiKey': 'security/_types/ApiKey.ts#L27-L113', 'security._types.ApiKeyType': 'security/_types/ApiKey.ts#L115-L118', -'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L434-L436', -'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L27-L40', +'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L398-L400', +'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L28-L41', 'security._types.BulkError': 'security/_types/Bulk.ts#L24-L33', 'security._types.ClusterNode': 'security/_types/ClusterNode.ts#L22-L24', -'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L42-L199', +'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L43-L200', 'security._types.CreatedStatus': 'security/_types/CreatedStatus.ts#L20-L22', 'security._types.FieldRule': 'security/_types/RoleMappingRule.ts#L35-L43', 'security._types.FieldSecurity': 'security/_types/FieldSecurity.ts#L22-L25', -'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L430-L432', +'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L394-L396', 'security._types.GrantType': 'security/_types/GrantType.ts#L20-L30', -'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L386-L428', -'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L216-L242', -'security._types.IndicesPrivilegesQuery': 'security/_types/Privileges.ts#L341-L349', -'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L438-L440', +'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L350-L392', +'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L244-L244', +'security._types.IndicesPrivilegesQuery': 'security/_types/Privileges.ts#L305-L313', +'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L402-L404', 'security._types.RealmInfo': 'security/_types/RealmInfo.ts#L22-L25', -'security._types.RemoteClusterPrivilege': 'security/_types/Privileges.ts#L201-L213', -'security._types.RemoteClusterPrivileges': 'security/_types/Privileges.ts#L278-L290', -'security._types.RemoteIndicesPrivileges': 'security/_types/Privileges.ts#L244-L276', -'security._types.RemoteUserIndicesPrivileges': 'security/_types/Privileges.ts#L316-L339', -'security._types.ReplicationAccess': 'security/_types/Privileges.ts#L442-L452', +'security._types.RemoteClusterPrivilege': 'security/_types/Privileges.ts#L202-L214', +'security._types.RemoteClusterPrivileges': 'security/_types/Privileges.ts#L258-L270', +'security._types.RemoteIndicesPrivileges': 'security/_types/Privileges.ts#L246-L256', +'security._types.RemoteUserIndicesPrivileges': 'security/_types/Privileges.ts#L299-L303', +'security._types.ReplicationAccess': 'security/_types/Privileges.ts#L406-L416', 'security._types.Restriction': 'security/_types/RoleDescriptor.ts#L90-L96', 'security._types.RestrictionWorkflow': 'security/_types/RoleDescriptor.ts#L98-L101', 'security._types.RoleDescriptor': 'security/_types/RoleDescriptor.ts#L33-L83', @@ -2779,14 +2780,14 @@ 'security._types.RoleMapping': 'security/_types/RoleMapping.ts#L25-L33', 'security._types.RoleMappingRule': 'security/_types/RoleMappingRule.ts#L22-L33', 'security._types.RoleTemplate': 'security/_types/RoleTemplate.ts#L28-L31', -'security._types.RoleTemplateInlineQuery': 'security/_types/Privileges.ts#L383-L384', -'security._types.RoleTemplateQuery': 'security/_types/Privileges.ts#L351-L361', -'security._types.RoleTemplateScript': 'security/_types/Privileges.ts#L363-L381', -'security._types.SearchAccess': 'security/_types/Privileges.ts#L454-L474', +'security._types.RoleTemplateInlineQuery': 'security/_types/Privileges.ts#L347-L348', +'security._types.RoleTemplateQuery': 'security/_types/Privileges.ts#L315-L325', +'security._types.RoleTemplateScript': 'security/_types/Privileges.ts#L327-L345', +'security._types.SearchAccess': 'security/_types/Privileges.ts#L418-L438', 'security._types.SecuritySettings': 'security/_types/SecuritySettings.ts#L22-L24', 'security._types.TemplateFormat': 'security/_types/RoleTemplate.ts#L22-L25', 'security._types.User': 'security/_types/User.ts#L23-L31', -'security._types.UserIndicesPrivileges': 'security/_types/Privileges.ts#L292-L314', +'security._types.UserIndicesPrivileges': 'security/_types/Privileges.ts#L296-L297', 'security._types.UserProfile': 'security/_types/UserProfile.ts#L41-L47', 'security._types.UserProfileHitMetadata': 'security/_types/UserProfile.ts#L27-L30', 'security._types.UserProfileUser': 'security/_types/UserProfile.ts#L32-L39', @@ -3132,10 +3133,10 @@ 'transform._types.PivotGroupByContainer': 'transform/_types/Transform.ts#L70-L78', 'transform._types.RetentionPolicy': 'transform/_types/Transform.ts#L88-L96', 'transform._types.RetentionPolicyContainer': 'transform/_types/Transform.ts#L80-L86', -'transform._types.Settings': 'transform/_types/Transform.ts#L98-L154', -'transform._types.Source': 'transform/_types/Transform.ts#L156-L175', -'transform._types.SyncContainer': 'transform/_types/Transform.ts#L179-L185', -'transform._types.TimeSync': 'transform/_types/Transform.ts#L187-L199', +'transform._types.Settings': 'transform/_types/Transform.ts#L98-L166', +'transform._types.Source': 'transform/_types/Transform.ts#L168-L187', +'transform._types.SyncContainer': 'transform/_types/Transform.ts#L191-L197', +'transform._types.TimeSync': 'transform/_types/Transform.ts#L199-L211', 'transform.delete_transform.Request': 'transform/delete_transform/DeleteTransformRequest.ts#L24-L65', 'transform.delete_transform.Response': 'transform/delete_transform/DeleteTransformResponse.ts#L22-L24', 'transform.get_node_stats.Request': 'transform/get_node_stats/GetNodeStatsRequest.ts#L23-L40', @@ -3378,10 +3379,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/3666dcf13c05c73516c9dd5fc0fcaeed0e557da2/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/6ee016a765be615b0205fc209d3d3c515044689d/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java new file mode 100644 index 0000000000..145f034a53 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java @@ -0,0 +1,224 @@ +/* + * 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.FieldValue; +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.NamedValue; +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.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: esql._types.ESQLParams + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ESQLParams implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Named, Value + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private ESQLParams(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private ESQLParams(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static ESQLParams of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code named}? + */ + public boolean isNamed() { + return _kind == Kind.Named; + } + + /** + * Get the {@code named} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code named} kind. + */ + public List>> named() { + return TaggedUnionUtils.get(this, Kind.Named); + } + + /** + * Is this variant instance of kind {@code value}? + */ + public boolean isValue() { + return _kind == Kind.Value; + } + + /** + * Get the {@code value} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code value} kind. + */ + public List> value() { + return TaggedUnionUtils.get(this, Kind.Value); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Named : + generator.writeStartArray(); + for (NamedValue> item0 : ((List>>) this._value)) { + generator.writeStartObject(); + generator.writeKey(item0.name()); + generator.writeStartArray(); + if (item0.value() != null) { + for (FieldValue item2 : item0.value()) { + item2.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + generator.writeEnd(); + + } + generator.writeEnd(); + + break; + case Value : + generator.writeStartArray(); + for (List item0 : ((List>) this._value)) { + generator.writeStartArray(); + if (item0 != null) { + for (FieldValue item1 : item0) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + 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 named(List>> v) { + this._kind = Kind.Named; + this._value = v; + return this; + } + + public ObjectBuilder value(List> v) { + this._kind = Kind.Value; + this._value = v; + return this; + } + + public ESQLParams build() { + _checkSingleUse(); + return new ESQLParams(this); + } + + } + + private static JsonpDeserializer buildESQLParamsDeserializer() { + return new UnionDeserializer.Builder(ESQLParams::new, false) + .addMember(Kind.Named, + JsonpDeserializer.arrayDeserializer(NamedValue + .deserializer(() -> JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER)))) + .addMember(Kind.Value, + JsonpDeserializer + .arrayDeserializer(JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER))) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(ESQLParams::buildESQLParamsDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java new file mode 100644 index 0000000000..821655eed5 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java @@ -0,0 +1,55 @@ +/* + * 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.FieldValue; +import co.elastic.clients.util.NamedValue; +import co.elastic.clients.util.ObjectBuilder; +import java.util.List; +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 ESQLParams} variants. + *

+ * Variants named, value are not available here as + * they don't have a dedicated class. Use {@link ESQLParams}'s builder for + * these. + * + */ +public class ESQLParamsBuilders { + private ESQLParamsBuilders() { + } + +} 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 index 327115b949..c96ef488d7 100644 --- 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 @@ -20,7 +20,6 @@ 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.elasticsearch._types.query_dsl.QueryVariant; @@ -42,7 +41,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; @@ -98,7 +96,8 @@ public class QueryRequest extends RequestBase implements JsonpSerializable { @Nullable private final String locale; - private final List params; + @Nullable + private final ESQLParams params; @Nullable private final Boolean profile; @@ -119,7 +118,7 @@ private QueryRequest(Builder builder) { this.format = builder.format; this.includeCcsMetadata = builder.includeCcsMetadata; this.locale = builder.locale; - this.params = ApiTypeHelper.unmodifiable(builder.params); + this.params = builder.params; this.profile = builder.profile; this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); this.tables = ApiTypeHelper.unmodifiable(builder.tables); @@ -237,7 +236,8 @@ public final String locale() { *

* API name: {@code params} */ - public final List params() { + @Nullable + public final ESQLParams params() { return this.params; } @@ -305,14 +305,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.locale); } - if (ApiTypeHelper.isDefined(this.params)) { + if (this.params != null) { generator.writeKey("params"); - generator.writeStartArray(); - for (FieldValue item0 : this.params) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + this.params.serialize(generator, mapper); } if (this.profile != null) { @@ -377,7 +372,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private String locale; @Nullable - private List params; + private ESQLParams params; @Nullable private Boolean profile; @@ -531,59 +526,9 @@ public final Builder locale(@Nullable String value) { * 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 one or more values to params. - */ - public final Builder params(String value, String... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - for (String v : values) { - _listAdd(this.params, FieldValue.of(v)); - } - 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(long value, long... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - for (long v : values) { - _listAdd(this.params, FieldValue.of(v)); - } + public final Builder params(@Nullable ESQLParams value) { + this.params = value; return this; } @@ -593,45 +538,9 @@ public final Builder params(long value, long... values) { * string for each of the parameters. *

* API name: {@code params} - *

- * Adds one or more values to params. - */ - public final Builder params(double value, double... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - for (double v : values) { - _listAdd(this.params, FieldValue.of(v)); - } - 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(boolean value, boolean... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - for (boolean v : values) { - _listAdd(this.params, FieldValue.of(v)); - } - 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()); + public final Builder params(Function> fn) { + return this.params(fn.apply(new ESQLParams.Builder()).build()); } /** @@ -722,7 +631,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializer private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptionsTemplate dataStreamOptions; + private DataStreamOptions dataStreamOptions; public Builder() { } @@ -327,7 +328,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { this.dataStreamOptions = value; return this; } @@ -336,8 +337,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); } @Override @@ -378,7 +379,7 @@ protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializer clusters; + private final List fieldSecurity; private final List names; @@ -73,19 +75,17 @@ public class RemoteUserIndicesPrivileges implements JsonpSerializable { private final boolean allowRestrictedIndices; - private final List clusters; - // --------------------------------------------------------------------------------------------- private RemoteUserIndicesPrivileges(Builder builder) { + this.clusters = ApiTypeHelper.unmodifiableRequired(builder.clusters, this, "clusters"); this.fieldSecurity = ApiTypeHelper.unmodifiable(builder.fieldSecurity); this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges"); this.query = ApiTypeHelper.unmodifiable(builder.query); this.allowRestrictedIndices = ApiTypeHelper.requireNonNull(builder.allowRestrictedIndices, this, "allowRestrictedIndices", false); - this.clusters = ApiTypeHelper.unmodifiableRequired(builder.clusters, this, "clusters"); } @@ -93,6 +93,13 @@ public static RemoteUserIndicesPrivileges of(Function clusters() { + return this.clusters; + } + /** * The document fields that the owners of the role have read access to. *

@@ -147,13 +154,6 @@ public final boolean allowRestrictedIndices() { return this.allowRestrictedIndices; } - /** - * Required - API name: {@code clusters} - */ - public final List clusters() { - return this.clusters; - } - /** * Serialize this object to JSON. */ @@ -165,6 +165,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.clusters)) { + generator.writeKey("clusters"); + generator.writeStartArray(); + for (String item0 : this.clusters) { + generator.write(item0); + + } + generator.writeEnd(); + + } if (ApiTypeHelper.isDefined(this.fieldSecurity)) { generator.writeKey("field_security"); generator.writeStartArray(); @@ -208,17 +218,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("allow_restricted_indices"); generator.write(this.allowRestrictedIndices); - if (ApiTypeHelper.isDefined(this.clusters)) { - generator.writeKey("clusters"); - generator.writeStartArray(); - for (String item0 : this.clusters) { - generator.write(item0); - - } - generator.writeEnd(); - - } - } @Override @@ -235,6 +234,8 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private List clusters; + @Nullable private List fieldSecurity; @@ -247,19 +248,37 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean allowRestrictedIndices; - private List clusters; - public Builder() { } private Builder(RemoteUserIndicesPrivileges instance) { + this.clusters = instance.clusters; this.fieldSecurity = instance.fieldSecurity; this.names = instance.names; this.privileges = instance.privileges; this.query = instance.query; this.allowRestrictedIndices = instance.allowRestrictedIndices; - this.clusters = instance.clusters; } + /** + * Required - API name: {@code clusters} + *

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

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

@@ -417,26 +436,6 @@ public final Builder allowRestrictedIndices(boolean value) { return this; } - /** - * Required - API name: {@code clusters} - *

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

- * Adds one or more values to clusters. - */ - public final Builder clusters(String value, String... values) { - this.clusters = _listAdd(this.clusters, value, values); - return this; - } - @Override protected Builder self() { return this; @@ -472,6 +471,8 @@ public Builder rebuild() { protected static void setupRemoteUserIndicesPrivilegesDeserializer( ObjectDeserializer op) { + op.add(Builder::clusters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "clusters"); op.add(Builder::fieldSecurity, JsonpDeserializer.arrayDeserializer(FieldSecurity._DESERIALIZER), "field_security"); op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); @@ -479,8 +480,6 @@ protected static void setupRemoteUserIndicesPrivilegesDeserializer( "privileges"); op.add(Builder::query, JsonpDeserializer.arrayDeserializer(IndicesPrivilegesQuery._DESERIALIZER), "query"); op.add(Builder::allowRestrictedIndices, JsonpDeserializer.booleanDeserializer(), "allow_restricted_indices"); - op.add(Builder::clusters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "clusters"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java index fe1a77cc03..05bb5b7313 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/Settings.java @@ -79,6 +79,9 @@ public class Settings implements JsonpSerializable { @Nullable private final Boolean usePointInTime; + @Nullable + private final Integer numFailureRetries; + @Nullable private final Boolean unattended; @@ -92,6 +95,7 @@ private Settings(Builder builder) { this.docsPerSecond = builder.docsPerSecond; this.maxPageSearchSize = builder.maxPageSearchSize; this.usePointInTime = builder.usePointInTime; + this.numFailureRetries = builder.numFailureRetries; this.unattended = builder.unattended; } @@ -179,6 +183,23 @@ public final Boolean usePointInTime() { return this.usePointInTime; } + /** + * Defines the number of retries on a recoverable failure before the transform + * task is marked as failed. The minimum value is 0 + * and the maximum is 100, where -1 indicates that the + * transform retries indefinitely. If unset, the cluster-level setting + * num_transform_failure_retries is used. + *

+ * This setting cannot be specified when unattended is + * true, because unattended transforms always retry indefinitely. + *

+ * API name: {@code num_failure_retries} + */ + @Nullable + public final Integer numFailureRetries() { + return this.numFailureRetries; + } + /** * If true, the transform runs in unattended mode. In unattended * mode, the transform retries indefinitely in case of an error which means the @@ -232,6 +253,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("use_point_in_time"); generator.write(this.usePointInTime); + } + if (this.numFailureRetries != null) { + generator.writeKey("num_failure_retries"); + generator.write(this.numFailureRetries); + } if (this.unattended != null) { generator.writeKey("unattended"); @@ -271,6 +297,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Boolean usePointInTime; + @Nullable + private Integer numFailureRetries; + @Nullable private Boolean unattended; @@ -283,6 +312,7 @@ private Builder(Settings instance) { this.docsPerSecond = instance.docsPerSecond; this.maxPageSearchSize = instance.maxPageSearchSize; this.usePointInTime = instance.usePointInTime; + this.numFailureRetries = instance.numFailureRetries; this.unattended = instance.unattended; } @@ -365,6 +395,23 @@ public final Builder usePointInTime(@Nullable Boolean value) { return this; } + /** + * Defines the number of retries on a recoverable failure before the transform + * task is marked as failed. The minimum value is 0 + * and the maximum is 100, where -1 indicates that the + * transform retries indefinitely. If unset, the cluster-level setting + * num_transform_failure_retries is used. + *

+ * This setting cannot be specified when unattended is + * true, because unattended transforms always retry indefinitely. + *

+ * API name: {@code num_failure_retries} + */ + public final Builder numFailureRetries(@Nullable Integer value) { + this.numFailureRetries = value; + return this; + } + /** * If true, the transform runs in unattended mode. In unattended * mode, the transform retries indefinitely in case of an error which means the @@ -418,6 +465,7 @@ protected static void setupSettingsDeserializer(ObjectDeserializer Date: Thu, 26 Feb 2026 15:32:34 +0100 Subject: [PATCH 2/3] revert unwanted changes --- .../cluster/ComponentTemplateSummary.java | 17 ++++++++--------- .../cluster/PutComponentTemplateRequest.java | 16 ++++++++-------- .../indices/IndexTemplateSummary.java | 15 +++++++-------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java index ec71d0adaa..9cb227c73b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.AliasDefinition; import co.elastic.clients.elasticsearch.indices.DataStreamLifecycleWithRollover; -import co.elastic.clients.elasticsearch.indices.DataStreamOptions; +import co.elastic.clients.elasticsearch.indices.DataStreamOptionsTemplate; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -39,7 +39,6 @@ import java.lang.Long; import java.lang.String; import java.util.Map; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -84,7 +83,7 @@ public class ComponentTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptions dataStreamOptions; + private final DataStreamOptionsTemplate dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -153,7 +152,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptions dataStreamOptions() { + public final DataStreamOptionsTemplate dataStreamOptions() { return this.dataStreamOptions; } @@ -257,7 +256,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptions dataStreamOptions; + private DataStreamOptionsTemplate dataStreamOptions; public Builder() { } @@ -391,7 +390,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { this.dataStreamOptions = value; return this; } @@ -400,8 +399,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); } @Override @@ -445,7 +444,7 @@ protected static void setupComponentTemplateSummaryDeserializer( op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::dataStreamOptions, DataStreamOptions._DESERIALIZER, "data_stream_options"); + op.add(Builder::dataStreamOptions, DataStreamOptionsTemplate._DESERIALIZER, "data_stream_options"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java index e722a0079e..17a0c4b2bd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java @@ -22,7 +22,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.elasticsearch.indices.put_index_template.IndexTemplateMapping; +import co.elastic.clients.elasticsearch.indices.IndexState; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -112,7 +112,7 @@ public class PutComponentTemplateRequest extends RequestBase implements JsonpSer private final String name; - private final IndexTemplateMapping template; + private final IndexState template; @Nullable private final Long version; @@ -218,7 +218,7 @@ public final String name() { *

* API name: {@code template} */ - public final IndexTemplateMapping template() { + public final IndexState template() { return this.template; } @@ -298,7 +298,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; - private IndexTemplateMapping template; + private IndexState template; @Nullable private Long version; @@ -428,7 +428,7 @@ public final Builder name(String value) { *

* API name: {@code template} */ - public final Builder template(IndexTemplateMapping value) { + public final Builder template(IndexState value) { this.template = value; return this; } @@ -439,8 +439,8 @@ public final Builder template(IndexTemplateMapping value) { *

* API name: {@code template} */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); + public final Builder template(Function> fn) { + return this.template(fn.apply(new IndexState.Builder()).build()); } /** @@ -492,7 +492,7 @@ protected static void setupPutComponentTemplateRequestDeserializer( op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); + op.add(Builder::template, IndexState._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java index 53089fe50f..0e3eb1c972 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java @@ -33,7 +33,6 @@ 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; @@ -74,7 +73,7 @@ public class IndexTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptions dataStreamOptions; + private final DataStreamOptionsTemplate dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -137,7 +136,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptions dataStreamOptions() { + public final DataStreamOptionsTemplate dataStreamOptions() { return this.dataStreamOptions; } @@ -213,7 +212,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptions dataStreamOptions; + private DataStreamOptionsTemplate dataStreamOptions; public Builder() { } @@ -328,7 +327,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { this.dataStreamOptions = value; return this; } @@ -337,8 +336,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); } @Override @@ -379,7 +378,7 @@ protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializer Date: Tue, 7 Apr 2026 14:46:54 +0200 Subject: [PATCH 3/3] fix esql params --- .../elasticsearch/doc-files/api-spec.html | 1 - .../elasticsearch/esql/ESQLParams.java | 224 ------------------ .../esql/ESQLParamsBuilders.java | 55 ----- .../elasticsearch/esql/QueryRequest.java | 117 ++++++++- 4 files changed, 104 insertions(+), 293 deletions(-) delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java 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 a8c9c32ef2..46bb79f1a4 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 @@ -1448,7 +1448,6 @@ 'eql.search.Request': 'eql/search/EqlSearchRequest.ts#L28-L173', 'eql.search.Response': 'eql/search/EqlSearchResponse.ts#L22-L24', 'eql.search.ResultPosition': 'eql/search/types.ts#L20-L32', -'esql._types.ESQLParams': 'esql/_types/types.ts#L23-L26', 'esql._types.TableValuesContainer': 'esql/_types/TableValuesContainer.ts#L22-L28', 'esql.query.EsqlFormat': 'esql/query/QueryParameters.ts#L20-L29', 'esql.query.Request': 'esql/query/QueryRequest.ts#L28-L119', diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java deleted file mode 100644 index 145f034a53..0000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParams.java +++ /dev/null @@ -1,224 +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. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.elasticsearch._types.FieldValue; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.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.NamedValue; -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.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: esql._types.ESQLParams - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ESQLParams implements TaggedUnion, JsonpSerializable { - - public enum Kind { - Named, Value - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private ESQLParams(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private ESQLParams(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static ESQLParams of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code named}? - */ - public boolean isNamed() { - return _kind == Kind.Named; - } - - /** - * Get the {@code named} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code named} kind. - */ - public List>> named() { - return TaggedUnionUtils.get(this, Kind.Named); - } - - /** - * Is this variant instance of kind {@code value}? - */ - public boolean isValue() { - return _kind == Kind.Value; - } - - /** - * Get the {@code value} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code value} kind. - */ - public List> value() { - return TaggedUnionUtils.get(this, Kind.Value); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Named : - generator.writeStartArray(); - for (NamedValue> item0 : ((List>>) this._value)) { - generator.writeStartObject(); - generator.writeKey(item0.name()); - generator.writeStartArray(); - if (item0.value() != null) { - for (FieldValue item2 : item0.value()) { - item2.serialize(generator, mapper); - - } - } - generator.writeEnd(); - - generator.writeEnd(); - - } - generator.writeEnd(); - - break; - case Value : - generator.writeStartArray(); - for (List item0 : ((List>) this._value)) { - generator.writeStartArray(); - if (item0 != null) { - for (FieldValue item1 : item0) { - item1.serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - 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 named(List>> v) { - this._kind = Kind.Named; - this._value = v; - return this; - } - - public ObjectBuilder value(List> v) { - this._kind = Kind.Value; - this._value = v; - return this; - } - - public ESQLParams build() { - _checkSingleUse(); - return new ESQLParams(this); - } - - } - - private static JsonpDeserializer buildESQLParamsDeserializer() { - return new UnionDeserializer.Builder(ESQLParams::new, false) - .addMember(Kind.Named, - JsonpDeserializer.arrayDeserializer(NamedValue - .deserializer(() -> JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER)))) - .addMember(Kind.Value, - JsonpDeserializer - .arrayDeserializer(JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER))) - .build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(ESQLParams::buildESQLParamsDeserializer); -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java deleted file mode 100644 index 821655eed5..0000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLParamsBuilders.java +++ /dev/null @@ -1,55 +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. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.elasticsearch._types.FieldValue; -import co.elastic.clients.util.NamedValue; -import co.elastic.clients.util.ObjectBuilder; -import java.util.List; -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 ESQLParams} variants. - *

- * Variants named, value are not available here as - * they don't have a dedicated class. Use {@link ESQLParams}'s builder for - * these. - * - */ -public class ESQLParamsBuilders { - private ESQLParamsBuilders() { - } - -} 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 index c96ef488d7..327115b949 100644 --- 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 @@ -20,6 +20,7 @@ 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.elasticsearch._types.query_dsl.QueryVariant; @@ -41,6 +42,7 @@ 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; @@ -96,8 +98,7 @@ public class QueryRequest extends RequestBase implements JsonpSerializable { @Nullable private final String locale; - @Nullable - private final ESQLParams params; + private final List params; @Nullable private final Boolean profile; @@ -118,7 +119,7 @@ private QueryRequest(Builder builder) { this.format = builder.format; this.includeCcsMetadata = builder.includeCcsMetadata; this.locale = builder.locale; - this.params = builder.params; + this.params = ApiTypeHelper.unmodifiable(builder.params); this.profile = builder.profile; this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); this.tables = ApiTypeHelper.unmodifiable(builder.tables); @@ -236,8 +237,7 @@ public final String locale() { *

* API name: {@code params} */ - @Nullable - public final ESQLParams params() { + public final List params() { return this.params; } @@ -305,9 +305,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.locale); } - if (this.params != null) { + if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); - this.params.serialize(generator, mapper); + generator.writeStartArray(); + for (FieldValue item0 : this.params) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); } if (this.profile != null) { @@ -372,7 +377,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private String locale; @Nullable - private ESQLParams params; + private List params; @Nullable private Boolean profile; @@ -526,9 +531,59 @@ public final Builder locale(@Nullable String value) { * 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 one or more values to params. + */ + public final Builder params(String value, String... values) { + this.params = _listAdd(this.params, FieldValue.of(value)); + for (String v : values) { + _listAdd(this.params, FieldValue.of(v)); + } + 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(@Nullable ESQLParams value) { - this.params = value; + public final Builder params(long value, long... values) { + this.params = _listAdd(this.params, FieldValue.of(value)); + for (long v : values) { + _listAdd(this.params, FieldValue.of(v)); + } return this; } @@ -538,9 +593,45 @@ public final Builder params(@Nullable ESQLParams value) { * string for each of the parameters. *

* API name: {@code params} + *

+ * Adds one or more values to params. + */ + public final Builder params(double value, double... values) { + this.params = _listAdd(this.params, FieldValue.of(value)); + for (double v : values) { + _listAdd(this.params, FieldValue.of(v)); + } + 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(boolean value, boolean... values) { + this.params = _listAdd(this.params, FieldValue.of(value)); + for (boolean v : values) { + _listAdd(this.params, FieldValue.of(v)); + } + 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 this.params(fn.apply(new ESQLParams.Builder()).build()); + public final Builder params(Function> fn) { + return params(fn.apply(new FieldValue.Builder()).build()); } /** @@ -631,7 +722,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializer