From 7c46ddd904f31cab870ad5804003af29408ffe6d Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 16 Sep 2024 10:10:13 +0200 Subject: [PATCH] [codegen] update to latest spec --- .../elasticsearch/doc-files/api-spec.html | 82 ++-- .../clients/elasticsearch/nodes/Http.java | 63 +++ .../elasticsearch/nodes/HttpRoute.java | 190 +++++++++ .../nodes/HttpRouteRequests.java | 232 +++++++++++ .../nodes/HttpRouteResponses.java | 289 +++++++++++++ .../clients/elasticsearch/nodes/Ingest.java | 18 +- .../elasticsearch/nodes/IngestStats.java | 388 ++++++++++++++++++ .../elasticsearch/nodes/IngestTotal.java | 156 ++----- .../nodes/SizeHttpHistogram.java | 212 ++++++++++ .../nodes/TimeHttpHistogram.java | 212 ++++++++++ 10 files changed, 1677 insertions(+), 165 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRoute.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteRequests.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/SizeHttpHistogram.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.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 24ee432d6..077f04602 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 @@ -2149,61 +2149,67 @@ 'ml.validate_detector.Response': 'ml/validate_detector/MlValidateDetectorResponse.ts#L22-L24', 'monitoring.bulk.Request': 'monitoring/bulk/BulkMonitoringRequest.ts#L24-L59', 'monitoring.bulk.Response': 'monitoring/bulk/BulkMonitoringResponse.ts#L23-L32', -'nodes._types.AdaptiveSelection': 'nodes/_types/Stats.ts#L403-L432', -'nodes._types.Breaker': 'nodes/_types/Stats.ts#L434-L459', -'nodes._types.Cgroup': 'nodes/_types/Stats.ts#L461-L474', -'nodes._types.CgroupCpu': 'nodes/_types/Stats.ts#L487-L504', -'nodes._types.CgroupCpuStat': 'nodes/_types/Stats.ts#L506-L519', -'nodes._types.CgroupMemory': 'nodes/_types/Stats.ts#L521-L537', -'nodes._types.Client': 'nodes/_types/Stats.ts#L649-L696', +'nodes._types.AdaptiveSelection': 'nodes/_types/Stats.ts#L439-L468', +'nodes._types.Breaker': 'nodes/_types/Stats.ts#L470-L495', +'nodes._types.Cgroup': 'nodes/_types/Stats.ts#L497-L510', +'nodes._types.CgroupCpu': 'nodes/_types/Stats.ts#L523-L540', +'nodes._types.CgroupCpuStat': 'nodes/_types/Stats.ts#L542-L555', +'nodes._types.CgroupMemory': 'nodes/_types/Stats.ts#L557-L573', +'nodes._types.Client': 'nodes/_types/Stats.ts#L720-L767', 'nodes._types.ClusterAppliedStats': 'nodes/_types/Stats.ts#L221-L223', 'nodes._types.ClusterStateQueue': 'nodes/_types/Stats.ts#L248-L261', 'nodes._types.ClusterStateUpdate': 'nodes/_types/Stats.ts#L278-L343', -'nodes._types.Context': 'nodes/_types/Stats.ts#L997-L1002', -'nodes._types.Cpu': 'nodes/_types/Stats.ts#L539-L548', -'nodes._types.CpuAcct': 'nodes/_types/Stats.ts#L476-L485', -'nodes._types.DataPathStats': 'nodes/_types/Stats.ts#L550-L594', +'nodes._types.Context': 'nodes/_types/Stats.ts#L1068-L1073', +'nodes._types.Cpu': 'nodes/_types/Stats.ts#L575-L584', +'nodes._types.CpuAcct': 'nodes/_types/Stats.ts#L512-L521', +'nodes._types.DataPathStats': 'nodes/_types/Stats.ts#L586-L630', 'nodes._types.Discovery': 'nodes/_types/Stats.ts#L201-L219', -'nodes._types.ExtendedMemoryStats': 'nodes/_types/Stats.ts#L622-L631', -'nodes._types.FileSystem': 'nodes/_types/Stats.ts#L698-L716', -'nodes._types.FileSystemTotal': 'nodes/_types/Stats.ts#L757-L786', -'nodes._types.GarbageCollector': 'nodes/_types/Stats.ts#L923-L928', -'nodes._types.GarbageCollectorTotal': 'nodes/_types/Stats.ts#L930-L943', -'nodes._types.Http': 'nodes/_types/Stats.ts#L633-L647', +'nodes._types.ExtendedMemoryStats': 'nodes/_types/Stats.ts#L658-L667', +'nodes._types.FileSystem': 'nodes/_types/Stats.ts#L769-L787', +'nodes._types.FileSystemTotal': 'nodes/_types/Stats.ts#L828-L857', +'nodes._types.GarbageCollector': 'nodes/_types/Stats.ts#L994-L999', +'nodes._types.GarbageCollectorTotal': 'nodes/_types/Stats.ts#L1001-L1014', +'nodes._types.Http': 'nodes/_types/Stats.ts#L669-L688', +'nodes._types.HttpRoute': 'nodes/_types/Stats.ts#L690-L693', +'nodes._types.HttpRouteRequests': 'nodes/_types/Stats.ts#L695-L699', +'nodes._types.HttpRouteResponses': 'nodes/_types/Stats.ts#L701-L706', 'nodes._types.IndexingPressure': 'nodes/_types/Stats.ts#L116-L121', 'nodes._types.IndexingPressureMemory': 'nodes/_types/Stats.ts#L123-L142', 'nodes._types.Ingest': 'nodes/_types/Stats.ts#L345-L354', -'nodes._types.IngestTotal': 'nodes/_types/Stats.ts#L356-L377', -'nodes._types.IoStatDevice': 'nodes/_types/Stats.ts#L730-L755', -'nodes._types.IoStats': 'nodes/_types/Stats.ts#L718-L728', -'nodes._types.Jvm': 'nodes/_types/Stats.ts#L811-L845', -'nodes._types.JvmClasses': 'nodes/_types/Stats.ts#L908-L921', -'nodes._types.JvmMemoryStats': 'nodes/_types/Stats.ts#L847-L876', -'nodes._types.JvmThreads': 'nodes/_types/Stats.ts#L897-L906', -'nodes._types.KeyedProcessor': 'nodes/_types/Stats.ts#L379-L382', -'nodes._types.MemoryStats': 'nodes/_types/Stats.ts#L596-L620', -'nodes._types.NodeBufferPool': 'nodes/_types/Stats.ts#L788-L809', +'nodes._types.IngestStats': 'nodes/_types/Stats.ts#L356-L394', +'nodes._types.IngestTotal': 'nodes/_types/Stats.ts#L396-L413', +'nodes._types.IoStatDevice': 'nodes/_types/Stats.ts#L801-L826', +'nodes._types.IoStats': 'nodes/_types/Stats.ts#L789-L799', +'nodes._types.Jvm': 'nodes/_types/Stats.ts#L882-L916', +'nodes._types.JvmClasses': 'nodes/_types/Stats.ts#L979-L992', +'nodes._types.JvmMemoryStats': 'nodes/_types/Stats.ts#L918-L947', +'nodes._types.JvmThreads': 'nodes/_types/Stats.ts#L968-L977', +'nodes._types.KeyedProcessor': 'nodes/_types/Stats.ts#L415-L418', +'nodes._types.MemoryStats': 'nodes/_types/Stats.ts#L632-L656', +'nodes._types.NodeBufferPool': 'nodes/_types/Stats.ts#L859-L880', 'nodes._types.NodeReloadError': 'nodes/_types/NodeReloadResult.ts#L24-L27', 'nodes._types.NodeReloadResult': 'nodes/_types/NodeReloadResult.ts#L29-L30', 'nodes._types.NodesResponseBase': 'nodes/_types/NodesResponseBase.ts#L22-L29', -'nodes._types.OperatingSystem': 'nodes/_types/Stats.ts#L945-L951', -'nodes._types.Pool': 'nodes/_types/Stats.ts#L878-L895', +'nodes._types.OperatingSystem': 'nodes/_types/Stats.ts#L1016-L1022', +'nodes._types.Pool': 'nodes/_types/Stats.ts#L949-L966', 'nodes._types.PressureMemory': 'nodes/_types/Stats.ts#L144-L199', -'nodes._types.Process': 'nodes/_types/Stats.ts#L953-L975', -'nodes._types.Processor': 'nodes/_types/Stats.ts#L384-L401', +'nodes._types.Process': 'nodes/_types/Stats.ts#L1024-L1046', +'nodes._types.Processor': 'nodes/_types/Stats.ts#L420-L437', 'nodes._types.PublishedClusterStates': 'nodes/_types/Stats.ts#L263-L276', 'nodes._types.Recording': 'nodes/_types/Stats.ts#L225-L230', 'nodes._types.RepositoryLocation': 'nodes/_types/RepositoryMeteringInformation.ts#L68-L74', 'nodes._types.RepositoryMeteringInformation': 'nodes/_types/RepositoryMeteringInformation.ts#L24-L66', 'nodes._types.RequestCounts': 'nodes/_types/RepositoryMeteringInformation.ts#L76-L103', -'nodes._types.ScriptCache': 'nodes/_types/Stats.ts#L1031-L1045', -'nodes._types.Scripting': 'nodes/_types/Stats.ts#L977-L995', +'nodes._types.ScriptCache': 'nodes/_types/Stats.ts#L1102-L1116', +'nodes._types.Scripting': 'nodes/_types/Stats.ts#L1048-L1066', 'nodes._types.SerializedClusterState': 'nodes/_types/Stats.ts#L232-L238', 'nodes._types.SerializedClusterStateDetail': 'nodes/_types/Stats.ts#L240-L246', +'nodes._types.SizeHttpHistogram': 'nodes/_types/Stats.ts#L714-L718', 'nodes._types.Stats': 'nodes/_types/Stats.ts#L30-L114', -'nodes._types.ThreadCount': 'nodes/_types/Stats.ts#L1004-L1029', -'nodes._types.Transport': 'nodes/_types/Stats.ts#L1047-L1090', -'nodes._types.TransportHistogram': 'nodes/_types/Stats.ts#L1092-L1106', +'nodes._types.ThreadCount': 'nodes/_types/Stats.ts#L1075-L1100', +'nodes._types.TimeHttpHistogram': 'nodes/_types/Stats.ts#L708-L712', +'nodes._types.Transport': 'nodes/_types/Stats.ts#L1118-L1161', +'nodes._types.TransportHistogram': 'nodes/_types/Stats.ts#L1163-L1177', 'nodes.clear_repositories_metering_archive.Request': 'nodes/clear_repositories_metering_archive/ClearRepositoriesMeteringArchiveRequest.ts#L24-L43', 'nodes.clear_repositories_metering_archive.Response': 'nodes/clear_repositories_metering_archive/ClearRepositoriesMeteringArchiveResponse.ts#L36-L38', 'nodes.clear_repositories_metering_archive.ResponseBase': 'nodes/clear_repositories_metering_archive/ClearRepositoriesMeteringArchiveResponse.ts#L25-L34', @@ -2909,10 +2915,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/b2ad2265c9a6469efee4426abbc45df5b0fe1c54/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/a37d0218e4755ffe229c1a0efccc48e8f7d2d44b/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/nodes/Http.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Http.java index 928a716a3..44533c0eb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Http.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Http.java @@ -32,7 +32,9 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Integer; import java.lang.Long; +import java.lang.String; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -69,6 +71,8 @@ public class Http implements JsonpSerializable { private final List clients; + private final Map routes; + // --------------------------------------------------------------------------------------------- private Http(Builder builder) { @@ -76,6 +80,7 @@ private Http(Builder builder) { this.currentOpen = builder.currentOpen; this.totalOpened = builder.totalOpened; this.clients = ApiTypeHelper.unmodifiable(builder.clients); + this.routes = ApiTypeHelper.unmodifiableRequired(builder.routes, this, "routes"); } @@ -115,6 +120,15 @@ public final List clients() { return this.clients; } + /** + * Required - Detailed HTTP stats broken down by route + *

+ * API name: {@code routes} + */ + public final Map routes() { + return this.routes; + } + /** * Serialize this object to JSON. */ @@ -146,6 +160,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (ApiTypeHelper.isDefined(this.routes)) { + generator.writeKey("routes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.routes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -170,6 +195,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private List clients; + private Map routes; + /** * Current number of open HTTP connections for the node. *

@@ -234,6 +261,41 @@ public final Builder clients(Function> fn) return clients(fn.apply(new Client.Builder()).build()); } + /** + * Required - Detailed HTTP stats broken down by route + *

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

+ * Adds all entries of map to routes. + */ + public final Builder routes(Map map) { + this.routes = _mapPutAll(this.routes, map); + return this; + } + + /** + * Required - Detailed HTTP stats broken down by route + *

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

+ * Adds an entry to routes. + */ + public final Builder routes(String key, HttpRoute value) { + this.routes = _mapPut(this.routes, key, value); + return this; + } + + /** + * Required - Detailed HTTP stats broken down by route + *

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

+ * Adds an entry to routes using a builder lambda. + */ + public final Builder routes(String key, Function> fn) { + return routes(key, fn.apply(new HttpRoute.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -265,6 +327,7 @@ protected static void setupHttpDeserializer(ObjectDeserializer op) op.add(Builder::currentOpen, JsonpDeserializer.integerDeserializer(), "current_open"); op.add(Builder::totalOpened, JsonpDeserializer.longDeserializer(), "total_opened"); op.add(Builder::clients, JsonpDeserializer.arrayDeserializer(Client._DESERIALIZER), "clients"); + op.add(Builder::routes, JsonpDeserializer.stringMapDeserializer(HttpRoute._DESERIALIZER), "routes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRoute.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRoute.java new file mode 100644 index 000000000..c87e6ab49 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRoute.java @@ -0,0 +1,190 @@ +/* + * 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.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.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: nodes._types.HttpRoute + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class HttpRoute implements JsonpSerializable { + private final HttpRouteRequests requests; + + private final HttpRouteResponses responses; + + // --------------------------------------------------------------------------------------------- + + private HttpRoute(Builder builder) { + + this.requests = ApiTypeHelper.requireNonNull(builder.requests, this, "requests"); + this.responses = ApiTypeHelper.requireNonNull(builder.responses, this, "responses"); + + } + + public static HttpRoute of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code requests} + */ + public final HttpRouteRequests requests() { + return this.requests; + } + + /** + * Required - API name: {@code responses} + */ + public final HttpRouteResponses responses() { + return this.responses; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("requests"); + this.requests.serialize(generator, mapper); + + generator.writeKey("responses"); + this.responses.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HttpRoute}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private HttpRouteRequests requests; + + private HttpRouteResponses responses; + + /** + * Required - API name: {@code requests} + */ + public final Builder requests(HttpRouteRequests value) { + this.requests = value; + return this; + } + + /** + * Required - API name: {@code requests} + */ + public final Builder requests(Function> fn) { + return this.requests(fn.apply(new HttpRouteRequests.Builder()).build()); + } + + /** + * Required - API name: {@code responses} + */ + public final Builder responses(HttpRouteResponses value) { + this.responses = value; + return this; + } + + /** + * Required - API name: {@code responses} + */ + public final Builder responses(Function> fn) { + return this.responses(fn.apply(new HttpRouteResponses.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HttpRoute}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HttpRoute build() { + _checkSingleUse(); + + return new HttpRoute(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HttpRoute} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + HttpRoute::setupHttpRouteDeserializer); + + protected static void setupHttpRouteDeserializer(ObjectDeserializer op) { + + op.add(Builder::requests, HttpRouteRequests._DESERIALIZER, "requests"); + op.add(Builder::responses, HttpRouteResponses._DESERIALIZER, "responses"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteRequests.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteRequests.java new file mode 100644 index 000000000..4b6a14a41 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteRequests.java @@ -0,0 +1,232 @@ +/* + * 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.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Long; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: nodes._types.HttpRouteRequests + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class HttpRouteRequests implements JsonpSerializable { + private final long count; + + private final long totalSizeInBytes; + + private final List sizeHistogram; + + // --------------------------------------------------------------------------------------------- + + private HttpRouteRequests(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.sizeHistogram = ApiTypeHelper.unmodifiableRequired(builder.sizeHistogram, this, "sizeHistogram"); + + } + + public static HttpRouteRequests of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * Required - API name: {@code size_histogram} + */ + public final List sizeHistogram() { + return this.sizeHistogram; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("count"); + generator.write(this.count); + + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (ApiTypeHelper.isDefined(this.sizeHistogram)) { + generator.writeKey("size_histogram"); + generator.writeStartArray(); + for (SizeHttpHistogram item0 : this.sizeHistogram) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HttpRouteRequests}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Long count; + + private Long totalSizeInBytes; + + private List sizeHistogram; + + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code size_histogram} + *

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

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

+ * Adds a value to sizeHistogram using a builder lambda. + */ + public final Builder sizeHistogram(Function> fn) { + return sizeHistogram(fn.apply(new SizeHttpHistogram.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HttpRouteRequests}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HttpRouteRequests build() { + _checkSingleUse(); + + return new HttpRouteRequests(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HttpRouteRequests} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HttpRouteRequests::setupHttpRouteRequestsDeserializer); + + protected static void setupHttpRouteRequestsDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::sizeHistogram, JsonpDeserializer.arrayDeserializer(SizeHttpHistogram._DESERIALIZER), + "size_histogram"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java new file mode 100644 index 000000000..04f85b883 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java @@ -0,0 +1,289 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Long; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: nodes._types.HttpRouteResponses + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class HttpRouteResponses implements JsonpSerializable { + private final long count; + + private final long totalSizeInBytes; + + private final List handlingTimeHistogram; + + private final List sizeHistogram; + + // --------------------------------------------------------------------------------------------- + + private HttpRouteResponses(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.handlingTimeHistogram = ApiTypeHelper.unmodifiableRequired(builder.handlingTimeHistogram, this, + "handlingTimeHistogram"); + this.sizeHistogram = ApiTypeHelper.unmodifiableRequired(builder.sizeHistogram, this, "sizeHistogram"); + + } + + public static HttpRouteResponses of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * Required - API name: {@code handling_time_histogram} + */ + public final List handlingTimeHistogram() { + return this.handlingTimeHistogram; + } + + /** + * Required - API name: {@code size_histogram} + */ + public final List sizeHistogram() { + return this.sizeHistogram; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("count"); + generator.write(this.count); + + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (ApiTypeHelper.isDefined(this.handlingTimeHistogram)) { + generator.writeKey("handling_time_histogram"); + generator.writeStartArray(); + for (TimeHttpHistogram item0 : this.handlingTimeHistogram) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.sizeHistogram)) { + generator.writeKey("size_histogram"); + generator.writeStartArray(); + for (SizeHttpHistogram item0 : this.sizeHistogram) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HttpRouteResponses}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long count; + + private Long totalSizeInBytes; + + private List handlingTimeHistogram; + + private List sizeHistogram; + + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code handling_time_histogram} + *

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

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

+ * Adds a value to handlingTimeHistogram using a builder lambda. + */ + public final Builder handlingTimeHistogram( + Function> fn) { + return handlingTimeHistogram(fn.apply(new TimeHttpHistogram.Builder()).build()); + } + + /** + * Required - API name: {@code size_histogram} + *

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

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

+ * Adds a value to sizeHistogram using a builder lambda. + */ + public final Builder sizeHistogram(Function> fn) { + return sizeHistogram(fn.apply(new SizeHttpHistogram.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HttpRouteResponses}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HttpRouteResponses build() { + _checkSingleUse(); + + return new HttpRouteResponses(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HttpRouteResponses} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HttpRouteResponses::setupHttpRouteResponsesDeserializer); + + protected static void setupHttpRouteResponsesDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::handlingTimeHistogram, JsonpDeserializer.arrayDeserializer(TimeHttpHistogram._DESERIALIZER), + "handling_time_histogram"); + op.add(Builder::sizeHistogram, JsonpDeserializer.arrayDeserializer(SizeHttpHistogram._DESERIALIZER), + "size_histogram"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Ingest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Ingest.java index db31b0a80..bece8ac0b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Ingest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Ingest.java @@ -60,7 +60,7 @@ */ @JsonpDeserializable public class Ingest implements JsonpSerializable { - private final Map pipelines; + private final Map pipelines; @Nullable private final IngestTotal total; @@ -83,7 +83,7 @@ public static Ingest of(Function> fn) { *

* API name: {@code pipelines} */ - public final Map pipelines() { + public final Map pipelines() { return this.pipelines; } @@ -111,7 +111,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.pipelines)) { generator.writeKey("pipelines"); generator.writeStartObject(); - for (Map.Entry item0 : this.pipelines.entrySet()) { + for (Map.Entry item0 : this.pipelines.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); @@ -140,7 +140,7 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private Map pipelines; + private Map pipelines; @Nullable private IngestTotal total; @@ -152,7 +152,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement *

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

* Adds an entry to pipelines. */ - public final Builder pipelines(String key, IngestTotal value) { + public final Builder pipelines(String key, IngestStats value) { this.pipelines = _mapPut(this.pipelines, key, value); return this; } @@ -176,8 +176,8 @@ public final Builder pipelines(String key, IngestTotal value) { *

* Adds an entry to pipelines using a builder lambda. */ - public final Builder pipelines(String key, Function> fn) { - return pipelines(key, fn.apply(new IngestTotal.Builder()).build()); + public final Builder pipelines(String key, Function> fn) { + return pipelines(key, fn.apply(new IngestStats.Builder()).build()); } /** @@ -227,7 +227,7 @@ public Ingest build() { protected static void setupIngestDeserializer(ObjectDeserializer op) { - op.add(Builder::pipelines, JsonpDeserializer.stringMapDeserializer(IngestTotal._DESERIALIZER), "pipelines"); + op.add(Builder::pipelines, JsonpDeserializer.stringMapDeserializer(IngestStats._DESERIALIZER), "pipelines"); op.add(Builder::total, IngestTotal._DESERIALIZER, "total"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java new file mode 100644 index 000000000..c73554c15 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java @@ -0,0 +1,388 @@ +/* + * 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.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Long; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: nodes._types.IngestStats + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IngestStats implements JsonpSerializable { + private final long count; + + private final long current; + + private final long failed; + + private final List> processors; + + private final long timeInMillis; + + private final long ingestedAsFirstPipelineInBytes; + + private final long producedAsFirstPipelineInBytes; + + // --------------------------------------------------------------------------------------------- + + private IngestStats(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.processors = ApiTypeHelper.unmodifiableRequired(builder.processors, this, "processors"); + this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); + this.ingestedAsFirstPipelineInBytes = ApiTypeHelper.requireNonNull(builder.ingestedAsFirstPipelineInBytes, this, + "ingestedAsFirstPipelineInBytes"); + this.producedAsFirstPipelineInBytes = ApiTypeHelper.requireNonNull(builder.producedAsFirstPipelineInBytes, this, + "producedAsFirstPipelineInBytes"); + + } + + public static IngestStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Total number of documents ingested during the lifetime of this + * node. + *

+ * API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * Required - Total number of documents currently being ingested. + *

+ * API name: {@code current} + */ + public final long current() { + return this.current; + } + + /** + * Required - Total number of failed ingest operations during the lifetime of + * this node. + *

+ * API name: {@code failed} + */ + public final long failed() { + return this.failed; + } + + /** + * Required - Total number of ingest processors. + *

+ * API name: {@code processors} + */ + public final List> processors() { + return this.processors; + } + + /** + * Required - Total time, in milliseconds, spent preprocessing ingest documents + * during the lifetime of this node. + *

+ * API name: {@code time_in_millis} + */ + public final long timeInMillis() { + return this.timeInMillis; + } + + /** + * Required - Total number of bytes of all documents ingested by the pipeline. + * This field is only present on pipelines which are the first to process a + * document. Thus, it is not present on pipelines which only serve as a final + * pipeline after a default pipeline, a pipeline run after a reroute processor, + * or pipelines in pipeline processors. + *

+ * API name: {@code ingested_as_first_pipeline_in_bytes} + */ + public final long ingestedAsFirstPipelineInBytes() { + return this.ingestedAsFirstPipelineInBytes; + } + + /** + * Required - Total number of bytes of all documents produced by the pipeline. + * This field is only present on pipelines which are the first to process a + * document. Thus, it is not present on pipelines which only serve as a final + * pipeline after a default pipeline, a pipeline run after a reroute processor, + * or pipelines in pipeline processors. In situations where there are subsequent + * pipelines, the value represents the size of the document after all pipelines + * have run. + *

+ * API name: {@code produced_as_first_pipeline_in_bytes} + */ + public final long producedAsFirstPipelineInBytes() { + return this.producedAsFirstPipelineInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("count"); + generator.write(this.count); + + generator.writeKey("current"); + generator.write(this.current); + + generator.writeKey("failed"); + generator.write(this.failed); + + if (ApiTypeHelper.isDefined(this.processors)) { + generator.writeKey("processors"); + generator.writeStartArray(); + for (Map item0 : this.processors) { + generator.writeStartObject(); + if (item0 != null) { + for (Map.Entry item1 : item0.entrySet()) { + generator.writeKey(item1.getKey()); + item1.getValue().serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + generator.writeKey("time_in_millis"); + generator.write(this.timeInMillis); + + generator.writeKey("ingested_as_first_pipeline_in_bytes"); + generator.write(this.ingestedAsFirstPipelineInBytes); + + generator.writeKey("produced_as_first_pipeline_in_bytes"); + generator.write(this.producedAsFirstPipelineInBytes); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IngestStats}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Long count; + + private Long current; + + private Long failed; + + private List> processors; + + private Long timeInMillis; + + private Long ingestedAsFirstPipelineInBytes; + + private Long producedAsFirstPipelineInBytes; + + /** + * Required - Total number of documents ingested during the lifetime of this + * node. + *

+ * API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * Required - Total number of documents currently being ingested. + *

+ * API name: {@code current} + */ + public final Builder current(long value) { + this.current = value; + return this; + } + + /** + * Required - Total number of failed ingest operations during the lifetime of + * this node. + *

+ * API name: {@code failed} + */ + public final Builder failed(long value) { + this.failed = value; + return this; + } + + /** + * Required - Total number of ingest processors. + *

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

+ * Adds all elements of list to processors. + */ + public final Builder processors(List> list) { + this.processors = _listAddAll(this.processors, list); + return this; + } + + /** + * Required - Total number of ingest processors. + *

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

+ * Adds one or more values to processors. + */ + public final Builder processors(Map value, Map... values) { + this.processors = _listAdd(this.processors, value, values); + return this; + } + + /** + * Required - Total time, in milliseconds, spent preprocessing ingest documents + * during the lifetime of this node. + *

+ * API name: {@code time_in_millis} + */ + public final Builder timeInMillis(long value) { + this.timeInMillis = value; + return this; + } + + /** + * Required - Total number of bytes of all documents ingested by the pipeline. + * This field is only present on pipelines which are the first to process a + * document. Thus, it is not present on pipelines which only serve as a final + * pipeline after a default pipeline, a pipeline run after a reroute processor, + * or pipelines in pipeline processors. + *

+ * API name: {@code ingested_as_first_pipeline_in_bytes} + */ + public final Builder ingestedAsFirstPipelineInBytes(long value) { + this.ingestedAsFirstPipelineInBytes = value; + return this; + } + + /** + * Required - Total number of bytes of all documents produced by the pipeline. + * This field is only present on pipelines which are the first to process a + * document. Thus, it is not present on pipelines which only serve as a final + * pipeline after a default pipeline, a pipeline run after a reroute processor, + * or pipelines in pipeline processors. In situations where there are subsequent + * pipelines, the value represents the size of the document after all pipelines + * have run. + *

+ * API name: {@code produced_as_first_pipeline_in_bytes} + */ + public final Builder producedAsFirstPipelineInBytes(long value) { + this.producedAsFirstPipelineInBytes = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IngestStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IngestStats build() { + _checkSingleUse(); + + return new IngestStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IngestStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + IngestStats::setupIngestStatsDeserializer); + + protected static void setupIngestStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::failed, JsonpDeserializer.longDeserializer(), "failed"); + op.add(Builder::processors, JsonpDeserializer.arrayDeserializer( + JsonpDeserializer.stringMapDeserializer(KeyedProcessor._DESERIALIZER)), "processors"); + op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + op.add(Builder::ingestedAsFirstPipelineInBytes, JsonpDeserializer.longDeserializer(), + "ingested_as_first_pipeline_in_bytes"); + op.add(Builder::producedAsFirstPipelineInBytes, JsonpDeserializer.longDeserializer(), + "produced_as_first_pipeline_in_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestTotal.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestTotal.java index 9b71c5892..c7a92675c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestTotal.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestTotal.java @@ -31,12 +31,8 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -62,29 +58,22 @@ */ @JsonpDeserializable public class IngestTotal implements JsonpSerializable { - @Nullable - private final Long count; + private final long count; - @Nullable - private final Long current; + private final long current; - @Nullable - private final Long failed; + private final long failed; - private final List> processors; - - @Nullable - private final Long timeInMillis; + private final long timeInMillis; // --------------------------------------------------------------------------------------------- private IngestTotal(Builder builder) { - this.count = builder.count; - this.current = builder.current; - this.failed = builder.failed; - this.processors = ApiTypeHelper.unmodifiable(builder.processors); - this.timeInMillis = builder.timeInMillis; + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); } @@ -93,52 +82,41 @@ public static IngestTotal of(Function> fn) { } /** - * Total number of documents ingested during the lifetime of this node. + * Required - Total number of documents ingested during the lifetime of this + * node. *

* API name: {@code count} */ - @Nullable - public final Long count() { + public final long count() { return this.count; } /** - * Total number of documents currently being ingested. + * Required - Total number of documents currently being ingested. *

* API name: {@code current} */ - @Nullable - public final Long current() { + public final long current() { return this.current; } /** - * Total number of failed ingest operations during the lifetime of this node. + * Required - Total number of failed ingest operations during the lifetime of + * this node. *

* API name: {@code failed} */ - @Nullable - public final Long failed() { + public final long failed() { return this.failed; } /** - * Total number of ingest processors. - *

- * API name: {@code processors} - */ - public final List> processors() { - return this.processors; - } - - /** - * Total time, in milliseconds, spent preprocessing ingest documents during the - * lifetime of this node. + * Required - Total time, in milliseconds, spent preprocessing ingest documents + * during the lifetime of this node. *

* API name: {@code time_in_millis} */ - @Nullable - public final Long timeInMillis() { + public final long timeInMillis() { return this.timeInMillis; } @@ -153,44 +131,17 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.count != null) { - generator.writeKey("count"); - generator.write(this.count); - - } - if (this.current != null) { - generator.writeKey("current"); - generator.write(this.current); + generator.writeKey("count"); + generator.write(this.count); - } - if (this.failed != null) { - generator.writeKey("failed"); - generator.write(this.failed); + generator.writeKey("current"); + generator.write(this.current); - } - if (ApiTypeHelper.isDefined(this.processors)) { - generator.writeKey("processors"); - generator.writeStartArray(); - for (Map item0 : this.processors) { - generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); + generator.writeKey("failed"); + generator.write(this.failed); - } - if (this.timeInMillis != null) { - generator.writeKey("time_in_millis"); - generator.write(this.timeInMillis); - - } + generator.writeKey("time_in_millis"); + generator.write(this.timeInMillis); } @@ -206,82 +157,53 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable private Long count; - @Nullable private Long current; - @Nullable private Long failed; - @Nullable - private List> processors; - - @Nullable private Long timeInMillis; /** - * Total number of documents ingested during the lifetime of this node. + * Required - Total number of documents ingested during the lifetime of this + * node. *

* API name: {@code count} */ - public final Builder count(@Nullable Long value) { + public final Builder count(long value) { this.count = value; return this; } /** - * Total number of documents currently being ingested. + * Required - Total number of documents currently being ingested. *

* API name: {@code current} */ - public final Builder current(@Nullable Long value) { + public final Builder current(long value) { this.current = value; return this; } /** - * Total number of failed ingest operations during the lifetime of this node. + * Required - Total number of failed ingest operations during the lifetime of + * this node. *

* API name: {@code failed} */ - public final Builder failed(@Nullable Long value) { + public final Builder failed(long value) { this.failed = value; return this; } /** - * Total number of ingest processors. - *

- * API name: {@code processors} - *

- * Adds all elements of list to processors. - */ - public final Builder processors(List> list) { - this.processors = _listAddAll(this.processors, list); - return this; - } - - /** - * Total number of ingest processors. - *

- * API name: {@code processors} - *

- * Adds one or more values to processors. - */ - public final Builder processors(Map value, Map... values) { - this.processors = _listAdd(this.processors, value, values); - return this; - } - - /** - * Total time, in milliseconds, spent preprocessing ingest documents during the - * lifetime of this node. + * Required - Total time, in milliseconds, spent preprocessing ingest documents + * during the lifetime of this node. *

* API name: {@code time_in_millis} */ - public final Builder timeInMillis(@Nullable Long value) { + public final Builder timeInMillis(long value) { this.timeInMillis = value; return this; } @@ -317,8 +239,6 @@ protected static void setupIngestTotalDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class SizeHttpHistogram implements JsonpSerializable { + private final long count; + + @Nullable + private final Long geBytes; + + @Nullable + private final Long ltBytes; + + // --------------------------------------------------------------------------------------------- + + private SizeHttpHistogram(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.geBytes = builder.geBytes; + this.ltBytes = builder.ltBytes; + + } + + public static SizeHttpHistogram of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * API name: {@code ge_bytes} + */ + @Nullable + public final Long geBytes() { + return this.geBytes; + } + + /** + * API name: {@code lt_bytes} + */ + @Nullable + public final Long ltBytes() { + return this.ltBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("count"); + generator.write(this.count); + + if (this.geBytes != null) { + generator.writeKey("ge_bytes"); + generator.write(this.geBytes); + + } + if (this.ltBytes != null) { + generator.writeKey("lt_bytes"); + generator.write(this.ltBytes); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SizeHttpHistogram}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Long count; + + @Nullable + private Long geBytes; + + @Nullable + private Long ltBytes; + + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * API name: {@code ge_bytes} + */ + public final Builder geBytes(@Nullable Long value) { + this.geBytes = value; + return this; + } + + /** + * API name: {@code lt_bytes} + */ + public final Builder ltBytes(@Nullable Long value) { + this.ltBytes = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SizeHttpHistogram}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SizeHttpHistogram build() { + _checkSingleUse(); + + return new SizeHttpHistogram(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SizeHttpHistogram} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SizeHttpHistogram::setupSizeHttpHistogramDeserializer); + + protected static void setupSizeHttpHistogramDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::geBytes, JsonpDeserializer.longDeserializer(), "ge_bytes"); + op.add(Builder::ltBytes, JsonpDeserializer.longDeserializer(), "lt_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java new file mode 100644 index 000000000..b55357d58 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java @@ -0,0 +1,212 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Long; +import java.util.Objects; +import java.util.function.Function; +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: nodes._types.TimeHttpHistogram + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TimeHttpHistogram implements JsonpSerializable { + private final long count; + + @Nullable + private final Long geMillis; + + @Nullable + private final Long ltMillis; + + // --------------------------------------------------------------------------------------------- + + private TimeHttpHistogram(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.geMillis = builder.geMillis; + this.ltMillis = builder.ltMillis; + + } + + public static TimeHttpHistogram of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * API name: {@code ge_millis} + */ + @Nullable + public final Long geMillis() { + return this.geMillis; + } + + /** + * API name: {@code lt_millis} + */ + @Nullable + public final Long ltMillis() { + return this.ltMillis; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("count"); + generator.write(this.count); + + if (this.geMillis != null) { + generator.writeKey("ge_millis"); + generator.write(this.geMillis); + + } + if (this.ltMillis != null) { + generator.writeKey("lt_millis"); + generator.write(this.ltMillis); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TimeHttpHistogram}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Long count; + + @Nullable + private Long geMillis; + + @Nullable + private Long ltMillis; + + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * API name: {@code ge_millis} + */ + public final Builder geMillis(@Nullable Long value) { + this.geMillis = value; + return this; + } + + /** + * API name: {@code lt_millis} + */ + public final Builder ltMillis(@Nullable Long value) { + this.ltMillis = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TimeHttpHistogram}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TimeHttpHistogram build() { + _checkSingleUse(); + + return new TimeHttpHistogram(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TimeHttpHistogram} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TimeHttpHistogram::setupTimeHttpHistogramDeserializer); + + protected static void setupTimeHttpHistogramDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::geMillis, JsonpDeserializer.longDeserializer(), "ge_millis"); + op.add(Builder::ltMillis, JsonpDeserializer.longDeserializer(), "lt_millis"); + + } + +}