From e2912c39d4c79c520a5f053886cdd0ba9737df1f Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 16 Sep 2024 10:15:48 +0200 Subject: [PATCH] [codegen] update to latest spec (+ fixed esql adapter) --- .../_helpers/esql/EsqlHelper.java | 5 +- .../elasticsearch/doc-files/api-spec.html | 224 +++++----- .../elasticsearch/esql/QueryRequest.java | 11 +- .../elasticsearch/esql/query/EsqlFormat.java | 78 ++++ .../elasticsearch/ingest/Processor.java | 30 ++ .../ingest/ProcessorBuilders.java | 18 + .../elasticsearch/ingest/RedactProcessor.java | 390 ++++++++++++++++++ .../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 ++++++++++ .../_helpers/esql/EsqlAdapterTest.java | 3 +- 17 files changed, 2276 insertions(+), 243 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/esql/query/EsqlFormat.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java 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/_helpers/esql/EsqlHelper.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlHelper.java index a57afcdb3..26597ec87 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlHelper.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlHelper.java @@ -23,6 +23,7 @@ import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlAsyncClient; import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlClient; import co.elastic.clients.elasticsearch.esql.QueryRequest; +import co.elastic.clients.elasticsearch.esql.query.EsqlFormat; import co.elastic.clients.json.JsonData; import co.elastic.clients.transport.endpoints.BinaryResponse; @@ -81,7 +82,7 @@ private static CompletableFuture doQueryAsync( private static QueryRequest buildRequest(EsqlAdapter adapter, String query, Object... params) { return QueryRequest.of(esql -> esql - .format(adapter.format()) + .format(EsqlFormat._DESERIALIZER.parse(adapter.format())) .columnar(adapter.columnar()) .query(query) .params(asFieldValues(params)) @@ -91,7 +92,7 @@ private static QueryRequest buildRequest(EsqlAdapter adapter, String query, O private static QueryRequest buildRequest(EsqlAdapter adapter, QueryRequest request) { return QueryRequest.of(q -> q // Set/override format and columnar - .format(adapter.format()) + .format(EsqlFormat._DESERIALIZER.parse(adapter.format())) .columnar(adapter.columnar()) .delimiter(request.delimiter()) 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 497398bb6..ca0e3b29d 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 @@ -250,13 +250,13 @@ '_types.AcknowledgedResponseBase': '_types/Base.ts#L47-L50', '_types.BulkIndexByScrollFailure': '_types/Errors.ts#L60-L66', '_types.BulkStats': '_types/Stats.ts#L68-L78', -'_types.Bytes': '_types/common.ts#L169-L181', +'_types.Bytes': '_types/common.ts#L170-L182', '_types.ClusterDetails': '_types/Stats.ts#L45-L52', -'_types.ClusterInfoTarget': '_types/common.ts#L381-L387', +'_types.ClusterInfoTarget': '_types/common.ts#L382-L388', '_types.ClusterSearchStatus': '_types/Stats.ts#L37-L43', '_types.ClusterStatistics': '_types/Stats.ts#L27-L35', '_types.CompletionStats': '_types/Stats.ts#L80-L90', -'_types.Conflicts': '_types/common.ts#L183-L192', +'_types.Conflicts': '_types/common.ts#L184-L193', '_types.CoordsGeoBounds': '_types/Geo.ts#L154-L159', '_types.DFIIndependenceMeasure': '_types/Similarity.ts#L20-L24', '_types.DFRAfterEffect': '_types/Similarity.ts#L26-L30', @@ -265,10 +265,10 @@ '_types.DocStats': '_types/Stats.ts#L97-L109', '_types.ElasticsearchVersionInfo': '_types/Base.ts#L54-L64', '_types.ElasticsearchVersionMinInfo': '_types/Base.ts#L66-L74', -'_types.EmptyObject': '_types/common.ts#L160-L161', +'_types.EmptyObject': '_types/common.ts#L161-L162', '_types.ErrorCause': '_types/Errors.ts#L25-L50', '_types.ErrorResponseBase': '_types/Base.ts#L76-L85', -'_types.ExpandWildcard': '_types/common.ts#L201-L215', +'_types.ExpandWildcard': '_types/common.ts#L202-L216', '_types.FieldMemoryUsage': '_types/Stats.ts#L118-L121', '_types.FieldSizeUsage': '_types/Stats.ts#L92-L95', '_types.FieldSort': '_types/sort.ts#L43-L52', @@ -284,18 +284,18 @@ '_types.GeoLocation': '_types/Geo.ts#L104-L118', '_types.GeoShapeRelation': '_types/Geo.ts#L64-L82', '_types.GetStats': '_types/Stats.ts#L130-L141', -'_types.HealthStatus': '_types/common.ts#L219-L239', +'_types.HealthStatus': '_types/common.ts#L220-L240', '_types.IBDistribution': '_types/Similarity.ts#L42-L45', '_types.IBLambda': '_types/Similarity.ts#L47-L50', '_types.IndexingStats': '_types/Stats.ts#L143-L159', -'_types.IndicesOptions': '_types/common.ts#L335-L362', +'_types.IndicesOptions': '_types/common.ts#L336-L363', '_types.IndicesResponseBase': '_types/Base.ts#L87-L89', -'_types.InlineGet': '_types/common.ts#L320-L333', +'_types.InlineGet': '_types/common.ts#L321-L334', '_types.KnnQuery': '_types/Knn.ts#L54-L69', '_types.KnnRetriever': '_types/Retriever.ts#L58-L71', '_types.KnnSearch': '_types/Knn.ts#L30-L52', '_types.LatLonGeoLocation': '_types/Geo.ts#L120-L129', -'_types.Level': '_types/common.ts#L249-L253', +'_types.Level': '_types/common.ts#L250-L254', '_types.LifecycleOperationMode': '_types/Lifecycle.ts#L20-L24', '_types.MergesStats': '_types/Stats.ts#L161-L178', '_types.NestedSortValue': '_types/sort.ts#L29-L34', @@ -304,7 +304,7 @@ '_types.NodeShard': '_types/Node.ts#L54-L65', '_types.NodeStatistics': '_types/Node.ts#L28-L39', '_types.Normalization': '_types/Similarity.ts#L52-L58', -'_types.OpType': '_types/common.ts#L255-L264', +'_types.OpType': '_types/common.ts#L256-L265', '_types.PluginStats': '_types/Stats.ts#L180-L190', '_types.QueryCacheStats': '_types/Stats.ts#L192-L226', '_types.QueryVectorBuilder': '_types/Knn.ts#L71-L74', @@ -312,7 +312,7 @@ '_types.RankBase': '_types/Rank.ts#L30-L30', '_types.RankContainer': '_types/Rank.ts#L22-L28', '_types.RecoveryStats': '_types/Stats.ts#L228-L233', -'_types.Refresh': '_types/common.ts#L266-L273', +'_types.Refresh': '_types/common.ts#L267-L274', '_types.RefreshStats': '_types/Stats.ts#L235-L242', '_types.RelocationFailureInfo': '_types/Node.ts#L67-L69', '_types.RequestBase': '_types/Base.ts#L34-L34', @@ -331,33 +331,33 @@ '_types.ScriptTransform': '_types/Transform.ts#L36-L44', '_types.SearchStats': '_types/Stats.ts#L252-L271', '_types.SearchTransform': '_types/Transform.ts#L46-L49', -'_types.SearchType': '_types/common.ts#L275-L280', +'_types.SearchType': '_types/common.ts#L276-L281', '_types.SegmentsStats': '_types/Stats.ts#L273-L366', '_types.ShardFailure': '_types/Errors.ts#L52-L58', '_types.ShardStatistics': '_types/Stats.ts#L54-L66', '_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L93', '_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27', -'_types.Slices': '_types/common.ts#L364-L369', -'_types.SlicesCalculation': '_types/common.ts#L371-L379', +'_types.Slices': '_types/common.ts#L365-L370', +'_types.SlicesCalculation': '_types/common.ts#L372-L380', '_types.SortMode': '_types/sort.ts#L108-L117', '_types.SortOptions': '_types/sort.ts#L86-L96', '_types.SortOrder': '_types/sort.ts#L119-L128', '_types.StandardRetriever': '_types/Retriever.ts#L43-L56', '_types.StoreStats': '_types/Stats.ts#L368-L395', '_types.StoredScript': '_types/Scripting.ts#L47-L57', -'_types.SuggestMode': '_types/common.ts#L282-L295', +'_types.SuggestMode': '_types/common.ts#L283-L296', '_types.TaskFailure': '_types/Errors.ts#L68-L73', '_types.TextEmbedding': '_types/Knn.ts#L76-L79', -'_types.ThreadType': '_types/common.ts#L297-L303', +'_types.ThreadType': '_types/common.ts#L298-L304', '_types.TimeUnit': '_types/Time.ts#L69-L77', '_types.TopLeftBottomRightGeoBounds': '_types/Geo.ts#L161-L164', '_types.TopRightBottomLeftGeoBounds': '_types/Geo.ts#L166-L169', '_types.TransformContainer': '_types/Transform.ts#L27-L34', '_types.TranslogStats': '_types/Stats.ts#L397-L405', -'_types.VersionType': '_types/common.ts#L106-L122', -'_types.WaitForActiveShardOptions': '_types/common.ts#L305-L309', -'_types.WaitForActiveShards': '_types/common.ts#L142-L143', -'_types.WaitForEvents': '_types/common.ts#L311-L318', +'_types.VersionType': '_types/common.ts#L107-L123', +'_types.WaitForActiveShardOptions': '_types/common.ts#L306-L310', +'_types.WaitForActiveShards': '_types/common.ts#L143-L144', +'_types.WaitForEvents': '_types/common.ts#L312-L319', '_types.WarmerStats': '_types/Stats.ts#L407-L412', '_types.WktGeoBounds': '_types/Geo.ts#L150-L152', '_types.WriteResponseBase': '_types/Base.ts#L36-L45', @@ -1288,6 +1288,7 @@ 'eql.search.Request': 'eql/search/EqlSearchRequest.ts#L28-L118', 'eql.search.Response': 'eql/search/EqlSearchResponse.ts#L22-L24', 'eql.search.ResultPosition': 'eql/search/types.ts#L20-L32', +'esql.query.EsqlFormat': 'esql/query/QueryRequest.ts#L67-L76', 'esql.query.Request': 'esql/query/QueryRequest.ts#L24-L65', 'esql.query.Response': 'esql/query/QueryResponse.ts#L22-L25', 'features._types.Feature': 'features/_types/Feature.ts#L20-L23', @@ -1638,58 +1639,59 @@ 'inference.inference.Response': 'inference/inference/InferenceResponse.ts#L22-L24', 'inference.put.Request': 'inference/put/PutRequest.ts#L25-L44', 'inference.put.Response': 'inference/put/PutResponse.ts#L22-L24', -'ingest._types.AppendProcessor': 'ingest/_types/Processors.ts#L297-L312', -'ingest._types.AttachmentProcessor': 'ingest/_types/Processors.ts#L314-L355', -'ingest._types.BytesProcessor': 'ingest/_types/Processors.ts#L464-L480', -'ingest._types.CircleProcessor': 'ingest/_types/Processors.ts#L482-L505', -'ingest._types.ConvertProcessor': 'ingest/_types/Processors.ts#L517-L537', -'ingest._types.ConvertType': 'ingest/_types/Processors.ts#L507-L515', -'ingest._types.CsvProcessor': 'ingest/_types/Processors.ts#L539-L572', +'ingest._types.AppendProcessor': 'ingest/_types/Processors.ts#L304-L319', +'ingest._types.AttachmentProcessor': 'ingest/_types/Processors.ts#L321-L362', +'ingest._types.BytesProcessor': 'ingest/_types/Processors.ts#L471-L487', +'ingest._types.CircleProcessor': 'ingest/_types/Processors.ts#L489-L512', +'ingest._types.ConvertProcessor': 'ingest/_types/Processors.ts#L524-L544', +'ingest._types.ConvertType': 'ingest/_types/Processors.ts#L514-L522', +'ingest._types.CsvProcessor': 'ingest/_types/Processors.ts#L546-L579', 'ingest._types.DatabaseConfiguration': 'ingest/_types/Database.ts#L22-L29', -'ingest._types.DateIndexNameProcessor': 'ingest/_types/Processors.ts#L574-L612', -'ingest._types.DateProcessor': 'ingest/_types/Processors.ts#L614-L641', -'ingest._types.DissectProcessor': 'ingest/_types/Processors.ts#L643-L662', -'ingest._types.DotExpanderProcessor': 'ingest/_types/Processors.ts#L664-L675', -'ingest._types.DropProcessor': 'ingest/_types/Processors.ts#L677-L677', -'ingest._types.EnrichProcessor': 'ingest/_types/Processors.ts#L679-L718', -'ingest._types.FailProcessor': 'ingest/_types/Processors.ts#L720-L726', -'ingest._types.ForeachProcessor': 'ingest/_types/Processors.ts#L728-L742', -'ingest._types.GeoGridProcessor': 'ingest/_types/Processors.ts#L357-L398', -'ingest._types.GeoGridTargetFormat': 'ingest/_types/Processors.ts#L406-L409', -'ingest._types.GeoGridTileType': 'ingest/_types/Processors.ts#L400-L404', -'ingest._types.GeoIpProcessor': 'ingest/_types/Processors.ts#L411-L440', -'ingest._types.GrokProcessor': 'ingest/_types/Processors.ts#L744-L769', -'ingest._types.GsubProcessor': 'ingest/_types/Processors.ts#L771-L795', -'ingest._types.HtmlStripProcessor': 'ingest/_types/Processors.ts#L797-L813', -'ingest._types.InferenceConfig': 'ingest/_types/Processors.ts#L836-L848', -'ingest._types.InferenceConfigClassification': 'ingest/_types/Processors.ts#L863-L889', -'ingest._types.InferenceConfigRegression': 'ingest/_types/Processors.ts#L850-L861', -'ingest._types.InferenceProcessor': 'ingest/_types/Processors.ts#L815-L834', -'ingest._types.JoinProcessor': 'ingest/_types/Processors.ts#L891-L906', -'ingest._types.JsonProcessor': 'ingest/_types/Processors.ts#L908-L937', -'ingest._types.JsonProcessorConflictStrategy': 'ingest/_types/Processors.ts#L939-L944', -'ingest._types.KeyValueProcessor': 'ingest/_types/Processors.ts#L946-L998', -'ingest._types.LowercaseProcessor': 'ingest/_types/Processors.ts#L1000-L1016', +'ingest._types.DateIndexNameProcessor': 'ingest/_types/Processors.ts#L581-L619', +'ingest._types.DateProcessor': 'ingest/_types/Processors.ts#L621-L648', +'ingest._types.DissectProcessor': 'ingest/_types/Processors.ts#L650-L669', +'ingest._types.DotExpanderProcessor': 'ingest/_types/Processors.ts#L671-L682', +'ingest._types.DropProcessor': 'ingest/_types/Processors.ts#L684-L684', +'ingest._types.EnrichProcessor': 'ingest/_types/Processors.ts#L686-L725', +'ingest._types.FailProcessor': 'ingest/_types/Processors.ts#L727-L733', +'ingest._types.ForeachProcessor': 'ingest/_types/Processors.ts#L735-L749', +'ingest._types.GeoGridProcessor': 'ingest/_types/Processors.ts#L364-L405', +'ingest._types.GeoGridTargetFormat': 'ingest/_types/Processors.ts#L413-L416', +'ingest._types.GeoGridTileType': 'ingest/_types/Processors.ts#L407-L411', +'ingest._types.GeoIpProcessor': 'ingest/_types/Processors.ts#L418-L447', +'ingest._types.GrokProcessor': 'ingest/_types/Processors.ts#L751-L776', +'ingest._types.GsubProcessor': 'ingest/_types/Processors.ts#L778-L802', +'ingest._types.HtmlStripProcessor': 'ingest/_types/Processors.ts#L804-L820', +'ingest._types.InferenceConfig': 'ingest/_types/Processors.ts#L843-L855', +'ingest._types.InferenceConfigClassification': 'ingest/_types/Processors.ts#L870-L896', +'ingest._types.InferenceConfigRegression': 'ingest/_types/Processors.ts#L857-L868', +'ingest._types.InferenceProcessor': 'ingest/_types/Processors.ts#L822-L841', +'ingest._types.JoinProcessor': 'ingest/_types/Processors.ts#L898-L913', +'ingest._types.JsonProcessor': 'ingest/_types/Processors.ts#L915-L944', +'ingest._types.JsonProcessorConflictStrategy': 'ingest/_types/Processors.ts#L946-L951', +'ingest._types.KeyValueProcessor': 'ingest/_types/Processors.ts#L953-L1005', +'ingest._types.LowercaseProcessor': 'ingest/_types/Processors.ts#L1007-L1023', 'ingest._types.Maxmind': 'ingest/_types/Database.ts#L31-L33', 'ingest._types.Pipeline': 'ingest/_types/Pipeline.ts#L23-L45', -'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1018-L1029', -'ingest._types.ProcessorBase': 'ingest/_types/Processors.ts#L259-L282', -'ingest._types.ProcessorContainer': 'ingest/_types/Processors.ts#L27-L257', -'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1031-L1045', -'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1047-L1063', -'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1065-L1093', -'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1095-L1115', -'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1117-L1151', -'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1153-L1162', -'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1164-L1167', -'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1169-L1185', -'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1187-L1212', -'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1214-L1230', -'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1232-L1248', -'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1268-L1294', -'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1250-L1266', -'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L442-L462', -'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L284-L295', +'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1025-L1036', +'ingest._types.ProcessorBase': 'ingest/_types/Processors.ts#L266-L289', +'ingest._types.ProcessorContainer': 'ingest/_types/Processors.ts#L27-L264', +'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1038-L1072', +'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1074-L1088', +'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1090-L1106', +'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1108-L1136', +'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1138-L1158', +'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1160-L1194', +'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1196-L1205', +'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1207-L1210', +'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1212-L1228', +'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1230-L1255', +'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1257-L1273', +'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1275-L1291', +'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1311-L1337', +'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1293-L1309', +'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L449-L469', +'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L291-L302', 'ingest.delete_geoip_database.Request': 'ingest/delete_geoip_database/DeleteGeoipDatabaseRequest.ts#L24-L48', 'ingest.delete_geoip_database.Response': 'ingest/delete_geoip_database/DeleteGeoipDatabaseResponse.ts#L22-L24', 'ingest.delete_pipeline.Request': 'ingest/delete_pipeline/DeletePipelineRequest.ts#L24-L52', @@ -2100,61 +2102,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', @@ -2621,7 +2629,7 @@ 'tasks.list.Response': 'tasks/list/ListTasksResponse.ts#L22-L24', 'text_structure.test_grok_pattern.MatchedField': 'text_structure/test_grok_pattern/types.ts#L23-L27', 'text_structure.test_grok_pattern.MatchedText': 'text_structure/test_grok_pattern/types.ts#L29-L32', -'text_structure.test_grok_pattern.Request': 'text_structure/test_grok_pattern/TestGrokPatternRequest.ts#L22-L43', +'text_structure.test_grok_pattern.Request': 'text_structure/test_grok_pattern/TestGrokPatternRequest.ts#L23-L44', 'text_structure.test_grok_pattern.Response': 'text_structure/test_grok_pattern/TestGrokPatternResponse.ts#L22-L26', 'transform._types.Destination': 'transform/_types/Transform.ts#L34-L45', 'transform._types.Latest': 'transform/_types/Transform.ts#L47-L52', @@ -2860,10 +2868,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "/~https://github.com/elastic/elasticsearch-specification/tree/9797b2eb668fca5d676dd53285ffeabd9793a6ef/specification/" + (paths[hash] || ""); + window.location = "/~https://github.com/elastic/elasticsearch-specification/tree/9ac3207678866ad8c2cbeb96555b44d929866546/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java index 68f52f6ae..eaac99a4e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java @@ -23,6 +23,7 @@ import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.elasticsearch.esql.query.EsqlFormat; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -81,7 +82,7 @@ public class QueryRequest extends RequestBase implements JsonpSerializable { private final Query filter; @Nullable - private final String format; + private final EsqlFormat format; @Nullable private final String locale; @@ -149,7 +150,7 @@ public final Query filter() { * API name: {@code format} */ @Nullable - public final String format() { + public final EsqlFormat format() { return this.format; } @@ -240,7 +241,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private Query filter; @Nullable - private String format; + private EsqlFormat format; @Nullable private String locale; @@ -300,7 +301,7 @@ public final Builder filter(Function> fn) { *

* API name: {@code format} */ - public final Builder format(@Nullable String value) { + public final Builder format(@Nullable EsqlFormat value) { this.format = value; return this; } @@ -433,7 +434,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public enum EsqlFormat implements JsonEnum { + Csv("csv"), + + Json("json"), + + Tsv("tsv"), + + Txt("txt"), + + Yaml("yaml"), + + Cbor("cbor"), + + Smile("smile"), + + Arrow("arrow"), + + ; + + private final String jsonValue; + + EsqlFormat(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + EsqlFormat.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java index 268b16bf9..2aae85a87 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java @@ -124,6 +124,8 @@ public enum Kind implements JsonEnum { Pipeline("pipeline"), + Redact("redact"), + Remove("remove"), Rename("rename"), @@ -626,6 +628,23 @@ public PipelineProcessor pipeline() { return TaggedUnionUtils.get(this, Kind.Pipeline); } + /** + * Is this variant instance of kind {@code redact}? + */ + public boolean isRedact() { + return _kind == Kind.Redact; + } + + /** + * Get the {@code redact} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code redact} kind. + */ + public RedactProcessor redact() { + return TaggedUnionUtils.get(this, Kind.Redact); + } + /** * Is this variant instance of kind {@code remove}? */ @@ -1167,6 +1186,16 @@ public ObjectBuilder pipeline( return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); } + public ObjectBuilder redact(RedactProcessor v) { + this._kind = Kind.Redact; + this._value = v; + return this; + } + + public ObjectBuilder redact(Function> fn) { + return this.redact(fn.apply(new RedactProcessor.Builder()).build()); + } + public ObjectBuilder remove(RemoveProcessor v) { this._kind = Kind.Remove; this._value = v; @@ -1353,6 +1382,7 @@ protected static void setupProcessorDeserializer(ObjectDeserializer op) op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::lowercase, LowercaseProcessor._DESERIALIZER, "lowercase"); op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); + op.add(Builder::redact, RedactProcessor._DESERIALIZER, "redact"); op.add(Builder::remove, RemoveProcessor._DESERIALIZER, "remove"); op.add(Builder::rename, RenameProcessor._DESERIALIZER, "rename"); op.add(Builder::reroute, RerouteProcessor._DESERIALIZER, "reroute"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java index d2a22bc11..efcb19263 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java @@ -495,6 +495,24 @@ public static Processor pipeline(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.redact(fn.apply(new RedactProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link RemoveProcessor remove} {@code Processor} * variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java new file mode 100644 index 000000000..21a0fb763 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/RedactProcessor.java @@ -0,0 +1,390 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ingest; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at /~https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ingest._types.RedactProcessor + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RedactProcessor extends ProcessorBase implements ProcessorVariant { + private final String field; + + private final List patterns; + + private final Map patternDefinitions; + + @Nullable + private final String prefix; + + @Nullable + private final String suffix; + + @Nullable + private final Boolean ignoreMissing; + + @Nullable + private final Boolean skipIfUnlicensed; + + // --------------------------------------------------------------------------------------------- + + private RedactProcessor(Builder builder) { + super(builder); + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.patterns = ApiTypeHelper.unmodifiableRequired(builder.patterns, this, "patterns"); + this.patternDefinitions = ApiTypeHelper.unmodifiable(builder.patternDefinitions); + this.prefix = builder.prefix; + this.suffix = builder.suffix; + this.ignoreMissing = builder.ignoreMissing; + this.skipIfUnlicensed = builder.skipIfUnlicensed; + + } + + public static RedactProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Processor variant kind. + */ + @Override + public Processor.Kind _processorKind() { + return Processor.Kind.Redact; + } + + /** + * Required - The field to be redacted + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

+ * API name: {@code patterns} + */ + public final List patterns() { + return this.patterns; + } + + /** + * API name: {@code pattern_definitions} + */ + public final Map patternDefinitions() { + return this.patternDefinitions; + } + + /** + * Start a redacted section with this token + *

+ * API name: {@code prefix} + */ + @Nullable + public final String prefix() { + return this.prefix; + } + + /** + * End a redacted section with this token + *

+ * API name: {@code suffix} + */ + @Nullable + public final String suffix() { + return this.suffix; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document. + *

+ * API name: {@code ignore_missing} + */ + @Nullable + public final Boolean ignoreMissing() { + return this.ignoreMissing; + } + + /** + * If true and the current license does not support running redact + * processors, then the processor quietly exits without modifying the document + *

+ * API name: {@code skip_if_unlicensed} + */ + @Nullable + public final Boolean skipIfUnlicensed() { + return this.skipIfUnlicensed; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("field"); + generator.write(this.field); + + if (ApiTypeHelper.isDefined(this.patterns)) { + generator.writeKey("patterns"); + generator.writeStartArray(); + for (String item0 : this.patterns) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.patternDefinitions)) { + generator.writeKey("pattern_definitions"); + generator.writeStartObject(); + for (Map.Entry item0 : this.patternDefinitions.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (this.prefix != null) { + generator.writeKey("prefix"); + generator.write(this.prefix); + + } + if (this.suffix != null) { + generator.writeKey("suffix"); + generator.write(this.suffix); + + } + if (this.ignoreMissing != null) { + generator.writeKey("ignore_missing"); + generator.write(this.ignoreMissing); + + } + if (this.skipIfUnlicensed != null) { + generator.writeKey("skip_if_unlicensed"); + generator.write(this.skipIfUnlicensed); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RedactProcessor}. + */ + + public static class Builder extends ProcessorBase.AbstractBuilder + implements + ObjectBuilder { + private String field; + + private List patterns; + + @Nullable + private Map patternDefinitions; + + @Nullable + private String prefix; + + @Nullable + private String suffix; + + @Nullable + private Boolean ignoreMissing; + + @Nullable + private Boolean skipIfUnlicensed; + + /** + * Required - The field to be redacted + *

+ * API name: {@code field} + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

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

+ * Adds all elements of list to patterns. + */ + public final Builder patterns(List list) { + this.patterns = _listAddAll(this.patterns, list); + return this; + } + + /** + * Required - A list of grok expressions to match and redact named captures with + *

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

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

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

+ * Adds an entry to patternDefinitions. + */ + public final Builder patternDefinitions(String key, String value) { + this.patternDefinitions = _mapPut(this.patternDefinitions, key, value); + return this; + } + + /** + * Start a redacted section with this token + *

+ * API name: {@code prefix} + */ + public final Builder prefix(@Nullable String value) { + this.prefix = value; + return this; + } + + /** + * End a redacted section with this token + *

+ * API name: {@code suffix} + */ + public final Builder suffix(@Nullable String value) { + this.suffix = value; + return this; + } + + /** + * If true and field does not exist or is + * null, the processor quietly exits without modifying the + * document. + *

+ * API name: {@code ignore_missing} + */ + public final Builder ignoreMissing(@Nullable Boolean value) { + this.ignoreMissing = value; + return this; + } + + /** + * If true and the current license does not support running redact + * processors, then the processor quietly exits without modifying the document + *

+ * API name: {@code skip_if_unlicensed} + */ + public final Builder skipIfUnlicensed(@Nullable Boolean value) { + this.skipIfUnlicensed = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RedactProcessor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RedactProcessor build() { + _checkSingleUse(); + + return new RedactProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RedactProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RedactProcessor::setupRedactProcessorDeserializer); + + protected static void setupRedactProcessorDeserializer(ObjectDeserializer op) { + ProcessorBase.setupProcessorBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::patterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "patterns"); + op.add(Builder::patternDefinitions, + JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "pattern_definitions"); + op.add(Builder::prefix, JsonpDeserializer.stringDeserializer(), "prefix"); + op.add(Builder::suffix, JsonpDeserializer.stringDeserializer(), "suffix"); + op.add(Builder::ignoreMissing, JsonpDeserializer.booleanDeserializer(), "ignore_missing"); + op.add(Builder::skipIfUnlicensed, JsonpDeserializer.booleanDeserializer(), "skip_if_unlicensed"); + + } + +} 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"); + + } + +} diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlAdapterTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlAdapterTest.java index 95917ca55..8f0d877ec 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlAdapterTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/esql/EsqlAdapterTest.java @@ -22,6 +22,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._helpers.esql.jdbc.ResultSetEsqlAdapter; import co.elastic.clients.elasticsearch._helpers.esql.objects.ObjectsEsqlAdapter; +import co.elastic.clients.elasticsearch.esql.query.EsqlFormat; import co.elastic.clients.json.jackson.JacksonJsonpMapper; import co.elastic.clients.testkit.MockHttpClient; import co.elastic.clients.transport.endpoints.BinaryResponse; @@ -60,7 +61,7 @@ public void testObjectDeserializer() throws IOException { BinaryResponse response = esClient.esql().query(q -> q .query("FROM foo") - .format("json") + .format(EsqlFormat.Json) ); Iterable data = esClient.esql().query(