From 8aef10fc838be0b6380ce3a61e8417adf515cd50 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Thu, 14 Aug 2025 13:07:21 +0200 Subject: [PATCH 1/5] bump version --- config/version.txt | 2 +- .../java/co/elastic/clients/transport/VersionInfo.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/version.txt b/config/version.txt index d6b7c4d54..3a0350e65 100644 --- a/config/version.txt +++ b/config/version.txt @@ -1 +1 @@ -9.1.2 +9.1.3 diff --git a/java-client/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java b/java-client/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java index 260d5495b..c2dd4e815 100644 --- a/java-client/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java +++ b/java-client/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java @@ -21,5 +21,5 @@ // Package private class VersionInfo { - static final String VERSION = "9.1.2"; + static final String VERSION = "9.1.3"; } From c944415770ccd0227d07c91c8a96ea2b6a3af9d0 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 20 Aug 2025 13:13:27 +0100 Subject: [PATCH 2/5] Update logging.md (#1059) Changed the Logging class, as this is the correct location for the Request Object. --- docs/reference/transport/rest5-client/usage/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/transport/rest5-client/usage/logging.md b/docs/reference/transport/rest5-client/usage/logging.md index 28a79acd8..1ba48d569 100644 --- a/docs/reference/transport/rest5-client/usage/logging.md +++ b/docs/reference/transport/rest5-client/usage/logging.md @@ -2,7 +2,7 @@ The Java REST 5 client uses the same logging library that the Apache Async Http Client uses: [Apache Commons Logging](https://commons.apache.org/proper/commons-logging/), which comes with support for a number of popular logging implementations. The java packages to enable logging for is `co.elastic.clients.transport.rest5_client`. -The request tracer logging can also be enabled to log every request and corresponding response in curl format. That comes handy when debugging, for instance in case a request needs to be manually executed to check whether it still yields the same response as it did. Enable trace logging for the `co.elastic.clients.transport.rest5_client.Request` class to have such log lines printed out. Do note that this type of logging is expensive and should not be enabled at all times in production environments, but rather temporarily used only when needed. +The request tracer logging can also be enabled to log every request and corresponding response in curl format. That comes handy when debugging, for instance in case a request needs to be manually executed to check whether it still yields the same response as it did. Enable trace logging for the `co.elastic.clients.transport.rest5_client.low_level.Request` class to have such log lines printed out. Do note that this type of logging is expensive and should not be enabled at all times in production environments, but rather temporarily used only when needed. From 2acac9b5e8e9359ae7c60cac70bb853c0bb32721 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 10:07:42 +0200 Subject: [PATCH 3/5] Http2 bug workaround (#1060) (#1062) * http2 issue workaround * adding comment Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../transport/ElasticsearchTransportBase.java | 13 ++++++------- .../transport/rest5_client/Rest5ClientOptions.java | 2 +- .../low_level/BufferedByteConsumer.java | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/transport/ElasticsearchTransportBase.java b/java-client/src/main/java/co/elastic/clients/transport/ElasticsearchTransportBase.java index 8d561f506..26dcd273b 100644 --- a/java-client/src/main/java/co/elastic/clients/transport/ElasticsearchTransportBase.java +++ b/java-client/src/main/java/co/elastic/clients/transport/ElasticsearchTransportBase.java @@ -243,7 +243,11 @@ private TransportHttpClient.Request prepareTranspo Map params = endpoint.queryParameters(request); List bodyBuffers = null; - HeaderMap headers = DefaultHeaders; + // Setting the Content-type header for all requests, even the ones without body. + // This is a workaround for a bug with server version 9.1.2 and http2, where + // http2 stream requests are considered not to have a body. So if the client doesn't always send + // the Content-type header, empty body requests will fail with the above-described conditions. + HeaderMap headers = JsonContentTypeHeaders; Object body = endpoint.body(request); if (body != null) { @@ -251,17 +255,12 @@ private TransportHttpClient.Request prepareTranspo if (body instanceof NdJsonpSerializable) { bodyBuffers = new ArrayList<>(); collectNdJsonLines(bodyBuffers, (NdJsonpSerializable) request); - headers = JsonContentTypeHeaders; - } else if (body instanceof BinaryData) { BinaryData data = (BinaryData) body; // ES expects the Accept and Content-Type headers to be consistent. String dataContentType = data.contentType(); - if (ContentType.APPLICATION_JSON.equals(dataContentType)) { - // Fast path - headers = JsonContentTypeHeaders; - } else { + if (!ContentType.APPLICATION_JSON.equals(dataContentType)) { headers = new HeaderMap(DefaultHeaders); headers.put(HeaderMap.CONTENT_TYPE, dataContentType); } diff --git a/java-client/src/main/java/co/elastic/clients/transport/rest5_client/Rest5ClientOptions.java b/java-client/src/main/java/co/elastic/clients/transport/rest5_client/Rest5ClientOptions.java index 6135a6738..2520b16bb 100644 --- a/java-client/src/main/java/co/elastic/clients/transport/rest5_client/Rest5ClientOptions.java +++ b/java-client/src/main/java/co/elastic/clients/transport/rest5_client/Rest5ClientOptions.java @@ -238,7 +238,7 @@ private static String getClientMeta() { VersionInfo httpClientVersion = null; try { httpClientVersion = VersionInfo.loadVersionInfo( - "org.apache.http.nio.client", + "org.apache.hc.core5", HttpAsyncClientBuilder.class.getClassLoader() ); } catch (Exception e) { diff --git a/java-client/src/main/java/co/elastic/clients/transport/rest5_client/low_level/BufferedByteConsumer.java b/java-client/src/main/java/co/elastic/clients/transport/rest5_client/low_level/BufferedByteConsumer.java index ef33c7295..f42bb413e 100644 --- a/java-client/src/main/java/co/elastic/clients/transport/rest5_client/low_level/BufferedByteConsumer.java +++ b/java-client/src/main/java/co/elastic/clients/transport/rest5_client/low_level/BufferedByteConsumer.java @@ -57,7 +57,7 @@ protected int capacityIncrement() { protected void data(final ByteBuffer src, final boolean endOfStream) throws ContentTooLongException { if (buffer.length() + src.limit() > limit) { throw new ContentTooLongException( - "entity content is too long [" + src.capacity() + "] for the configured buffer limit [" + limit + "]" + "entity content is too long [" + src.limit() + "] for the configured buffer limit [" + limit + "]" ); } buffer.append(src); From e410b0f75213a46fe88c3ca9caa92919d8264498 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 25 Aug 2025 10:45:13 +0200 Subject: [PATCH 4/5] [codegen] update to latest spec and generator --- .../_types/aggregations/BucketsPath.java | 16 +++++++ .../elasticsearch/cat/AliasesRequest.java | 15 +++++++ .../elasticsearch/cat/AllocationRequest.java | 15 +++++++ .../cat/ComponentTemplatesRequest.java | 15 +++++++ .../elasticsearch/cat/CountRequest.java | 15 +++++++ .../elasticsearch/cat/FielddataRequest.java | 15 +++++++ .../elasticsearch/cat/NodesRequest.java | 15 +++++++ .../elasticsearch/cat/RecoveryRequest.java | 15 +++++++ .../elasticsearch/cat/SegmentsRequest.java | 15 +++++++ .../elasticsearch/cat/ShardsRequest.java | 14 +++++++ .../elasticsearch/cat/SnapshotsRequest.java | 15 +++++++ .../elasticsearch/cat/ThreadPoolRequest.java | 14 +++++++ .../core/DeleteByQueryRequest.java | 42 ++++++++++++++----- .../elasticsearch/doc-files/api-spec.html | 6 +-- .../GetBuiltinPrivilegesResponse.java | 15 +++++++ .../security/HasPrivilegesRequest.java | 14 +++++++ .../security/IndicesPrivileges.java | 15 +++++++ .../security/PutRoleRequest.java | 15 +++++++ .../security/RemoteIndicesPrivileges.java | 15 +++++++ .../security/RemoteUserIndicesPrivileges.java | 15 +++++++ .../elasticsearch/security/Restriction.java | 16 +++++++ .../security/RoleDescriptor.java | 15 +++++++ .../security/RoleDescriptorRead.java | 15 +++++++ .../security/UserIndicesPrivileges.java | 15 +++++++ .../elasticsearch/security/get_role/Role.java | 12 ++++++ .../has_privileges/IndexPrivilegesCheck.java | 15 +++++++ .../PrivilegesCheck.java | 14 +++++++ 27 files changed, 404 insertions(+), 14 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketsPath.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketsPath.java index a55d5bd11..b2a928dc4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketsPath.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketsPath.java @@ -38,6 +38,7 @@ import java.util.Map; import java.util.Objects; import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.Nullable; //---------------------------------------------------------------- @@ -92,6 +93,21 @@ private BucketsPath(Kind kind, Object value) { this._value = value; } + public String _toJsonString() { + switch (_kind) { + case Array : + return this.array().stream().map(v -> v).collect(Collectors.joining(",")); + case Dict : + return this.dict().entrySet().stream().map(e -> e.getKey() + ":" + e.getValue()) + .collect(Collectors.joining(",")); + case Single : + return this.single(); + + default : + throw new IllegalStateException("Unknown kind " + _kind); + } + } + private BucketsPath(Builder builder) { this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AliasesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AliasesRequest.java index 92e9278f9..4c9d72935 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AliasesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AliasesRequest.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -236,6 +237,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatAliasesColumn value, CatAliasesColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatAliasesColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * The period to wait for a connection to the master node. If the master node is * not available before the timeout expires, the request fails and returns an diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AllocationRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AllocationRequest.java index 77d9053e0..79605fbde 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AllocationRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AllocationRequest.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -232,6 +233,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatAllocationColumn value, CatAllocationColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatAllocationColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * If true, the request computes the list of selected nodes from * the local cluster state. If false the list of selected nodes are diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java index a619f0eeb..6b300674c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java @@ -32,6 +32,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -208,6 +209,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatComponentColumn value, CatComponentColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatComponentColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * If true, the request computes the list of selected nodes from * the local cluster state. If false the list of selected nodes are diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/CountRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/CountRequest.java index c1808a28f..9f0bc7281 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/CountRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/CountRequest.java @@ -30,6 +30,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -166,6 +167,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatCountColumn value, CatCountColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatCountColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * A comma-separated list of data streams, indices, and aliases used to limit * the request. It supports wildcards (*). To target all data diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/FielddataRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/FielddataRequest.java index adf24c2d0..34f34dae6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/FielddataRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/FielddataRequest.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -219,6 +220,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatFieldDataColumn value, CatFieldDataColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatFieldDataColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * List of columns that determine how the table should be sorted. Sorting * defaults to ascending and can be changed by setting :asc or diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/NodesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/NodesRequest.java index 6390a4f02..f3cb44839 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/NodesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/NodesRequest.java @@ -34,6 +34,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -258,6 +259,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatNodeColumn value, CatNodeColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatNodeColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * If true, the response includes information from segments that are not loaded * into memory. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/RecoveryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/RecoveryRequest.java index 7ec5644a3..b77a625e6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/RecoveryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/RecoveryRequest.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -271,6 +272,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatRecoveryColumn value, CatRecoveryColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatRecoveryColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * A comma-separated list of data streams, indices, and aliases used to limit * the request. Supports wildcards (*). To target all data streams diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SegmentsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SegmentsRequest.java index 703763324..3203e0617 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SegmentsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SegmentsRequest.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -233,6 +234,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatSegmentsColumn value, CatSegmentsColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatSegmentsColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * A comma-separated list of data streams, indices, and aliases used to limit * the request. Supports wildcards (*). To target all data streams diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ShardsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ShardsRequest.java index 173736f06..b0341dd20 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ShardsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ShardsRequest.java @@ -33,6 +33,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -225,6 +226,19 @@ public final Builder h(String value, String... values) { return this; } + /** + * List of columns to appear in the response. Supports simple wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatShardColumn value, CatShardColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatShardColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * A comma-separated list of data streams, indices, and aliases used to limit * the request. Supports wildcards (*). To target all data streams diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SnapshotsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SnapshotsRequest.java index 311fadc38..00ba4df7b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SnapshotsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SnapshotsRequest.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -220,6 +221,20 @@ public final Builder h(String value, String... values) { return this; } + /** + * A comma-separated list of columns names to display. It supports simple + * wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatSnapshotsColumn value, CatSnapshotsColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatSnapshotsColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * If true, the response does not include information from * unavailable snapshots. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java index 67d9def57..57a84032c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -219,6 +220,19 @@ public final Builder h(String value, String... values) { return this; } + /** + * List of columns to appear in the response. Supports simple wildcards. + *

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

+ * Adds one or more enum values to h. + */ + public final Builder h(CatThreadPoolColumn value, CatThreadPoolColumn... values) { + this.h = _listAdd(this.h, value.jsonValue(), + Arrays.stream(values).map(CatThreadPoolColumn::jsonValue).toArray(String[]::new)); + return this; + } + /** * If true, the request computes the list of selected nodes from * the local cluster state. If false the list of selected nodes are 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 7371a9abe..c03433650 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 @@ -26,6 +26,7 @@ import co.elastic.clients.elasticsearch._types.SearchType; import co.elastic.clients.elasticsearch._types.SlicedScroll; import co.elastic.clients.elasticsearch._types.Slices; +import co.elastic.clients.elasticsearch._types.SortOptions; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch._types.WaitForActiveShards; import co.elastic.clients.elasticsearch._types.query_dsl.Operator; @@ -281,7 +282,7 @@ public class DeleteByQueryRequest extends RequestBase implements JsonpSerializab @Nullable private final Slices slices; - private final List sort; + private final List sort; private final List stats; @@ -621,11 +622,11 @@ public final Slices slices() { } /** - * A comma-separated list of <field>:<direction> pairs. + * A sort object that specifies the order of deleted documents. *

* API name: {@code sort} */ - public final List sort() { + public final List sort() { return this.sort; } @@ -731,6 +732,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.slice.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("sort"); + generator.writeStartArray(); + for (SortOptions item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -818,7 +829,7 @@ public static class Builder extends RequestBase.AbstractBuilder private Slices slices; @Nullable - private List sort; + private List sort; @Nullable private List stats; @@ -1207,29 +1218,40 @@ public final Builder slices(Function> fn) } /** - * A comma-separated list of <field>:<direction> pairs. + * A sort object that specifies the order of deleted documents. *

* API name: {@code sort} *

* Adds all elements of list to sort. */ - public final Builder sort(List list) { + public final Builder sort(List list) { this.sort = _listAddAll(this.sort, list); return this; } /** - * A comma-separated list of <field>:<direction> pairs. + * A sort object that specifies the order of deleted documents. *

* API name: {@code sort} *

* Adds one or more values to sort. */ - public final Builder sort(String value, String... values) { + public final Builder sort(SortOptions value, SortOptions... values) { this.sort = _listAdd(this.sort, value, values); return this; } + /** + * A sort object that specifies the order of deleted documents. + *

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

+ * Adds a value to sort using a builder lambda. + */ + public final Builder sort(Function> fn) { + return sort(fn.apply(new SortOptions.Builder()).build()); + } + /** * The specific tag of the request for logging and statistical * purposes. @@ -1376,6 +1398,7 @@ protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer v).collect(Collectors.joining(","))); - } if (request.searchType != null) { params.put("search_type", request.searchType.jsonValue()); } 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 478e2654d..01a5b8648 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 @@ -27,7 +27,7 @@ '_global.create.Response': '_global/create/CreateResponse.ts#L22-L25', '_global.delete.Request': '_global/delete/DeleteRequest.ts#L34-L146', '_global.delete.Response': '_global/delete/DeleteResponse.ts#L22-L35', -'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L36-L314', +'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L37-L319', '_global.delete_by_query.Response': '_global/delete_by_query/DeleteByQueryResponse.ts#L26-L88', '_global.delete_by_query_rethrottle.Request': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleRequest.ts#L24-L55', '_global.delete_by_query_rethrottle.Response': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleResponse.ts#L22-L25', @@ -3353,10 +3353,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/ea30618394c19ed7ddc841646edd2bdac9835d47/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/cd98bcd5444ce3e5b079a41c263e9ef3b99650c8/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetBuiltinPrivilegesResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetBuiltinPrivilegesResponse.java index 1cb21f519..eab3782ae 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetBuiltinPrivilegesResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetBuiltinPrivilegesResponse.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -201,6 +202,20 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * Required - The list of cluster privileges that are understood by this version + * of Elasticsearch. + *

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

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Required - The list of index privileges that are understood by this version * of Elasticsearch. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesRequest.java index 26d489d85..10e277d64 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesRequest.java @@ -35,6 +35,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -248,6 +249,19 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * A list of the cluster privileges that you want to check. + *

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

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * API name: {@code index} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivileges.java index 3067e0e1f..c5eb622cc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivileges.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivileges.java @@ -34,6 +34,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -297,6 +298,20 @@ public final Builder privileges(String value, String... values) { return this; } + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * A search query that defines the documents the owners of the role have access * to. A document within the specified indices must match this query for it to diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java index 5470aad53..edc4007b6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java @@ -35,6 +35,7 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -470,6 +471,20 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * A list of cluster privileges. These privileges define the cluster-level + * actions for users with this role. + *

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

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Optional description of the role descriptor *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java index bf0228ca9..5e3166870 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java @@ -32,6 +32,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -347,6 +348,20 @@ public final Builder privileges(String value, String... values) { return this; } + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * A search query that defines the documents the owners of the role have access * to. A document within the specified indices must match this query for it to diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteUserIndicesPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteUserIndicesPrivileges.java index a6e4d760d..c0d90fc5e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteUserIndicesPrivileges.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteUserIndicesPrivileges.java @@ -32,6 +32,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -335,6 +336,20 @@ public final Builder privileges(String value, String... values) { return this; } + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Search queries that define the documents the user has access to. A document * within the specified indices must match these queries for it to be accessible diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java index c26c522fe..e1a34ec0a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -151,6 +152,21 @@ public final Builder workflows(String value, String... values) { return this; } + /** + * Required - A list of workflows to which the API key is restricted. NOTE: In + * order to use a role restriction, an API key must be created with a single + * role descriptor. + *

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

+ * Adds one or more enum values to workflows. + */ + public final Builder workflows(RestrictionWorkflow value, RestrictionWorkflow... values) { + this.workflows = _listAdd(this.workflows, value.jsonValue(), + Arrays.stream(values).map(RestrictionWorkflow::jsonValue).toArray(String[]::new)); + return this; + } + @Override protected Builder self() { return this; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java index abc5c41fd..742f16ecf 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; @@ -425,6 +426,20 @@ public final BuilderT cluster(String value, String... values) { return self(); } + /** + * A list of cluster privileges. These privileges define the cluster level + * actions that API keys are able to execute. + *

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

+ * Adds one or more enum values to cluster. + */ + public final BuilderT cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return self(); + } + /** * A list of indices permissions entries. *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java index e330baaaa..fa456d6ea 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; @@ -400,6 +401,20 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * Required - A list of cluster privileges. These privileges define the cluster + * level actions that API keys are able to execute. + *

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

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Required - A list of indices permissions entries. *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserIndicesPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserIndicesPrivileges.java index 0327f8bf5..e8002d1b3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserIndicesPrivileges.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserIndicesPrivileges.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -315,6 +316,20 @@ public final Builder privileges(String value, String... values) { return this; } + /** + * Required - The index level privileges that owners of the role have on the + * specified indices. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Search queries that define the documents the user has access to. A document * within the specified indices must match these queries for it to be accessible 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 30101a021..97908847b 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 @@ -38,6 +38,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; @@ -397,6 +398,17 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * Required - API name: {@code cluster} + *

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * Required - API name: {@code indices} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges/IndexPrivilegesCheck.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges/IndexPrivilegesCheck.java index 3fda7dd6e..8929e3f1f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges/IndexPrivilegesCheck.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges/IndexPrivilegesCheck.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -229,6 +230,20 @@ public final Builder privileges(String value, String... values) { return this; } + /** + * Required - A list of the privileges that you want to check for the specified + * indices. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * This needs to be set to true (default is false) if * using wildcards or regexps for patterns that cover restricted indices. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java index e1848f773..e6f6357eb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java @@ -34,6 +34,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -226,6 +227,19 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * A list of the cluster privileges that you want to check. + *

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

+ * Adds one or more enum values to cluster. + */ + public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) { + this.cluster = _listAdd(this.cluster, value.jsonValue(), + Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new)); + return this; + } + /** * API name: {@code index} *

From 778ab952b8daf4c86b87ccf722105ec8edb09faa Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 25 Aug 2025 11:29:43 +0200 Subject: [PATCH 5/5] better unit test version resolve --- .../elastic/clients/elasticsearch/ElasticsearchTestServer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java index 52c3f82e6..4fe064086 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java @@ -111,8 +111,9 @@ private Version selectLatestVersion(Version version, String info) { throw new RuntimeException("Elasticsearch server container version: " + version + " not yet " + "available"); } + String prerelease = version.isPreRelease() ? "SNAPSHOT" : null; return selectLatestVersion(new Version(version.major(), version.minor(), version.maintenance() - 1, - false), info); + prerelease, null), info); } private String fetchAndWriteVersionInfo(File file) throws IOException {