From 119cabc2a3d37fec059385b9760d804d18b3f949 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Thu, 12 Oct 2023 13:44:44 -0700 Subject: [PATCH] [Backport 2.x] Migrating from checkstyle to spotless (#648 and #651) (#661) * Migrating from checkstyle to spotless for formatting (#648) * Adding spotless for checking and fixing formatting and removing checkstyle Signed-off-by: Vacha Shah * Making build task depend on spotlessJavaCheck Signed-off-by: Vacha Shah * Removing resources and documentation related to checkstyle Signed-off-by: Vacha Shah * Running spotless for json, transport and util folders Signed-off-by: Vacha Shah * Running spotless for samples Signed-off-by: Vacha Shah * Removing commented code Signed-off-by: Vacha Shah --------- Signed-off-by: Vacha Shah * Fixing merge conflicts and build Signed-off-by: Vacha Shah * Enabling spotless for all modules from PR 651 Signed-off-by: Vacha Shah * Applying spotless to all the remaining files Signed-off-by: Vacha Shah --------- Signed-off-by: Vacha Shah --- .github/workflows/checkstyle.yml | 24 - CHANGELOG.md | 1 + DEVELOPER_GUIDE.md | 25 +- README.md | 1 - build.gradle.kts | 2 - buildSrc/formatterConfig.xml | 362 + config/checkstyle/checkstyle.xml | 156 - config/checkstyle/checkstyle_suppressions.xml | 44 - config/checkstyle/header.java.txt | 7 - java-client/build.gradle.kts | 26 +- .../java/org/opensearch/client/ApiClient.java | 7 +- .../client/json/AttributedJsonpMapper.java | 2 +- .../json/BuildFunctionDeserializer.java | 1 - .../client/json/DelegatingDeserializer.java | 3 +- .../client/json/DelegatingJsonParser.java | 3 +- .../client/json/ExternallyTaggedUnion.java | 93 +- .../org/opensearch/client/json/JsonData.java | 11 +- .../opensearch/client/json/JsonDataImpl.java | 6 +- .../org/opensearch/client/json/JsonEnum.java | 3 +- .../client/json/JsonpDeserializable.java | 2 +- .../client/json/JsonpDeserializer.java | 12 +- .../client/json/JsonpDeserializerBase.java | 218 +- .../client/json/JsonpMapperBase.java | 5 +- .../opensearch/client/json/JsonpUtils.java | 22 +- .../client/json/LookAheadJsonParser.java | 1 - .../client/json/NamedDeserializer.java | 1 - .../json/ObjectBuilderDeserializer.java | 11 +- .../client/json/ObjectDeserializer.java | 57 +- .../json/UnexpectedJsonEventException.java | 1 - .../client/json/UnionDeserializer.java | 54 +- .../json/jackson/JacksonJsonProvider.java | 7 +- .../json/jackson/JacksonJsonpGenerator.java | 9 +- .../json/jackson/JacksonJsonpMapper.java | 24 +- .../json/jackson/JacksonJsonpParser.java | 38 +- .../client/json/jackson/JacksonUtils.java | 1 - .../client/json/jackson/JsonValueParser.java | 7 +- .../client/json/jsonb/JsonbJsonpMapper.java | 23 +- .../opensearch/OpenSearchAsyncClient.java | 3011 +++--- .../client/opensearch/OpenSearchClient.java | 2959 +++--- .../_types/AcknowledgedResponseBase.java | 96 +- .../client/opensearch/_types/BaseNode.java | 449 +- .../_types/BulkIndexByScrollFailure.java | 351 +- .../client/opensearch/_types/BulkStats.java | 591 +- .../client/opensearch/_types/Bytes.java | 30 +- .../opensearch/_types/ClusterStatistics.java | 260 +- .../opensearch/_types/CompletionStats.java | 334 +- .../client/opensearch/_types/Conflicts.java | 23 +- .../opensearch/_types/CoordsGeoBounds.java | 292 +- .../opensearch/_types/DistanceUnit.java | 37 +- .../client/opensearch/_types/DocStats.java | 166 +- .../client/opensearch/_types/EmptyObject.java | 41 +- .../opensearch/_types/EmptyTransform.java | 39 +- .../client/opensearch/_types/ErrorCause.java | 688 +- .../opensearch/_types/ErrorResponse.java | 263 +- .../opensearch/_types/ExpandWildcard.java | 63 +- .../opensearch/_types/FieldMemoryUsage.java | 226 +- .../opensearch/_types/FieldSizeUsage.java | 226 +- .../client/opensearch/_types/FieldSort.java | 607 +- .../_types/FieldSortNumericType.java | 29 +- .../client/opensearch/_types/FieldValue.java | 479 +- .../opensearch/_types/FielddataStats.java | 383 +- .../client/opensearch/_types/FlushStats.java | 310 +- .../client/opensearch/_types/GeoBounds.java | 353 +- .../opensearch/_types/GeoBoundsBuilders.java | 57 +- .../opensearch/_types/GeoDistanceSort.java | 559 +- .../opensearch/_types/GeoDistanceType.java | 23 +- .../opensearch/_types/GeoHashLocation.java | 124 +- .../opensearch/_types/GeoHashPrecision.java | 269 +- .../_types/GeoHashPrecisionBuilders.java | 5 +- .../client/opensearch/_types/GeoLine.java | 297 +- .../client/opensearch/_types/GeoLocation.java | 371 +- .../_types/GeoLocationBuilders.java | 33 +- .../opensearch/_types/GeoShapeRelation.java | 27 +- .../client/opensearch/_types/GetStats.java | 629 +- .../opensearch/_types/HealthStatus.java | 59 +- .../opensearch/_types/IndexingStats.java | 883 +- .../_types/IndicesResponseBase.java | 100 +- .../client/opensearch/_types/InlineGet.java | 626 +- .../opensearch/_types/InlineScript.java | 319 +- .../opensearch/_types/LatLonGeoLocation.java | 166 +- .../client/opensearch/_types/Level.java | 24 +- .../_types/LifecycleOperationMode.java | 27 +- .../client/opensearch/_types/MergesStats.java | 952 +- .../opensearch/_types/NestedSortValue.java | 371 +- .../opensearch/_types/NodeAttributes.java | 547 +- .../client/opensearch/_types/NodeRole.java | 50 +- .../client/opensearch/_types/NodeShard.java | 632 +- .../opensearch/_types/NodeStatistics.java | 398 +- .../client/opensearch/_types/OpType.java | 22 +- .../_types/OpenSearchException.java | 48 +- .../_types/OpenSearchVersionInfo.java | 603 +- .../client/opensearch/_types/PluginStats.java | 533 +- .../opensearch/_types/QueryCacheStats.java | 502 +- .../opensearch/_types/RecoveryStats.java | 311 +- .../client/opensearch/_types/Refresh.java | 24 +- .../opensearch/_types/RefreshStats.java | 403 +- .../client/opensearch/_types/RequestBase.java | 12 +- .../opensearch/_types/RequestCacheStats.java | 350 +- .../client/opensearch/_types/Result.java | 28 +- .../client/opensearch/_types/Retries.java | 166 +- .../client/opensearch/_types/ScoreSort.java | 195 +- .../client/opensearch/_types/Script.java | 234 +- .../client/opensearch/_types/ScriptBase.java | 124 +- .../opensearch/_types/ScriptBuilders.java | 29 +- .../client/opensearch/_types/ScriptField.java | 242 +- .../client/opensearch/_types/ScriptSort.java | 441 +- .../opensearch/_types/ScriptSortType.java | 23 +- .../client/opensearch/_types/SearchStats.java | 863 +- .../client/opensearch/_types/SearchType.java | 39 +- .../opensearch/_types/SegmentsStats.java | 1362 ++- .../opensearch/_types/ShardFailure.java | 398 +- .../opensearch/_types/ShardStatistics.java | 410 +- .../_types/ShardsOperationResponseBase.java | 99 +- .../opensearch/_types/SlicedScroll.java | 274 +- .../client/opensearch/_types/SortMode.java | 28 +- .../client/opensearch/_types/SortOptions.java | 544 +- .../_types/SortOptionsBuilders.java | 71 +- .../opensearch/_types/SortOptionsVariant.java | 8 +- .../client/opensearch/_types/SortOrder.java | 23 +- .../client/opensearch/_types/StoreStats.java | 484 +- .../opensearch/_types/StoredScript.java | 310 +- .../opensearch/_types/StoredScriptId.java | 122 +- .../client/opensearch/_types/SuggestMode.java | 25 +- .../client/opensearch/_types/ThreadType.java | 25 +- .../client/opensearch/_types/Time.java | 266 +- .../opensearch/_types/TimeBuilders.java | 5 +- .../client/opensearch/_types/TimeUnit.java | 32 +- .../_types/TopLeftBottomRightGeoBounds.java | 244 +- .../_types/TopRightBottomLeftGeoBounds.java | 244 +- .../opensearch/_types/TranslogStats.java | 473 +- .../client/opensearch/_types/VersionType.java | 27 +- .../_types/WaitForActiveShardOptions.java | 23 +- .../_types/WaitForActiveShards.java | 259 +- .../_types/WaitForActiveShardsBuilders.java | 5 +- .../opensearch/_types/WaitForEvents.java | 31 +- .../client/opensearch/_types/WarmerStats.java | 310 +- .../opensearch/_types/WktGeoBounds.java | 124 +- .../opensearch/_types/WriteResponseBase.java | 468 +- .../AdjacencyMatrixAggregate.java | 128 +- .../AdjacencyMatrixAggregation.java | 251 +- .../aggregations/AdjacencyMatrixBucket.java | 79 +- .../_types/aggregations/Aggregate.java | 3967 ++++---- .../_types/aggregations/AggregateBase.java | 124 +- .../aggregations/AggregateBuilders.java | 1019 +- .../_types/aggregations/AggregateVariant.java | 8 +- .../_types/aggregations/Aggregation.java | 4599 +++++---- .../_types/aggregations/AggregationBase.java | 220 +- .../aggregations/AggregationBuilders.java | 1105 +- .../_types/aggregations/AggregationRange.java | 296 +- .../aggregations/AggregationVariant.java | 8 +- .../aggregations/ArrayPercentilesItem.java | 282 +- .../AutoDateHistogramAggregate.java | 189 +- .../AutoDateHistogramAggregation.java | 709 +- .../aggregations/AverageAggregation.java | 119 +- .../AverageBucketAggregation.java | 122 +- .../_types/aggregations/AvgAggregate.java | 119 +- .../_types/aggregations/BoxPlotAggregate.java | 878 +- .../aggregations/BoxplotAggregation.java | 194 +- .../aggregations/BucketAggregationBase.java | 27 +- .../BucketMetricValueAggregate.java | 225 +- .../aggregations/BucketScriptAggregation.java | 212 +- .../BucketSelectorAggregation.java | 214 +- .../aggregations/BucketSortAggregation.java | 418 +- .../_types/aggregations/Buckets.java | 269 +- .../_types/aggregations/BucketsBuilders.java | 5 +- .../_types/aggregations/BucketsPath.java | 328 +- .../aggregations/BucketsPathBuilders.java | 5 +- .../_types/aggregations/CalendarInterval.java | 45 +- .../aggregations/CardinalityAggregate.java | 180 +- .../aggregations/CardinalityAggregation.java | 253 +- .../aggregations/ChiSquareHeuristic.java | 167 +- .../aggregations/ChildrenAggregate.java | 117 +- .../aggregations/ChildrenAggregation.java | 194 +- .../ClassificationInferenceOptions.java | 475 +- .../aggregations/CompositeAggregate.java | 232 +- .../aggregations/CompositeAggregation.java | 399 +- .../CompositeAggregationSource.java | 414 +- .../_types/aggregations/CompositeBucket.java | 208 +- .../CumulativeCardinalityAggregate.java | 246 +- .../CumulativeCardinalityAggregation.java | 125 +- .../CumulativeSumAggregation.java | 122 +- .../aggregations/DateHistogramAggregate.java | 124 +- .../DateHistogramAggregation.java | 1147 ++- .../aggregations/DateHistogramBucket.java | 224 +- .../aggregations/DateRangeAggregate.java | 121 +- .../aggregations/DateRangeAggregation.java | 550 +- .../aggregations/DateRangeExpression.java | 324 +- .../aggregations/DerivativeAggregate.java | 252 +- .../aggregations/DerivativeAggregation.java | 119 +- .../DiversifiedSamplerAggregation.java | 443 +- .../aggregations/DoubleTermsAggregate.java | 125 +- .../aggregations/DoubleTermsBucket.java | 226 +- .../aggregations/EwmaModelSettings.java | 136 +- .../EwmaMovingAverageAggregation.java | 206 +- .../_types/aggregations/ExtendedBounds.java | 261 +- .../aggregations/ExtendedStatsAggregate.java | 867 +- .../ExtendedStatsAggregation.java | 197 +- .../ExtendedStatsBucketAggregate.java | 122 +- .../ExtendedStatsBucketAggregation.java | 198 +- .../_types/aggregations/FieldDateMath.java | 269 +- .../aggregations/FieldDateMathBuilders.java | 5 +- .../_types/aggregations/FilterAggregate.java | 119 +- .../_types/aggregations/FiltersAggregate.java | 123 +- .../aggregations/FiltersAggregation.java | 384 +- .../_types/aggregations/FiltersBucket.java | 79 +- .../FormatMetricAggregationBase.java | 85 +- .../FormattableMetricAggregation.java | 85 +- .../_types/aggregations/GapPolicy.java | 23 +- .../aggregations/GeoBoundsAggregate.java | 197 +- .../aggregations/GeoBoundsAggregation.java | 194 +- .../aggregations/GeoCentroidAggregate.java | 258 +- .../aggregations/GeoCentroidAggregation.java | 269 +- .../aggregations/GeoDistanceAggregate.java | 121 +- .../aggregations/GeoDistanceAggregation.java | 493 +- .../aggregations/GeoHashGridAggregate.java | 123 +- .../aggregations/GeoHashGridAggregation.java | 459 +- .../aggregations/GeoHashGridBucket.java | 124 +- .../_types/aggregations/GeoLineAggregate.java | 244 +- .../aggregations/GeoLineAggregation.java | 436 +- .../_types/aggregations/GeoLinePoint.java | 124 +- .../_types/aggregations/GeoLineSort.java | 124 +- .../aggregations/GeoTileGridAggregate.java | 123 +- .../aggregations/GeoTileGridAggregation.java | 443 +- .../aggregations/GeoTileGridBucket.java | 125 +- .../_types/aggregations/GlobalAggregate.java | 120 +- .../aggregations/GlobalAggregation.java | 120 +- .../GoogleNormalizedDistanceHeuristic.java | 141 +- .../_types/aggregations/HdrMethod.java | 138 +- .../HdrPercentileRanksAggregate.java | 123 +- .../aggregations/HdrPercentilesAggregate.java | 123 +- .../aggregations/HistogramAggregate.java | 124 +- .../aggregations/HistogramAggregation.java | 842 +- .../_types/aggregations/HistogramBucket.java | 225 +- .../_types/aggregations/HistogramOrder.java | 238 +- .../aggregations/HoltLinearModelSettings.java | 240 +- .../HoltMovingAverageAggregation.java | 208 +- .../HoltWintersModelSettings.java | 470 +- .../HoltWintersMovingAverageAggregation.java | 212 +- .../_types/aggregations/HoltWintersType.java | 24 +- .../aggregations/InferenceAggregate.java | 586 +- .../aggregations/InferenceAggregation.java | 257 +- .../InferenceClassImportance.java | 168 +- .../_types/aggregations/InferenceConfig.java | 296 +- .../InferenceFeatureImportance.java | 336 +- .../aggregations/InferenceTopClassEntry.java | 278 +- .../_types/aggregations/IpRangeAggregate.java | 124 +- .../aggregations/IpRangeAggregation.java | 304 +- .../aggregations/IpRangeAggregationRange.java | 297 +- .../_types/aggregations/IpRangeBucket.java | 237 +- .../LinearMovingAverageAggregation.java | 210 +- .../aggregations/LongRareTermsAggregate.java | 124 +- .../aggregations/LongRareTermsBucket.java | 227 +- .../aggregations/LongTermsAggregate.java | 123 +- .../_types/aggregations/LongTermsBucket.java | 227 +- .../aggregations/MatrixAggregation.java | 238 +- .../aggregations/MatrixStatsAggregate.java | 288 +- .../aggregations/MatrixStatsAggregation.java | 197 +- .../aggregations/MatrixStatsFields.java | 577 +- .../_types/aggregations/MaxAggregate.java | 120 +- .../_types/aggregations/MaxAggregation.java | 120 +- .../aggregations/MaxBucketAggregation.java | 120 +- .../MedianAbsoluteDeviationAggregate.java | 126 +- .../MedianAbsoluteDeviationAggregation.java | 201 +- .../aggregations/MetricAggregationBase.java | 280 +- .../_types/aggregations/MinAggregate.java | 119 +- .../_types/aggregations/MinAggregation.java | 119 +- .../aggregations/MinBucketAggregation.java | 119 +- .../_types/aggregations/MinimumInterval.java | 31 +- .../_types/aggregations/MissingAggregate.java | 119 +- .../aggregations/MissingAggregation.java | 268 +- .../_types/aggregations/MissingOrder.java | 25 +- .../MovingAverageAggregation.java | 488 +- .../MovingAverageAggregationBase.java | 229 +- .../MovingAverageAggregationBuilders.java | 73 +- .../MovingAverageAggregationVariant.java | 8 +- .../MovingFunctionAggregation.java | 313 +- .../MovingPercentilesAggregation.java | 313 +- .../MultiBucketAggregateBase.java | 151 +- .../_types/aggregations/MultiBucketBase.java | 225 +- .../_types/aggregations/MultiTermLookup.java | 124 +- .../aggregations/MultiTermsAggregate.java | 123 +- .../aggregations/MultiTermsAggregation.java | 297 +- .../_types/aggregations/MultiTermsBucket.java | 324 +- .../MutualInformationHeuristic.java | 239 +- .../_types/aggregations/NestedAggregate.java | 119 +- .../aggregations/NestedAggregation.java | 194 +- .../aggregations/NormalizeAggregation.java | 193 +- .../_types/aggregations/NormalizeMethod.java | 31 +- .../aggregations/ParentAggregation.java | 194 +- .../PercentageScoreHeuristic.java | 41 +- .../PercentileRanksAggregation.java | 431 +- .../_types/aggregations/Percentiles.java | 268 +- .../PercentilesAggregateBase.java | 88 +- .../aggregations/PercentilesAggregation.java | 432 +- .../PercentilesBucketAggregate.java | 122 +- .../PercentilesBucketAggregation.java | 230 +- .../aggregations/PercentilesBuilders.java | 5 +- .../aggregations/PipelineAggregationBase.java | 243 +- .../_types/aggregations/RangeAggregate.java | 131 +- .../_types/aggregations/RangeAggregation.java | 493 +- .../_types/aggregations/RangeBucket.java | 407 +- .../aggregations/RareTermsAggregation.java | 587 +- .../_types/aggregations/RateAggregate.java | 241 +- .../_types/aggregations/RateAggregation.java | 250 +- .../_types/aggregations/RateMode.java | 23 +- .../RegressionInferenceOptions.java | 265 +- .../aggregations/ReverseNestedAggregate.java | 123 +- .../ReverseNestedAggregation.java | 196 +- .../_types/aggregations/SamplerAggregate.java | 120 +- .../aggregations/SamplerAggregation.java | 195 +- .../SamplerAggregationExecutionHint.java | 28 +- .../aggregations/ScriptedHeuristic.java | 140 +- .../aggregations/ScriptedMetricAggregate.java | 183 +- .../ScriptedMetricAggregation.java | 520 +- .../SerialDifferencingAggregation.java | 198 +- .../SignificantLongTermsAggregate.java | 130 +- .../SignificantLongTermsBucket.java | 230 +- .../SignificantStringTermsAggregate.java | 131 +- .../SignificantStringTermsBucket.java | 128 +- .../SignificantTermsAggregation.java | 1086 +- .../SignificantTermsBucketBase.java | 112 +- .../SignificantTextAggregation.java | 1233 ++- .../SimpleMovingAverageAggregation.java | 210 +- .../aggregations/SimpleValueAggregate.java | 120 +- .../SingleBucketAggregateBase.java | 159 +- .../SingleMetricAggregateBase.java | 179 +- .../aggregations/StandardDeviationBounds.java | 445 +- .../StandardDeviationBoundsAsString.java | 381 +- .../_types/aggregations/StatsAggregate.java | 644 +- .../_types/aggregations/StatsAggregation.java | 119 +- .../aggregations/StatsBucketAggregate.java | 120 +- .../aggregations/StatsBucketAggregation.java | 121 +- .../StringRareTermsAggregate.java | 128 +- .../aggregations/StringRareTermsBucket.java | 125 +- .../aggregations/StringStatsAggregate.java | 633 +- .../aggregations/StringStatsAggregation.java | 195 +- .../aggregations/StringTermsAggregate.java | 123 +- .../aggregations/StringTermsBucket.java | 125 +- .../_types/aggregations/SumAggregate.java | 119 +- .../_types/aggregations/SumAggregation.java | 120 +- .../aggregations/SumBucketAggregation.java | 120 +- .../_types/aggregations/TDigest.java | 137 +- .../TDigestPercentileRanksAggregate.java | 124 +- .../TDigestPercentilesAggregate.java | 123 +- .../_types/aggregations/TTestAggregate.java | 249 +- .../_types/aggregations/TTestAggregation.java | 338 +- .../_types/aggregations/TTestType.java | 26 +- .../aggregations/TermsAggregateBase.java | 162 +- .../_types/aggregations/TermsAggregation.java | 1117 +- .../TermsAggregationCollectMode.java | 26 +- .../TermsAggregationExecutionHint.java | 30 +- .../_types/aggregations/TermsBucketBase.java | 84 +- .../_types/aggregations/TermsExclude.java | 280 +- .../aggregations/TermsExcludeBuilders.java | 5 +- .../_types/aggregations/TermsInclude.java | 310 +- .../aggregations/TermsIncludeBuilders.java | 19 +- .../_types/aggregations/TermsPartition.java | 167 +- .../_types/aggregations/TestPopulation.java | 319 +- .../_types/aggregations/TopHitsAggregate.java | 198 +- .../aggregations/TopHitsAggregation.java | 1034 +- .../_types/aggregations/TopMetrics.java | 337 +- .../aggregations/TopMetricsAggregate.java | 124 +- .../aggregations/TopMetricsAggregation.java | 409 +- .../_types/aggregations/TopMetricsBucket.java | 225 +- .../_types/aggregations/TopMetricsValue.java | 125 +- .../UnmappedRareTermsAggregate.java | 124 +- .../UnmappedSignificantTermsAggregate.java | 127 +- .../aggregations/UnmappedTermsAggregate.java | 122 +- .../aggregations/ValueCountAggregate.java | 119 +- .../aggregations/ValueCountAggregation.java | 122 +- .../_types/aggregations/ValueType.java | 40 +- .../VariableWidthHistogramAggregate.java | 131 +- .../VariableWidthHistogramAggregation.java | 374 +- .../VariableWidthHistogramBucket.java | 430 +- .../WeightedAverageAggregation.java | 396 +- .../aggregations/WeightedAverageValue.java | 313 +- .../aggregations/WeightedAvgAggregate.java | 119 +- .../opensearch/_types/analysis/Analyzer.java | 1008 +- .../_types/analysis/AnalyzerBuilders.java | 223 +- .../_types/analysis/AnalyzerVariant.java | 8 +- .../analysis/AsciiFoldingTokenFilter.java | 186 +- .../_types/analysis/CharFilter.java | 243 +- .../_types/analysis/CharFilterBase.java | 94 +- .../_types/analysis/CharFilterBuilders.java | 19 +- .../_types/analysis/CharFilterDefinition.java | 490 +- .../CharFilterDefinitionBuilders.java | 73 +- .../analysis/CharFilterDefinitionVariant.java | 8 +- .../_types/analysis/CharGroupTokenizer.java | 287 +- .../_types/analysis/CjkAnalyzer.java | 293 +- .../analysis/CommonGramsTokenFilter.java | 407 +- .../analysis/CompoundWordTokenFilterBase.java | 495 +- .../_types/analysis/ConditionTokenFilter.java | 288 +- .../_types/analysis/CustomAnalyzer.java | 485 +- .../_types/analysis/CustomNormalizer.java | 324 +- .../analysis/DelimitedPayloadEncoding.java | 28 +- .../analysis/DelimitedPayloadTokenFilter.java | 233 +- .../DictionaryDecompounderTokenFilter.java | 148 +- .../_types/analysis/DutchAnalyzer.java | 235 +- .../_types/analysis/EdgeNGramSide.java | 23 +- .../_types/analysis/EdgeNGramTokenFilter.java | 347 +- .../_types/analysis/EdgeNGramTokenizer.java | 370 +- .../_types/analysis/ElisionTokenFilter.java | 274 +- .../_types/analysis/FingerprintAnalyzer.java | 491 +- .../analysis/FingerprintTokenFilter.java | 233 +- .../_types/analysis/HtmlStripCharFilter.java | 105 +- .../_types/analysis/HunspellTokenFilter.java | 317 +- .../HyphenationDecompounderTokenFilter.java | 149 +- .../_types/analysis/IcuAnalyzer.java | 236 +- .../analysis/IcuCollationAlternate.java | 25 +- .../analysis/IcuCollationCaseFirst.java | 25 +- .../analysis/IcuCollationDecomposition.java | 26 +- .../_types/analysis/IcuCollationStrength.java | 31 +- .../analysis/IcuCollationTokenFilter.java | 670 +- .../analysis/IcuFoldingTokenFilter.java | 184 +- .../analysis/IcuNormalizationCharFilter.java | 254 +- .../_types/analysis/IcuNormalizationMode.java | 26 +- .../analysis/IcuNormalizationTokenFilter.java | 186 +- .../_types/analysis/IcuNormalizationType.java | 28 +- .../_types/analysis/IcuTokenizer.java | 199 +- .../analysis/IcuTransformDirection.java | 26 +- .../analysis/IcuTransformTokenFilter.java | 231 +- .../_types/analysis/KStemTokenFilter.java | 105 +- .../_types/analysis/KeepTypesMode.java | 23 +- .../_types/analysis/KeepTypesTokenFilter.java | 287 +- .../_types/analysis/KeepWordsTokenFilter.java | 348 +- .../_types/analysis/KeywordAnalyzer.java | 155 +- .../analysis/KeywordMarkerTokenFilter.java | 406 +- .../_types/analysis/KeywordTokenizer.java | 185 +- .../_types/analysis/KuromojiAnalyzer.java | 249 +- .../KuromojiIterationMarkCharFilter.java | 235 +- .../KuromojiPartOfSpeechTokenFilter.java | 230 +- .../KuromojiReadingFormTokenFilter.java | 186 +- .../analysis/KuromojiStemmerTokenFilter.java | 185 +- .../analysis/KuromojiTokenizationMode.java | 28 +- .../_types/analysis/KuromojiTokenizer.java | 572 +- .../opensearch/_types/analysis/Language.java | 86 +- .../_types/analysis/LanguageAnalyzer.java | 485 +- .../_types/analysis/LengthTokenFilter.java | 232 +- .../_types/analysis/LetterTokenizer.java | 106 +- .../analysis/LimitTokenCountTokenFilter.java | 234 +- .../_types/analysis/LowercaseNormalizer.java | 105 +- .../_types/analysis/LowercaseTokenFilter.java | 199 +- .../_types/analysis/LowercaseTokenizer.java | 106 +- .../_types/analysis/MappingCharFilter.java | 288 +- .../analysis/MultiplexerTokenFilter.java | 275 +- .../_types/analysis/NGramTokenFilter.java | 314 +- .../_types/analysis/NGramTokenizer.java | 371 +- .../_types/analysis/NoriAnalyzer.java | 408 +- .../_types/analysis/NoriDecompoundMode.java | 26 +- .../analysis/NoriPartOfSpeechTokenFilter.java | 229 +- .../_types/analysis/NoriTokenizer.java | 406 +- .../_types/analysis/Normalizer.java | 224 +- .../_types/analysis/NormalizerBuilders.java | 31 +- .../_types/analysis/NormalizerVariant.java | 8 +- .../analysis/PathHierarchyTokenizer.java | 356 +- .../_types/analysis/PatternAnalyzer.java | 457 +- .../analysis/PatternCaptureTokenFilter.java | 274 +- .../analysis/PatternReplaceCharFilter.java | 281 +- .../analysis/PatternReplaceTokenFilter.java | 282 +- .../_types/analysis/PatternTokenizer.java | 281 +- .../_types/analysis/PhoneticEncoder.java | 43 +- .../_types/analysis/PhoneticLanguage.java | 44 +- .../_types/analysis/PhoneticNameType.java | 26 +- .../_types/analysis/PhoneticRuleType.java | 24 +- .../_types/analysis/PhoneticTokenFilter.java | 482 +- .../analysis/PorterStemTokenFilter.java | 106 +- .../_types/analysis/PredicateTokenFilter.java | 202 +- .../analysis/RemoveDuplicatesTokenFilter.java | 107 +- .../_types/analysis/ReverseTokenFilter.java | 106 +- .../_types/analysis/ShingleTokenFilter.java | 489 +- .../_types/analysis/SimpleAnalyzer.java | 155 +- .../_types/analysis/SmartcnAnalyzer.java | 104 +- .../analysis/SmartcnStopTokenFilter.java | 104 +- .../_types/analysis/SmartcnTokenizer.java | 102 +- .../_types/analysis/SnowballAnalyzer.java | 336 +- .../_types/analysis/SnowballLanguage.java | 64 +- .../_types/analysis/SnowballTokenFilter.java | 186 +- .../_types/analysis/StandardAnalyzer.java | 294 +- .../_types/analysis/StandardTokenizer.java | 199 +- .../analysis/StemmerOverrideTokenFilter.java | 290 +- .../_types/analysis/StemmerTokenFilter.java | 184 +- .../_types/analysis/StopAnalyzer.java | 347 +- .../_types/analysis/StopTokenFilter.java | 403 +- .../_types/analysis/SynonymFormat.java | 23 +- .../analysis/SynonymGraphTokenFilter.java | 578 +- .../_types/analysis/SynonymTokenFilter.java | 577 +- .../opensearch/_types/analysis/TokenChar.java | 32 +- .../_types/analysis/TokenFilter.java | 242 +- .../_types/analysis/TokenFilterBase.java | 94 +- .../_types/analysis/TokenFilterBuilders.java | 19 +- .../analysis/TokenFilterDefinition.java | 3096 +++--- .../TokenFilterDefinitionBuilders.java | 771 +- .../TokenFilterDefinitionVariant.java | 8 +- .../opensearch/_types/analysis/Tokenizer.java | 242 +- .../_types/analysis/TokenizerBase.java | 95 +- .../_types/analysis/TokenizerBuilders.java | 19 +- .../_types/analysis/TokenizerDefinition.java | 1007 +- .../analysis/TokenizerDefinitionBuilders.java | 227 +- .../analysis/TokenizerDefinitionVariant.java | 8 +- .../_types/analysis/TrimTokenFilter.java | 105 +- .../_types/analysis/TruncateTokenFilter.java | 185 +- .../_types/analysis/UaxEmailUrlTokenizer.java | 198 +- .../_types/analysis/UniqueTokenFilter.java | 198 +- .../_types/analysis/UppercaseTokenFilter.java | 106 +- .../_types/analysis/WhitespaceAnalyzer.java | 154 +- .../_types/analysis/WhitespaceTokenizer.java | 198 +- .../WordDelimiterGraphTokenFilter.java | 1075 +- .../analysis/WordDelimiterTokenFilter.java | 960 +- .../AggregateMetricDoubleProperty.java | 277 +- .../opensearch/_types/mapping/AllField.java | 593 +- .../_types/mapping/BinaryProperty.java | 106 +- .../_types/mapping/BooleanProperty.java | 389 +- .../_types/mapping/ByteNumberProperty.java | 199 +- .../_types/mapping/CompletionProperty.java | 540 +- .../mapping/ConstantKeywordProperty.java | 201 +- .../_types/mapping/CorePropertyBase.java | 261 +- .../_types/mapping/DateNanosProperty.java | 489 +- .../_types/mapping/DateProperty.java | 621 +- .../_types/mapping/DateRangeProperty.java | 199 +- .../_types/mapping/DocValuesPropertyBase.java | 86 +- .../_types/mapping/DoubleNumberProperty.java | 199 +- .../_types/mapping/DoubleRangeProperty.java | 106 +- .../_types/mapping/DynamicMapping.java | 28 +- .../_types/mapping/DynamicTemplate.java | 541 +- .../_types/mapping/FieldAliasProperty.java | 199 +- .../_types/mapping/FieldMapping.java | 277 +- .../_types/mapping/FieldNamesField.java | 125 +- .../opensearch/_types/mapping/FieldType.java | 101 +- .../_types/mapping/FlattenedProperty.java | 662 +- .../_types/mapping/FloatNumberProperty.java | 199 +- .../_types/mapping/FloatRangeProperty.java | 106 +- .../_types/mapping/GeoOrientation.java | 34 +- .../_types/mapping/GeoPointProperty.java | 331 +- .../_types/mapping/GeoShapeProperty.java | 428 +- .../_types/mapping/GeoStrategy.java | 24 +- .../mapping/HalfFloatNumberProperty.java | 199 +- .../_types/mapping/HistogramProperty.java | 199 +- .../opensearch/_types/mapping/IndexField.java | 125 +- .../_types/mapping/IndexOptions.java | 28 +- .../_types/mapping/IntegerNumberProperty.java | 199 +- .../_types/mapping/IntegerRangeProperty.java | 106 +- .../opensearch/_types/mapping/IpProperty.java | 373 +- .../_types/mapping/IpRangeProperty.java | 106 +- .../_types/mapping/JoinProperty.java | 252 +- .../_types/mapping/KeywordProperty.java | 604 +- .../_types/mapping/KnnVectorMethod.java | 14 +- .../_types/mapping/KnnVectorProperty.java | 315 +- .../_types/mapping/LongNumberProperty.java | 199 +- .../_types/mapping/LongRangeProperty.java | 106 +- .../opensearch/_types/mapping/MatchType.java | 24 +- .../_types/mapping/Murmur3HashProperty.java | 106 +- .../_types/mapping/NestedProperty.java | 315 +- .../_types/mapping/NumberPropertyBase.java | 172 +- .../_types/mapping/ObjectProperty.java | 199 +- .../_types/mapping/OnScriptError.java | 24 +- .../_types/mapping/PercolatorProperty.java | 106 +- .../_types/mapping/PointProperty.java | 315 +- .../opensearch/_types/mapping/Property.java | 2729 +++-- .../_types/mapping/PropertyBase.java | 646 +- .../_types/mapping/PropertyBuilders.java | 699 +- .../_types/mapping/PropertyVariant.java | 8 +- .../_types/mapping/RangePropertyBase.java | 228 +- .../_types/mapping/RankFeatureProperty.java | 199 +- .../_types/mapping/RankFeaturesProperty.java | 106 +- .../_types/mapping/RoutingField.java | 125 +- .../_types/mapping/RuntimeField.java | 301 +- .../_types/mapping/RuntimeFieldType.java | 34 +- .../mapping/ScaledFloatNumberProperty.java | 316 +- .../mapping/SearchAsYouTypeProperty.java | 602 +- .../_types/mapping/ShapeProperty.java | 372 +- .../_types/mapping/ShortNumberProperty.java | 199 +- .../opensearch/_types/mapping/SizeField.java | 125 +- .../_types/mapping/SourceField.java | 477 +- .../mapping/StandardNumberProperty.java | 246 +- .../_types/mapping/SuggestContext.java | 321 +- .../_types/mapping/TermVectorOption.java | 34 +- .../_types/mapping/TextIndexPrefixes.java | 167 +- .../_types/mapping/TextProperty.java | 982 +- .../_types/mapping/TokenCountProperty.java | 432 +- .../_types/mapping/TypeMapping.java | 1298 +-- .../mapping/UnsignedLongNumberProperty.java | 200 +- .../_types/mapping/VersionProperty.java | 106 +- .../_types/mapping/WildcardProperty.java | 199 +- .../_types/query_dsl/BoolQuery.java | 619 +- .../_types/query_dsl/BoostingQuery.java | 301 +- .../_types/query_dsl/ChildScoreMode.java | 30 +- .../query_dsl/CombinedFieldsOperator.java | 26 +- .../_types/query_dsl/CombinedFieldsQuery.java | 502 +- .../query_dsl/CombinedFieldsZeroTerms.java | 26 +- .../_types/query_dsl/CommonTermsQuery.java | 521 +- .../_types/query_dsl/ConstantScoreQuery.java | 196 +- .../_types/query_dsl/DecayFunction.java | 241 +- .../_types/query_dsl/DecayFunctionBase.java | 85 +- .../_types/query_dsl/DecayPlacement.java | 355 +- .../_types/query_dsl/DisMaxQuery.java | 299 +- .../query_dsl/DistanceFeatureQuery.java | 277 +- .../_types/query_dsl/ExistsQuery.java | 179 +- .../_types/query_dsl/FieldAndFormat.java | 310 +- .../_types/query_dsl/FieldLookup.java | 335 +- .../query_dsl/FieldValueFactorModifier.java | 42 +- .../FieldValueFactorScoreFunction.java | 358 +- .../_types/query_dsl/FunctionBoostMode.java | 32 +- .../_types/query_dsl/FunctionScore.java | 721 +- .../query_dsl/FunctionScoreBuilders.java | 87 +- .../_types/query_dsl/FunctionScoreMode.java | 32 +- .../_types/query_dsl/FunctionScoreQuery.java | 545 +- .../query_dsl/FunctionScoreVariant.java | 8 +- .../_types/query_dsl/FuzzyQuery.java | 541 +- .../_types/query_dsl/GeoBoundingBoxQuery.java | 429 +- .../_types/query_dsl/GeoDistanceQuery.java | 417 +- .../_types/query_dsl/GeoExecution.java | 24 +- .../_types/query_dsl/GeoPolygonPoints.java | 229 +- .../_types/query_dsl/GeoPolygonQuery.java | 356 +- .../_types/query_dsl/GeoShapeFieldQuery.java | 312 +- .../_types/query_dsl/GeoShapeQuery.java | 301 +- .../_types/query_dsl/GeoValidationMethod.java | 28 +- .../_types/query_dsl/HasChildQuery.java | 547 +- .../_types/query_dsl/HasParentQuery.java | 429 +- .../opensearch/_types/query_dsl/IdsQuery.java | 225 +- .../_types/query_dsl/Intervals.java | 545 +- .../_types/query_dsl/IntervalsAllOf.java | 449 +- .../_types/query_dsl/IntervalsAnyOf.java | 333 +- .../_types/query_dsl/IntervalsBuilders.java | 87 +- .../_types/query_dsl/IntervalsFilter.java | 700 +- .../query_dsl/IntervalsFilterBuilders.java | 129 +- .../query_dsl/IntervalsFilterVariant.java | 8 +- .../_types/query_dsl/IntervalsFuzzy.java | 493 +- .../_types/query_dsl/IntervalsMatch.java | 507 +- .../_types/query_dsl/IntervalsPrefix.java | 317 +- .../_types/query_dsl/IntervalsQuery.java | 619 +- .../query_dsl/IntervalsQueryBuilders.java | 87 +- .../query_dsl/IntervalsQueryVariant.java | 2 +- .../_types/query_dsl/IntervalsVariant.java | 8 +- .../_types/query_dsl/IntervalsWildcard.java | 317 +- .../opensearch/_types/query_dsl/KnnQuery.java | 6 +- .../opensearch/_types/query_dsl/Like.java | 241 +- .../_types/query_dsl/LikeBuilders.java | 17 +- .../_types/query_dsl/LikeDocument.java | 716 +- .../_types/query_dsl/MatchAllQuery.java | 118 +- .../query_dsl/MatchBoolPrefixQuery.java | 699 +- .../_types/query_dsl/MatchNoneQuery.java | 118 +- .../query_dsl/MatchPhrasePrefixQuery.java | 470 +- .../_types/query_dsl/MatchPhraseQuery.java | 409 +- .../_types/query_dsl/MatchQuery.java | 958 +- .../_types/query_dsl/MoreLikeThisQuery.java | 1424 +-- .../_types/query_dsl/MultiMatchQuery.java | 1148 +-- .../_types/query_dsl/MultiValueMode.java | 28 +- .../_types/query_dsl/NestedQuery.java | 433 +- .../opensearch/_types/query_dsl/Operator.java | 33 +- .../_types/query_dsl/ParentIdQuery.java | 309 +- .../_types/query_dsl/PercolateQuery.java | 679 +- .../_types/query_dsl/PinnedDoc.java | 167 +- .../_types/query_dsl/PinnedQuery.java | 457 +- .../_types/query_dsl/PinnedQueryBuilders.java | 5 +- .../_types/query_dsl/PinnedQueryVariant.java | 2 +- .../_types/query_dsl/PrefixQuery.java | 349 +- .../opensearch/_types/query_dsl/Query.java | 3333 +++--- .../_types/query_dsl/QueryBase.java | 185 +- .../_types/query_dsl/QueryBuilders.java | 847 +- .../_types/query_dsl/QueryStringQuery.java | 1559 ++- .../_types/query_dsl/QueryVariant.java | 8 +- .../_types/query_dsl/RandomScoreFunction.java | 253 +- .../_types/query_dsl/RangeQuery.java | 651 +- .../_types/query_dsl/RangeQueryBase.java | 85 +- .../_types/query_dsl/RangeRelation.java | 26 +- .../_types/query_dsl/RankFeatureFunction.java | 13 +- .../query_dsl/RankFeatureFunctionLinear.java | 42 +- .../RankFeatureFunctionLogarithm.java | 126 +- .../RankFeatureFunctionSaturation.java | 138 +- .../query_dsl/RankFeatureFunctionSigmoid.java | 167 +- .../_types/query_dsl/RankFeatureQuery.java | 475 +- .../_types/query_dsl/RegexpQuery.java | 467 +- .../_types/query_dsl/ScoreFunctionBase.java | 203 +- .../_types/query_dsl/ScriptQuery.java | 196 +- .../_types/query_dsl/ScriptScoreFunction.java | 198 +- .../_types/query_dsl/ScriptScoreQuery.java | 317 +- .../_types/query_dsl/ShapeFieldQuery.java | 312 +- .../_types/query_dsl/ShapeQuery.java | 301 +- .../query_dsl/SimpleQueryStringFlag.java | 48 +- .../query_dsl/SimpleQueryStringFlags.java | 259 +- .../SimpleQueryStringFlagsBuilders.java | 5 +- .../query_dsl/SimpleQueryStringQuery.java | 927 +- .../_types/query_dsl/SpanContainingQuery.java | 274 +- .../query_dsl/SpanFieldMaskingQuery.java | 259 +- .../_types/query_dsl/SpanFirstQuery.java | 257 +- .../_types/query_dsl/SpanGapQuery.java | 173 +- .../_types/query_dsl/SpanMultiTermQuery.java | 230 +- .../_types/query_dsl/SpanNearQuery.java | 373 +- .../_types/query_dsl/SpanNotQuery.java | 449 +- .../_types/query_dsl/SpanOrQuery.java | 255 +- .../_types/query_dsl/SpanQuery.java | 760 +- .../_types/query_dsl/SpanQueryBuilders.java | 143 +- .../_types/query_dsl/SpanQueryVariant.java | 8 +- .../_types/query_dsl/SpanTermQuery.java | 249 +- .../_types/query_dsl/SpanWithinQuery.java | 272 +- .../_types/query_dsl/TermQuery.java | 309 +- .../_types/query_dsl/TermsLookup.java | 311 +- .../_types/query_dsl/TermsQuery.java | 239 +- .../_types/query_dsl/TermsQueryField.java | 258 +- .../query_dsl/TermsQueryFieldBuilders.java | 19 +- .../_types/query_dsl/TermsSetQuery.java | 405 +- .../_types/query_dsl/TextQueryType.java | 32 +- .../_types/query_dsl/TypeQuery.java | 179 +- .../_types/query_dsl/WildcardQuery.java | 469 +- .../_types/query_dsl/WrapperQuery.java | 12 +- .../_types/query_dsl/ZeroTermsQuery.java | 24 +- .../client/opensearch/cat/AliasesRequest.java | 352 +- .../opensearch/cat/AliasesResponse.java | 216 +- .../opensearch/cat/AllocationRequest.java | 321 +- .../opensearch/cat/AllocationResponse.java | 215 +- .../client/opensearch/cat/CatRequestBase.java | 16 +- .../opensearch/cat/ClusterManagerRequest.java | 82 +- .../cat/ClusterManagerResponse.java | 215 +- .../client/opensearch/cat/CountRequest.java | 248 +- .../client/opensearch/cat/CountResponse.java | 216 +- .../opensearch/cat/FielddataRequest.java | 319 +- .../opensearch/cat/FielddataResponse.java | 215 +- .../client/opensearch/cat/HealthRequest.java | 197 +- .../client/opensearch/cat/HealthResponse.java | 216 +- .../client/opensearch/cat/HelpRequest.java | 30 +- .../client/opensearch/cat/HelpResponse.java | 216 +- .../client/opensearch/cat/IndicesRequest.java | 128 +- .../opensearch/cat/IndicesResponse.java | 216 +- .../opensearch/cat/NodeattrsRequest.java | 30 +- .../opensearch/cat/NodeattrsResponse.java | 217 +- .../client/opensearch/cat/NodesRequest.java | 61 +- .../client/opensearch/cat/NodesResponse.java | 216 +- .../cat/OpenSearchCatAsyncClient.java | 1477 +-- .../opensearch/cat/OpenSearchCatClient.java | 1484 +-- .../opensearch/cat/PendingTasksRequest.java | 50 +- .../opensearch/cat/PendingTasksResponse.java | 217 +- .../opensearch/cat/PitSegmentsRequest.java | 52 +- .../client/opensearch/cat/PluginsRequest.java | 48 +- .../opensearch/cat/PluginsResponse.java | 216 +- .../opensearch/cat/RecoveryRequest.java | 111 +- .../opensearch/cat/RecoveryResponse.java | 215 +- .../opensearch/cat/RepositoriesRequest.java | 50 +- .../opensearch/cat/RepositoriesResponse.java | 217 +- .../opensearch/cat/SegmentsRequest.java | 318 +- .../opensearch/cat/SegmentsResponse.java | 216 +- .../client/opensearch/cat/ShardsRequest.java | 318 +- .../client/opensearch/cat/ShardsResponse.java | 216 +- .../opensearch/cat/SnapshotsRequest.java | 319 +- .../opensearch/cat/SnapshotsResponse.java | 215 +- .../client/opensearch/cat/TasksRequest.java | 413 +- .../client/opensearch/cat/TasksResponse.java | 215 +- .../opensearch/cat/TemplatesRequest.java | 222 +- .../opensearch/cat/TemplatesResponse.java | 215 +- .../opensearch/cat/ThreadPoolRequest.java | 328 +- .../opensearch/cat/ThreadPoolResponse.java | 215 +- .../opensearch/cat/aliases/AliasesRecord.java | 519 +- .../cat/allocation/AllocationRecord.java | 717 +- .../cluster_manager/ClusterManagerRecord.java | 387 +- .../opensearch/cat/count/CountRecord.java | 321 +- .../cat/fielddata/FielddataRecord.java | 519 +- .../opensearch/cat/health/HealthRecord.java | 1053 +- .../opensearch/cat/help/HelpRecord.java | 125 +- .../opensearch/cat/indices/IndicesRecord.java | 9016 +++++++++-------- .../cat/nodeattrs/NodeAttributesRecord.java | 651 +- .../opensearch/cat/nodes/NodesRecord.java | 6313 ++++++------ .../cat/pending_tasks/PendingTasksRecord.java | 386 +- .../opensearch/cat/plugins/PluginsRecord.java | 519 +- .../cat/recovery/RecoveryRecord.java | 1791 ++-- .../cat/repositories/RepositoriesRecord.java | 255 +- .../cat/segments/SegmentsRecord.java | 1113 +- .../opensearch/cat/shards/ShardsRecord.java | 4955 ++++----- .../cat/snapshots/SnapshotsRecord.java | 1001 +- .../opensearch/cat/tasks/TasksRecord.java | 1179 +-- .../cat/templates/TemplatesRecord.java | 453 +- .../cat/thread_pool/ThreadPoolRecord.java | 1439 +-- .../cat/thread_pool/ThreadPoolSize.java | 30 +- .../cluster/AllocationExplainRequest.java | 577 +- .../cluster/AllocationExplainResponse.java | 1684 +-- .../cluster/ClusterStatsRequest.java | 413 +- .../cluster/ClusterStatsResponse.java | 515 +- .../opensearch/cluster/ComponentTemplate.java | 230 +- .../cluster/ComponentTemplateNode.java | 332 +- .../cluster/ComponentTemplateSummary.java | 567 +- .../DeleteComponentTemplateRequest.java | 448 +- .../DeleteComponentTemplateResponse.java | 109 +- .../DeleteVotingConfigExclusionsRequest.java | 212 +- .../DeleteVotingConfigExclusionsResponse.java | 17 +- .../ExistsComponentTemplateRequest.java | 484 +- .../ExistsComponentTemplateResponse.java | 17 +- .../cluster/GetClusterSettingsRequest.java | 491 +- .../cluster/GetClusterSettingsResponse.java | 385 +- .../cluster/GetComponentTemplateRequest.java | 501 +- .../cluster/GetComponentTemplateResponse.java | 230 +- .../opensearch/cluster/HealthRequest.java | 1165 ++- .../opensearch/cluster/HealthResponse.java | 1094 +- .../cluster/OpenSearchClusterAsyncClient.java | 1258 +-- .../cluster/OpenSearchClusterClient.java | 1234 +-- .../cluster/PendingTasksRequest.java | 357 +- .../cluster/PendingTasksResponse.java | 229 +- .../PostVotingConfigExclusionsRequest.java | 410 +- .../PostVotingConfigExclusionsResponse.java | 17 +- .../cluster/PutClusterSettingsRequest.java | 671 +- .../cluster/PutClusterSettingsResponse.java | 341 +- .../cluster/PutComponentTemplateRequest.java | 967 +- .../cluster/PutComponentTemplateResponse.java | 108 +- .../opensearch/cluster/RemoteInfoRequest.java | 54 +- .../cluster/RemoteInfoResponse.java | 112 +- .../opensearch/cluster/RerouteRequest.java | 857 +- .../opensearch/cluster/RerouteResponse.java | 296 +- .../opensearch/cluster/StateRequest.java | 1017 +- .../opensearch/cluster/StateResponse.java | 116 +- .../AllocationDecision.java | 261 +- .../AllocationExplainDecision.java | 29 +- .../allocation_explain/AllocationStore.java | 380 +- .../allocation_explain/ClusterInfo.java | 610 +- .../allocation_explain/CurrentNode.java | 380 +- .../cluster/allocation_explain/Decision.java | 35 +- .../cluster/allocation_explain/DiskUsage.java | 379 +- .../NodeAllocationExplanation.java | 627 +- .../allocation_explain/NodeDiskUsage.java | 289 +- .../allocation_explain/ReservedSize.java | 335 +- .../UnassignedInformation.java | 507 +- .../UnassignedInformationReason.java | 51 +- .../cluster/health/IndexHealthStats.java | 607 +- .../cluster/health/ShardHealthStats.java | 381 +- .../cluster/pending_tasks/PendingTask.java | 378 +- .../remote_info/ClusterRemoteInfo.java | 239 +- .../ClusterRemoteInfoBuilders.java | 31 +- .../remote_info/ClusterRemoteInfoVariant.java | 8 +- .../remote_info/ClusterRemoteProxyInfo.java | 484 +- .../remote_info/ClusterRemoteSniffInfo.java | 474 +- .../opensearch/cluster/reroute/Command.java | 696 +- .../reroute/CommandAllocatePrimaryAction.java | 320 +- .../reroute/CommandAllocateReplicaAction.java | 261 +- .../cluster/reroute/CommandCancelAction.java | 311 +- .../cluster/reroute/CommandMoveAction.java | 315 +- .../cluster/reroute/RerouteDecision.java | 261 +- .../cluster/reroute/RerouteExplanation.java | 333 +- .../cluster/reroute/RerouteParameters.java | 414 +- .../cluster/stats/CharFilterTypes.java | 963 +- .../cluster/stats/ClusterFileSystem.java | 261 +- .../cluster/stats/ClusterIndices.java | 989 +- .../cluster/stats/ClusterIndicesShards.java | 405 +- .../stats/ClusterIndicesShardsIndex.java | 361 +- .../cluster/stats/ClusterIngest.java | 279 +- .../opensearch/cluster/stats/ClusterJvm.java | 364 +- .../cluster/stats/ClusterJvmMemory.java | 167 +- .../cluster/stats/ClusterJvmVersion.java | 431 +- .../cluster/stats/ClusterNetworkTypes.java | 304 +- .../cluster/stats/ClusterNodeCount.java | 796 +- .../cluster/stats/ClusterNodes.java | 1119 +- .../cluster/stats/ClusterOperatingSystem.java | 608 +- .../ClusterOperatingSystemArchitecture.java | 220 +- .../stats/ClusterOperatingSystemName.java | 167 +- .../ClusterOperatingSystemPrettyName.java | 218 +- .../cluster/stats/ClusterProcess.java | 247 +- .../cluster/stats/ClusterProcessCpu.java | 124 +- .../ClusterProcessOpenFileDescriptors.java | 264 +- .../cluster/stats/ClusterProcessor.java | 293 +- .../cluster/stats/ClusterShardMetrics.java | 261 +- .../opensearch/cluster/stats/FieldTypes.java | 311 +- .../cluster/stats/FieldTypesMappings.java | 337 +- .../cluster/stats/IndicesVersions.java | 293 +- .../cluster/stats/NodePackagingType.java | 260 +- .../stats/OperatingSystemMemoryInfo.java | 338 +- .../cluster/stats/RuntimeFieldTypes.java | 822 +- .../client/opensearch/core/BulkRequest.java | 1062 +- .../client/opensearch/core/BulkResponse.java | 372 +- .../opensearch/core/ClearScrollRequest.java | 268 +- .../opensearch/core/ClearScrollResponse.java | 166 +- .../client/opensearch/core/CountRequest.java | 1296 +-- .../client/opensearch/core/CountResponse.java | 231 +- .../client/opensearch/core/CreateRequest.java | 880 +- .../opensearch/core/CreateResponse.java | 82 +- .../opensearch/core/DeleteByQueryRequest.java | 2640 ++--- .../core/DeleteByQueryResponse.java | 1005 +- .../core/DeleteByQueryRethrottleRequest.java | 270 +- .../core/DeleteByQueryRethrottleResponse.java | 107 +- .../client/opensearch/core/DeleteRequest.java | 816 +- .../opensearch/core/DeleteResponse.java | 82 +- .../opensearch/core/DeleteScriptRequest.java | 443 +- .../opensearch/core/DeleteScriptResponse.java | 81 +- .../client/opensearch/core/ExistsRequest.java | 966 +- .../opensearch/core/ExistsResponse.java | 15 +- .../opensearch/core/ExistsSourceRequest.java | 881 +- .../opensearch/core/ExistsSourceResponse.java | 16 +- .../opensearch/core/ExplainRequest.java | 1248 +-- .../opensearch/core/ExplainResponse.java | 468 +- .../opensearch/core/FieldCapsRequest.java | 870 +- .../opensearch/core/FieldCapsResponse.java | 323 +- .../client/opensearch/core/GetRequest.java | 989 +- .../client/opensearch/core/GetResponse.java | 137 +- .../core/GetScriptContextRequest.java | 54 +- .../core/GetScriptContextResponse.java | 230 +- .../core/GetScriptLanguagesRequest.java | 54 +- .../core/GetScriptLanguagesResponse.java | 318 +- .../opensearch/core/GetScriptRequest.java | 367 +- .../opensearch/core/GetScriptResponse.java | 288 +- .../opensearch/core/GetSourceRequest.java | 978 +- .../opensearch/core/GetSourceResponse.java | 205 +- .../client/opensearch/core/IndexRequest.java | 1178 +-- .../client/opensearch/core/IndexResponse.java | 82 +- .../client/opensearch/core/InfoRequest.java | 52 +- .../client/opensearch/core/InfoResponse.java | 355 +- .../client/opensearch/core/MgetRequest.java | 1080 +- .../client/opensearch/core/MgetResponse.java | 303 +- .../opensearch/core/MsearchRequest.java | 1037 +- .../opensearch/core/MsearchResponse.java | 137 +- .../core/MsearchTemplateRequest.java | 605 +- .../core/MsearchTemplateResponse.java | 139 +- .../opensearch/core/MtermvectorsRequest.java | 1229 +-- .../opensearch/core/MtermvectorsResponse.java | 229 +- .../client/opensearch/core/PingRequest.java | 54 +- .../client/opensearch/core/PingResponse.java | 16 +- .../opensearch/core/PutScriptRequest.java | 648 +- .../opensearch/core/PutScriptResponse.java | 81 +- .../opensearch/core/RankEvalRequest.java | 827 +- .../opensearch/core/RankEvalResponse.java | 399 +- .../opensearch/core/ReindexRequest.java | 1148 +-- .../opensearch/core/ReindexResponse.java | 1138 ++- .../core/ReindexRethrottleRequest.java | 267 +- .../core/ReindexRethrottleResponse.java | 232 +- .../core/RenderSearchTemplateRequest.java | 490 +- .../core/RenderSearchTemplateResponse.java | 212 +- .../core/ScriptsPainlessExecuteRequest.java | 415 +- .../core/ScriptsPainlessExecuteResponse.java | 238 +- .../client/opensearch/core/ScrollRequest.java | 341 +- .../opensearch/core/ScrollResponse.java | 136 +- .../client/opensearch/core/SearchRequest.java | 4228 ++++---- .../opensearch/core/SearchResponse.java | 122 +- .../opensearch/core/SearchShardsRequest.java | 664 +- .../opensearch/core/SearchShardsResponse.java | 443 +- .../core/SearchTemplateRequest.java | 1316 +-- .../core/SearchTemplateResponse.java | 135 +- .../opensearch/core/TermsEnumRequest.java | 775 +- .../opensearch/core/TermsEnumResponse.java | 317 +- .../opensearch/core/TermvectorsRequest.java | 1320 +-- .../opensearch/core/TermvectorsResponse.java | 453 +- .../opensearch/core/UpdateByQueryRequest.java | 2762 ++--- .../core/UpdateByQueryResponse.java | 1005 +- .../core/UpdateByQueryRethrottleRequest.java | 270 +- .../core/UpdateByQueryRethrottleResponse.java | 238 +- .../client/opensearch/core/UpdateRequest.java | 1570 +-- .../opensearch/core/UpdateResponse.java | 263 +- .../opensearch/core/bulk/BulkOperation.java | 413 +- .../core/bulk/BulkOperationBase.java | 477 +- .../core/bulk/BulkOperationBuilders.java | 59 +- .../core/bulk/BulkOperationVariant.java | 8 +- .../core/bulk/BulkResponseItem.java | 848 +- .../opensearch/core/bulk/CreateOperation.java | 186 +- .../opensearch/core/bulk/DeleteOperation.java | 120 +- .../opensearch/core/bulk/IndexOperation.java | 186 +- .../opensearch/core/bulk/OperationType.java | 28 +- .../opensearch/core/bulk/UpdateOperation.java | 376 +- .../core/bulk/UpdateOperationData.java | 16 +- .../opensearch/core/bulk/WriteOperation.java | 126 +- .../opensearch/core/explain/Explanation.java | 319 +- .../core/explain/ExplanationDetail.java | 323 +- .../core/field_caps/FieldCapability.java | 716 +- .../client/opensearch/core/get/GetResult.java | 723 +- .../core/get_script_context/Context.java | 273 +- .../get_script_context/ContextMethod.java | 315 +- .../ContextMethodParam.java | 167 +- .../get_script_languages/LanguageContext.java | 255 +- .../opensearch/core/mget/MultiGetError.java | 278 +- .../core/mget/MultiGetOperation.java | 569 +- .../core/mget/MultiGetResponseItem.java | 258 +- .../mget/MultiGetResponseItemBuilders.java | 35 +- .../core/msearch/MultiSearchItem.java | 185 +- .../core/msearch/MultiSearchResponseItem.java | 261 +- .../MultiSearchResponseItemBuilders.java | 35 +- .../core/msearch/MultiSearchResult.java | 275 +- .../core/msearch/MultisearchBody.java | 1214 ++- .../core/msearch/MultisearchHeader.java | 649 +- .../opensearch/core/msearch/RequestItem.java | 224 +- .../core/msearch_template/RequestItem.java | 226 +- .../core/msearch_template/TemplateConfig.java | 475 +- .../MultiTermVectorsOperation.java | 797 +- .../mtermvectors/MultiTermVectorsResult.java | 450 +- .../opensearch/core/pit/CreatePitRequest.java | 93 +- .../core/pit/CreatePitResponse.java | 17 +- .../opensearch/core/pit/DeletePitRecord.java | 12 +- .../opensearch/core/pit/DeletePitRequest.java | 54 +- .../core/pit/DeletePitResponse.java | 18 +- .../core/pit/ListAllPitRequest.java | 22 +- .../core/pit/ListAllPitResponse.java | 20 +- .../client/opensearch/core/pit/PitRecord.java | 12 +- .../core/rank_eval/DocumentRating.java | 291 +- .../core/rank_eval/RankEvalHit.java | 262 +- .../core/rank_eval/RankEvalHitItem.java | 243 +- .../core/rank_eval/RankEvalMetric.java | 497 +- .../core/rank_eval/RankEvalMetricBase.java | 109 +- .../core/rank_eval/RankEvalMetricDetail.java | 589 +- ...ankEvalMetricDiscountedCumulativeGain.java | 195 +- .../RankEvalMetricExpectedReciprocalRank.java | 183 +- .../RankEvalMetricMeanReciprocalRank.java | 109 +- .../rank_eval/RankEvalMetricPrecision.java | 199 +- .../RankEvalMetricRatingTreshold.java | 127 +- .../core/rank_eval/RankEvalMetricRecall.java | 107 +- .../core/rank_eval/RankEvalQuery.java | 246 +- .../core/rank_eval/RankEvalRequestItem.java | 555 +- .../core/rank_eval/UnratedDocument.java | 167 +- .../opensearch/core/reindex/Destination.java | 440 +- .../opensearch/core/reindex/RemoteSource.java | 367 +- .../opensearch/core/reindex/Source.java | 801 +- .../core/reindex_rethrottle/ReindexNode.java | 227 +- .../reindex_rethrottle/ReindexStatus.java | 654 +- .../core/reindex_rethrottle/ReindexTask.java | 670 +- .../PainlessContextSetup.java | 276 +- .../core/search/AggregationBreakdown.java | 719 +- .../core/search/AggregationProfile.java | 492 +- .../core/search/AggregationProfileDebug.java | 1442 +-- .../AggregationProfileDelegateDebug.java | 472 +- ...AggregationProfileDelegateDebugFilter.java | 304 +- .../core/search/BoundaryScanner.java | 25 +- .../core/search/BuiltinHighlighterType.java | 27 +- .../opensearch/core/search/Collector.java | 357 +- .../core/search/CompletionContext.java | 487 +- .../core/search/CompletionSuggest.java | 51 +- .../core/search/CompletionSuggestOption.java | 733 +- .../core/search/CompletionSuggester.java | 495 +- .../opensearch/core/search/Context.java | 245 +- .../core/search/ContextBuilders.java | 19 +- .../core/search/DirectGenerator.java | 751 +- .../opensearch/core/search/FetchProfile.java | 494 +- .../core/search/FetchProfileBreakdown.java | 471 +- .../core/search/FetchProfileDebug.java | 272 +- .../opensearch/core/search/FieldCollapse.java | 335 +- .../core/search/FieldSuggester.java | 546 +- .../core/search/FieldSuggesterBuilders.java | 47 +- .../core/search/FieldSuggesterVariant.java | 8 +- .../opensearch/core/search/Highlight.java | 1407 ++- .../core/search/HighlightField.java | 1446 ++- .../core/search/HighlighterEncoder.java | 23 +- .../core/search/HighlighterFragmenter.java | 25 +- .../core/search/HighlighterOrder.java | 21 +- .../core/search/HighlighterTagsSchema.java | 23 +- .../core/search/HighlighterType.java | 259 +- .../core/search/HighlighterTypeBuilders.java | 5 +- .../client/opensearch/core/search/Hit.java | 1431 ++- .../opensearch/core/search/HitsMetadata.java | 391 +- .../opensearch/core/search/InnerHits.java | 1311 ++- .../core/search/InnerHitsResult.java | 138 +- .../core/search/LaplaceSmoothingModel.java | 139 +- .../LinearInterpolationSmoothingModel.java | 281 +- .../core/search/NestedIdentity.java | 287 +- .../opensearch/core/search/PhraseSuggest.java | 13 +- .../core/search/PhraseSuggestCollate.java | 334 +- .../search/PhraseSuggestCollateQuery.java | 17 +- .../core/search/PhraseSuggestHighlight.java | 168 +- .../core/search/PhraseSuggestOption.java | 276 +- .../core/search/PhraseSuggester.java | 985 +- .../client/opensearch/core/search/Pit.java | 8 +- .../opensearch/core/search/Profile.java | 226 +- .../core/search/QueryBreakdown.java | 882 +- .../opensearch/core/search/QueryProfile.java | 411 +- .../opensearch/core/search/Rescore.java | 243 +- .../opensearch/core/search/RescoreQuery.java | 359 +- .../opensearch/core/search/ScoreMode.java | 30 +- .../opensearch/core/search/SearchProfile.java | 375 +- .../opensearch/core/search/SearchResult.java | 1159 ++- .../opensearch/core/search/ShardProfile.java | 440 +- .../core/search/SmoothingModel.java | 367 +- .../core/search/SmoothingModelBuilders.java | 45 +- .../core/search/SmoothingModelVariant.java | 8 +- .../opensearch/core/search/SourceConfig.java | 243 +- .../core/search/SourceConfigBuilders.java | 19 +- .../core/search/SourceConfigParam.java | 283 +- .../search/SourceConfigParamBuilders.java | 5 +- .../opensearch/core/search/SourceFilter.java | 306 +- .../core/search/StringDistance.java | 30 +- .../search/StupidBackoffSmoothingModel.java | 15 +- .../opensearch/core/search/Suggest.java | 307 +- .../opensearch/core/search/SuggestBase.java | 167 +- .../core/search/SuggestFuzziness.java | 337 +- .../core/search/SuggestOptionBuilders.java | 45 +- .../opensearch/core/search/SuggestSort.java | 24 +- .../core/search/SuggestVariant.java | 4 +- .../opensearch/core/search/Suggester.java | 310 +- .../opensearch/core/search/SuggesterBase.java | 235 +- .../opensearch/core/search/TermSuggest.java | 12 +- .../core/search/TermSuggestOption.java | 274 +- .../opensearch/core/search/TermSuggester.java | 827 +- .../opensearch/core/search/TotalHits.java | 213 +- .../core/search/TotalHitsRelation.java | 36 +- .../opensearch/core/search/TrackHits.java | 265 +- .../core/search/TrackHitsBuilders.java | 5 +- .../core/search_shards/ShardStoreIndex.java | 288 +- .../core/termvectors/FieldStatistics.java | 261 +- .../opensearch/core/termvectors/Filter.java | 528 +- .../opensearch/core/termvectors/Term.java | 444 +- .../core/termvectors/TermVector.java | 295 +- .../opensearch/core/termvectors/Token.java | 335 +- .../UpdateByQueryRethrottleNode.java | 231 +- .../DeleteDanglingIndexRequest.java | 494 +- .../DeleteDanglingIndexResponse.java | 108 +- .../ImportDanglingIndexRequest.java | 496 +- .../ImportDanglingIndexResponse.java | 108 +- .../ListDanglingIndicesRequest.java | 55 +- .../ListDanglingIndicesResponse.java | 231 +- .../OpenSearchDanglingIndicesAsyncClient.java | 203 +- .../OpenSearchDanglingIndicesClient.java | 200 +- .../list_dangling_indices/DanglingIndex.java | 335 +- .../client/opensearch/features/Feature.java | 167 +- .../features/GetFeaturesRequest.java | 54 +- .../features/GetFeaturesResponse.java | 226 +- .../OpenSearchFeaturesAsyncClient.java | 72 +- .../features/OpenSearchFeaturesClient.java | 65 +- .../features/ResetFeaturesRequest.java | 54 +- .../features/ResetFeaturesResponse.java | 226 +- .../opensearch/indices/AddBlockRequest.java | 729 +- .../opensearch/indices/AddBlockResponse.java | 277 +- .../client/opensearch/indices/Alias.java | 487 +- .../opensearch/indices/AliasDefinition.java | 429 +- .../opensearch/indices/AnalyzeRequest.java | 977 +- .../opensearch/indices/AnalyzeResponse.java | 307 +- .../opensearch/indices/ClearCacheRequest.java | 744 +- .../indices/ClearCacheResponse.java | 81 +- .../opensearch/indices/CloneIndexRequest.java | 847 +- .../indices/CloneIndexResponse.java | 214 +- .../opensearch/indices/CloseIndexRequest.java | 796 +- .../indices/CloseIndexResponse.java | 279 +- .../indices/CreateDataStreamRequest.java | 54 +- .../indices/CreateDataStreamResponse.java | 13 +- .../indices/CreateIndexRequest.java | 883 +- .../indices/CreateIndexResponse.java | 272 +- .../client/opensearch/indices/DataStream.java | 211 +- .../indices/DataStreamIndexInfo.java | 9 +- .../opensearch/indices/DataStreamInfo.java | 12 +- .../opensearch/indices/DataStreamStats.java | 11 +- .../indices/DataStreamTimestampField.java | 11 +- .../indices/DataStreamsStatsRequest.java | 95 +- .../indices/DataStreamsStatsResponse.java | 13 +- .../indices/DeleteAliasRequest.java | 591 +- .../indices/DeleteAliasResponse.java | 81 +- .../indices/DeleteDataStreamRequest.java | 58 +- .../indices/DeleteDataStreamResponse.java | 15 +- .../indices/DeleteIndexRequest.java | 697 +- .../indices/DeleteIndexResponse.java | 81 +- .../indices/DeleteIndexTemplateRequest.java | 196 +- .../indices/DeleteIndexTemplateResponse.java | 108 +- .../indices/DeleteTemplateRequest.java | 445 +- .../indices/DeleteTemplateResponse.java | 82 +- .../opensearch/indices/DiskUsageRequest.java | 847 +- .../opensearch/indices/DiskUsageResponse.java | 116 +- .../indices/ExistsAliasRequest.java | 624 +- .../indices/ExistsAliasResponse.java | 15 +- .../indices/ExistsIndexTemplateRequest.java | 385 +- .../indices/ExistsIndexTemplateResponse.java | 17 +- .../opensearch/indices/ExistsRequest.java | 633 +- .../opensearch/indices/ExistsResponse.java | 15 +- .../indices/ExistsTemplateRequest.java | 525 +- .../indices/ExistsTemplateResponse.java | 17 +- .../indices/FielddataFrequencyFilter.java | 261 +- .../opensearch/indices/FlushRequest.java | 618 +- .../opensearch/indices/FlushResponse.java | 81 +- .../opensearch/indices/ForcemergeRequest.java | 660 +- .../indices/ForcemergeResponse.java | 81 +- .../opensearch/indices/GetAliasRequest.java | 649 +- .../opensearch/indices/GetAliasResponse.java | 112 +- .../indices/GetDataStreamRequest.java | 78 +- .../indices/GetDataStreamResponse.java | 11 +- .../indices/GetFieldMappingRequest.java | 688 +- .../indices/GetFieldMappingResponse.java | 113 +- .../opensearch/indices/GetIndexRequest.java | 821 +- .../opensearch/indices/GetIndexResponse.java | 111 +- .../indices/GetIndexTemplateRequest.java | 524 +- .../indices/GetIndexTemplateResponse.java | 231 +- .../indices/GetIndicesSettingsRequest.java | 941 +- .../indices/GetIndicesSettingsResponse.java | 111 +- .../opensearch/indices/GetMappingRequest.java | 700 +- .../indices/GetMappingResponse.java | 116 +- .../indices/GetTemplateRequest.java | 536 +- .../indices/GetTemplateResponse.java | 110 +- .../opensearch/indices/GetUpgradeRequest.java | 218 +- .../indices/GetUpgradeResponse.java | 339 +- .../indices/IndexCheckOnStartup.java | 28 +- .../opensearch/indices/IndexRouting.java | 270 +- .../indices/IndexRoutingAllocation.java | 403 +- .../indices/IndexRoutingAllocationDisk.java | 138 +- .../IndexRoutingAllocationInclude.java | 240 +- ...IndexRoutingAllocationInitialRecovery.java | 144 +- .../IndexRoutingAllocationOptions.java | 30 +- .../indices/IndexRoutingRebalance.java | 126 +- .../indices/IndexRoutingRebalanceOptions.java | 30 +- .../opensearch/indices/IndexSegmentSort.java | 467 +- .../indices/IndexSettingBlocks.java | 413 +- .../opensearch/indices/IndexSettings.java | 3652 +++---- .../indices/IndexSettingsAnalysis.java | 676 +- .../indices/IndexSettingsMapping.java | 472 +- .../indices/IndexSettingsMappingLimit.java | 163 +- .../client/opensearch/indices/IndexState.java | 528 +- .../opensearch/indices/IndexVersioning.java | 125 +- .../indices/IndicesStatsRequest.java | 1157 ++- .../indices/IndicesStatsResponse.java | 359 +- .../opensearch/indices/NumericFielddata.java | 126 +- .../indices/NumericFielddataFormat.java | 25 +- .../opensearch/indices/OpenRequest.java | 778 +- .../opensearch/indices/OpenResponse.java | 127 +- .../indices/OpenSearchIndicesAsyncClient.java | 3740 +++---- .../indices/OpenSearchIndicesClient.java | 3613 +++---- .../indices/OverlappingIndexTemplate.java | 263 +- .../opensearch/indices/PutAliasRequest.java | 932 +- .../opensearch/indices/PutAliasResponse.java | 81 +- .../indices/PutIndexTemplateRequest.java | 794 +- .../indices/PutIndexTemplateResponse.java | 108 +- .../indices/PutIndicesSettingsRequest.java | 956 +- .../indices/PutIndicesSettingsResponse.java | 108 +- .../opensearch/indices/PutMappingRequest.java | 1823 ++-- .../indices/PutMappingResponse.java | 81 +- .../indices/PutTemplateRequest.java | 1193 +-- .../indices/PutTemplateResponse.java | 81 +- .../opensearch/indices/RecoveryRequest.java | 372 +- .../opensearch/indices/RecoveryResponse.java | 112 +- .../opensearch/indices/RefreshRequest.java | 476 +- .../opensearch/indices/RefreshResponse.java | 81 +- .../indices/ResolveIndexRequest.java | 327 +- .../indices/ResolveIndexResponse.java | 335 +- .../opensearch/indices/RolloverRequest.java | 1083 +- .../opensearch/indices/RolloverResponse.java | 423 +- .../indices/SegmentSortMissing.java | 24 +- .../opensearch/indices/SegmentSortMode.java | 24 +- .../opensearch/indices/SegmentSortOrder.java | 24 +- .../opensearch/indices/SegmentsRequest.java | 536 +- .../opensearch/indices/SegmentsResponse.java | 293 +- .../indices/ShardStoresRequest.java | 557 +- .../indices/ShardStoresResponse.java | 232 +- .../opensearch/indices/ShrinkRequest.java | 849 +- .../opensearch/indices/ShrinkResponse.java | 214 +- .../indices/SimulateIndexTemplateRequest.java | 1114 +- .../SimulateIndexTemplateResponse.java | 17 +- .../indices/SimulateTemplateRequest.java | 593 +- .../indices/SimulateTemplateResponse.java | 140 +- .../opensearch/indices/SoftDeletes.java | 125 +- .../opensearch/indices/SplitRequest.java | 847 +- .../opensearch/indices/SplitResponse.java | 214 +- .../opensearch/indices/TemplateMapping.java | 577 +- .../client/opensearch/indices/Translog.java | 12 +- .../indices/UpdateAliasesRequest.java | 545 +- .../indices/UpdateAliasesResponse.java | 81 +- .../opensearch/indices/UpgradeRequest.java | 578 +- .../opensearch/indices/UpgradeResponse.java | 81 +- .../indices/ValidateQueryRequest.java | 1175 +-- .../indices/ValidateQueryResponse.java | 403 +- .../add_block/IndicesBlockOptions.java | 29 +- .../indices/add_block/IndicesBlockStatus.java | 166 +- .../indices/analyze/AnalyzeDetail.java | 530 +- .../indices/analyze/AnalyzeToken.java | 397 +- .../indices/analyze/AnalyzerDetail.java | 275 +- .../indices/analyze/CharFilterDetail.java | 256 +- .../indices/analyze/ExplainAnalyzeToken.java | 551 +- .../indices/analyze/TokenDetail.java | 275 +- .../indices/close/CloseIndexResult.java | 281 +- .../indices/close/CloseShardResult.java | 228 +- .../indices/get_alias/IndexAliases.java | 230 +- .../get_field_mapping/TypeFieldMappings.java | 232 +- .../get_index_template/IndexTemplate.java | 726 +- .../get_index_template/IndexTemplateItem.java | 228 +- .../IndexTemplateSummary.java | 396 +- .../get_mapping/IndexMappingRecord.java | 257 +- .../IndexTemplateMapping.java | 382 +- .../indices/recovery/FileDetails.java | 261 +- .../indices/recovery/RecoveryBytes.java | 604 +- .../indices/recovery/RecoveryFiles.java | 400 +- .../indices/recovery/RecoveryIndexStatus.java | 693 +- .../indices/recovery/RecoveryOrigin.java | 819 +- .../indices/recovery/RecoveryStartStatus.java | 167 +- .../indices/recovery/RecoveryStatus.java | 227 +- .../indices/recovery/ShardRecovery.java | 1001 +- .../indices/recovery/TranslogStatus.java | 395 +- .../indices/recovery/VerifyIndex.java | 358 +- .../resolve_index/ResolveIndexAliasItem.java | 257 +- .../resolve_index/ResolveIndexItem.java | 390 +- .../rollover/IndexRolloverMapping.java | 261 +- .../IndexRolloverMappingBuilders.java | 19 +- .../indices/rollover/RolloverConditions.java | 371 +- .../indices/segments/IndexSegment.java | 231 +- .../opensearch/indices/segments/Segment.java | 632 +- .../indices/segments/ShardSegmentRouting.java | 261 +- .../indices/segments/ShardsSegment.java | 370 +- .../shard_stores/IndicesShardStores.java | 230 +- .../indices/shard_stores/ShardStore.java | 548 +- .../shard_stores/ShardStoreAllocation.java | 27 +- .../shard_stores/ShardStoreException.java | 167 +- .../shard_stores/ShardStoreStatus.java | 52 +- .../shard_stores/ShardStoreWrapper.java | 227 +- .../simulate_template/Overlapping.java | 257 +- .../indices/simulate_template/Template.java | 474 +- .../opensearch/indices/stats/IndexStats.java | 1648 +-- .../indices/stats/IndicesStats.java | 407 +- .../opensearch/indices/stats/ShardCommit.java | 338 +- .../indices/stats/ShardFileSizeInfo.java | 451 +- .../opensearch/indices/stats/ShardLease.java | 293 +- .../opensearch/indices/stats/ShardPath.java | 261 +- .../indices/stats/ShardQueryCache.java | 430 +- .../indices/stats/ShardRetentionLeases.java | 315 +- .../indices/stats/ShardRouting.java | 311 +- .../indices/stats/ShardRoutingState.java | 28 +- .../indices/stats/ShardSequenceNumber.java | 261 +- .../opensearch/indices/stats/ShardStats.java | 1415 ++- .../indices/stats/ShardsTotalStats.java | 125 +- .../indices/update_aliases/Action.java | 359 +- .../update_aliases/ActionBuilders.java | 47 +- .../indices/update_aliases/ActionVariant.java | 8 +- .../indices/update_aliases/AddAction.java | 799 +- .../indices/update_aliases/RemoveAction.java | 493 +- .../update_aliases/RemoveIndexAction.java | 288 +- .../IndicesValidationExplanation.java | 327 +- .../opensearch/ingest/AppendProcessor.java | 329 +- .../ingest/AttachmentProcessor.java | 566 +- .../opensearch/ingest/BytesProcessor.java | 301 +- .../opensearch/ingest/CircleProcessor.java | 351 +- .../opensearch/ingest/ConvertProcessor.java | 327 +- .../client/opensearch/ingest/ConvertType.java | 34 +- .../opensearch/ingest/CsvProcessor.java | 598 +- .../ingest/DateIndexNameProcessor.java | 533 +- .../opensearch/ingest/DateProcessor.java | 444 +- .../ingest/DeletePipelineRequest.java | 447 +- .../ingest/DeletePipelineResponse.java | 83 +- .../opensearch/ingest/DissectProcessor.java | 311 +- .../ingest/DotExpanderProcessor.java | 243 +- .../opensearch/ingest/DropProcessor.java | 118 +- .../opensearch/ingest/FailProcessor.java | 179 +- .../opensearch/ingest/ForeachProcessor.java | 303 +- .../opensearch/ingest/GeoIpProcessor.java | 444 +- .../opensearch/ingest/GeoIpStatsRequest.java | 54 +- .../opensearch/ingest/GeoIpStatsResponse.java | 324 +- .../opensearch/ingest/GetPipelineRequest.java | 448 +- .../ingest/GetPipelineResponse.java | 110 +- .../opensearch/ingest/GrokProcessor.java | 484 +- .../opensearch/ingest/GsubProcessor.java | 375 +- .../opensearch/ingest/InferenceConfig.java | 151 +- .../ingest/InferenceConfigRegression.java | 126 +- .../opensearch/ingest/InferenceProcessor.java | 383 +- .../opensearch/ingest/JoinProcessor.java | 285 +- .../opensearch/ingest/JsonProcessor.java | 271 +- .../opensearch/ingest/KeyValueProcessor.java | 806 +- .../opensearch/ingest/LowercaseProcessor.java | 301 +- .../ingest/OpenSearchIngestAsyncClient.java | 389 +- .../ingest/OpenSearchIngestClient.java | 375 +- .../client/opensearch/ingest/Pipeline.java | 451 +- .../opensearch/ingest/PipelineProcessor.java | 181 +- .../client/opensearch/ingest/Processor.java | 2080 ++-- .../opensearch/ingest/ProcessorBase.java | 355 +- .../opensearch/ingest/ProcessorBuilders.java | 525 +- .../ingest/ProcessorGrokRequest.java | 54 +- .../ingest/ProcessorGrokResponse.java | 211 +- .../opensearch/ingest/ProcessorVariant.java | 8 +- .../opensearch/ingest/PutPipelineRequest.java | 968 +- .../ingest/PutPipelineResponse.java | 81 +- .../opensearch/ingest/RemoveProcessor.java | 283 +- .../opensearch/ingest/RenameProcessor.java | 289 +- .../opensearch/ingest/SetProcessor.java | 287 +- .../ingest/SetSecurityUserProcessor.java | 277 +- .../client/opensearch/ingest/ShapeType.java | 24 +- .../opensearch/ingest/SimulateRequest.java | 529 +- .../opensearch/ingest/SimulateResponse.java | 228 +- .../opensearch/ingest/SortProcessor.java | 275 +- .../opensearch/ingest/SplitProcessor.java | 405 +- .../opensearch/ingest/TrimProcessor.java | 299 +- .../opensearch/ingest/UppercaseProcessor.java | 301 +- .../opensearch/ingest/UrlDecodeProcessor.java | 301 +- .../opensearch/ingest/UserAgentProcessor.java | 397 +- .../opensearch/ingest/UserAgentProperty.java | 40 +- .../geo_ip_stats/GeoIpDownloadStatistics.java | 393 +- .../geo_ip_stats/GeoIpNodeDatabaseName.java | 133 +- .../geo_ip_stats/GeoIpNodeDatabases.java | 355 +- .../opensearch/ingest/simulate/Document.java | 284 +- .../ingest/simulate/DocumentSimulation.java | 544 +- .../opensearch/ingest/simulate/Ingest.java | 228 +- .../ingest/simulate/PipelineSimulation.java | 478 +- .../opensearch/nodes/AdaptiveSelection.java | 337 +- .../client/opensearch/nodes/Breaker.java | 379 +- .../client/opensearch/nodes/Cpu.java | 608 +- .../opensearch/nodes/DataPathStats.java | 379 +- .../opensearch/nodes/ExtendedMemoryStats.java | 212 +- .../client/opensearch/nodes/FileSystem.java | 335 +- .../opensearch/nodes/FileSystemTotal.java | 219 +- .../opensearch/nodes/GarbageCollector.java | 231 +- .../nodes/GarbageCollectorTotal.java | 168 +- .../opensearch/nodes/HotThreadsRequest.java | 930 +- .../opensearch/nodes/HotThreadsResponse.java | 229 +- .../client/opensearch/nodes/Http.java | 160 +- .../client/opensearch/nodes/Ingest.java | 289 +- .../client/opensearch/nodes/IngestTotal.java | 293 +- .../client/opensearch/nodes/Jvm.java | 556 +- .../client/opensearch/nodes/JvmClasses.java | 260 +- .../client/opensearch/nodes/JvmThreads.java | 167 +- .../opensearch/nodes/KeyedProcessor.java | 229 +- .../client/opensearch/nodes/MemoryStats.java | 654 +- .../opensearch/nodes/NodeBufferPool.java | 262 +- .../opensearch/nodes/NodesInfoRequest.java | 691 +- .../opensearch/nodes/NodesInfoResponse.java | 278 +- .../opensearch/nodes/NodesResponseBase.java | 150 +- .../opensearch/nodes/NodesStatsRequest.java | 1379 ++- .../opensearch/nodes/NodesStatsResponse.java | 275 +- .../opensearch/nodes/NodesUsageRequest.java | 461 +- .../opensearch/nodes/NodesUsageResponse.java | 278 +- .../nodes/OpenSearchNodesAsyncClient.java | 475 +- .../nodes/OpenSearchNodesClient.java | 448 +- .../opensearch/nodes/OperatingSystem.java | 335 +- .../client/opensearch/nodes/Process.java | 326 +- .../nodes/ReloadSecureSettingsRequest.java | 457 +- .../nodes/ReloadSecureSettingsResponse.java | 278 +- .../client/opensearch/nodes/Scripting.java | 167 +- .../client/opensearch/nodes/Stats.java | 1378 ++- .../client/opensearch/nodes/ThreadCount.java | 379 +- .../client/opensearch/nodes/Transport.java | 337 +- .../nodes/hot_threads/HotThread.java | 374 +- .../opensearch/nodes/info/NodeInfo.java | 1782 ++-- .../opensearch/nodes/info/NodeInfoAction.java | 125 +- .../nodes/info/NodeInfoAggregation.java | 208 +- .../nodes/info/NodeInfoBootstrap.java | 124 +- .../opensearch/nodes/info/NodeInfoClient.java | 124 +- .../nodes/info/NodeInfoDiscover.java | 174 +- .../opensearch/nodes/info/NodeInfoHttp.java | 354 +- .../opensearch/nodes/info/NodeInfoIngest.java | 228 +- .../nodes/info/NodeInfoIngestDownloader.java | 125 +- .../nodes/info/NodeInfoIngestInfo.java | 138 +- .../nodes/info/NodeInfoIngestProcessor.java | 125 +- .../nodes/info/NodeInfoJvmMemory.java | 650 +- .../opensearch/nodes/info/NodeInfoMemory.java | 166 +- .../nodes/info/NodeInfoNetwork.java | 229 +- .../nodes/info/NodeInfoNetworkInterface.java | 261 +- .../opensearch/nodes/info/NodeInfoOSCPU.java | 480 +- .../opensearch/nodes/info/NodeInfoPath.java | 378 +- .../nodes/info/NodeInfoRepositories.java | 137 +- .../nodes/info/NodeInfoRepositoriesUrl.java | 125 +- .../opensearch/nodes/info/NodeInfoScript.java | 229 +- .../opensearch/nodes/info/NodeInfoSearch.java | 137 +- .../nodes/info/NodeInfoSearchRemote.java | 124 +- .../nodes/info/NodeInfoSettings.java | 1076 +- .../nodes/info/NodeInfoSettingsCluster.java | 453 +- .../info/NodeInfoSettingsClusterElection.java | 126 +- .../nodes/info/NodeInfoSettingsHttp.java | 349 +- .../nodes/info/NodeInfoSettingsHttpType.java | 127 +- .../nodes/info/NodeInfoSettingsIngest.java | 2381 +++-- .../nodes/info/NodeInfoSettingsNetwork.java | 125 +- .../nodes/info/NodeInfoSettingsNode.java | 322 +- .../nodes/info/NodeInfoSettingsTransport.java | 244 +- .../info/NodeInfoSettingsTransportType.java | 127 +- .../nodes/info/NodeInfoTransport.java | 342 +- .../opensearch/nodes/info/NodeJvmInfo.java | 892 +- .../nodes/info/NodeOperatingSystemInfo.java | 743 +- .../nodes/info/NodeProcessInfo.java | 291 +- .../nodes/info/NodeThreadPoolInfo.java | 448 +- .../NodeReloadError.java | 244 +- .../NodeReloadResult.java | 240 +- .../NodeReloadResultBuilders.java | 35 +- .../opensearch/nodes/usage/NodeUsage.java | 377 +- .../shutdown/DeleteNodeRequest.java | 197 +- .../shutdown/DeleteNodeResponse.java | 81 +- .../opensearch/shutdown/GetNodeRequest.java | 247 +- .../opensearch/shutdown/GetNodeResponse.java | 229 +- .../OpenSearchShutdownAsyncClient.java | 276 +- .../shutdown/OpenSearchShutdownClient.java | 261 +- .../opensearch/shutdown/PutNodeRequest.java | 197 +- .../opensearch/shutdown/PutNodeResponse.java | 81 +- .../shutdown/get_node/NodeShutdownStatus.java | 533 +- .../get_node/PersistentTaskStatus.java | 125 +- .../shutdown/get_node/PluginsStatus.java | 125 +- .../get_node/ShardMigrationStatus.java | 125 +- .../shutdown/get_node/ShutdownStatus.java | 27 +- .../shutdown/get_node/ShutdownType.java | 23 +- .../snapshot/CleanupRepositoryRequest.java | 447 +- .../snapshot/CleanupRepositoryResponse.java | 141 +- .../snapshot/CloneSnapshotRequest.java | 652 +- .../snapshot/CloneSnapshotResponse.java | 81 +- .../snapshot/CreateRepositoryRequest.java | 749 +- .../snapshot/CreateRepositoryResponse.java | 108 +- .../snapshot/CreateSnapshotRequest.java | 1156 +-- .../snapshot/CreateSnapshotResponse.java | 241 +- .../snapshot/DeleteRepositoryRequest.java | 481 +- .../snapshot/DeleteRepositoryResponse.java | 108 +- .../snapshot/DeleteSnapshotRequest.java | 417 +- .../snapshot/DeleteSnapshotResponse.java | 82 +- .../snapshot/FileCountSnapshotStats.java | 167 +- .../snapshot/GetRepositoryRequest.java | 474 +- .../snapshot/GetRepositoryResponse.java | 110 +- .../snapshot/GetSnapshotRequest.java | 832 +- .../snapshot/GetSnapshotResponse.java | 463 +- .../opensearch/snapshot/IndexDetails.java | 311 +- .../opensearch/snapshot/InfoFeatureState.java | 257 +- .../OpenSearchSnapshotAsyncClient.java | 822 +- .../snapshot/OpenSearchSnapshotClient.java | 795 +- .../opensearch/snapshot/Repository.java | 288 +- .../snapshot/RepositorySettings.java | 402 +- .../opensearch/snapshot/RestoreRequest.java | 1154 +-- .../opensearch/snapshot/RestoreResponse.java | 139 +- .../opensearch/snapshot/ShardsStats.java | 378 +- .../opensearch/snapshot/ShardsStatsStage.java | 69 +- .../snapshot/ShardsStatsSummary.java | 321 +- .../snapshot/ShardsStatsSummaryItem.java | 167 +- .../snapshot/SnapshotIndexStats.java | 351 +- .../opensearch/snapshot/SnapshotInfo.java | 1591 ++- .../snapshot/SnapshotShardFailure.java | 336 +- .../snapshot/SnapshotShardsStatus.java | 227 +- .../opensearch/snapshot/SnapshotStats.java | 322 +- .../snapshot/SnapshotStatusRequest.java | 560 +- .../snapshot/SnapshotStatusResponse.java | 227 +- .../client/opensearch/snapshot/Status.java | 580 +- .../snapshot/VerifyRepositoryRequest.java | 445 +- .../snapshot/VerifyRepositoryResponse.java | 231 +- .../CleanupRepositoryResults.java | 167 +- .../snapshot/get/SnapshotResponseItem.java | 353 +- .../snapshot/restore/SnapshotRestore.java | 319 +- .../verify_repository/CompactNodeInfo.java | 124 +- .../opensearch/tasks/CancelRequest.java | 538 +- .../opensearch/tasks/CancelResponse.java | 343 +- .../opensearch/tasks/GetTasksRequest.java | 337 +- .../opensearch/tasks/GetTasksResponse.java | 366 +- .../client/opensearch/tasks/GroupBy.java | 25 +- .../client/opensearch/tasks/Info.java | 861 +- .../client/opensearch/tasks/ListRequest.java | 637 +- .../client/opensearch/tasks/ListResponse.java | 478 +- .../tasks/OpenSearchTasksAsyncClient.java | 268 +- .../tasks/OpenSearchTasksClient.java | 262 +- .../client/opensearch/tasks/State.java | 756 +- .../client/opensearch/tasks/Status.java | 1044 +- .../opensearch/tasks/TaskExecutingNode.java | 228 +- .../opensearch/watcher/HourAndMinute.java | 295 +- .../client/opensearch/watcher/TimeOfDay.java | 244 +- .../opensearch/watcher/TimeOfDayBuilders.java | 19 +- .../opensearch/client/transport/Endpoint.java | 67 +- .../client/transport/Transport.java | 7 +- .../client/transport/TransportException.java | 1 - .../client/transport/TransportHeaders.java | 3 +- .../client/transport/TransportOptions.java | 14 +- .../opensearch/client/transport/Version.java | 16 +- .../aws/AsyncByteArrayContentPublisher.java | 7 +- .../aws/AsyncCapturingResponseHandler.java | 7 +- .../aws/AsyncCapturingSubscriber.java | 5 +- .../transport/aws/AwsSdk2Transport.java | 236 +- .../aws/AwsSdk2TransportOptions.java | 8 +- .../transport/endpoints/BooleanEndpoint.java | 6 +- .../endpoints/DelegatingJsonEndpoint.java | 5 +- .../endpoints/DictionaryResponse.java | 29 +- .../EndpointWithResponseMapperAttr.java | 5 +- .../transport/endpoints/SimpleEndpoint.java | 26 +- .../httpclient5/ApacheHttpClient5Options.java | 50 +- .../ApacheHttpClient5Transport.java | 157 +- .../ApacheHttpClient5TransportBuilder.java | 29 +- .../HttpAsyncResponseConsumerFactory.java | 3 +- .../transport/httpclient5/Response.java | 11 +- .../httpclient5/ResponseException.java | 5 +- .../HeapBufferedAsyncEntityConsumer.java | 7 +- .../HeapBufferedAsyncResponseConsumer.java | 3 +- .../HttpEntityAsyncEntityProducer.java | 13 +- .../transport/httpclient5/internal/Node.java | 3 +- .../rest_client/RestClientOptions.java | 28 +- .../rest_client/RestClientTransport.java | 87 +- .../client/util/ActionStatusOptions.java | 6 +- .../opensearch/client/util/ApiTypeHelper.java | 13 +- .../opensearch/client/util/ListBuilder.java | 2 +- .../opensearch/client/util/MapBuilder.java | 10 +- .../MissingRequiredPropertyException.java | 1 + .../opensearch/client/util/ObjectBuilder.java | 2 +- .../client/util/ObjectBuilderBase.java | 10 +- .../util/OpenSearchRequestBodyBuffer.java | 14 +- .../client/util/TaggedUnionUtils.java | 3 +- .../documentation/ApiConventionsTest.java | 17 +- .../client/documentation/ConnectingTest.java | 12 +- .../documentation/FailingTransport.java | 25 +- .../client/documentation/MigrateHlrcTest.java | 13 +- .../_types/mapping/KnnVectorMethodTest.java | 26 +- .../_types/mapping/KnnVectorPropertyTest.java | 27 +- .../core/DeleteByQueryRequestTest.java | 11 +- .../opensearch/core/ReindexRequestTest.java | 9 +- .../core/UpdateByQueryRequestTest.java | 11 +- .../opensearch/experiments/ClientTests.java | 115 +- .../opensearch/experiments/ParsingTests.java | 263 +- .../opensearch/experiments/api/Bar.java | 75 +- .../experiments/api/FooOptRequest.java | 418 +- .../experiments/api/FooRequest.java | 468 +- .../experiments/api/FooResponse.java | 2 +- .../experiments/api/query2/BoolQuery.java | 31 +- .../experiments/api/query2/Query.java | 14 +- .../experiments/api/query2/QueryTest.java | 3 +- .../experiments/api/query2/TermsQuery.java | 2 +- .../experiments/api/query2/Union2.java | 205 +- .../opensearch/experiments/base/Client.java | 28 +- .../experiments/base/PrimitiveUtils.java | 24 +- .../opensearch/experiments/base/Variants.java | 191 +- .../experiments/containers/SomeUnion.java | 14 +- .../experiments/containers/SomeUnionTest.java | 9 +- .../containers/SomeUnionVariant.java | 3 +- .../experiments/containers/UVariantA.java | 5 +- .../experiments/containers/UVariantB.java | 7 +- .../experiments/generics/GenericClass.java | 8 +- .../inheritance/InheritanceTest.java | 1 - .../inheritance/base/BaseClass.java | 9 +- .../inheritance/child/ChildClass.java | 14 +- .../inheritance/final_/FinalClass.java | 18 +- .../AbstractAggregationRequestIT.java | 457 +- .../integTest/AbstractCatClientIT.java | 92 +- .../integTest/AbstractClusterClientIT.java | 135 +- .../opensearch/integTest/AbstractCrudIT.java | 249 +- .../integTest/AbstractHighlightIT.java | 81 +- .../integTest/AbstractIndicesClientIT.java | 51 +- .../opensearch/integTest/AbstractKnnIT.java | 77 +- .../AbstractMultiSearchRequestIT.java | 708 +- .../opensearch/integTest/AbstractNodesIT.java | 1 - .../integTest/AbstractPingAndInfoIT.java | 7 +- .../integTest/AbstractRequestIT.java | 738 +- .../AbstractSearchTemplateRequestIT.java | 363 +- .../OpenSearchJavaClientTestCase.java | 48 +- .../integTest/OpenSearchTransportSupport.java | 5 +- .../integTest/aws/AwsSdk2BulkRequestIT.java | 37 +- .../integTest/aws/AwsSdk2SearchIT.java | 37 +- .../integTest/aws/AwsSdk2SecurityIT.java | 14 +- .../aws/AwsSdk2TransportTestCase.java | 142 +- .../httpclient5/AggregationRequestIT.java | 3 +- .../integTest/httpclient5/CatIT.java | 5 +- .../httpclient5/ClusterClientIT.java | 1 - .../integTest/httpclient5/CrudIT.java | 3 +- .../integTest/httpclient5/HighlightIT.java | 3 +- .../HttpClient5TransportSupport.java | 24 +- .../httpclient5/IndicesClientIT.java | 3 +- .../integTest/httpclient5/KnnIT.java | 3 +- .../httpclient5/MultiSearchRequestIT.java | 3 +- .../integTest/httpclient5/NodesIT.java | 3 +- .../integTest/httpclient5/PingAndInfoIT.java | 4 +- .../integTest/httpclient5/RequestIT.java | 3 +- .../httpclient5/SearchTemplateRequestIT.java | 3 +- .../restclient/AggregationRequestIT.java | 3 +- .../integTest/restclient/CatIT.java | 3 +- .../integTest/restclient/ClusterClientIT.java | 1 - .../integTest/restclient/CrudIT.java | 1 - .../integTest/restclient/HighlightIT.java | 3 +- .../integTest/restclient/IndicesClientIT.java | 1 - .../restclient/MultiSearchRequestIT.java | 11 +- .../integTest/restclient/NodesIT.java | 1 - .../integTest/restclient/PingAndInfoIT.java | 1 - .../integTest/restclient/RequestIT.java | 59 +- .../restclient/SearchTemplateRequestIT.java | 3 +- .../client/opensearch/json/JsonDataTest.java | 14 +- .../opensearch/json/JsonpMapperTest.java | 35 +- .../json/jackson/JacksonJsonpParserTest.java | 140 +- .../opensearch/model/BehaviorsTest.java | 58 +- .../opensearch/model/BuiltinTypesTest.java | 85 +- .../opensearch/model/ClassStructureTest.java | 105 +- .../client/opensearch/model/EndpointTest.java | 4 +- .../client/opensearch/model/EnumTest.java | 3 +- .../opensearch/model/ModelTestCase.java | 13 +- .../opensearch/model/RequestEncodingTest.java | 17 +- .../opensearch/model/SerializationTest.java | 44 +- .../opensearch/model/TypedKeysTest.java | 70 +- .../client/opensearch/model/UnionTests.java | 17 +- .../client/opensearch/model/VariantsTest.java | 154 +- .../client/transport/RequestOptionsTest.java | 42 +- .../HeapBufferedAsyncEntityConsumerTest.java | 15 +- samples/build.gradle.kts | 22 +- .../org/opensearch/client/samples/Bulk.java | 52 +- .../client/samples/DataStreamBasics.java | 13 +- .../client/samples/IndexingBasics.java | 40 +- .../client/samples/PointInTime.java | 33 +- .../client/samples/SampleClient.java | 47 +- .../org/opensearch/client/samples/Search.java | 175 +- .../client/samples/knn/KnnBasics.java | 34 +- .../client/samples/knn/KnnBooleanFilter.java | 58 +- .../samples/knn/KnnEfficientFilter.java | 131 +- .../client/samples/knn/KnnPainlessScript.java | 49 +- .../client/samples/knn/KnnScriptScore.java | 53 +- .../client/samples/util/IndexData.java | 3 +- .../client/samples/util/RandUtil.java | 2 +- 1660 files changed, 272379 insertions(+), 272548 deletions(-) delete mode 100644 .github/workflows/checkstyle.yml create mode 100644 buildSrc/formatterConfig.xml delete mode 100644 config/checkstyle/checkstyle.xml delete mode 100644 config/checkstyle/checkstyle_suppressions.xml delete mode 100644 config/checkstyle/header.java.txt diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml deleted file mode 100644 index eb0ea0b887..0000000000 --- a/.github/workflows/checkstyle.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Checkstyle - -on: [push, pull_request] - -jobs: - checkstyle: - runs-on: ubuntu-latest - strategy: - matrix: - java: [ 11 ] - steps: - - name: Checkout Java Client - uses: actions/checkout@v3 - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - cache: 'gradle' - - - name: Check style and license headers - run: | - ./gradlew checkstyleMain checkstyleTest diff --git a/CHANGELOG.md b/CHANGELOG.md index cb61a63a40..fda0392554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Changed - Moved "software.amazon.awssdk" dependencies to the compileOnly scope. ([#628](https://github.com/opensearch-project/opensearch-java/pull/628)) +- Migrated from checkstyle to spotless ([#648](https://github.com/opensearch-project/opensearch-java/pull/648)) ### Deprecated diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index c90e138b40..6969aba856 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -97,11 +97,28 @@ Follow links in the [Java Tutorial](https://code.visualstudio.com/docs/java/java ## Java Language Formatting Guidelines -Java files in the opensearch-java codebase are formatted with the [checkstyle plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html). This plugin is configured using [checkstyle.xml](config/checkstyle/checkstyle.xml). To run the formatting checks: +Java files in the OpenSearch codebase are formatted with the Eclipse JDT formatter, using the [Spotless Gradle](https://github.com/diffplug/spotless/tree/master/plugin-gradle) plugin. This plugin is configured on a project-by-project basis, via `build.gradle.kts`. So long as at least one project is configured, the formatting check can be run explicitly with: -``` -./gradlew checkstyleMain checkstyleTest -``` + ./gradlew spotlessJavaCheck + +The code can be formatted with: + + ./gradlew spotlessApply + +These tasks can also be run for specific subprojects, e.g. + + ./gradlew :java-client:spotlessJavaCheck + ./gradlew :samples:spotlessJavaCheck + +Please follow these formatting guidelines: + +* Java indent is 4 spaces +* Line width is 140 characters +* Lines of code surrounded by `// tag::NAME` and `// end::NAME` comments are included in the documentation and should only be 76 characters wide not counting leading indentation. Such regions of code are not formatted automatically as it is not possible to change the line length rule of the formatter for part of a file. Please format such sections sympathetically with the rest of the code, while keeping lines to maximum length of 76 characters. +* Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause the build to fail. +* If *absolutely* necessary, you can disable formatting for regions of code with the `// tag::NAME` and `// end::NAME` directives, but note that these are intended for use in documentation, so please make it clear what you have done, and only do this where the benefit clearly outweighs the decrease in consistency. +* Note that JavaDoc and block comments i.e. `/* ... */` are not formatted, but line comments i.e `// ...` are. +* There is an implicit rule that negative boolean expressions should use the form `foo == false` instead of `!foo` for better readability of the code. While this isn't strictly enforced, if might get called out in PR reviews as something to change. ## Submitting Changes diff --git a/README.md b/README.md index 1c73fe5a95..84206a71d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Checkstyle](https://github.com/opensearch-project/opensearch-java/actions/workflows/checkstyle.yml/badge.svg?branch=main)](https://github.com/opensearch-project/opensearch-java/actions/workflows/checkstyle.yml) [![Build](https://github.com/opensearch-project/opensearch-java/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/opensearch-project/opensearch-java/actions/workflows/build.yml) [![Integration Tests](https://github.com/opensearch-project/opensearch-java/actions/workflows/test-integration.yml/badge.svg?branch=main)](https://github.com/opensearch-project/opensearch-java/actions/workflows/test-integration.yml) ![Maven Central](https://img.shields.io/maven-central/v/org.opensearch.client/opensearch-java) diff --git a/build.gradle.kts b/build.gradle.kts index df7f0dc13b..7779a42fd3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,8 +42,6 @@ allprojects { mavenCentral() maven(url = "https://plugins.gradle.org/m2/") } - - apply(plugin = "checkstyle") } // Find git information. diff --git a/buildSrc/formatterConfig.xml b/buildSrc/formatterConfig.xml new file mode 100644 index 0000000000..425f9acfea --- /dev/null +++ b/buildSrc/formatterConfig.xml @@ -0,0 +1,362 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml deleted file mode 100644 index 7739883f14..0000000000 --- a/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/checkstyle/checkstyle_suppressions.xml b/config/checkstyle/checkstyle_suppressions.xml deleted file mode 100644 index edfa8870aa..0000000000 --- a/config/checkstyle/checkstyle_suppressions.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/config/checkstyle/header.java.txt b/config/checkstyle/header.java.txt deleted file mode 100644 index b5b39ea4ed..0000000000 --- a/config/checkstyle/header.java.txt +++ /dev/null @@ -1,7 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index ba555bf000..8f85f84a8d 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -46,10 +46,10 @@ buildscript { plugins { java `java-library` - checkstyle `maven-publish` id("com.github.jk1.dependency-license-report") version "2.5" id("org.owasp.dependencycheck") version "8.4.0" + id("com.diffplug.spotless") version "6.22.0" } apply(plugin = "org.owasp.dependencycheck") @@ -60,10 +60,6 @@ configurations { } } -checkstyle { - toolVersion = "10.12.3" -} - java { targetCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11 @@ -113,6 +109,10 @@ tasks.withType { } } +tasks.build { + dependsOn("spotlessJavaCheck") +} + tasks.test { systemProperty("tests.security.manager", "false") @@ -265,6 +265,22 @@ tasks.withType { } } +spotless { + java { + + target("**/*.java") + + // Use the default importOrder configuration + importOrder() + removeUnusedImports() + + eclipse().configFile("../buildSrc/formatterConfig.xml") + + trimTrailingWhitespace() + endWithNewline() + } +} + publishing { repositories{ if (version.toString().endsWith("SNAPSHOT")) { diff --git a/java-client/src/main/java/org/opensearch/client/ApiClient.java b/java-client/src/main/java/org/opensearch/client/ApiClient.java index 1938dea4bb..327fc235ec 100644 --- a/java-client/src/main/java/org/opensearch/client/ApiClient.java +++ b/java-client/src/main/java/org/opensearch/client/ApiClient.java @@ -32,12 +32,11 @@ package org.opensearch.client; -import org.opensearch.client.transport.TransportOptions; -import org.opensearch.client.transport.Transport; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapperBase; - -import javax.annotation.Nullable; +import org.opensearch.client.transport.Transport; +import org.opensearch.client.transport.TransportOptions; public abstract class ApiClient> { diff --git a/java-client/src/main/java/org/opensearch/client/json/AttributedJsonpMapper.java b/java-client/src/main/java/org/opensearch/client/json/AttributedJsonpMapper.java index 92eb9d0b8f..baf834324a 100644 --- a/java-client/src/main/java/org/opensearch/client/json/AttributedJsonpMapper.java +++ b/java-client/src/main/java/org/opensearch/client/json/AttributedJsonpMapper.java @@ -72,7 +72,7 @@ public boolean ignoreUnknownFields() { @SuppressWarnings("unchecked") public T attribute(String name) { if (this.name.equals(name)) { - return (T)this.value; + return (T) this.value; } else { return mapper.attribute(name); } diff --git a/java-client/src/main/java/org/opensearch/client/json/BuildFunctionDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/BuildFunctionDeserializer.java index 677fb94098..aeb22671c2 100644 --- a/java-client/src/main/java/org/opensearch/client/json/BuildFunctionDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/BuildFunctionDeserializer.java @@ -33,7 +33,6 @@ package org.opensearch.client.json; import jakarta.json.stream.JsonParser; - import java.util.function.Function; /** diff --git a/java-client/src/main/java/org/opensearch/client/json/DelegatingDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/DelegatingDeserializer.java index 84e96ef5dd..1cf864be7b 100644 --- a/java-client/src/main/java/org/opensearch/client/json/DelegatingDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/DelegatingDeserializer.java @@ -33,7 +33,6 @@ package org.opensearch.client.json; import jakarta.json.stream.JsonParser; - import java.util.EnumSet; public abstract class DelegatingDeserializer implements JsonpDeserializer { @@ -68,7 +67,7 @@ public T deserialize(JsonParser parser, JsonpMapper mapper, JsonParser.Event eve */ public static JsonpDeserializer unwrap(JsonpDeserializer deserializer) { while (deserializer instanceof DelegatingDeserializer) { - deserializer = ((DelegatingDeserializer) deserializer).unwrap(); + deserializer = ((DelegatingDeserializer) deserializer).unwrap(); } return deserializer; } diff --git a/java-client/src/main/java/org/opensearch/client/json/DelegatingJsonParser.java b/java-client/src/main/java/org/opensearch/client/json/DelegatingJsonParser.java index b34606e20a..c1b5b5c303 100644 --- a/java-client/src/main/java/org/opensearch/client/json/DelegatingJsonParser.java +++ b/java-client/src/main/java/org/opensearch/client/json/DelegatingJsonParser.java @@ -37,7 +37,6 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonLocation; import jakarta.json.stream.JsonParser; - import java.math.BigDecimal; import java.util.Map; import java.util.stream.Stream; @@ -134,4 +133,4 @@ public void skipObject() { public void close() { parser.close(); } -} \ No newline at end of file +} diff --git a/java-client/src/main/java/org/opensearch/client/json/ExternallyTaggedUnion.java b/java-client/src/main/java/org/opensearch/client/json/ExternallyTaggedUnion.java index 94627156e8..2878c7e127 100644 --- a/java-client/src/main/java/org/opensearch/client/json/ExternallyTaggedUnion.java +++ b/java-client/src/main/java/org/opensearch/client/json/ExternallyTaggedUnion.java @@ -32,13 +32,11 @@ package org.opensearch.client.json; -import org.opensearch.client.util.TaggedUnion; - +import static jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; - import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; @@ -46,10 +44,8 @@ import java.util.Map; import java.util.function.BiFunction; import java.util.function.Function; - import javax.annotation.Nullable; - -import static jakarta.json.stream.JsonParser.Event; +import org.opensearch.client.util.TaggedUnion; /** * Utilities for union types whose discriminant is not directly part of the structure, either as an enclosing property name or as @@ -71,15 +67,17 @@ public static class Deserializer, Member> { @Nullable private final BiFunction unKnownUnionCtor; - public Deserializer(Map> deserializers, - Function unionCtor) { + public Deserializer(Map> deserializers, Function unionCtor) { this.deserializers = deserializers; this.unionCtor = unionCtor; this.unKnownUnionCtor = null; } - - public Deserializer(Map> deserializers, - Function unionCtor, BiFunction unKnownUnionCtor) { + + public Deserializer( + Map> deserializers, + Function unionCtor, + BiFunction unKnownUnionCtor + ) { this.deserializers = deserializers; this.unionCtor = unionCtor; this.unKnownUnionCtor = unKnownUnionCtor; @@ -127,9 +125,9 @@ public void deserializeEntry(String key, JsonParser parser, JsonpMapper mapper, int hashPos = key.indexOf('#'); if (hashPos == -1) { throw new JsonParsingException( - "Property name '" + key - + "' is not in the 'type#name' format. Make sure the request has 'typed_keys' set.", - parser.getLocation()); + "Property name '" + key + "' is not in the 'type#name' format. Make sure the request has 'typed_keys' set.", + parser.getLocation() + ); } String type = key.substring(0, hashPos); @@ -138,43 +136,44 @@ public void deserializeEntry(String key, JsonParser parser, JsonpMapper mapper, targetMap.put(name, deserializer.deserialize(type, parser, mapper, parser.next())); } } - + public static > JsonpDeserializer>> arrayDeserializer( - TypedKeysDeserializer deserializer) { - return JsonpDeserializer.of( - EnumSet.of(Event.START_OBJECT), - (parser, mapper, event) -> { - Map> result = new HashMap<>(); - String key = null; - while ((event = parser.next()) != Event.END_OBJECT) { - JsonpUtils.expectEvent(parser, event, Event.KEY_NAME); - // Split key and type - key = parser.getString(); - int hashPos = key.indexOf('#'); - - String type = key.substring(0, hashPos); - String name = key.substring(hashPos + 1); - - List list = new ArrayList<>(); - JsonpUtils.expectNextEvent(parser, Event.START_ARRAY); - try { - while ((event = parser.next()) != Event.END_ARRAY) { - list.add(deserializer.deserializer.deserialize(type, parser, mapper, event)); - } - } catch (Exception e) { - throw e; - } - result.put(name, list); - } - return result; - }); + TypedKeysDeserializer deserializer + ) { + return JsonpDeserializer.of(EnumSet.of(Event.START_OBJECT), (parser, mapper, event) -> { + Map> result = new HashMap<>(); + String key = null; + while ((event = parser.next()) != Event.END_OBJECT) { + JsonpUtils.expectEvent(parser, event, Event.KEY_NAME); + // Split key and type + key = parser.getString(); + int hashPos = key.indexOf('#'); + + String type = key.substring(0, hashPos); + String name = key.substring(hashPos + 1); + + List list = new ArrayList<>(); + JsonpUtils.expectNextEvent(parser, Event.START_ARRAY); + try { + while ((event = parser.next()) != Event.END_ARRAY) { + list.add(deserializer.deserializer.deserialize(type, parser, mapper, event)); + } + } catch (Exception e) { + throw e; + } + result.put(name, list); + } + return result; + }); } /** * Serialize an externally tagged union using the typed keys encoding. */ public static > void serializeTypedKeys( - Map map, JsonGenerator generator, JsonpMapper mapper + Map map, + JsonGenerator generator, + JsonpMapper mapper ) { generator.writeStartObject(); serializeTypedKeysInner(map, generator, mapper); @@ -185,9 +184,11 @@ public void deserializeEntry(String key, JsonParser parser, JsonpMapper mapper, * Serialize an externally tagged union using the typed keys encoding, without the enclosing start/end object. */ public static > void serializeTypedKeysInner( - Map map, JsonGenerator generator, JsonpMapper mapper + Map map, + JsonGenerator generator, + JsonpMapper mapper ) { - for (Map.Entry entry: map.entrySet()) { + for (Map.Entry entry : map.entrySet()) { T value = entry.getValue(); generator.writeKey(value._kind().jsonValue() + "#" + entry.getKey()); value.serialize(generator, mapper); diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonData.java b/java-client/src/main/java/org/opensearch/client/json/JsonData.java index 3e2e95748e..ad907650bb 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonData.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonData.java @@ -34,7 +34,6 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonParser; - import java.util.EnumSet; /** @@ -71,19 +70,19 @@ public interface JsonData extends JsonpSerializable { /** * Converts this object to a target class. */ - T to(Class clazz, JsonpMapper mapper); + T to(Class clazz, JsonpMapper mapper); /** * Converts this object using a deserializer. A mapper must have been provided at creation time. * * @throws IllegalStateException if no mapper was provided at creation time. */ - T deserialize(JsonpDeserializer deserializer); + T deserialize(JsonpDeserializer deserializer); /** * Converts this object using a deserializer. */ - T deserialize(JsonpDeserializer deserializer, JsonpMapper mapper); + T deserialize(JsonpDeserializer deserializer, JsonpMapper mapper); /** * Creates a raw JSON value from an existing object. A mapper will be needed to convert the result. @@ -109,7 +108,5 @@ static JsonData from(JsonParser parser, JsonpMapper mapper) { return of(parser.getValue(), mapper); } - JsonpDeserializer _DESERIALIZER = JsonpDeserializer.of( - EnumSet.allOf(JsonParser.Event.class), JsonData::from - ); + JsonpDeserializer _DESERIALIZER = JsonpDeserializer.of(EnumSet.allOf(JsonParser.Event.class), JsonData::from); } diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java b/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java index 56c7c8d0d3..72c9e0235b 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonDataImpl.java @@ -35,7 +35,6 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; - import java.io.StringReader; import java.io.StringWriter; @@ -67,8 +66,9 @@ public JsonValue toJson(JsonpMapper mapper) { // Provided mapper has precedence over the one that was optionally set at creation time mapper = mapper != null ? mapper : this.mapper; if (mapper == null) { - throw new IllegalStateException("Contains a '" + value.getClass().getName() + - "' that cannot be converted to a JsonValue without a mapper"); + throw new IllegalStateException( + "Contains a '" + value.getClass().getName() + "' that cannot be converted to a JsonValue without a mapper" + ); } final JsonParser parser = getParser(mapper); diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonEnum.java b/java-client/src/main/java/org/opensearch/client/json/JsonEnum.java index ab63641594..0965041d7e 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonEnum.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonEnum.java @@ -35,12 +35,11 @@ import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; - -import javax.annotation.Nullable; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import java.util.NoSuchElementException; +import javax.annotation.Nullable; /** * Base interface for enumerations in API types. Members have a JSON representation and also accept diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializable.java b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializable.java index 5616c31a8b..dc05f477ca 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializable.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializable.java @@ -41,7 +41,7 @@ /** * Indicates that a class has a {@link JsonpDeserializer} as a static field. */ -@Target({ElementType.TYPE}) +@Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface JsonpDeserializable { diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializer.java index 3c12aa2884..e35079ffd7 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializer.java @@ -32,16 +32,15 @@ package org.opensearch.client.json; -import org.opensearch.client.util.TriFunction; import jakarta.json.JsonValue; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; - import java.util.EnumSet; import java.util.List; import java.util.Map; import java.util.function.BiFunction; import java.util.function.Supplier; +import org.opensearch.client.util.TriFunction; public interface JsonpDeserializer { @@ -98,13 +97,13 @@ default V deserialize(JsonParser parser, JsonpMapper mapper) { */ V deserialize(JsonParser parser, JsonpMapper mapper, Event event); - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- /** * Creates a deserializer for a class that delegates to the mapper provided to * {@link #deserialize(JsonParser, JsonpMapper)}. */ - static JsonpDeserializer of (Class clazz) { + static JsonpDeserializer of(Class clazz) { return new JsonpDeserializerBase(EnumSet.allOf(JsonParser.Event.class)) { @Override public T deserialize(JsonParser parser, JsonpMapper mapper) { @@ -145,7 +144,7 @@ static JsonpDeserializer lazy(Supplier> ctor) { return new LazyDeserializer<>(ctor); } - //----- Builtin types + // ----- Builtin types static JsonpDeserializer fixedValue(T value) { return new JsonpDeserializerBase(EnumSet.noneOf(Event.class)) { @@ -229,7 +228,8 @@ static JsonpDeserializer> stringMapDeserializer(JsonpDeserial } static JsonpDeserializer> enumMapDeserializer( - JsonpDeserializer keyDeserializer, JsonpDeserializer valueDeserializer + JsonpDeserializer keyDeserializer, + JsonpDeserializer valueDeserializer ) { return new JsonpDeserializerBase.EnumMapDeserializer(keyDeserializer, valueDeserializer); } diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializerBase.java b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializerBase.java index d706f8ec72..df405110eb 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializerBase.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonpDeserializerBase.java @@ -37,7 +37,6 @@ import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; @@ -65,14 +64,9 @@ protected JsonpDeserializerBase(EnumSet acceptedEvents, EnumSet na /** Combines accepted events from a number of deserializers */ protected static EnumSet allAcceptedEvents(JsonpDeserializer... deserializers) { EnumSet result = EnumSet.noneOf(Event.class); - for (JsonpDeserializer deserializer: deserializers) { + for (JsonpDeserializer deserializer : deserializers) { EnumSet set = deserializer.acceptedEvents(); - // Disabled for now. Only happens with the experimental Union2 and is caused by string and number - // parsers leniency. Need to be replaced with a check on a preferred event type. - //if (!Collections.disjoint(result, set)) { - // throw new IllegalArgumentException("Deserializer accepted events are not disjoint"); - //} result.addAll(set); } @@ -98,16 +92,14 @@ public final boolean accepts(Event event) { return acceptedEvents.contains(event); } - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - //----- Builtin types + // ----- Builtin types static final JsonpDeserializer STRING = // String parsing is lenient and accepts any other primitive type - new JsonpDeserializerBase(EnumSet.of( - Event.KEY_NAME, Event.VALUE_STRING, Event.VALUE_NUMBER, - Event.VALUE_FALSE, Event.VALUE_TRUE - ), + new JsonpDeserializerBase( + EnumSet.of(Event.KEY_NAME, Event.VALUE_STRING, Event.VALUE_NUMBER, Event.VALUE_FALSE, Event.VALUE_TRUE), EnumSet.of(Event.VALUE_STRING) ) { @Override @@ -122,77 +114,72 @@ public String deserialize(JsonParser parser, JsonpMapper mapper, Event event) { } }; - static final JsonpDeserializer INTEGER = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_NUMBER) - ) { - @Override - public Integer deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Integer.valueOf(parser.getString()); - } - return parser.getInt(); + static final JsonpDeserializer INTEGER = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_NUMBER) + ) { + @Override + public Integer deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Integer.valueOf(parser.getString()); } - }; + return parser.getInt(); + } + }; - static final JsonpDeserializer BOOLEAN = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_FALSE, Event.VALUE_TRUE, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_FALSE, Event.VALUE_TRUE) - ) { - @Override - public Boolean deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Boolean.parseBoolean(parser.getString()); - } else { - return event == Event.VALUE_TRUE; - } + static final JsonpDeserializer BOOLEAN = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_FALSE, Event.VALUE_TRUE, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_FALSE, Event.VALUE_TRUE) + ) { + @Override + public Boolean deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Boolean.parseBoolean(parser.getString()); + } else { + return event == Event.VALUE_TRUE; } - }; + } + }; - static final JsonpDeserializer LONG = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_NUMBER) - ) { - @Override - public Long deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Long.valueOf(parser.getString()); - } - return parser.getLong(); + static final JsonpDeserializer LONG = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_NUMBER) + ) { + @Override + public Long deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Long.valueOf(parser.getString()); } - }; + return parser.getLong(); + } + }; - static final JsonpDeserializer FLOAT = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_NUMBER) + static final JsonpDeserializer FLOAT = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_NUMBER) - ) { - @Override - public Float deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Float.valueOf(parser.getString()); - } - return parser.getBigDecimal().floatValue(); + ) { + @Override + public Float deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Float.valueOf(parser.getString()); } - }; + return parser.getBigDecimal().floatValue(); + } + }; - static final JsonpDeserializer DOUBLE = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_NUMBER) - ) { - @Override - public Double deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Double.valueOf(parser.getString()); - } - return parser.getBigDecimal().doubleValue(); + static final JsonpDeserializer DOUBLE = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_NUMBER) + ) { + @Override + public Double deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Double.valueOf(parser.getString()); } - }; + return parser.getBigDecimal().doubleValue(); + } + }; static final class DoubleOrNullDeserializer extends JsonpDeserializerBase { static final EnumSet nativeEvents = EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_NULL); @@ -240,8 +227,14 @@ public Integer deserialize(JsonParser parser, JsonpMapper mapper, Event event) { static final class StringOrNullDeserializer extends JsonpDeserializerBase { static final EnumSet nativeEvents = EnumSet.of(Event.VALUE_STRING, Event.VALUE_NULL); - static final EnumSet acceptedEvents = EnumSet.of(Event.KEY_NAME, Event.VALUE_STRING, - Event.VALUE_NUMBER, Event.VALUE_FALSE, Event.VALUE_TRUE, Event.VALUE_NULL); + static final EnumSet acceptedEvents = EnumSet.of( + Event.KEY_NAME, + Event.VALUE_STRING, + Event.VALUE_NUMBER, + Event.VALUE_FALSE, + Event.VALUE_TRUE, + Event.VALUE_NULL + ); StringOrNullDeserializer() { super(acceptedEvents, nativeEvents); @@ -262,50 +255,43 @@ public String deserialize(JsonParser parser, JsonpMapper mapper, Event event) { } } - static final JsonpDeserializer DOUBLE_OR_NAN = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING, Event.VALUE_NULL), - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_NULL) - ) { - @Override - public Double deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_NULL) { - return Double.NaN; - } - if (event == Event.VALUE_STRING) { - return Double.valueOf(parser.getString()); - } - return parser.getBigDecimal().doubleValue(); + static final JsonpDeserializer DOUBLE_OR_NAN = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING, Event.VALUE_NULL), + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_NULL) + ) { + @Override + public Double deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_NULL) { + return Double.NaN; } - }; - - static final JsonpDeserializer NUMBER = - new JsonpDeserializerBase( - EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), - EnumSet.of(Event.VALUE_NUMBER) - ) { - @Override - public Number deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - if (event == Event.VALUE_STRING) { - return Double.valueOf(parser.getString()); - } - return ((JsonNumber)parser.getValue()).numberValue(); + if (event == Event.VALUE_STRING) { + return Double.valueOf(parser.getString()); } - }; + return parser.getBigDecimal().doubleValue(); + } + }; - static final JsonpDeserializer JSON_VALUE = - new JsonpDeserializerBase( - EnumSet.allOf(Event.class) - ) { - @Override - public JsonValue deserialize(JsonParser parser, JsonpMapper mapper, Event event) { - return parser.getValue(); + static final JsonpDeserializer NUMBER = new JsonpDeserializerBase( + EnumSet.of(Event.VALUE_NUMBER, Event.VALUE_STRING), + EnumSet.of(Event.VALUE_NUMBER) + ) { + @Override + public Number deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + if (event == Event.VALUE_STRING) { + return Double.valueOf(parser.getString()); } - }; + return ((JsonNumber) parser.getValue()).numberValue(); + } + }; - static final JsonpDeserializer VOID = new JsonpDeserializerBase( - EnumSet.noneOf(Event.class) - ) { + static final JsonpDeserializer JSON_VALUE = new JsonpDeserializerBase(EnumSet.allOf(Event.class)) { + @Override + public JsonValue deserialize(JsonParser parser, JsonpMapper mapper, Event event) { + return parser.getValue(); + } + }; + + static final JsonpDeserializer VOID = new JsonpDeserializerBase(EnumSet.noneOf(Event.class)) { @Override public Void deserialize(JsonParser parser, JsonpMapper mapper) { throw new JsonParsingException("Void types should not have any value", parser.getLocation()); @@ -317,7 +303,7 @@ public Void deserialize(JsonParser parser, JsonpMapper mapper, Event event) { } }; - //----- Collections + // ----- Collections static class ArrayDeserializer implements JsonpDeserializer> { private final JsonpDeserializer itemDeserializer; diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonpMapperBase.java b/java-client/src/main/java/org/opensearch/client/json/JsonpMapperBase.java index 2ce6e7f788..9e3295f984 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonpMapperBase.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonpMapperBase.java @@ -35,9 +35,8 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; - -import javax.annotation.Nullable; import java.lang.reflect.Field; +import javax.annotation.Nullable; public abstract class JsonpMapperBase implements JsonpMapper { @@ -61,7 +60,7 @@ public static JsonpDeserializer findDeserializer(Class clazz) { if (annotation != null) { try { Field field = clazz.getDeclaredField(annotation.field()); - return (JsonpDeserializer)field.get(null); + return (JsonpDeserializer) field.get(null); } catch (Exception e) { throw new RuntimeException("No deserializer found in '" + clazz.getName() + "." + annotation.field() + "'"); } diff --git a/java-client/src/main/java/org/opensearch/client/json/JsonpUtils.java b/java-client/src/main/java/org/opensearch/client/json/JsonpUtils.java index c6e1938999..604bf2791e 100644 --- a/java-client/src/main/java/org/opensearch/client/json/JsonpUtils.java +++ b/java-client/src/main/java/org/opensearch/client/json/JsonpUtils.java @@ -32,7 +32,6 @@ package org.opensearch.client.json; -import org.opensearch.client.util.ObjectBuilder; import jakarta.json.JsonObject; import jakarta.json.JsonString; import jakarta.json.JsonValue; @@ -41,12 +40,12 @@ import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - -import javax.annotation.Nullable; import java.io.StringReader; import java.util.AbstractMap; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.Nullable; +import org.opensearch.client.util.ObjectBuilder; public class JsonpUtils { @@ -94,7 +93,7 @@ public static void skipValue(JsonParser parser) { * Skip the value at the current position of the parser. */ public static void skipValue(JsonParser parser, Event event) { - switch(event) { + switch (event) { case START_OBJECT: parser.skipObject(); break; @@ -111,7 +110,7 @@ public static void skipValue(JsonParser parser, Event event) { public static T buildVariant(JsonParser parser, ObjectBuilder builder) { if (builder == null) { - throw new JsonParsingException("No variant found" , parser.getLocation()); + throw new JsonParsingException("No variant found", parser.getLocation()); } return builder.build(); } @@ -134,7 +133,10 @@ public static void serialize(T value, JsonGenerator generator, @Nullable Jso * (the object has been consumed from the original one). */ public static Map.Entry lookAheadFieldValue( - String name, String defaultValue, JsonParser parser, JsonpMapper mapper + String name, + String defaultValue, + JsonParser parser, + JsonpMapper mapper ) { JsonLocation location = parser.getLocation(); @@ -192,17 +194,15 @@ public static JsonParser objectParser(JsonObject object, JsonpMapper mapper) { } public static String toString(JsonValue value) { - switch(value.getValueType()) { + switch (value.getValueType()) { case OBJECT: throw new IllegalArgumentException("Json objects cannot be used as string"); case ARRAY: - return value.asJsonArray().stream() - .map(JsonpUtils::toString) - .collect(Collectors.joining(",")); + return value.asJsonArray().stream().map(JsonpUtils::toString).collect(Collectors.joining(",")); case STRING: - return ((JsonString)value).getString(); + return ((JsonString) value).getString(); case TRUE: return "true"; diff --git a/java-client/src/main/java/org/opensearch/client/json/LookAheadJsonParser.java b/java-client/src/main/java/org/opensearch/client/json/LookAheadJsonParser.java index b4a4231d14..63e9a9f318 100644 --- a/java-client/src/main/java/org/opensearch/client/json/LookAheadJsonParser.java +++ b/java-client/src/main/java/org/opensearch/client/json/LookAheadJsonParser.java @@ -33,7 +33,6 @@ package org.opensearch.client.json; import jakarta.json.stream.JsonParser; - import java.util.Map; public interface LookAheadJsonParser extends JsonParser { diff --git a/java-client/src/main/java/org/opensearch/client/json/NamedDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/NamedDeserializer.java index 309295e313..e162d2a783 100644 --- a/java-client/src/main/java/org/opensearch/client/json/NamedDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/NamedDeserializer.java @@ -35,7 +35,6 @@ import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - import java.util.EnumSet; /** diff --git a/java-client/src/main/java/org/opensearch/client/json/ObjectBuilderDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/ObjectBuilderDeserializer.java index 112686f7c9..4943e83eb3 100644 --- a/java-client/src/main/java/org/opensearch/client/json/ObjectBuilderDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/ObjectBuilderDeserializer.java @@ -32,12 +32,11 @@ package org.opensearch.client.json; -import org.opensearch.client.util.ObjectBuilder; import jakarta.json.stream.JsonParser; - import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.opensearch.client.util.ObjectBuilder; /** * An object deserializer based on an {@link ObjectBuilder}. @@ -63,10 +62,10 @@ public static JsonpDeserializer lazy( Function buildFn ) { return new LazyDeserializer<>(() -> { - ObjectDeserializer builderDeser = new ObjectDeserializer(builderCtor); - builderDeserializerSetup.accept(builderDeser); - return new BuildFunctionDeserializer<>(builderDeser, buildFn); - }); + ObjectDeserializer builderDeser = new ObjectDeserializer(builderCtor); + builderDeserializerSetup.accept(builderDeser); + return new BuildFunctionDeserializer<>(builderDeser, buildFn); + }); } public static > JsonpDeserializer createForObject( diff --git a/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java index d7e3c59317..316b0239e3 100644 --- a/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/ObjectDeserializer.java @@ -32,12 +32,9 @@ package org.opensearch.client.json; -import org.opensearch.client.util.QuadConsumer; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - -import javax.annotation.Nullable; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; @@ -47,6 +44,8 @@ import java.util.function.BiConsumer; import java.util.function.ObjIntConsumer; import java.util.function.Supplier; +import javax.annotation.Nullable; +import org.opensearch.client.util.QuadConsumer; public class ObjectDeserializer implements JsonpDeserializer { @@ -68,10 +67,7 @@ public static class FieldObjectDeserializer extends Field private final BiConsumer setter; private final JsonpDeserializer deserializer; - public FieldObjectDeserializer( - BiConsumer setter, JsonpDeserializer deserializer, - String name - ) { + public FieldObjectDeserializer(BiConsumer setter, JsonpDeserializer deserializer, String name) { super(name); this.setter = setter; this.deserializer = deserializer; @@ -106,7 +102,7 @@ public void deserialize(JsonParser parser, JsonpMapper mapper, String fieldName, } }; - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- private static final EnumSet EventSetObject = EnumSet.of(Event.START_OBJECT, Event.KEY_NAME); private static final EnumSet EventSetObjectAndString = EnumSet.of(Event.START_OBJECT, Event.VALUE_STRING, Event.KEY_NAME); @@ -222,7 +218,7 @@ protected void parseUnknownField(JsonParser parser, JsonpMapper mapper, String f } else { throw new JsonParsingException( - "Unknown field '" + fieldName + "' for type '" + object.getClass().getName() +"'", + "Unknown field '" + fieldName + "' for type '" + object.getClass().getName() + "'", parser.getLocation() ); } @@ -246,27 +242,22 @@ public void shortcutProperty(String name) { acceptedEvents = EventSetObjectAndString; } - //----- Object types + // ----- Object types - public void add( - BiConsumer setter, - JsonpDeserializer deserializer, - String name - ) { - FieldObjectDeserializer fieldDeserializer = - new FieldObjectDeserializer<>(setter, deserializer, name); + public void add(BiConsumer setter, JsonpDeserializer deserializer, String name) { + FieldObjectDeserializer fieldDeserializer = new FieldObjectDeserializer<>(setter, deserializer, name); this.fieldDeserializers.put(name, fieldDeserializer); } public void add( BiConsumer setter, JsonpDeserializer deserializer, - String name, String... aliases + String name, + String... aliases ) { - FieldObjectDeserializer fieldDeserializer = - new FieldObjectDeserializer<>(setter, deserializer, name); + FieldObjectDeserializer fieldDeserializer = new FieldObjectDeserializer<>(setter, deserializer, name); this.fieldDeserializers.put(name, fieldDeserializer); - for (String alias: aliases) { + for (String alias : aliases) { this.fieldDeserializers.put(alias, fieldDeserializer); } } @@ -280,33 +271,11 @@ public void setTypeProperty(String name, String defaultType) { this.defaultType = defaultType; } - //----- Primitive types + // ----- Primitive types public void add(ObjIntConsumer setter, String name, String... deprecatedNames) { // FIXME (perf): add specialized deserializer to avoid intermediate boxing add(setter::accept, JsonpDeserializer.integerDeserializer(), name, deprecatedNames); } -// Experiment: avoid boxing, allow multiple primitive parsers (e.g. int as number & string) -// public void add( -// ObjIntConsumer setter, -// JsonpIntParser vp, -// String name, String... deprecatedNames -// ) { -// this.fieldDeserializers.put(name, new FieldDeserializer(name, deprecatedNames) { -// @Override -// public void deserialize(JsonParser parser, JsonpMapper mapper, String fieldName, ObjectType object) { -// JsonpUtils.expectNextEvent(parser, Event.VALUE_NUMBER); -// setter.accept(object, vp.parse(parser)); -// } -// }); -// } -// -// public static class JsonpIntParser { -// public int parse(JsonParser parser) { -// JsonpUtils.expectNextEvent(parser, Event.VALUE_NUMBER); -// return parser.getInt(); -// } -// } - } diff --git a/java-client/src/main/java/org/opensearch/client/json/UnexpectedJsonEventException.java b/java-client/src/main/java/org/opensearch/client/json/UnexpectedJsonEventException.java index e717f73a9e..c7aa821133 100644 --- a/java-client/src/main/java/org/opensearch/client/json/UnexpectedJsonEventException.java +++ b/java-client/src/main/java/org/opensearch/client/json/UnexpectedJsonEventException.java @@ -35,7 +35,6 @@ import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - import java.util.EnumSet; public class UnexpectedJsonEventException extends JsonParsingException { diff --git a/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java b/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java index 0e77419d46..55527cefc0 100644 --- a/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java +++ b/java-client/src/main/java/org/opensearch/client/json/UnionDeserializer.java @@ -32,13 +32,11 @@ package org.opensearch.client.json; -import org.opensearch.client.util.ObjectBuilder; import jakarta.json.JsonObject; import jakarta.json.stream.JsonLocation; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; import jakarta.json.stream.JsonParsingException; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -51,6 +49,7 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.stream.Collectors; +import org.opensearch.client.util.ObjectBuilder; public class UnionDeserializer implements JsonpDeserializer { @@ -62,6 +61,7 @@ public AmbiguousUnionException(String message) { private abstract static class EventHandler { abstract Union deserialize(JsonParser parser, JsonpMapper mapper, Event event, BiFunction buildFn); + abstract EnumSet nativeEvents(); } @@ -102,7 +102,7 @@ private static class MultiMemberHandler extends EventHandle @Override EnumSet nativeEvents() { EnumSet result = EnumSet.noneOf(Event.class); - for (SingleMemberHandler smh: handlers) { + for (SingleMemberHandler smh : handlers) { result.addAll(smh.deserializer.nativeEvents()); } return result; @@ -111,10 +111,10 @@ EnumSet nativeEvents() { @Override Union deserialize(JsonParser parser, JsonpMapper mapper, Event event, BiFunction buildFn) { RuntimeException exception = null; - for (EventHandler d: handlers) { + for (EventHandler d : handlers) { try { return d.deserialize(parser, mapper, event, buildFn); - } catch(RuntimeException ex) { + } catch (RuntimeException ex) { exception = ex; } } @@ -172,8 +172,11 @@ public Builder addMember(Kind tag, JsonpDeserializer unwrapped = DelegatingDeserializer.unwrap(deserializer); if (unwrapped instanceof ObjectDeserializer) { ObjectDeserializer od = (ObjectDeserializer) unwrapped; - UnionDeserializer.SingleMemberHandler member = - new SingleMemberHandler<>(tag, deserializer, new HashSet<>(od.fieldNames())); + UnionDeserializer.SingleMemberHandler member = new SingleMemberHandler<>( + tag, + deserializer, + new HashSet<>(od.fieldNames()) + ); objectMembers.add(member); if (od.shortcutProperty() != null) { // also add it as a string @@ -181,7 +184,7 @@ public Builder addMember(Kind tag, JsonpDeserializer member = new SingleMemberHandler<>(tag, deserializer); - for (Event e: deserializer.nativeEvents()) { + for (Event e : deserializer.nativeEvents()) { addMember(e, tag, member); } } @@ -191,18 +194,20 @@ public Builder addMember(Kind tag, JsonpDeserializer build() { - Map fieldFrequencies = objectMembers.stream().flatMap(m -> m.fields.stream()) - .collect( Collectors.groupingBy(Function.identity(), Collectors.counting())); - Set duplicateFields = fieldFrequencies.entrySet().stream() - .filter(entry -> entry.getValue() > 1) - .map(Map.Entry::getKey) - .collect(Collectors.toSet()); - for (UnionDeserializer.SingleMemberHandler member: objectMembers) { + Map fieldFrequencies = objectMembers.stream() + .flatMap(m -> m.fields.stream()) + .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); + Set duplicateFields = fieldFrequencies.entrySet() + .stream() + .filter(entry -> entry.getValue() > 1) + .map(Map.Entry::getKey) + .collect(Collectors.toSet()); + for (UnionDeserializer.SingleMemberHandler member : objectMembers) { member.fields.removeAll(duplicateFields); } // Check that no object member had all its fields removed - for (UnionDeserializer.SingleMemberHandler member: objectMembers) { + for (UnionDeserializer.SingleMemberHandler member : objectMembers) { if (member.fields.isEmpty()) { throw new AmbiguousUnionException("All properties of '" + member.tag + "' also exist in other object members"); } @@ -213,10 +218,6 @@ public JsonpDeserializer build() { otherMembers.put(Event.START_OBJECT, objectMembers.remove(0)); } -// if (objectMembers.size() > 1) { -// System.out.println("multiple objects in " + buildFn); -// } - return new UnionDeserializer<>(objectMembers, otherMembers, buildFn); } } @@ -239,8 +240,8 @@ public UnionDeserializer( this.objectMembers = Collections.emptyMap(); } else { this.objectMembers = new HashMap<>(); - for (SingleMemberHandler member: objectMembers) { - for (String field: member.fields) { + for (SingleMemberHandler member : objectMembers) { + for (String field : member.fields) { this.objectMembers.put(field, member); } } @@ -249,7 +250,7 @@ public UnionDeserializer( this.nonObjectMembers = nonObjectMembers; this.nativeEvents = EnumSet.noneOf(Event.class); - for (EventHandler member: nonObjectMembers.values()) { + for (EventHandler member : nonObjectMembers.values()) { this.nativeEvents.addAll(member.nativeEvents()); } @@ -286,8 +287,9 @@ public Union deserialize(JsonParser parser, JsonpMapper mapper, Event event) { if (member == null && event == Event.START_OBJECT && !objectMembers.isEmpty()) { if (parser instanceof LookAheadJsonParser) { - Map.Entry, JsonParser> memberAndParser = - ((LookAheadJsonParser) parser).findVariant(objectMembers); + Map.Entry, JsonParser> memberAndParser = ((LookAheadJsonParser) parser).findVariant( + objectMembers + ); member = memberAndParser.getKey(); // Parse the buffered parser @@ -297,7 +299,7 @@ public Union deserialize(JsonParser parser, JsonpMapper mapper, Event event) { // Parse as an object to find matching field names JsonObject object = parser.getObject(); - for (String field: object.keySet()) { + for (String field : object.keySet()) { member = objectMembers.get(field); if (member != null) { break; diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonProvider.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonProvider.java index 56045e4e51..bc14bf1537 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonProvider.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonProvider.java @@ -47,7 +47,6 @@ import jakarta.json.stream.JsonGeneratorFactory; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParserFactory; - import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -81,7 +80,7 @@ public JsonFactory jacksonJsonFactory() { return this.jsonFactory; } - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- // Parser private final ParserFactory defaultParserFactory = new ParserFactory(null); @@ -166,7 +165,7 @@ public JsonParser createParser(JsonArray array) { } } - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- // Generator private final JsonGeneratorFactory defaultGeneratorFactory = new GeneratorFactory(null); @@ -233,7 +232,7 @@ public JsonGenerator createGenerator(OutputStream out, Charset charset) { } } - //--------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- // Unsupported operations /** diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpGenerator.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpGenerator.java index 5b6e5efdff..50dc7f2f8f 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpGenerator.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpGenerator.java @@ -38,7 +38,6 @@ import jakarta.json.JsonValue; import jakarta.json.stream.JsonGenerationException; import jakarta.json.stream.JsonGenerator; - import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; @@ -339,10 +338,10 @@ public void flush() { } private void writeValue(JsonValue value) throws IOException { - switch(value.getValueType()) { + switch (value.getValueType()) { case OBJECT: generator.writeStartObject(); - for (Map.Entry entry: value.asJsonObject().entrySet()) { + for (Map.Entry entry : value.asJsonObject().entrySet()) { generator.writeFieldName(entry.getKey()); writeValue(entry.getValue()); } @@ -351,14 +350,14 @@ private void writeValue(JsonValue value) throws IOException { case ARRAY: generator.writeStartArray(); - for (JsonValue item: value.asJsonArray()) { + for (JsonValue item : value.asJsonArray()) { writeValue(item); } generator.writeEndArray(); break; case STRING: - generator.writeString(((JsonString)value).getString()); + generator.writeString(((JsonString) value).getString()); break; case FALSE: diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpMapper.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpMapper.java index 3a92266ca0..186018a0d2 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpMapper.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpMapper.java @@ -32,11 +32,6 @@ package org.opensearch.client.json.jackson; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpDeserializerBase; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpMapperBase; -import org.opensearch.client.json.JsonpSerializer; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; @@ -44,9 +39,13 @@ import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; - import java.io.IOException; import java.util.EnumSet; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpDeserializerBase; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpMapperBase; +import org.opensearch.client.json.JsonpSerializer; public class JacksonJsonpMapper extends JsonpMapperBase { @@ -64,9 +63,8 @@ public JacksonJsonpMapper(ObjectMapper objectMapper, JsonFactory jsonFactory) { } public JacksonJsonpMapper() { - this(new ObjectMapper() - .configure(SerializationFeature.INDENT_OUTPUT, false) - .setSerializationInclusion(JsonInclude.Include.NON_NULL) + this( + new ObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, false).setSerializationInclusion(JsonInclude.Include.NON_NULL) ); } @@ -83,7 +81,7 @@ public JsonProvider jsonProvider() { } @Override - protected JsonpDeserializer getDefaultDeserializer(Class clazz) { + protected JsonpDeserializer getDefaultDeserializer(Class clazz) { return new JacksonValueParser<>(clazz); } @@ -100,7 +98,7 @@ public void serialize(T value, JsonGenerator generator) { return; } - com.fasterxml.jackson.core.JsonGenerator jkGenerator = ((JacksonJsonpGenerator)generator).jacksonGenerator(); + com.fasterxml.jackson.core.JsonGenerator jkGenerator = ((JacksonJsonpGenerator) generator).jacksonGenerator(); try { objectMapper.writeValue(jkGenerator, value); } catch (IOException ioe) { @@ -124,11 +122,11 @@ public T deserialize(JsonParser parser, JsonpMapper mapper, JsonParser.Event eve throw new IllegalArgumentException("Jackson's ObjectMapper can only be used with the JacksonJsonpProvider"); } - com.fasterxml.jackson.core.JsonParser jkParser = ((JacksonJsonpParser)parser).jacksonParser(); + com.fasterxml.jackson.core.JsonParser jkParser = ((JacksonJsonpParser) parser).jacksonParser(); try { return objectMapper.readValue(jkParser, clazz); - } catch(IOException ioe) { + } catch (IOException ioe) { throw JacksonUtils.convertException(ioe); } } diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpParser.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpParser.java index eb75a2bb63..8597b81604 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpParser.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonJsonpParser.java @@ -41,9 +41,6 @@ import jakarta.json.stream.JsonLocation; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParsingException; -import org.opensearch.client.json.LookAheadJsonParser; -import org.opensearch.client.json.UnexpectedJsonEventException; - import java.io.IOException; import java.math.BigDecimal; import java.util.AbstractMap; @@ -51,6 +48,8 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.stream.Stream; +import org.opensearch.client.json.LookAheadJsonParser; +import org.opensearch.client.json.UnexpectedJsonEventException; /** * A JSONP parser implementation on top of Jackson. @@ -105,7 +104,7 @@ private JsonParsingException convertException(IOException ioe) { private JsonToken fetchNextToken() { try { return parser.nextToken(); - } catch(IOException e) { + } catch (IOException e) { throw convertException(e); } } @@ -142,7 +141,7 @@ public Event next() { Event result = tokenToEvent.get(token); if (result == null) { - throw new JsonParsingException("Unsupported Jackson event type '"+ token + "'", getLocation()); + throw new JsonParsingException("Unsupported Jackson event type '" + token + "'", getLocation()); } return result; @@ -214,8 +213,7 @@ public void close() { public JsonObject getObject() { ensureTokenIsCurrent(); if (parser.currentToken() != JsonToken.START_OBJECT) { - throw new IllegalStateException("Unexpected event '" + parser.currentToken() + - "' at " + parser.getTokenLocation()); + throw new IllegalStateException("Unexpected event '" + parser.currentToken() + "' at " + parser.getTokenLocation()); } if (valueParser == null) { valueParser = new JsonValueParser(); @@ -234,8 +232,7 @@ public JsonArray getArray() { valueParser = new JsonValueParser(); } if (parser.currentToken() != JsonToken.START_ARRAY) { - throw new IllegalStateException("Unexpected event '" + parser.currentToken() + - "' at " + parser.getTokenLocation()); + throw new IllegalStateException("Unexpected event '" + parser.currentToken() + "' at " + parser.getTokenLocation()); } try { return valueParser.parseArray(parser); @@ -277,7 +274,7 @@ public void skipObject() { depth--; break; } - } while(!(token == JsonToken.END_OBJECT && depth == 0)); + } while (!(token == JsonToken.END_OBJECT && depth == 0)); } catch (IOException e) { throw convertException(e); } @@ -303,7 +300,7 @@ public void skipArray() { depth--; break; } - } while(!(token == JsonToken.END_ARRAY && depth == 0)); + } while (!(token == JsonToken.END_ARRAY && depth == 0)); } catch (IOException e) { throw convertException(e); } @@ -327,7 +324,7 @@ public Stream getValueStream() { return LookAheadJsonParser.super.getValueStream(); } - //----- Look ahead methods + // ----- Look ahead methods public Map.Entry lookAheadFieldValue(String name, String defaultValue) { @@ -349,8 +346,8 @@ public Map.Entry lookAheadFieldValue(String name, String def tb.copyCurrentEvent(parser); return new AbstractMap.SimpleImmutableEntry<>( - parser.getText(), - new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) + parser.getText(), + new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) ); } else { tb.copyCurrentStructure(parser); @@ -364,8 +361,8 @@ public Map.Entry lookAheadFieldValue(String name, String def // Field not found return new AbstractMap.SimpleImmutableEntry<>( - defaultValue, - new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) + defaultValue, + new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) ); } @@ -386,8 +383,8 @@ public Map.Entry findVariant(Map if (variant != null) { tb.copyCurrentEvent(parser); return new AbstractMap.SimpleImmutableEntry<>( - variant, - new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) + variant, + new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) ); } else { tb.copyCurrentStructure(parser); @@ -401,8 +398,8 @@ public Map.Entry findVariant(Map // No variant found: return the buffered parser and let the caller decide what to do. return new AbstractMap.SimpleImmutableEntry<>( - null, - new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) + null, + new JacksonJsonpParser(JsonParserSequence.createFlattened(false, tb.asParser(), parser)) ); } @@ -420,4 +417,3 @@ private void expectEvent(JsonToken expected) { } } } - diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonUtils.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonUtils.java index 988474f7ce..7c1894ea95 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonUtils.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JacksonUtils.java @@ -36,7 +36,6 @@ import jakarta.json.JsonException; import jakarta.json.stream.JsonGenerationException; import jakarta.json.stream.JsonParsingException; - import java.io.IOException; class JacksonUtils { diff --git a/java-client/src/main/java/org/opensearch/client/json/jackson/JsonValueParser.java b/java-client/src/main/java/org/opensearch/client/json/jackson/JsonValueParser.java index 565e38e35d..3b4b9dd0d1 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jackson/JsonValueParser.java +++ b/java-client/src/main/java/org/opensearch/client/json/jackson/JsonValueParser.java @@ -41,7 +41,6 @@ import jakarta.json.JsonValue; import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonParsingException; - import java.io.IOException; /** @@ -58,7 +57,7 @@ public JsonObject parseObject(JsonParser parser) throws IOException { JsonObjectBuilder ob = DefaultJsonProvider.INSTANCE.createObjectBuilder(); JsonToken token; - while((token = parser.nextToken()) != JsonToken.END_OBJECT) { + while ((token = parser.nextToken()) != JsonToken.END_OBJECT) { if (token != JsonToken.FIELD_NAME) { throw new JsonParsingException("Expected a property name", new JacksonJsonpLocation(parser)); } @@ -72,7 +71,7 @@ public JsonObject parseObject(JsonParser parser) throws IOException { public JsonArray parseArray(JsonParser parser) throws IOException { JsonArrayBuilder ab = DefaultJsonProvider.INSTANCE.createArrayBuilder(); - while(parser.nextToken() != JsonToken.END_ARRAY) { + while (parser.nextToken() != JsonToken.END_ARRAY) { ab.add(parseValue(parser)); } return ab.build(); @@ -100,7 +99,7 @@ public JsonValue parseValue(JsonParser parser) throws IOException { case VALUE_NUMBER_FLOAT: case VALUE_NUMBER_INT: - switch(parser.getNumberType()) { + switch (parser.getNumberType()) { case INT: return DefaultJsonProvider.INSTANCE.createValue(parser.getIntValue()); case LONG: diff --git a/java-client/src/main/java/org/opensearch/client/json/jsonb/JsonbJsonpMapper.java b/java-client/src/main/java/org/opensearch/client/json/jsonb/JsonbJsonpMapper.java index a01d478326..0a7c98e2da 100644 --- a/java-client/src/main/java/org/opensearch/client/json/jsonb/JsonbJsonpMapper.java +++ b/java-client/src/main/java/org/opensearch/client/json/jsonb/JsonbJsonpMapper.java @@ -32,21 +32,20 @@ package org.opensearch.client.json.jsonb; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpDeserializerBase; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpMapperBase; -import org.opensearch.client.json.JsonpSerializable; import jakarta.json.bind.Jsonb; import jakarta.json.bind.spi.JsonbProvider; import jakarta.json.spi.JsonProvider; import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import jakarta.json.stream.JsonParser.Event; - import java.io.CharArrayReader; import java.io.CharArrayWriter; import java.util.EnumSet; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpDeserializerBase; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpMapperBase; +import org.opensearch.client.json.JsonpSerializable; public class JsonbJsonpMapper extends JsonpMapperBase { @@ -74,7 +73,7 @@ protected JsonpDeserializer getDefaultDeserializer(Class clazz) { @Override public void serialize(T value, JsonGenerator generator) { if (value instanceof JsonpSerializable) { - ((JsonpSerializable)value).serialize(generator, this); + ((JsonpSerializable) value).serialize(generator, this); return; } @@ -126,7 +125,7 @@ private void transferAll(JsonParser from, JsonGenerator to) { */ private void transferAll(JsonParser from, JsonParser.Event event, JsonGenerator to) { transferEvent(from, event, to); - switch(event) { + switch (event) { case START_OBJECT: { int depth = 1; do { @@ -140,9 +139,9 @@ private void transferAll(JsonParser from, JsonParser.Event event, JsonGenerator depth--; break; } - } while(!(event == Event.END_OBJECT && depth == 0)); + } while (!(event == Event.END_OBJECT && depth == 0)); } - break; + break; case START_ARRAY: { int depth = 1; @@ -157,9 +156,9 @@ private void transferAll(JsonParser from, JsonParser.Event event, JsonGenerator depth--; break; } - } while(!(event == Event.END_ARRAY && depth == 0)); + } while (!(event == Event.END_ARRAY && depth == 0)); } - break; + break; default: // nothing more diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 0aa60b542c..5d869c6f59 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -32,9 +32,13 @@ package org.opensearch.client.opensearch; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.cat.OpenSearchCatAsyncClient; import org.opensearch.client.opensearch.cluster.OpenSearchClusterAsyncClient; import org.opensearch.client.opensearch.core.BulkRequest; @@ -126,1470 +130,1567 @@ import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownAsyncClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient; -import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.JsonEndpoint; +import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr; import org.opensearch.client.util.ObjectBuilder; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; /** * Client for the namespace. */ public class OpenSearchAsyncClient extends ApiClient { - public OpenSearchAsyncClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchAsyncClient(this.transport, transportOptions); - } - - // ----- Child clients - - public OpenSearchCatAsyncClient cat() { - return new OpenSearchCatAsyncClient(this.transport, this.transportOptions); - } - - - public OpenSearchClusterAsyncClient cluster() { - return new OpenSearchClusterAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchDanglingIndicesAsyncClient danglingIndices() { - return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchFeaturesAsyncClient features() { - return new OpenSearchFeaturesAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchIndicesAsyncClient indices() { - return new OpenSearchIndicesAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchIngestAsyncClient ingest() { - return new OpenSearchIngestAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchNodesAsyncClient nodes() { - return new OpenSearchNodesAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchShutdownAsyncClient shutdown() { - return new OpenSearchShutdownAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchSnapshotAsyncClient snapshot() { - return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions); - } - - public OpenSearchTasksAsyncClient tasks() { - return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); - } - - // ----- Endpoint: bulk - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * - */ - - public CompletableFuture bulk(BulkRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) BulkRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * @param fn - * a function that initializes a builder to create the - * {@link BulkRequest} - * - */ - - public final CompletableFuture bulk(Function> fn) - throws IOException, OpenSearchException { - return bulk(fn.apply(new BulkRequest.Builder()).build()); - } - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * - */ - - public CompletableFuture bulk() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: clear_scroll - - /** - * Explicitly clears the search context for a scroll. - * - * - */ - - public CompletableFuture clearScroll(ClearScrollRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ClearScrollRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Explicitly clears the search context for a scroll. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearScrollRequest} - * - */ - - public final CompletableFuture clearScroll( - Function> fn) - throws IOException, OpenSearchException { - return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); - } - - /** - * Explicitly clears the search context for a scroll. - * - * - */ - - public CompletableFuture clearScroll() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new ClearScrollRequest.Builder().build(), - ClearScrollRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: count - - /** - * Returns number of documents matching a query. - * - * - */ - - public CompletableFuture count(CountRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) CountRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns number of documents matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link CountRequest} - * - */ - - public final CompletableFuture count(Function> fn) - throws IOException, OpenSearchException { - return count(fn.apply(new CountRequest.Builder()).build()); - } - - /** - * Returns number of documents matching a query. - * - * - */ - - public CompletableFuture count() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new CountRequest.Builder().build(), CountRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: create - - /** - * Creates a new document in the index. - *

- * Returns a 409 response when a document with a same ID already exists in the - * index. - * - * - */ - - public CompletableFuture create(CreateRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, CreateResponse, ErrorResponse> endpoint = - (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates a new document in the index. - *

- * Returns a 409 response when a document with a same ID already exists in the - * index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRequest} - * - */ - - public final CompletableFuture create( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return create(fn.apply(new CreateRequest.Builder()).build()); - } - - // ----- Endpoint: create_point_in_time - - /** - * Provides low-level information about the disk utilization of a PIT by - * describing its Lucene segments. - * - * - */ - - public CompletableFuture createPit(CreatePitRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreatePitRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Provides low-level information about the disk utilization of a PIT by - * describing its Lucene segments. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreatePitRequest} - * - */ - - public final CompletableFuture createPit( - Function> fn) - throws IOException, OpenSearchException { - return createPit(fn.apply(new CreatePitRequest.Builder()).build()); - } - - // ----- Endpoint: delete - - /** - * Removes a document from the index. - * - * - */ - - public CompletableFuture delete(DeleteRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Removes a document from the index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRequest} - * - */ - - public final CompletableFuture delete( - Function> fn) - throws IOException, OpenSearchException { - return delete(fn.apply(new DeleteRequest.Builder()).build()); - } - - // ----- Endpoint: delete_point_in_time - - /** - * Delete Point In Time - * - * - */ - - public CompletableFuture deletePit(DeletePitRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeletePitRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete Point In Time - * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePitRequest} - * - */ - - public final CompletableFuture deletePit( - Function> fn) - throws IOException, OpenSearchException { - return deletePit(fn.apply(new DeletePitRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query - - /** - * Deletes documents matching the provided query. - * - * - */ - - public CompletableFuture deleteByQuery(DeleteByQueryRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteByQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes documents matching the provided query. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRequest} - * - */ - - public final CompletableFuture deleteByQuery( - Function> fn) - throws IOException, OpenSearchException { - return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query_rethrottle - - /** - * Changes the number of requests per second for a particular Delete By Query - * operation. - * - * - */ - - public CompletableFuture deleteByQueryRethrottle( - DeleteByQueryRethrottleRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - DeleteByQueryRethrottleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Delete By Query - * operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRethrottleRequest} - * - */ - - public final CompletableFuture deleteByQueryRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build()); - } - - // ----- Endpoint: delete_script - - /** - * Deletes a script. - * - * - */ - - public CompletableFuture deleteScript(DeleteScriptRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteScriptRequest} - * - */ - - public final CompletableFuture deleteScript( - Function> fn) - throws IOException, OpenSearchException { - return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); - } - - // ----- Endpoint: exists - - /** - * Returns information about whether a document exists in an index. - * - * - */ - - public CompletableFuture exists(ExistsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a document exists in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * - */ - - public final CompletableFuture exists( - Function> fn) - throws IOException, OpenSearchException { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: exists_source - - /** - * Returns information about whether a document source exists in an index. - * - * - */ - - public CompletableFuture existsSource(ExistsSourceRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsSourceRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a document source exists in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsSourceRequest} - * - */ - - public final CompletableFuture existsSource( - Function> fn) - throws IOException, OpenSearchException { - return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); - } - - // ----- Endpoint: explain - - /** - * Returns information about why a specific matches (or doesn't match) a query. - * - * - */ - - public CompletableFuture> explain(ExplainRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.explain.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about why a specific matches (or doesn't match) a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * - */ - - public final CompletableFuture> explain( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: field_caps - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - */ - - public CompletableFuture fieldCaps(FieldCapsRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) FieldCapsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link FieldCapsRequest} - * - */ - - public final CompletableFuture fieldCaps( - Function> fn) - throws IOException, OpenSearchException { - return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); - } - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - * - * - */ - - public CompletableFuture fieldCaps() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get - - /** - * Returns a document. - * - * - */ - - public CompletableFuture> get(GetRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.get.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * - */ - - public final CompletableFuture> get( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: get_script - - /** - * Returns a script. - * - * - */ - - public CompletableFuture getScript(GetScriptRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) GetScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetScriptRequest} - * - */ - - public final CompletableFuture getScript( - Function> fn) - throws IOException, OpenSearchException { - return getScript(fn.apply(new GetScriptRequest.Builder()).build()); - } - - // ----- Endpoint: get_script_context - - /** - * Returns all script contexts. - * - * - */ - public CompletableFuture getScriptContext() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(GetScriptContextRequest._INSTANCE, GetScriptContextRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get_script_languages - - /** - * Returns available script types, languages and contexts - * - * - */ - public CompletableFuture getScriptLanguages() - throws IOException, OpenSearchException { - return this.transport.performRequestAsync(GetScriptLanguagesRequest._INSTANCE, - GetScriptLanguagesRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: get_source - - /** - * Returns the source of a document. - * - * - */ - - public CompletableFuture> getSource(GetSourceRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.get_source.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * - */ - - public final CompletableFuture> getSource( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: index - - /** - * Creates or updates a document in an index. - * - * - */ - - public CompletableFuture index(IndexRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, IndexResponse, ErrorResponse> endpoint = - (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates or updates a document in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndexRequest} - * - */ - - public final CompletableFuture index( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return index(fn.apply(new IndexRequest.Builder()).build()); - } - - // ----- Endpoint: info - - /** - * Returns basic information about the cluster. - * - * - */ - public CompletableFuture info() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: list_point_in_time - - /** - * List all Point In Time - * - * - */ - - public CompletableFuture listAllPit() - throws IOException, OpenSearchException { - return this.transport.performRequestAsync(ListAllPitRequest._INSTANCE, ListAllPitRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: mget - - /** - * Allows to get multiple documents in one request. - * - * - */ - - public CompletableFuture> mget(MgetRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.mget.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * - */ - - public final CompletableFuture> mget( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: msearch - - /** - * Allows to execute several search operations in one request. - * - * - */ - - public CompletableFuture> msearch(MsearchRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.msearch.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * - */ - - public final CompletableFuture> msearch( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: msearch_template - - /** - * Allows to execute several search template operations in one request. - * - * - */ - - public CompletableFuture> msearchTemplate( - MsearchTemplateRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.msearch_template.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search template operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * - */ - - public final CompletableFuture> msearchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: mtermvectors - - /** - * Returns multiple termvectors in one request. - * - * - */ - - public CompletableFuture mtermvectors(MtermvectorsRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) MtermvectorsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns multiple termvectors in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MtermvectorsRequest} - * - */ - - public final CompletableFuture mtermvectors( - Function> fn) - throws IOException, OpenSearchException { - return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); - } - - /** - * Returns multiple termvectors in one request. - * - * - */ - - public CompletableFuture mtermvectors() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new MtermvectorsRequest.Builder().build(), - MtermvectorsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: ping - - /** - * Returns whether the cluster is running. - * - * - */ - public CompletableFuture ping() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: put_script - - /** - * Creates or updates a script. - * - * - */ - - public CompletableFuture putScript(PutScriptRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) PutScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates or updates a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutScriptRequest} - * - */ - - public final CompletableFuture putScript( - Function> fn) - throws IOException, OpenSearchException { - return putScript(fn.apply(new PutScriptRequest.Builder()).build()); - } - - // ----- Endpoint: rank_eval - - /** - * Allows to evaluate the quality of ranked search results over a set of typical - * search queries - * - * - */ - - public CompletableFuture rankEval(RankEvalRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) RankEvalRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to evaluate the quality of ranked search results over a set of typical - * search queries - * - * @param fn - * a function that initializes a builder to create the - * {@link RankEvalRequest} - * - */ - - public final CompletableFuture rankEval( - Function> fn) - throws IOException, OpenSearchException { - return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); - } - - // ----- Endpoint: reindex - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * - */ - - public CompletableFuture reindex(ReindexRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ReindexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRequest} - * - */ - - public final CompletableFuture reindex( - Function> fn) - throws IOException, OpenSearchException { - return reindex(fn.apply(new ReindexRequest.Builder()).build()); - } - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * - */ - - public CompletableFuture reindex() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new ReindexRequest.Builder().build(), ReindexRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: reindex_rethrottle - - /** - * Changes the number of requests per second for a particular Reindex operation. - * - * - */ - - public CompletableFuture reindexRethrottle(ReindexRethrottleRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - ReindexRethrottleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Reindex operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRethrottleRequest} - * - */ - - public final CompletableFuture reindexRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build()); - } - - // ----- Endpoint: render_search_template - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public CompletableFuture renderSearchTemplate(RenderSearchTemplateRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - RenderSearchTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * @param fn - * a function that initializes a builder to create the - * {@link RenderSearchTemplateRequest} - * - */ - - public final CompletableFuture renderSearchTemplate( - Function> fn) - throws IOException, OpenSearchException { - return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public CompletableFuture renderSearchTemplate() - throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new RenderSearchTemplateRequest.Builder().build(), - RenderSearchTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: scripts_painless_execute - - /** - * Allows an arbitrary script to be executed and a result to be returned - * - * - */ - - public CompletableFuture> scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Class tResultClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.scripts_painless_execute.TResult", - getDeserializer(tResultClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows an arbitrary script to be executed and a result to be returned - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * - */ - - public final CompletableFuture> scriptsPainlessExecute( - Function> fn, - Class tResultClass) throws IOException, OpenSearchException { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); - } - - // ----- Endpoint: scroll - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - */ - - public CompletableFuture> scroll(ScrollRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.scroll.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - */ - - public final CompletableFuture> scroll( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: search - - /** - * Returns results matching a query. - * - * - */ - - public CompletableFuture> search(SearchRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.search.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * - */ - - public final CompletableFuture> search( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: search_shards - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * - */ - - public CompletableFuture searchShards(SearchShardsRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) SearchShardsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchShardsRequest} - * - */ - - public final CompletableFuture searchShards( - Function> fn) - throws IOException, OpenSearchException { - return searchShards(fn.apply(new SearchShardsRequest.Builder()).build()); - } - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * - */ - - public CompletableFuture searchShards() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new SearchShardsRequest.Builder().build(), - SearchShardsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: search_template - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public CompletableFuture> searchTemplate( - SearchTemplateRequest request, Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.search_template.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * - */ - - public final CompletableFuture> searchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: terms_enum - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * - */ - - public CompletableFuture termsEnum(TermsEnumRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) TermsEnumRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermsEnumRequest} - * - */ - - public final CompletableFuture termsEnum( - Function> fn) - throws IOException, OpenSearchException { - return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); - } - - // ----- Endpoint: termvectors - - /** - * Returns information and statistics about terms in the fields of a particular - * document. - * - * - */ - - public CompletableFuture termvectors(TermvectorsRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = - (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information and statistics about terms in the fields of a particular - * document. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermvectorsRequest} - * - */ - - public final CompletableFuture termvectors( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); - } - - // ----- Endpoint: update - - /** - * Updates a document with a script or partial document. - * - * - */ - - public CompletableFuture> update( - UpdateRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = - (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.update.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Updates a document with a script or partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * - */ - - public final CompletableFuture> update( - Function, - ObjectBuilder>> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: update_by_query - - /** - * Performs an update on every document in the index without changing the - * source, for example to pick up a mapping change. - * - * - */ - - public CompletableFuture updateByQuery(UpdateByQueryRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - UpdateByQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Performs an update on every document in the index without changing the - * source, for example to pick up a mapping change. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRequest} - * - */ - - public final CompletableFuture updateByQuery( - Function> fn) - throws IOException, OpenSearchException { - return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: update_by_query_rethrottle - - /** - * Changes the number of requests per second for a particular Update By Query - * operation. - * - * - */ - - public CompletableFuture updateByQueryRethrottle( - UpdateByQueryRethrottleRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - UpdateByQueryRethrottleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Update By Query - * operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRethrottleRequest} - * - */ - - public final CompletableFuture updateByQueryRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build()); - } + public OpenSearchAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchAsyncClient(this.transport, transportOptions); + } + + // ----- Child clients + + public OpenSearchCatAsyncClient cat() { + return new OpenSearchCatAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchClusterAsyncClient cluster() { + return new OpenSearchClusterAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchDanglingIndicesAsyncClient danglingIndices() { + return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchFeaturesAsyncClient features() { + return new OpenSearchFeaturesAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchIndicesAsyncClient indices() { + return new OpenSearchIndicesAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchIngestAsyncClient ingest() { + return new OpenSearchIngestAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchNodesAsyncClient nodes() { + return new OpenSearchNodesAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchShutdownAsyncClient shutdown() { + return new OpenSearchShutdownAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchSnapshotAsyncClient snapshot() { + return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions); + } + + public OpenSearchTasksAsyncClient tasks() { + return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); + } + + // ----- Endpoint: bulk + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * + */ + + public CompletableFuture bulk(BulkRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + BulkRequest, + BulkResponse, + ErrorResponse>) BulkRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkRequest} + * + */ + + public final CompletableFuture bulk(Function> fn) throws IOException, + OpenSearchException { + return bulk(fn.apply(new BulkRequest.Builder()).build()); + } + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * + */ + + public CompletableFuture bulk() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: clear_scroll + + /** + * Explicitly clears the search context for a scroll. + * + * + */ + + public CompletableFuture clearScroll(ClearScrollRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ClearScrollRequest, + ClearScrollResponse, + ErrorResponse>) ClearScrollRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Explicitly clears the search context for a scroll. + * + * @param fn + * a function that initializes a builder to create the + * {@link ClearScrollRequest} + * + */ + + public final CompletableFuture clearScroll( + Function> fn + ) throws IOException, OpenSearchException { + return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); + } + + /** + * Explicitly clears the search context for a scroll. + * + * + */ + + public CompletableFuture clearScroll() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + new ClearScrollRequest.Builder().build(), + ClearScrollRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: count + + /** + * Returns number of documents matching a query. + * + * + */ + + public CompletableFuture count(CountRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + CountRequest, + CountResponse, + ErrorResponse>) CountRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns number of documents matching a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link CountRequest} + * + */ + + public final CompletableFuture count(Function> fn) throws IOException, + OpenSearchException { + return count(fn.apply(new CountRequest.Builder()).build()); + } + + /** + * Returns number of documents matching a query. + * + * + */ + + public CompletableFuture count() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(new CountRequest.Builder().build(), CountRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: create + + /** + * Creates a new document in the index. + *

+ * Returns a 409 response when a document with a same ID already exists in the + * index. + * + * + */ + + public CompletableFuture create(CreateRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint< + CreateRequest, + CreateResponse, + ErrorResponse>) CreateRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Creates a new document in the index. + *

+ * Returns a 409 response when a document with a same ID already exists in the + * index. + * + * @param fn + * a function that initializes a builder to create the + * {@link CreateRequest} + * + */ + + public final CompletableFuture create( + Function, ObjectBuilder>> fn + ) throws IOException, OpenSearchException { + return create(fn.apply(new CreateRequest.Builder()).build()); + } + + // ----- Endpoint: create_point_in_time + + /** + * Provides low-level information about the disk utilization of a PIT by + * describing its Lucene segments. + * + * + */ + + public CompletableFuture createPit(CreatePitRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + CreatePitRequest, + CreatePitResponse, + ErrorResponse>) CreatePitRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Provides low-level information about the disk utilization of a PIT by + * describing its Lucene segments. + * + * @param fn + * a function that initializes a builder to create the + * {@link CreatePitRequest} + * + */ + + public final CompletableFuture createPit(Function> fn) + throws IOException, OpenSearchException { + return createPit(fn.apply(new CreatePitRequest.Builder()).build()); + } + + // ----- Endpoint: delete + + /** + * Removes a document from the index. + * + * + */ + + public CompletableFuture delete(DeleteRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteRequest, + DeleteResponse, + ErrorResponse>) DeleteRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Removes a document from the index. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteRequest} + * + */ + + public final CompletableFuture delete(Function> fn) + throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteRequest.Builder()).build()); + } + + // ----- Endpoint: delete_point_in_time + + /** + * Delete Point In Time + * + * + */ + + public CompletableFuture deletePit(DeletePitRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeletePitRequest, + DeletePitResponse, + ErrorResponse>) DeletePitRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Delete Point In Time + * + * @param fn + * a function that initializes a builder to create the + * {@link DeletePitRequest} + * + */ + + public final CompletableFuture deletePit(Function> fn) + throws IOException, OpenSearchException { + return deletePit(fn.apply(new DeletePitRequest.Builder()).build()); + } + + // ----- Endpoint: delete_by_query + + /** + * Deletes documents matching the provided query. + * + * + */ + + public CompletableFuture deleteByQuery(DeleteByQueryRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteByQueryRequest, + DeleteByQueryResponse, + ErrorResponse>) DeleteByQueryRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes documents matching the provided query. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteByQueryRequest} + * + */ + + public final CompletableFuture deleteByQuery( + Function> fn + ) throws IOException, OpenSearchException { + return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); + } + + // ----- Endpoint: delete_by_query_rethrottle + + /** + * Changes the number of requests per second for a particular Delete By Query + * operation. + * + * + */ + + public CompletableFuture deleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteByQueryRethrottleRequest, + DeleteByQueryRethrottleResponse, + ErrorResponse>) DeleteByQueryRethrottleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Delete By Query + * operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteByQueryRethrottleRequest} + * + */ + + public final CompletableFuture deleteByQueryRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build()); + } + + // ----- Endpoint: delete_script + + /** + * Deletes a script. + * + * + */ + + public CompletableFuture deleteScript(DeleteScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteScriptRequest, + DeleteScriptResponse, + ErrorResponse>) DeleteScriptRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteScriptRequest} + * + */ + + public final CompletableFuture deleteScript( + Function> fn + ) throws IOException, OpenSearchException { + return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); + } + + // ----- Endpoint: exists + + /** + * Returns information about whether a document exists in an index. + * + * + */ + + public CompletableFuture exists(ExistsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ExistsRequest, + BooleanResponse, + ErrorResponse>) ExistsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about whether a document exists in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExistsRequest} + * + */ + + public final CompletableFuture exists(Function> fn) + throws IOException, OpenSearchException { + return exists(fn.apply(new ExistsRequest.Builder()).build()); + } + + // ----- Endpoint: exists_source + + /** + * Returns information about whether a document source exists in an index. + * + * + */ + + public CompletableFuture existsSource(ExistsSourceRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ExistsSourceRequest, + BooleanResponse, + ErrorResponse>) ExistsSourceRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about whether a document source exists in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExistsSourceRequest} + * + */ + + public final CompletableFuture existsSource( + Function> fn + ) throws IOException, OpenSearchException { + return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); + } + + // ----- Endpoint: explain + + /** + * Returns information about why a specific matches (or doesn't match) a query. + * + * + */ + + public CompletableFuture> explain(ExplainRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ExplainRequest, + ExplainResponse, + ErrorResponse>) ExplainRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.explain.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about why a specific matches (or doesn't match) a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExplainRequest} + * + */ + + public final CompletableFuture> explain( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: field_caps + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + */ + + public CompletableFuture fieldCaps(FieldCapsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + FieldCapsRequest, + FieldCapsResponse, + ErrorResponse>) FieldCapsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + * + * @param fn + * a function that initializes a builder to create the + * {@link FieldCapsRequest} + * + */ + + public final CompletableFuture fieldCaps(Function> fn) + throws IOException, OpenSearchException { + return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); + } + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + * + * + */ + + public CompletableFuture fieldCaps() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + new FieldCapsRequest.Builder().build(), + FieldCapsRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: get + + /** + * Returns a document. + * + * + */ + + public CompletableFuture> get(GetRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetRequest, + GetResponse, + ErrorResponse>) GetRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.get.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns a document. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetRequest} + * + */ + + public final CompletableFuture> get( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: get_script + + /** + * Returns a script. + * + * + */ + + public CompletableFuture getScript(GetScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetScriptRequest, + GetScriptResponse, + ErrorResponse>) GetScriptRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetScriptRequest} + * + */ + + public final CompletableFuture getScript(Function> fn) + throws IOException, OpenSearchException { + return getScript(fn.apply(new GetScriptRequest.Builder()).build()); + } + + // ----- Endpoint: get_script_context + + /** + * Returns all script contexts. + * + * + */ + public CompletableFuture getScriptContext() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + GetScriptContextRequest._INSTANCE, + GetScriptContextRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: get_script_languages + + /** + * Returns available script types, languages and contexts + * + * + */ + public CompletableFuture getScriptLanguages() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + GetScriptLanguagesRequest._INSTANCE, + GetScriptLanguagesRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: get_source + + /** + * Returns the source of a document. + * + * + */ + + public CompletableFuture> getSource(GetSourceRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetSourceRequest, + GetSourceResponse, + ErrorResponse>) GetSourceRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.get_source.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the source of a document. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetSourceRequest} + * + */ + + public final CompletableFuture> getSource( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: index + + /** + * Creates or updates a document in an index. + * + * + */ + + public CompletableFuture index(IndexRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint< + IndexRequest, + IndexResponse, + ErrorResponse>) IndexRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Creates or updates a document in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link IndexRequest} + * + */ + + public final CompletableFuture index( + Function, ObjectBuilder>> fn + ) throws IOException, OpenSearchException { + return index(fn.apply(new IndexRequest.Builder()).build()); + } + + // ----- Endpoint: info + + /** + * Returns basic information about the cluster. + * + * + */ + public CompletableFuture info() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: list_point_in_time + + /** + * List all Point In Time + * + * + */ + + public CompletableFuture listAllPit() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(ListAllPitRequest._INSTANCE, ListAllPitRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: mget + + /** + * Allows to get multiple documents in one request. + * + * + */ + + public CompletableFuture> mget(MgetRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MgetRequest, + MgetResponse, + ErrorResponse>) MgetRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.mget.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to get multiple documents in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MgetRequest} + * + */ + + public final CompletableFuture> mget( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: msearch + + /** + * Allows to execute several search operations in one request. + * + * + */ + + public CompletableFuture> msearch(MsearchRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MsearchRequest, + MsearchResponse, + ErrorResponse>) MsearchRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.msearch.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to execute several search operations in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MsearchRequest} + * + */ + + public final CompletableFuture> msearch( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: msearch_template + + /** + * Allows to execute several search template operations in one request. + * + * + */ + + public CompletableFuture> msearchTemplate( + MsearchTemplateRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MsearchTemplateRequest, + MsearchTemplateResponse, + ErrorResponse>) MsearchTemplateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.msearch_template.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to execute several search template operations in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MsearchTemplateRequest} + * + */ + + public final CompletableFuture> msearchTemplate( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: mtermvectors + + /** + * Returns multiple termvectors in one request. + * + * + */ + + public CompletableFuture mtermvectors(MtermvectorsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + MtermvectorsRequest, + MtermvectorsResponse, + ErrorResponse>) MtermvectorsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns multiple termvectors in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MtermvectorsRequest} + * + */ + + public final CompletableFuture mtermvectors( + Function> fn + ) throws IOException, OpenSearchException { + return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); + } + + /** + * Returns multiple termvectors in one request. + * + * + */ + + public CompletableFuture mtermvectors() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + new MtermvectorsRequest.Builder().build(), + MtermvectorsRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: ping + + /** + * Returns whether the cluster is running. + * + * + */ + public CompletableFuture ping() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: put_script + + /** + * Creates or updates a script. + * + * + */ + + public CompletableFuture putScript(PutScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + PutScriptRequest, + PutScriptResponse, + ErrorResponse>) PutScriptRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Creates or updates a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutScriptRequest} + * + */ + + public final CompletableFuture putScript(Function> fn) + throws IOException, OpenSearchException { + return putScript(fn.apply(new PutScriptRequest.Builder()).build()); + } + + // ----- Endpoint: rank_eval + + /** + * Allows to evaluate the quality of ranked search results over a set of typical + * search queries + * + * + */ + + public CompletableFuture rankEval(RankEvalRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RankEvalRequest, + RankEvalResponse, + ErrorResponse>) RankEvalRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to evaluate the quality of ranked search results over a set of typical + * search queries + * + * @param fn + * a function that initializes a builder to create the + * {@link RankEvalRequest} + * + */ + + public final CompletableFuture rankEval(Function> fn) + throws IOException, OpenSearchException { + return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); + } + + // ----- Endpoint: reindex + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * + */ + + public CompletableFuture reindex(ReindexRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ReindexRequest, + ReindexResponse, + ErrorResponse>) ReindexRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * @param fn + * a function that initializes a builder to create the + * {@link ReindexRequest} + * + */ + + public final CompletableFuture reindex(Function> fn) + throws IOException, OpenSearchException { + return reindex(fn.apply(new ReindexRequest.Builder()).build()); + } + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * + */ + + public CompletableFuture reindex() throws IOException, OpenSearchException { + return this.transport.performRequestAsync(new ReindexRequest.Builder().build(), ReindexRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: reindex_rethrottle + + /** + * Changes the number of requests per second for a particular Reindex operation. + * + * + */ + + public CompletableFuture reindexRethrottle(ReindexRethrottleRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ReindexRethrottleRequest, + ReindexRethrottleResponse, + ErrorResponse>) ReindexRethrottleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Reindex operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link ReindexRethrottleRequest} + * + */ + + public final CompletableFuture reindexRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build()); + } + + // ----- Endpoint: render_search_template + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public CompletableFuture renderSearchTemplate(RenderSearchTemplateRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RenderSearchTemplateRequest, + RenderSearchTemplateResponse, + ErrorResponse>) RenderSearchTemplateRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param fn + * a function that initializes a builder to create the + * {@link RenderSearchTemplateRequest} + * + */ + + public final CompletableFuture renderSearchTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public CompletableFuture renderSearchTemplate() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + new RenderSearchTemplateRequest.Builder().build(), + RenderSearchTemplateRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: scripts_painless_execute + + /** + * Allows an arbitrary script to be executed and a result to be returned + * + * + */ + + public CompletableFuture> scriptsPainlessExecute( + ScriptsPainlessExecuteRequest request, + Class tResultClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ScriptsPainlessExecuteRequest, + ScriptsPainlessExecuteResponse, + ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.scripts_painless_execute.TResult", + getDeserializer(tResultClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows an arbitrary script to be executed and a result to be returned + * + * @param fn + * a function that initializes a builder to create the + * {@link ScriptsPainlessExecuteRequest} + * + */ + + public final CompletableFuture> scriptsPainlessExecute( + Function> fn, + Class tResultClass + ) throws IOException, OpenSearchException { + return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); + } + + // ----- Endpoint: scroll + + /** + * Allows to retrieve a large numbers of results from a single search request. + * + */ + + public CompletableFuture> scroll(ScrollRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ScrollRequest, + ScrollResponse, + ErrorResponse>) ScrollRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.scroll.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to retrieve a large numbers of results from a single search request. + * + * @param fn + * a function that initializes a builder to create the + * {@link ScrollRequest} + */ + + public final CompletableFuture> scroll( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: search + + /** + * Returns results matching a query. + * + * + */ + + public CompletableFuture> search(SearchRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + SearchRequest, + SearchResponse, + ErrorResponse>) SearchRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.search.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns results matching a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchRequest} + * + */ + + public final CompletableFuture> search( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: search_shards + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * + */ + + public CompletableFuture searchShards(SearchShardsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + SearchShardsRequest, + SearchShardsResponse, + ErrorResponse>) SearchShardsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchShardsRequest} + * + */ + + public final CompletableFuture searchShards( + Function> fn + ) throws IOException, OpenSearchException { + return searchShards(fn.apply(new SearchShardsRequest.Builder()).build()); + } + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * + */ + + public CompletableFuture searchShards() throws IOException, OpenSearchException { + return this.transport.performRequestAsync( + new SearchShardsRequest.Builder().build(), + SearchShardsRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: search_template + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public CompletableFuture> searchTemplate( + SearchTemplateRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + SearchTemplateRequest, + SearchTemplateResponse, + ErrorResponse>) SearchTemplateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.search_template.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchTemplateRequest} + * + */ + + public final CompletableFuture> searchTemplate( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: terms_enum + + /** + * The terms enum API can be used to discover terms in the index that begin with + * the provided string. It is designed for low-latency look-ups used in + * auto-complete scenarios. + * + * + */ + + public CompletableFuture termsEnum(TermsEnumRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + TermsEnumRequest, + TermsEnumResponse, + ErrorResponse>) TermsEnumRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * The terms enum API can be used to discover terms in the index that begin with + * the provided string. It is designed for low-latency look-ups used in + * auto-complete scenarios. + * + * @param fn + * a function that initializes a builder to create the + * {@link TermsEnumRequest} + * + */ + + public final CompletableFuture termsEnum(Function> fn) + throws IOException, OpenSearchException { + return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); + } + + // ----- Endpoint: termvectors + + /** + * Returns information and statistics about terms in the fields of a particular + * document. + * + * + */ + + public CompletableFuture termvectors(TermvectorsRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint< + TermvectorsRequest, + TermvectorsResponse, + ErrorResponse>) TermvectorsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information and statistics about terms in the fields of a particular + * document. + * + * @param fn + * a function that initializes a builder to create the + * {@link TermvectorsRequest} + * + */ + + public final CompletableFuture termvectors( + Function, ObjectBuilder>> fn + ) throws IOException, OpenSearchException { + return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); + } + + // ----- Endpoint: update + + /** + * Updates a document with a script or partial document. + * + * + */ + + public CompletableFuture> update( + UpdateRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint< + UpdateRequest, + UpdateResponse, + ErrorResponse>) UpdateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.update.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Updates a document with a script or partial document. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateRequest} + * + */ + + public final CompletableFuture> update( + Function, ObjectBuilder>> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: update_by_query + + /** + * Performs an update on every document in the index without changing the + * source, for example to pick up a mapping change. + * + * + */ + + public CompletableFuture updateByQuery(UpdateByQueryRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UpdateByQueryRequest, + UpdateByQueryResponse, + ErrorResponse>) UpdateByQueryRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Performs an update on every document in the index without changing the + * source, for example to pick up a mapping change. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateByQueryRequest} + * + */ + + public final CompletableFuture updateByQuery( + Function> fn + ) throws IOException, OpenSearchException { + return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); + } + + // ----- Endpoint: update_by_query_rethrottle + + /** + * Changes the number of requests per second for a particular Update By Query + * operation. + * + * + */ + + public CompletableFuture updateByQueryRethrottle(UpdateByQueryRethrottleRequest request) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UpdateByQueryRethrottleRequest, + UpdateByQueryRethrottleResponse, + ErrorResponse>) UpdateByQueryRethrottleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Update By Query + * operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateByQueryRethrottleRequest} + * + */ + + public final CompletableFuture updateByQueryRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build()); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java index 801ff279df..3b2d8d76ff 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -32,9 +32,12 @@ package org.opensearch.client.opensearch; +import java.io.IOException; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.cat.OpenSearchCatClient; import org.opensearch.client.opensearch.cluster.OpenSearchClusterClient; import org.opensearch.client.opensearch.core.BulkRequest; @@ -126,1446 +129,1540 @@ import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient; -import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.JsonEndpoint; +import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr; import org.opensearch.client.util.ObjectBuilder; -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; /** * Client for the namespace. */ public class OpenSearchClient extends ApiClient { - public OpenSearchClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchClient(this.transport, transportOptions); - } - - // ----- Child clients - - public OpenSearchCatClient cat() { - return new OpenSearchCatClient(this.transport, this.transportOptions); - } - - public OpenSearchClusterClient cluster() { - return new OpenSearchClusterClient(this.transport, this.transportOptions); - } - - public OpenSearchDanglingIndicesClient danglingIndices() { - return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); - } - - public OpenSearchFeaturesClient features() { - return new OpenSearchFeaturesClient(this.transport, this.transportOptions); - } - - public OpenSearchIndicesClient indices() { - return new OpenSearchIndicesClient(this.transport, this.transportOptions); - } - - public OpenSearchIngestClient ingest() { - return new OpenSearchIngestClient(this.transport, this.transportOptions); - } - - public OpenSearchNodesClient nodes() { - return new OpenSearchNodesClient(this.transport, this.transportOptions); - } - - public OpenSearchShutdownClient shutdown() { - return new OpenSearchShutdownClient(this.transport, this.transportOptions); - } - - public OpenSearchSnapshotClient snapshot() { - return new OpenSearchSnapshotClient(this.transport, this.transportOptions); - } - - public OpenSearchTasksClient tasks() { - return new OpenSearchTasksClient(this.transport, this.transportOptions); - } - - // ----- Endpoint: bulk - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * - */ - - public BulkResponse bulk(BulkRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) BulkRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * @param fn - * a function that initializes a builder to create the - * {@link BulkRequest} - * - */ - - public final BulkResponse bulk(Function> fn) - throws IOException, OpenSearchException { - return bulk(fn.apply(new BulkRequest.Builder()).build()); - } - - /** - * Allows to perform multiple index/update/delete operations in a single - * request. - * - * - */ - - public BulkResponse bulk() throws IOException, OpenSearchException { - return this.transport.performRequest(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: clear_scroll - - /** - * Explicitly clears the search context for a scroll. - * - * - */ - - public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ClearScrollRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Explicitly clears the search context for a scroll. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearScrollRequest} - * - */ - - public final ClearScrollResponse clearScroll( - Function> fn) - throws IOException, OpenSearchException { - return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); - } - - /** - * Explicitly clears the search context for a scroll. - * - * - */ - - public ClearScrollResponse clearScroll() throws IOException, OpenSearchException { - return this.transport.performRequest(new ClearScrollRequest.Builder().build(), ClearScrollRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: count - - /** - * Returns number of documents matching a query. - * - * - */ - - public CountResponse count(CountRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) CountRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns number of documents matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link CountRequest} - * - */ - - public final CountResponse count(Function> fn) - throws IOException, OpenSearchException { - return count(fn.apply(new CountRequest.Builder()).build()); - } - - /** - * Returns number of documents matching a query. - * - * - */ - - public CountResponse count() throws IOException, OpenSearchException { - return this.transport.performRequest(new CountRequest.Builder().build(), CountRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: create - - /** - * Creates a new document in the index. - *

- * Returns a 409 response when a document with a same ID already exists in the - * index. - * - * - */ - - public CreateResponse create(CreateRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, CreateResponse, ErrorResponse> endpoint = - (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates a new document in the index. - *

- * Returns a 409 response when a document with a same ID already exists in the - * index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRequest} - * - */ - - public final CreateResponse create( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return create(fn.apply(new CreateRequest.Builder()).build()); - } - - // ----- Endpoint: create_point_in_time - - /** - * Provides low-level information about the disk utilization of a PIT by - * describing its Lucene segments. - * - * - */ - - public CreatePitResponse createPit(CreatePitRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreatePitRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Provides low-level information about the disk utilization of a PIT by - * describing its Lucene segments. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreatePitRequest} - * - */ - - public final CreatePitResponse createPit( - Function> fn) - throws IOException, OpenSearchException { - return createPit(fn.apply(new CreatePitRequest.Builder()).build()); - } - - // ----- Endpoint: delete - - /** - * Removes a document from the index. - * - * - */ - - public DeleteResponse delete(DeleteRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Removes a document from the index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRequest} - * - */ - - public final DeleteResponse delete(Function> fn) - throws IOException, OpenSearchException { - return delete(fn.apply(new DeleteRequest.Builder()).build()); - } - - // ----- Endpoint: delete_point_in_time - - /** - * Delete Point In Time - * - * - */ - - public DeletePitResponse deletePit(DeletePitRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeletePitRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete Point In Time - * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePitRequest} - * - */ - - public final DeletePitResponse deletePit( - Function> fn) - throws IOException, OpenSearchException { - return deletePit(fn.apply(new DeletePitRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query - - /** - * Deletes documents matching the provided query. - * - * - */ - - public DeleteByQueryResponse deleteByQuery(DeleteByQueryRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteByQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes documents matching the provided query. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRequest} - * - */ - - public final DeleteByQueryResponse deleteByQuery( - Function> fn) - throws IOException, OpenSearchException { - return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query_rethrottle - - /** - * Changes the number of requests per second for a particular Delete By Query - * operation. - * - * - */ - - public DeleteByQueryRethrottleResponse deleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - DeleteByQueryRethrottleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Delete By Query - * operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRethrottleRequest} - * - */ - - public final DeleteByQueryRethrottleResponse deleteByQueryRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build()); - } - - // ----- Endpoint: delete_script - - /** - * Deletes a script. - * - * - */ - - public DeleteScriptResponse deleteScript(DeleteScriptRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) DeleteScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteScriptRequest} - * - */ - - public final DeleteScriptResponse deleteScript( - Function> fn) - throws IOException, OpenSearchException { - return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); - } - - // ----- Endpoint: exists - - /** - * Returns information about whether a document exists in an index. - * - * - */ - - public BooleanResponse exists(ExistsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a document exists in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * - */ - - public final BooleanResponse exists(Function> fn) - throws IOException, OpenSearchException { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: exists_source - - /** - * Returns information about whether a document source exists in an index. - * - * - */ - - public BooleanResponse existsSource(ExistsSourceRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ExistsSourceRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a document source exists in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsSourceRequest} - * - */ - - public final BooleanResponse existsSource( - Function> fn) - throws IOException, OpenSearchException { - return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); - } - - // ----- Endpoint: explain - - /** - * Returns information about why a specific matches (or doesn't match) a query. - * - * - */ - - public ExplainResponse explain(ExplainRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.explain.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about why a specific matches (or doesn't match) a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * - */ - - public final ExplainResponse explain( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: field_caps - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - * - * - */ - - public FieldCapsResponse fieldCaps(FieldCapsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) FieldCapsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link FieldCapsRequest} - * - */ - - public final FieldCapsResponse fieldCaps(Function> fn) - throws IOException, OpenSearchException { - return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); - } - - /** - * Returns the information about the capabilities of fields among multiple - * indices. - * - * - */ - - public FieldCapsResponse fieldCaps() throws IOException, OpenSearchException { - return this.transport.performRequest(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get - - /** - * Returns a document. - * - * - */ - - public GetResponse get(GetRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.get.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * - */ - - public final GetResponse get(Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: get_script - - /** - * Returns a script. - * - * - */ - - public GetScriptResponse getScript(GetScriptRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) GetScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetScriptRequest} - * - */ - - public final GetScriptResponse getScript(Function> fn) - throws IOException, OpenSearchException { - return getScript(fn.apply(new GetScriptRequest.Builder()).build()); - } - - // ----- Endpoint: get_script_context - - /** - * Returns all script contexts. - * - * - */ - public GetScriptContextResponse getScriptContext() throws IOException, OpenSearchException { - return this.transport.performRequest(GetScriptContextRequest._INSTANCE, GetScriptContextRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get_script_languages - - /** - * Returns available script types, languages and contexts - * - * - */ - public GetScriptLanguagesResponse getScriptLanguages() throws IOException, OpenSearchException { - return this.transport.performRequest(GetScriptLanguagesRequest._INSTANCE, GetScriptLanguagesRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get_source - - /** - * Returns the source of a document. - * - * - */ - - public GetSourceResponse getSource(GetSourceRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.get_source.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * - */ - - public final GetSourceResponse getSource( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: index - - /** - * Creates or updates a document in an index. - * - * - */ - - public IndexResponse index(IndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, IndexResponse, ErrorResponse> endpoint = - (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates or updates a document in an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndexRequest} - * - */ - - public final IndexResponse index( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return index(fn.apply(new IndexRequest.Builder()).build()); - } - - // ----- Endpoint: info - - /** - * Returns basic information about the cluster. - * - * - */ - public InfoResponse info() throws IOException, OpenSearchException { - return this.transport.performRequest(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: list_point_in_time - - /** - * List all Point In Time - * - * - */ - - public ListAllPitResponse listAllPit() - throws IOException, OpenSearchException { - return this.transport.performRequest(ListAllPitRequest._INSTANCE, ListAllPitRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: mget - - /** - * Allows to get multiple documents in one request. - * - * - */ - - public MgetResponse mget(MgetRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.mget.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * - */ - - public final MgetResponse mget(Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: msearch - - /** - * Allows to execute several search operations in one request. - * - * - */ - - public MsearchResponse msearch(MsearchRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.msearch.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * - */ - - public final MsearchResponse msearch( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: msearch_template - - /** - * Allows to execute several search template operations in one request. - * - * - */ - - public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.msearch_template.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search template operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * - */ - - public final MsearchTemplateResponse msearchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: mtermvectors - - /** - * Returns multiple termvectors in one request. - * - * - */ - - public MtermvectorsResponse mtermvectors(MtermvectorsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) MtermvectorsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns multiple termvectors in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MtermvectorsRequest} - * - */ - - public final MtermvectorsResponse mtermvectors( - Function> fn) - throws IOException, OpenSearchException { - return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); - } - - /** - * Returns multiple termvectors in one request. - * - * - */ - - public MtermvectorsResponse mtermvectors() throws IOException, OpenSearchException { - return this.transport.performRequest(new MtermvectorsRequest.Builder().build(), MtermvectorsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: ping - - /** - * Returns whether the cluster is running. - * - * - */ - public BooleanResponse ping() throws IOException, OpenSearchException { - return this.transport.performRequest(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: put_script - - /** - * Creates or updates a script. - * - * - */ - - public PutScriptResponse putScript(PutScriptRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) PutScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates or updates a script. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutScriptRequest} - * - */ - - public final PutScriptResponse putScript(Function> fn) - throws IOException, OpenSearchException { - return putScript(fn.apply(new PutScriptRequest.Builder()).build()); - } - - // ----- Endpoint: rank_eval - - /** - * Allows to evaluate the quality of ranked search results over a set of typical - * search queries - * - * - */ - - public RankEvalResponse rankEval(RankEvalRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) RankEvalRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to evaluate the quality of ranked search results over a set of typical - * search queries - * - * @param fn - * a function that initializes a builder to create the - * {@link RankEvalRequest} - * - */ - - public final RankEvalResponse rankEval(Function> fn) - throws IOException, OpenSearchException { - return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); - } - - // ----- Endpoint: reindex - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * - */ - - public ReindexResponse reindex(ReindexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) ReindexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRequest} - * - */ - - public final ReindexResponse reindex(Function> fn) - throws IOException, OpenSearchException { - return reindex(fn.apply(new ReindexRequest.Builder()).build()); - } - - /** - * Allows to copy documents from one index to another, optionally filtering the - * source documents by a query, changing the destination index settings, or - * fetching the documents from a remote cluster. - * - * - */ - - public ReindexResponse reindex() throws IOException, OpenSearchException { - return this.transport.performRequest(new ReindexRequest.Builder().build(), ReindexRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: reindex_rethrottle - - /** - * Changes the number of requests per second for a particular Reindex operation. - * - * - */ - - public ReindexRethrottleResponse reindexRethrottle(ReindexRethrottleRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - ReindexRethrottleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Reindex operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRethrottleRequest} - * - */ - - public final ReindexRethrottleResponse reindexRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build()); - } - - // ----- Endpoint: render_search_template - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public RenderSearchTemplateResponse renderSearchTemplate(RenderSearchTemplateRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - RenderSearchTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * @param fn - * a function that initializes a builder to create the - * {@link RenderSearchTemplateRequest} - * - */ - - public final RenderSearchTemplateResponse renderSearchTemplate( - Function> fn) - throws IOException, OpenSearchException { - return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public RenderSearchTemplateResponse renderSearchTemplate() throws IOException, OpenSearchException { - return this.transport.performRequest(new RenderSearchTemplateRequest.Builder().build(), - RenderSearchTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: scripts_painless_execute - - /** - * Allows an arbitrary script to be executed and a result to be returned - * - * - */ - - public ScriptsPainlessExecuteResponse scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Class tResultClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.scripts_painless_execute.TResult", - getDeserializer(tResultClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows an arbitrary script to be executed and a result to be returned - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * - */ - - public final ScriptsPainlessExecuteResponse scriptsPainlessExecute( - Function> fn, - Class tResultClass) throws IOException, OpenSearchException { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); - } - - // ----- Endpoint: scroll - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - */ - - public ScrollResponse scroll(ScrollRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.scroll.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - */ - - public final ScrollResponse scroll( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: search - - /** - * Returns results matching a query. - * - * - */ - - public SearchResponse search(SearchRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.search.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * - */ - - public final SearchResponse search( - Function> fn, Class tDocumentClass) - throws IOException, OpenSearchException { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: search_shards - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * - */ - - public SearchShardsResponse searchShards(SearchShardsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) SearchShardsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchShardsRequest} - * - */ - - public final SearchShardsResponse searchShards( - Function> fn) - throws IOException, OpenSearchException { - return searchShards(fn.apply(new SearchShardsRequest.Builder()).build()); - } - - /** - * Returns information about the indices and shards that a search request would - * be executed against. - * - * - */ - - public SearchShardsResponse searchShards() throws IOException, OpenSearchException { - return this.transport.performRequest(new SearchShardsRequest.Builder().build(), SearchShardsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: search_template - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * - */ - - public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, - Class tDocumentClass) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = - (JsonEndpoint, ErrorResponse>) - SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.search_template.TDocument", - getDeserializer(tDocumentClass)); - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to use the Mustache language to pre-render a search definition. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * - */ - - public final SearchTemplateResponse searchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: terms_enum - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * - */ - - public TermsEnumResponse termsEnum(TermsEnumRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) TermsEnumRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermsEnumRequest} - * - */ - - public final TermsEnumResponse termsEnum(Function> fn) - throws IOException, OpenSearchException { - return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); - } - - // ----- Endpoint: termvectors - - /** - * Returns information and statistics about terms in the fields of a particular - * document. - * - * - */ - - public TermvectorsResponse termvectors(TermvectorsRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = - (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information and statistics about terms in the fields of a particular - * document. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermvectorsRequest} - * - */ - - public final TermvectorsResponse termvectors( - Function, ObjectBuilder>> fn) - throws IOException, OpenSearchException { - return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); - } - - // ----- Endpoint: update - - /** - * Updates a document with a script or partial document. - * - * - */ - - public UpdateResponse update( - UpdateRequest request, Class tDocumentClass) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = - (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "org.opensearch.client:Deserializer:_global.update.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Updates a document with a script or partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * - */ - - public final UpdateResponse update( - - Function, - ObjectBuilder>> fn, - Class tDocumentClass) throws IOException, OpenSearchException { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); - } - - // ----- Endpoint: update_by_query - - /** - * Performs an update on every document in the index without changing the - * source, for example to pick up a mapping change. - * - * - */ - - public UpdateByQueryResponse updateByQuery(UpdateByQueryRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - UpdateByQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Performs an update on every document in the index without changing the - * source, for example to pick up a mapping change. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRequest} - * - */ - - public final UpdateByQueryResponse updateByQuery( - Function> fn) - throws IOException, OpenSearchException { - return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: update_by_query_rethrottle - - /** - * Changes the number of requests per second for a particular Update By Query - * operation. - * - * - */ - - public UpdateByQueryRethrottleResponse updateByQueryRethrottle(UpdateByQueryRethrottleRequest request) - throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) - UpdateByQueryRethrottleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Changes the number of requests per second for a particular Update By Query - * operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRethrottleRequest} - * - */ - - public final UpdateByQueryRethrottleResponse updateByQueryRethrottle( - Function> fn) - throws IOException, OpenSearchException { - return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build()); - } + public OpenSearchClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchClient(this.transport, transportOptions); + } + + // ----- Child clients + + public OpenSearchCatClient cat() { + return new OpenSearchCatClient(this.transport, this.transportOptions); + } + + public OpenSearchClusterClient cluster() { + return new OpenSearchClusterClient(this.transport, this.transportOptions); + } + + public OpenSearchDanglingIndicesClient danglingIndices() { + return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); + } + + public OpenSearchFeaturesClient features() { + return new OpenSearchFeaturesClient(this.transport, this.transportOptions); + } + + public OpenSearchIndicesClient indices() { + return new OpenSearchIndicesClient(this.transport, this.transportOptions); + } + + public OpenSearchIngestClient ingest() { + return new OpenSearchIngestClient(this.transport, this.transportOptions); + } + + public OpenSearchNodesClient nodes() { + return new OpenSearchNodesClient(this.transport, this.transportOptions); + } + + public OpenSearchShutdownClient shutdown() { + return new OpenSearchShutdownClient(this.transport, this.transportOptions); + } + + public OpenSearchSnapshotClient snapshot() { + return new OpenSearchSnapshotClient(this.transport, this.transportOptions); + } + + public OpenSearchTasksClient tasks() { + return new OpenSearchTasksClient(this.transport, this.transportOptions); + } + + // ----- Endpoint: bulk + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * + */ + + public BulkResponse bulk(BulkRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + BulkRequest, + BulkResponse, + ErrorResponse>) BulkRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkRequest} + * + */ + + public final BulkResponse bulk(Function> fn) throws IOException, OpenSearchException { + return bulk(fn.apply(new BulkRequest.Builder()).build()); + } + + /** + * Allows to perform multiple index/update/delete operations in a single + * request. + * + * + */ + + public BulkResponse bulk() throws IOException, OpenSearchException { + return this.transport.performRequest(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: clear_scroll + + /** + * Explicitly clears the search context for a scroll. + * + * + */ + + public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ClearScrollRequest, + ClearScrollResponse, + ErrorResponse>) ClearScrollRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Explicitly clears the search context for a scroll. + * + * @param fn + * a function that initializes a builder to create the + * {@link ClearScrollRequest} + * + */ + + public final ClearScrollResponse clearScroll(Function> fn) + throws IOException, OpenSearchException { + return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); + } + + /** + * Explicitly clears the search context for a scroll. + * + * + */ + + public ClearScrollResponse clearScroll() throws IOException, OpenSearchException { + return this.transport.performRequest(new ClearScrollRequest.Builder().build(), ClearScrollRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: count + + /** + * Returns number of documents matching a query. + * + * + */ + + public CountResponse count(CountRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + CountRequest, + CountResponse, + ErrorResponse>) CountRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns number of documents matching a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link CountRequest} + * + */ + + public final CountResponse count(Function> fn) throws IOException, + OpenSearchException { + return count(fn.apply(new CountRequest.Builder()).build()); + } + + /** + * Returns number of documents matching a query. + * + * + */ + + public CountResponse count() throws IOException, OpenSearchException { + return this.transport.performRequest(new CountRequest.Builder().build(), CountRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: create + + /** + * Creates a new document in the index. + *

+ * Returns a 409 response when a document with a same ID already exists in the + * index. + * + * + */ + + public CreateResponse create(CreateRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint< + CreateRequest, + CreateResponse, + ErrorResponse>) CreateRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Creates a new document in the index. + *

+ * Returns a 409 response when a document with a same ID already exists in the + * index. + * + * @param fn + * a function that initializes a builder to create the + * {@link CreateRequest} + * + */ + + public final CreateResponse create(Function, ObjectBuilder>> fn) + throws IOException, OpenSearchException { + return create(fn.apply(new CreateRequest.Builder()).build()); + } + + // ----- Endpoint: create_point_in_time + + /** + * Provides low-level information about the disk utilization of a PIT by + * describing its Lucene segments. + * + * + */ + + public CreatePitResponse createPit(CreatePitRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + CreatePitRequest, + CreatePitResponse, + ErrorResponse>) CreatePitRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Provides low-level information about the disk utilization of a PIT by + * describing its Lucene segments. + * + * @param fn + * a function that initializes a builder to create the + * {@link CreatePitRequest} + * + */ + + public final CreatePitResponse createPit(Function> fn) throws IOException, + OpenSearchException { + return createPit(fn.apply(new CreatePitRequest.Builder()).build()); + } + + // ----- Endpoint: delete + + /** + * Removes a document from the index. + * + * + */ + + public DeleteResponse delete(DeleteRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteRequest, + DeleteResponse, + ErrorResponse>) DeleteRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Removes a document from the index. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteRequest} + * + */ + + public final DeleteResponse delete(Function> fn) throws IOException, + OpenSearchException { + return delete(fn.apply(new DeleteRequest.Builder()).build()); + } + + // ----- Endpoint: delete_point_in_time + + /** + * Delete Point In Time + * + * + */ + + public DeletePitResponse deletePit(DeletePitRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeletePitRequest, + DeletePitResponse, + ErrorResponse>) DeletePitRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Delete Point In Time + * + * @param fn + * a function that initializes a builder to create the + * {@link DeletePitRequest} + * + */ + + public final DeletePitResponse deletePit(Function> fn) throws IOException, + OpenSearchException { + return deletePit(fn.apply(new DeletePitRequest.Builder()).build()); + } + + // ----- Endpoint: delete_by_query + + /** + * Deletes documents matching the provided query. + * + * + */ + + public DeleteByQueryResponse deleteByQuery(DeleteByQueryRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteByQueryRequest, + DeleteByQueryResponse, + ErrorResponse>) DeleteByQueryRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes documents matching the provided query. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteByQueryRequest} + * + */ + + public final DeleteByQueryResponse deleteByQuery(Function> fn) + throws IOException, OpenSearchException { + return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); + } + + // ----- Endpoint: delete_by_query_rethrottle + + /** + * Changes the number of requests per second for a particular Delete By Query + * operation. + * + * + */ + + public DeleteByQueryRethrottleResponse deleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteByQueryRethrottleRequest, + DeleteByQueryRethrottleResponse, + ErrorResponse>) DeleteByQueryRethrottleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Delete By Query + * operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteByQueryRethrottleRequest} + * + */ + + public final DeleteByQueryRethrottleResponse deleteByQueryRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build()); + } + + // ----- Endpoint: delete_script + + /** + * Deletes a script. + * + * + */ + + public DeleteScriptResponse deleteScript(DeleteScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteScriptRequest, + DeleteScriptResponse, + ErrorResponse>) DeleteScriptRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteScriptRequest} + * + */ + + public final DeleteScriptResponse deleteScript(Function> fn) + throws IOException, OpenSearchException { + return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); + } + + // ----- Endpoint: exists + + /** + * Returns information about whether a document exists in an index. + * + * + */ + + public BooleanResponse exists(ExistsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ExistsRequest, + BooleanResponse, + ErrorResponse>) ExistsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about whether a document exists in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExistsRequest} + * + */ + + public final BooleanResponse exists(Function> fn) throws IOException, + OpenSearchException { + return exists(fn.apply(new ExistsRequest.Builder()).build()); + } + + // ----- Endpoint: exists_source + + /** + * Returns information about whether a document source exists in an index. + * + * + */ + + public BooleanResponse existsSource(ExistsSourceRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ExistsSourceRequest, + BooleanResponse, + ErrorResponse>) ExistsSourceRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about whether a document source exists in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExistsSourceRequest} + * + */ + + public final BooleanResponse existsSource(Function> fn) + throws IOException, OpenSearchException { + return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); + } + + // ----- Endpoint: explain + + /** + * Returns information about why a specific matches (or doesn't match) a query. + * + * + */ + + public ExplainResponse explain(ExplainRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ExplainRequest, + ExplainResponse, + ErrorResponse>) ExplainRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.explain.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about why a specific matches (or doesn't match) a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExplainRequest} + * + */ + + public final ExplainResponse explain( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: field_caps + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + * + * + */ + + public FieldCapsResponse fieldCaps(FieldCapsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + FieldCapsRequest, + FieldCapsResponse, + ErrorResponse>) FieldCapsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + * + * @param fn + * a function that initializes a builder to create the + * {@link FieldCapsRequest} + * + */ + + public final FieldCapsResponse fieldCaps(Function> fn) throws IOException, + OpenSearchException { + return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); + } + + /** + * Returns the information about the capabilities of fields among multiple + * indices. + * + * + */ + + public FieldCapsResponse fieldCaps() throws IOException, OpenSearchException { + return this.transport.performRequest(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: get + + /** + * Returns a document. + * + * + */ + + public GetResponse get(GetRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetRequest, + GetResponse, + ErrorResponse>) GetRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.get.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns a document. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetRequest} + * + */ + + public final GetResponse get( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: get_script + + /** + * Returns a script. + * + * + */ + + public GetScriptResponse getScript(GetScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetScriptRequest, + GetScriptResponse, + ErrorResponse>) GetScriptRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetScriptRequest} + * + */ + + public final GetScriptResponse getScript(Function> fn) throws IOException, + OpenSearchException { + return getScript(fn.apply(new GetScriptRequest.Builder()).build()); + } + + // ----- Endpoint: get_script_context + + /** + * Returns all script contexts. + * + * + */ + public GetScriptContextResponse getScriptContext() throws IOException, OpenSearchException { + return this.transport.performRequest(GetScriptContextRequest._INSTANCE, GetScriptContextRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: get_script_languages + + /** + * Returns available script types, languages and contexts + * + * + */ + public GetScriptLanguagesResponse getScriptLanguages() throws IOException, OpenSearchException { + return this.transport.performRequest( + GetScriptLanguagesRequest._INSTANCE, + GetScriptLanguagesRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: get_source + + /** + * Returns the source of a document. + * + * + */ + + public GetSourceResponse getSource(GetSourceRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetSourceRequest, + GetSourceResponse, + ErrorResponse>) GetSourceRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.get_source.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the source of a document. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetSourceRequest} + * + */ + + public final GetSourceResponse getSource( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: index + + /** + * Creates or updates a document in an index. + * + * + */ + + public IndexResponse index(IndexRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint< + IndexRequest, + IndexResponse, + ErrorResponse>) IndexRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Creates or updates a document in an index. + * + * @param fn + * a function that initializes a builder to create the + * {@link IndexRequest} + * + */ + + public final IndexResponse index(Function, ObjectBuilder>> fn) + throws IOException, OpenSearchException { + return index(fn.apply(new IndexRequest.Builder()).build()); + } + + // ----- Endpoint: info + + /** + * Returns basic information about the cluster. + * + * + */ + public InfoResponse info() throws IOException, OpenSearchException { + return this.transport.performRequest(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: list_point_in_time + + /** + * List all Point In Time + * + * + */ + + public ListAllPitResponse listAllPit() throws IOException, OpenSearchException { + return this.transport.performRequest(ListAllPitRequest._INSTANCE, ListAllPitRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: mget + + /** + * Allows to get multiple documents in one request. + * + * + */ + + public MgetResponse mget(MgetRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MgetRequest, + MgetResponse, + ErrorResponse>) MgetRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.mget.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to get multiple documents in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MgetRequest} + * + */ + + public final MgetResponse mget( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: msearch + + /** + * Allows to execute several search operations in one request. + * + * + */ + + public MsearchResponse msearch(MsearchRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MsearchRequest, + MsearchResponse, + ErrorResponse>) MsearchRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.msearch.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to execute several search operations in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MsearchRequest} + * + */ + + public final MsearchResponse msearch( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: msearch_template + + /** + * Allows to execute several search template operations in one request. + * + * + */ + + public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + MsearchTemplateRequest, + MsearchTemplateResponse, + ErrorResponse>) MsearchTemplateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.msearch_template.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to execute several search template operations in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MsearchTemplateRequest} + * + */ + + public final MsearchTemplateResponse msearchTemplate( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: mtermvectors + + /** + * Returns multiple termvectors in one request. + * + * + */ + + public MtermvectorsResponse mtermvectors(MtermvectorsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + MtermvectorsRequest, + MtermvectorsResponse, + ErrorResponse>) MtermvectorsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns multiple termvectors in one request. + * + * @param fn + * a function that initializes a builder to create the + * {@link MtermvectorsRequest} + * + */ + + public final MtermvectorsResponse mtermvectors(Function> fn) + throws IOException, OpenSearchException { + return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); + } + + /** + * Returns multiple termvectors in one request. + * + * + */ + + public MtermvectorsResponse mtermvectors() throws IOException, OpenSearchException { + return this.transport.performRequest( + new MtermvectorsRequest.Builder().build(), + MtermvectorsRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: ping + + /** + * Returns whether the cluster is running. + * + * + */ + public BooleanResponse ping() throws IOException, OpenSearchException { + return this.transport.performRequest(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: put_script + + /** + * Creates or updates a script. + * + * + */ + + public PutScriptResponse putScript(PutScriptRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + PutScriptRequest, + PutScriptResponse, + ErrorResponse>) PutScriptRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Creates or updates a script. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutScriptRequest} + * + */ + + public final PutScriptResponse putScript(Function> fn) throws IOException, + OpenSearchException { + return putScript(fn.apply(new PutScriptRequest.Builder()).build()); + } + + // ----- Endpoint: rank_eval + + /** + * Allows to evaluate the quality of ranked search results over a set of typical + * search queries + * + * + */ + + public RankEvalResponse rankEval(RankEvalRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RankEvalRequest, + RankEvalResponse, + ErrorResponse>) RankEvalRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to evaluate the quality of ranked search results over a set of typical + * search queries + * + * @param fn + * a function that initializes a builder to create the + * {@link RankEvalRequest} + * + */ + + public final RankEvalResponse rankEval(Function> fn) throws IOException, + OpenSearchException { + return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); + } + + // ----- Endpoint: reindex + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * + */ + + public ReindexResponse reindex(ReindexRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ReindexRequest, + ReindexResponse, + ErrorResponse>) ReindexRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * @param fn + * a function that initializes a builder to create the + * {@link ReindexRequest} + * + */ + + public final ReindexResponse reindex(Function> fn) throws IOException, + OpenSearchException { + return reindex(fn.apply(new ReindexRequest.Builder()).build()); + } + + /** + * Allows to copy documents from one index to another, optionally filtering the + * source documents by a query, changing the destination index settings, or + * fetching the documents from a remote cluster. + * + * + */ + + public ReindexResponse reindex() throws IOException, OpenSearchException { + return this.transport.performRequest(new ReindexRequest.Builder().build(), ReindexRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: reindex_rethrottle + + /** + * Changes the number of requests per second for a particular Reindex operation. + * + * + */ + + public ReindexRethrottleResponse reindexRethrottle(ReindexRethrottleRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + ReindexRethrottleRequest, + ReindexRethrottleResponse, + ErrorResponse>) ReindexRethrottleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Reindex operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link ReindexRethrottleRequest} + * + */ + + public final ReindexRethrottleResponse reindexRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build()); + } + + // ----- Endpoint: render_search_template + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public RenderSearchTemplateResponse renderSearchTemplate(RenderSearchTemplateRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RenderSearchTemplateRequest, + RenderSearchTemplateResponse, + ErrorResponse>) RenderSearchTemplateRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param fn + * a function that initializes a builder to create the + * {@link RenderSearchTemplateRequest} + * + */ + + public final RenderSearchTemplateResponse renderSearchTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public RenderSearchTemplateResponse renderSearchTemplate() throws IOException, OpenSearchException { + return this.transport.performRequest( + new RenderSearchTemplateRequest.Builder().build(), + RenderSearchTemplateRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: scripts_painless_execute + + /** + * Allows an arbitrary script to be executed and a result to be returned + * + * + */ + + public ScriptsPainlessExecuteResponse scriptsPainlessExecute( + ScriptsPainlessExecuteRequest request, + Class tResultClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ScriptsPainlessExecuteRequest, + ScriptsPainlessExecuteResponse, + ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.scripts_painless_execute.TResult", + getDeserializer(tResultClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows an arbitrary script to be executed and a result to be returned + * + * @param fn + * a function that initializes a builder to create the + * {@link ScriptsPainlessExecuteRequest} + * + */ + + public final ScriptsPainlessExecuteResponse scriptsPainlessExecute( + Function> fn, + Class tResultClass + ) throws IOException, OpenSearchException { + return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); + } + + // ----- Endpoint: scroll + + /** + * Allows to retrieve a large numbers of results from a single search request. + * + */ + + public ScrollResponse scroll(ScrollRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + ScrollRequest, + ScrollResponse, + ErrorResponse>) ScrollRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.scroll.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to retrieve a large numbers of results from a single search request. + * + * @param fn + * a function that initializes a builder to create the + * {@link ScrollRequest} + */ + + public final ScrollResponse scroll( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: search + + /** + * Returns results matching a query. + * + * + */ + + public SearchResponse search(SearchRequest request, Class tDocumentClass) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + SearchRequest, + SearchResponse, + ErrorResponse>) SearchRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.search.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns results matching a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchRequest} + * + */ + + public final SearchResponse search( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: search_shards + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * + */ + + public SearchShardsResponse searchShards(SearchShardsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + SearchShardsRequest, + SearchShardsResponse, + ErrorResponse>) SearchShardsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchShardsRequest} + * + */ + + public final SearchShardsResponse searchShards(Function> fn) + throws IOException, OpenSearchException { + return searchShards(fn.apply(new SearchShardsRequest.Builder()).build()); + } + + /** + * Returns information about the indices and shards that a search request would + * be executed against. + * + * + */ + + public SearchShardsResponse searchShards() throws IOException, OpenSearchException { + return this.transport.performRequest( + new SearchShardsRequest.Builder().build(), + SearchShardsRequest._ENDPOINT, + this.transportOptions + ); + } + + // ----- Endpoint: search_template + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * + */ + + public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + SearchTemplateRequest, + SearchTemplateResponse, + ErrorResponse>) SearchTemplateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.search_template.TDocument", + getDeserializer(tDocumentClass) + ); + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Allows to use the Mustache language to pre-render a search definition. + * + * @param fn + * a function that initializes a builder to create the + * {@link SearchTemplateRequest} + * + */ + + public final SearchTemplateResponse searchTemplate( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: terms_enum + + /** + * The terms enum API can be used to discover terms in the index that begin with + * the provided string. It is designed for low-latency look-ups used in + * auto-complete scenarios. + * + * + */ + + public TermsEnumResponse termsEnum(TermsEnumRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + TermsEnumRequest, + TermsEnumResponse, + ErrorResponse>) TermsEnumRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * The terms enum API can be used to discover terms in the index that begin with + * the provided string. It is designed for low-latency look-ups used in + * auto-complete scenarios. + * + * @param fn + * a function that initializes a builder to create the + * {@link TermsEnumRequest} + * + */ + + public final TermsEnumResponse termsEnum(Function> fn) throws IOException, + OpenSearchException { + return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); + } + + // ----- Endpoint: termvectors + + /** + * Returns information and statistics about terms in the fields of a particular + * document. + * + * + */ + + public TermvectorsResponse termvectors(TermvectorsRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint< + TermvectorsRequest, + TermvectorsResponse, + ErrorResponse>) TermvectorsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information and statistics about terms in the fields of a particular + * document. + * + * @param fn + * a function that initializes a builder to create the + * {@link TermvectorsRequest} + * + */ + + public final TermvectorsResponse termvectors( + Function, ObjectBuilder>> fn + ) throws IOException, OpenSearchException { + return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); + } + + // ----- Endpoint: update + + /** + * Updates a document with a script or partial document. + * + * + */ + + public UpdateResponse update( + UpdateRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint< + UpdateRequest, + UpdateResponse, + ErrorResponse>) UpdateRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:_global.update.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Updates a document with a script or partial document. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateRequest} + * + */ + + public final UpdateResponse update( + + Function, ObjectBuilder>> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); + } + + // ----- Endpoint: update_by_query + + /** + * Performs an update on every document in the index without changing the + * source, for example to pick up a mapping change. + * + * + */ + + public UpdateByQueryResponse updateByQuery(UpdateByQueryRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UpdateByQueryRequest, + UpdateByQueryResponse, + ErrorResponse>) UpdateByQueryRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Performs an update on every document in the index without changing the + * source, for example to pick up a mapping change. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateByQueryRequest} + * + */ + + public final UpdateByQueryResponse updateByQuery(Function> fn) + throws IOException, OpenSearchException { + return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); + } + + // ----- Endpoint: update_by_query_rethrottle + + /** + * Changes the number of requests per second for a particular Update By Query + * operation. + * + * + */ + + public UpdateByQueryRethrottleResponse updateByQueryRethrottle(UpdateByQueryRethrottleRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UpdateByQueryRethrottleRequest, + UpdateByQueryRethrottleResponse, + ErrorResponse>) UpdateByQueryRethrottleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Changes the number of requests per second for a particular Update By Query + * operation. + * + * @param fn + * a function that initializes a builder to create the + * {@link UpdateByQueryRethrottleRequest} + * + */ + + public final UpdateByQueryRethrottleResponse updateByQueryRethrottle( + Function> fn + ) throws IOException, OpenSearchException { + return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build()); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index 548be19f3d..96afe7515c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -32,80 +32,78 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; // typedef: _types.AcknowledgedResponseBase - public abstract class AcknowledgedResponseBase implements JsonpSerializable { - private final boolean acknowledged; + private final boolean acknowledged; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - protected AcknowledgedResponseBase(AbstractBuilder builder) { + protected AcknowledgedResponseBase(AbstractBuilder builder) { - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); + this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - } + } - /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. - *

- * API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } + /** + * Required - For a successful response, this value is always true. On failure, + * an exception is returned instead. + *

+ * API name: {@code acknowledged} + */ + public final boolean acknowledged() { + return this.acknowledged; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * 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) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); + generator.writeKey("acknowledged"); + generator.write(this.acknowledged); - } + } - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - private Boolean acknowledged; + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + private Boolean acknowledged; - /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. - *

- * API name: {@code acknowledged} - */ - public final BuilderT acknowledged(boolean value) { - this.acknowledged = value; - return self(); - } + /** + * Required - For a successful response, this value is always true. On failure, + * an exception is returned instead. + *

+ * API name: {@code acknowledged} + */ + public final BuilderT acknowledged(boolean value) { + this.acknowledged = value; + return self(); + } - protected abstract BuilderT self(); + protected abstract BuilderT self(); - } + } - // --------------------------------------------------------------------------------------------- - protected static > void setupAcknowledgedResponseBaseDeserializer( - ObjectDeserializer op) { + // --------------------------------------------------------------------------------------------- + protected static > void setupAcknowledgedResponseBaseDeserializer( + ObjectDeserializer op + ) { - op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); + op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java index 3fee84a10f..abd2b4204e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -32,242 +32,237 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import javax.annotation.Nullable; // typedef: _spec_utils.BaseNode - public abstract class BaseNode implements JsonpSerializable { - private final Map attributes; - - private final String host; - - private final String ip; - - private final String name; - - private final List roles; - - private final String transportAddress; - - // --------------------------------------------------------------------------------------------- - - protected BaseNode(AbstractBuilder builder) { - - this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); - this.host = builder.host; - this.ip = builder.ip; - this.name = builder.name; - this.roles = ApiTypeHelper.unmodifiable(builder.roles); - this.transportAddress = builder.transportAddress; - - } - - /** - * API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - - /** - * API name: {@code host} - */ - public final String host() { - return this.host; - } - - /** - * API name: {@code ip} - */ - public final String ip() { - return this.ip; - } - - /** - * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code roles} - */ - public final List roles() { - return this.roles; - } - - /** - * API name: {@code transport_address} - */ - public final String transportAddress() { - return this.transportAddress; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("host"); - generator.write(this.host); - - generator.writeKey("ip"); - generator.write(this.ip); - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.roles)) { - generator.writeKey("roles"); - generator.writeStartArray(); - for (NodeRole item0 : this.roles) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - generator.writeKey("transport_address"); - generator.write(this.transportAddress); - - } - - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - @Nullable - private Map attributes; - - @Nullable - private String host; - - @Nullable - private String ip; - - @Nullable - private String name; - - @Nullable - private List roles; - - @Nullable - private String transportAddress; - - /** - * API name: {@code attributes} - *

- * Adds all entries of map to attributes. - */ - public final BuilderT attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); - return self(); - } - - /** - * API name: {@code attributes} - *

- * Adds an entry to attributes. - */ - public final BuilderT attributes(String key, String value) { - this.attributes = _mapPut(this.attributes, key, value); - return self(); - } - - /** - * API name: {@code host} - */ - public final BuilderT host(String value) { - this.host = value; - return self(); - } - - /** - * API name: {@code ip} - */ - public final BuilderT ip(String value) { - this.ip = value; - return self(); - } - - /** - * API name: {@code name} - */ - public final BuilderT name(String value) { - this.name = value; - return self(); - } - - /** - * API name: {@code roles} - *

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

- * Adds one or more values to roles. - */ - public final BuilderT roles(NodeRole value, NodeRole... values) { - this.roles = _listAdd(this.roles, value, values); - return self(); - } - - /** - * API name: {@code transport_address} - */ - public final BuilderT transportAddress(String value) { - this.transportAddress = value; - return self(); - } - - protected abstract BuilderT self(); - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupBaseNodeDeserializer( - ObjectDeserializer op) { - - op.add(AbstractBuilder::attributes, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); - op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host"); - op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip"); - op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); - op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); - - } + private final Map attributes; + + private final String host; + + private final String ip; + + private final String name; + + private final List roles; + + private final String transportAddress; + + // --------------------------------------------------------------------------------------------- + + protected BaseNode(AbstractBuilder builder) { + + this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); + this.host = builder.host; + this.ip = builder.ip; + this.name = builder.name; + this.roles = ApiTypeHelper.unmodifiable(builder.roles); + this.transportAddress = builder.transportAddress; + + } + + /** + * API name: {@code attributes} + */ + public final Map attributes() { + return this.attributes; + } + + /** + * API name: {@code host} + */ + public final String host() { + return this.host; + } + + /** + * API name: {@code ip} + */ + public final String ip() { + return this.ip; + } + + /** + * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * API name: {@code roles} + */ + public final List roles() { + return this.roles; + } + + /** + * API name: {@code transport_address} + */ + public final String transportAddress() { + return this.transportAddress; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.attributes)) { + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("host"); + generator.write(this.host); + + generator.writeKey("ip"); + generator.write(this.ip); + + generator.writeKey("name"); + generator.write(this.name); + + if (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartArray(); + for (NodeRole item0 : this.roles) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + generator.writeKey("transport_address"); + generator.write(this.transportAddress); + + } + + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable + private Map attributes; + + @Nullable + private String host; + + @Nullable + private String ip; + + @Nullable + private String name; + + @Nullable + private List roles; + + @Nullable + private String transportAddress; + + /** + * API name: {@code attributes} + *

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

+ * Adds an entry to attributes. + */ + public final BuilderT attributes(String key, String value) { + this.attributes = _mapPut(this.attributes, key, value); + return self(); + } + + /** + * API name: {@code host} + */ + public final BuilderT host(String value) { + this.host = value; + return self(); + } + + /** + * API name: {@code ip} + */ + public final BuilderT ip(String value) { + this.ip = value; + return self(); + } + + /** + * API name: {@code name} + */ + public final BuilderT name(String value) { + this.name = value; + return self(); + } + + /** + * API name: {@code roles} + *

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

+ * Adds one or more values to roles. + */ + public final BuilderT roles(NodeRole value, NodeRole... values) { + this.roles = _listAdd(this.roles, value, values); + return self(); + } + + /** + * API name: {@code transport_address} + */ + public final BuilderT transportAddress(String value) { + this.transportAddress = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupBaseNodeDeserializer(ObjectDeserializer op) { + + op.add(AbstractBuilder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); + op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host"); + op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip"); + op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); + op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java index 183b486e8c..4718d336ab 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,196 +43,195 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.BulkIndexByScrollFailure @JsonpDeserializable public class BulkIndexByScrollFailure implements JsonpSerializable { - private final ErrorCause cause; + private final ErrorCause cause; - private final String id; + private final String id; - private final String index; + private final String index; - private final int status; + private final int status; - private final String type; + private final String type; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private BulkIndexByScrollFailure(Builder builder) { + private BulkIndexByScrollFailure(Builder builder) { - this.cause = ApiTypeHelper.requireNonNull(builder.cause, this, "cause"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.cause = ApiTypeHelper.requireNonNull(builder.cause, this, "cause"); + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - } + } - public static BulkIndexByScrollFailure of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static BulkIndexByScrollFailure of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code cause} - */ - public final ErrorCause cause() { - return this.cause; - } + /** + * Required - API name: {@code cause} + */ + public final ErrorCause cause() { + return this.cause; + } - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * 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("cause"); - this.cause.serialize(generator, mapper); - - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("index"); - generator.write(this.index); - - generator.writeKey("status"); - generator.write(this.status); - - generator.writeKey("type"); - generator.write(this.type); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkIndexByScrollFailure}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ErrorCause cause; - - private String id; - - private String index; - - private Integer status; - - private String type; - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(ErrorCause value) { - this.cause = value; - return this; - } - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(Function> fn) { - return this.cause(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Builds a {@link BulkIndexByScrollFailure}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkIndexByScrollFailure build() { - _checkSingleUse(); - - return new BulkIndexByScrollFailure(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkIndexByScrollFailure} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, BulkIndexByScrollFailure::setupBulkIndexByScrollFailureDeserializer); - - protected static void setupBulkIndexByScrollFailureDeserializer( - ObjectDeserializer op) { - - op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } + /** + * Required - API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * Required - API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * 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("cause"); + this.cause.serialize(generator, mapper); + + generator.writeKey("id"); + generator.write(this.id); + + generator.writeKey("index"); + generator.write(this.index); + + generator.writeKey("status"); + generator.write(this.status); + + generator.writeKey("type"); + generator.write(this.type); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkIndexByScrollFailure}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ErrorCause cause; + + private String id; + + private String index; + + private Integer status; + + private String type; + + /** + * Required - API name: {@code cause} + */ + public final Builder cause(ErrorCause value) { + this.cause = value; + return this; + } + + /** + * Required - API name: {@code cause} + */ + public final Builder cause(Function> fn) { + return this.cause(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Builds a {@link BulkIndexByScrollFailure}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkIndexByScrollFailure build() { + _checkSingleUse(); + + return new BulkIndexByScrollFailure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkIndexByScrollFailure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + BulkIndexByScrollFailure::setupBulkIndexByScrollFailureDeserializer + ); + + protected static void setupBulkIndexByScrollFailureDeserializer(ObjectDeserializer op) { + + op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java index 6cf3fb2dd0..ab174f1dcf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,306 +44,304 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.BulkStats @JsonpDeserializable public class BulkStats implements JsonpSerializable { - private final long totalOperations; - - @Nullable - private final String totalTime; - - private final long totalTimeInMillis; - - @Nullable - private final String totalSize; - - private final long totalSizeInBytes; - - @Nullable - private final String avgTime; - - private final long avgTimeInMillis; - - @Nullable - private final String avgSize; - - private final long avgSizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private BulkStats(Builder builder) { - - this.totalOperations = ApiTypeHelper.requireNonNull(builder.totalOperations, this, "totalOperations"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - this.totalSize = builder.totalSize; - this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); - this.avgTime = builder.avgTime; - this.avgTimeInMillis = ApiTypeHelper.requireNonNull(builder.avgTimeInMillis, this, "avgTimeInMillis"); - this.avgSize = builder.avgSize; - this.avgSizeInBytes = ApiTypeHelper.requireNonNull(builder.avgSizeInBytes, this, "avgSizeInBytes"); - - } - - public static BulkStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code total_operations} - */ - public final long totalOperations() { - return this.totalOperations; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * API name: {@code total_size} - */ - @Nullable - public final String totalSize() { - return this.totalSize; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final long totalSizeInBytes() { - return this.totalSizeInBytes; - } - - /** - * API name: {@code avg_time} - */ - @Nullable - public final String avgTime() { - return this.avgTime; - } + private final long totalOperations; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; + + @Nullable + private final String totalSize; + + private final long totalSizeInBytes; + + @Nullable + private final String avgTime; + + private final long avgTimeInMillis; + + @Nullable + private final String avgSize; + + private final long avgSizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private BulkStats(Builder builder) { + + this.totalOperations = ApiTypeHelper.requireNonNull(builder.totalOperations, this, "totalOperations"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + this.totalSize = builder.totalSize; + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.avgTime = builder.avgTime; + this.avgTimeInMillis = ApiTypeHelper.requireNonNull(builder.avgTimeInMillis, this, "avgTimeInMillis"); + this.avgSize = builder.avgSize; + this.avgSizeInBytes = ApiTypeHelper.requireNonNull(builder.avgSizeInBytes, this, "avgSizeInBytes"); + + } + + public static BulkStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code total_operations} + */ + public final long totalOperations() { + return this.totalOperations; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * API name: {@code avg_time} + */ + @Nullable + public final String avgTime() { + return this.avgTime; + } - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final long avgTimeInMillis() { - return this.avgTimeInMillis; - } - - /** - * API name: {@code avg_size} - */ - @Nullable - public final String avgSize() { - return this.avgSize; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final long avgSizeInBytes() { - return this.avgSizeInBytes; - } - - /** - * 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("total_operations"); - generator.write(this.totalOperations); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - if (this.totalSize != null) { - generator.writeKey("total_size"); - generator.write(this.totalSize); - - } - generator.writeKey("total_size_in_bytes"); - generator.write(this.totalSizeInBytes); - - if (this.avgTime != null) { - generator.writeKey("avg_time"); - generator.write(this.avgTime); - - } - generator.writeKey("avg_time_in_millis"); - generator.write(this.avgTimeInMillis); - - if (this.avgSize != null) { - generator.writeKey("avg_size"); - generator.write(this.avgSize); - - } - generator.writeKey("avg_size_in_bytes"); - generator.write(this.avgSizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long totalOperations; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - @Nullable - private String totalSize; - - private Long totalSizeInBytes; - - @Nullable - private String avgTime; - - private Long avgTimeInMillis; - - @Nullable - private String avgSize; - - private Long avgSizeInBytes; - - /** - * Required - API name: {@code total_operations} - */ - public final Builder totalOperations(long value) { - this.totalOperations = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_size} - */ - public final Builder totalSize(@Nullable String value) { - this.totalSize = value; - return this; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final Builder totalSizeInBytes(long value) { - this.totalSizeInBytes = value; - return this; - } - - /** - * API name: {@code avg_time} - */ - public final Builder avgTime(@Nullable String value) { - this.avgTime = value; - return this; - } - - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final Builder avgTimeInMillis(long value) { - this.avgTimeInMillis = value; - return this; - } - - /** - * API name: {@code avg_size} - */ - public final Builder avgSize(@Nullable String value) { - this.avgSize = value; - return this; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final Builder avgSizeInBytes(long value) { - this.avgSizeInBytes = value; - return this; - } - - /** - * Builds a {@link BulkStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkStats build() { - _checkSingleUse(); - - return new BulkStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - BulkStats::setupBulkStatsDeserializer); - - protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); - op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); - op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); - op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); - op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); - - } + /** + * Required - API name: {@code avg_time_in_millis} + */ + public final long avgTimeInMillis() { + return this.avgTimeInMillis; + } + + /** + * API name: {@code avg_size} + */ + @Nullable + public final String avgSize() { + return this.avgSize; + } + + /** + * Required - API name: {@code avg_size_in_bytes} + */ + public final long avgSizeInBytes() { + return this.avgSizeInBytes; + } + + /** + * 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("total_operations"); + generator.write(this.totalOperations); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (this.avgTime != null) { + generator.writeKey("avg_time"); + generator.write(this.avgTime); + + } + generator.writeKey("avg_time_in_millis"); + generator.write(this.avgTimeInMillis); + + if (this.avgSize != null) { + generator.writeKey("avg_size"); + generator.write(this.avgSize); + + } + generator.writeKey("avg_size_in_bytes"); + generator.write(this.avgSizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long totalOperations; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + @Nullable + private String totalSize; + + private Long totalSizeInBytes; + + @Nullable + private String avgTime; + + private Long avgTimeInMillis; + + @Nullable + private String avgSize; + + private Long avgSizeInBytes; + + /** + * Required - API name: {@code total_operations} + */ + public final Builder totalOperations(long value) { + this.totalOperations = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * API name: {@code avg_time} + */ + public final Builder avgTime(@Nullable String value) { + this.avgTime = value; + return this; + } + + /** + * Required - API name: {@code avg_time_in_millis} + */ + public final Builder avgTimeInMillis(long value) { + this.avgTimeInMillis = value; + return this; + } + + /** + * API name: {@code avg_size} + */ + public final Builder avgSize(@Nullable String value) { + this.avgSize = value; + return this; + } + + /** + * Required - API name: {@code avg_size_in_bytes} + */ + public final Builder avgSizeInBytes(long value) { + this.avgSizeInBytes = value; + return this; + } + + /** + * Builds a {@link BulkStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkStats build() { + _checkSingleUse(); + + return new BulkStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + BulkStats::setupBulkStatsDeserializer + ); + + protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); + op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); + op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); + op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java index 5f3cf670f8..0d6077e653 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java @@ -37,29 +37,29 @@ @JsonpDeserializable public enum Bytes implements JsonEnum { - Bytes("b"), + Bytes("b"), - KiloBytes("kb"), + KiloBytes("kb"), - MegaBytes("mb"), + MegaBytes("mb"), - GigaBytes("gb"), + GigaBytes("gb"), - TeraBytes("tb"), + TeraBytes("tb"), - PetaBytes("pb"), + PetaBytes("pb"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Bytes(String jsonValue) { - this.jsonValue = jsonValue; - } + Bytes(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Bytes.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Bytes.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java index 1c3bd5fa9a..025ebbe097 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,140 +43,140 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.ClusterStatistics @JsonpDeserializable public class ClusterStatistics implements JsonpSerializable { - private final int skipped; - - private final int successful; - - private final int total; - - // --------------------------------------------------------------------------------------------- - - private ClusterStatistics(Builder builder) { - - this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); - this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - - } - - public static ClusterStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code skipped} - */ - public final int skipped() { - return this.skipped; - } + private final int skipped; - /** - * Required - API name: {@code successful} - */ - public final int successful() { - return this.successful; - } - - /** - * Required - API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * 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("skipped"); - generator.write(this.skipped); - - generator.writeKey("successful"); - generator.write(this.successful); - - generator.writeKey("total"); - generator.write(this.total); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterStatistics}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer skipped; - - private Integer successful; - - private Integer total; - - /** - * Required - API name: {@code skipped} - */ - public final Builder skipped(int value) { - this.skipped = value; - return this; - } - - /** - * Required - API name: {@code successful} - */ - public final Builder successful(int value) { - this.successful = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(int value) { - this.total = value; - return this; - } - - /** - * Builds a {@link ClusterStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterStatistics build() { - _checkSingleUse(); - - return new ClusterStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ClusterStatistics::setupClusterStatisticsDeserializer); - - protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) { - - op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); - op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); - op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); - - } + private final int successful; + + private final int total; + + // --------------------------------------------------------------------------------------------- + + private ClusterStatistics(Builder builder) { + + this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); + this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + + } + + public static ClusterStatistics of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code skipped} + */ + public final int skipped() { + return this.skipped; + } + + /** + * Required - API name: {@code successful} + */ + public final int successful() { + return this.successful; + } + + /** + * Required - API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * 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("skipped"); + generator.write(this.skipped); + + generator.writeKey("successful"); + generator.write(this.successful); + + generator.writeKey("total"); + generator.write(this.total); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClusterStatistics}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer skipped; + + private Integer successful; + + private Integer total; + + /** + * Required - API name: {@code skipped} + */ + public final Builder skipped(int value) { + this.skipped = value; + return this; + } + + /** + * Required - API name: {@code successful} + */ + public final Builder successful(int value) { + this.successful = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * Builds a {@link ClusterStatistics}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ClusterStatistics build() { + _checkSingleUse(); + + return new ClusterStatistics(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterStatistics} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClusterStatistics::setupClusterStatisticsDeserializer + ); + + protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) { + + op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); + op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java index d375f28eab..85a4f4c1d3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,178 +45,176 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.CompletionStats @JsonpDeserializable public class CompletionStats implements JsonpSerializable { - private final long sizeInBytes; + private final long sizeInBytes; - @Nullable - private final String size; - - private final Map fields; + @Nullable + private final String size; + + private final Map fields; - // --------------------------------------------------------------------------------------------- - - private CompletionStats(Builder builder) { - - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - this.size = builder.size; - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - - } - - public static CompletionStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final long sizeInBytes() { - return this.sizeInBytes; - } - - /** - * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CompletionStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long sizeInBytes; - - @Nullable - private String size; - - @Nullable - private Map fields; - - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; - } - - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; - } - - /** - * API name: {@code fields} - *

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

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

- * Adds an entry to fields using a builder lambda. - */ - public final Builder fields(String key, Function> fn) { - return fields(key, fn.apply(new FieldSizeUsage.Builder()).build()); - } - - /** - * Builds a {@link CompletionStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompletionStats build() { - _checkSingleUse(); - - return new CompletionStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CompletionStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CompletionStats::setupCompletionStatsDeserializer); - - protected static void setupCompletionStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields"); - - } + // --------------------------------------------------------------------------------------------- + + private CompletionStats(Builder builder) { + + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); + this.size = builder.size; + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + + } + + public static CompletionStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * API name: {@code size} + */ + @Nullable + public final String size() { + return this.size; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CompletionStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long sizeInBytes; + + @Nullable + private String size; + + @Nullable + private Map fields; + + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * API name: {@code fields} + *

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

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

+ * Adds an entry to fields using a builder lambda. + */ + public final Builder fields(String key, Function> fn) { + return fields(key, fn.apply(new FieldSizeUsage.Builder()).build()); + } + + /** + * Builds a {@link CompletionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CompletionStats build() { + _checkSingleUse(); + + return new CompletionStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompletionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompletionStats::setupCompletionStatsDeserializer + ); + + protected static void setupCompletionStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java index 7bd42f6bc9..dc551c5d2a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java @@ -37,22 +37,21 @@ @JsonpDeserializable public enum Conflicts implements JsonEnum { - Abort("abort"), + Abort("abort"), - Proceed("proceed"), + Proceed("proceed"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Conflicts(String jsonValue) { - this.jsonValue = jsonValue; - } + Conflicts(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - Conflicts.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Conflicts.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java index dd7db05815..0551e8642c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,164 +43,164 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.CoordsGeoBounds @JsonpDeserializable public class CoordsGeoBounds implements JsonpSerializable { - private final double top; + private final double top; - private final double bottom; + private final double bottom; - private final double left; + private final double left; - private final double right; + private final double right; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private CoordsGeoBounds(Builder builder) { + private CoordsGeoBounds(Builder builder) { - this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); - this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); - this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); - this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); + this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); + this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); + this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); + this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); - } + } - public static CoordsGeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static CoordsGeoBounds of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code top} - */ - public final double top() { - return this.top; - } - - /** - * Required - API name: {@code bottom} - */ - public final double bottom() { - return this.bottom; - } - - /** - * Required - API name: {@code left} - */ - public final double left() { - return this.left; - } - - /** - * Required - API name: {@code right} - */ - public final double right() { - return this.right; - } - - /** - * 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("top"); - generator.write(this.top); - - generator.writeKey("bottom"); - generator.write(this.bottom); - - generator.writeKey("left"); - generator.write(this.left); - - generator.writeKey("right"); - generator.write(this.right); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CoordsGeoBounds}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Double top; - - private Double bottom; - - private Double left; - - private Double right; - - /** - * Required - API name: {@code top} - */ - public final Builder top(double value) { - this.top = value; - return this; - } - - /** - * Required - API name: {@code bottom} - */ - public final Builder bottom(double value) { - this.bottom = value; - return this; - } - - /** - * Required - API name: {@code left} - */ - public final Builder left(double value) { - this.left = value; - return this; - } - - /** - * Required - API name: {@code right} - */ - public final Builder right(double value) { - this.right = value; - return this; - } - - /** - * Builds a {@link CoordsGeoBounds}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CoordsGeoBounds build() { - _checkSingleUse(); - - return new CoordsGeoBounds(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CoordsGeoBounds} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CoordsGeoBounds::setupCoordsGeoBoundsDeserializer); - - protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { - - op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); - op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); - op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); - op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); - - } + /** + * Required - API name: {@code top} + */ + public final double top() { + return this.top; + } + + /** + * Required - API name: {@code bottom} + */ + public final double bottom() { + return this.bottom; + } + + /** + * Required - API name: {@code left} + */ + public final double left() { + return this.left; + } + + /** + * Required - API name: {@code right} + */ + public final double right() { + return this.right; + } + + /** + * 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("top"); + generator.write(this.top); + + generator.writeKey("bottom"); + generator.write(this.bottom); + + generator.writeKey("left"); + generator.write(this.left); + + generator.writeKey("right"); + generator.write(this.right); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CoordsGeoBounds}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Double top; + + private Double bottom; + + private Double left; + + private Double right; + + /** + * Required - API name: {@code top} + */ + public final Builder top(double value) { + this.top = value; + return this; + } + + /** + * Required - API name: {@code bottom} + */ + public final Builder bottom(double value) { + this.bottom = value; + return this; + } + + /** + * Required - API name: {@code left} + */ + public final Builder left(double value) { + this.left = value; + return this; + } + + /** + * Required - API name: {@code right} + */ + public final Builder right(double value) { + this.right = value; + return this; + } + + /** + * Builds a {@link CoordsGeoBounds}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CoordsGeoBounds build() { + _checkSingleUse(); + + return new CoordsGeoBounds(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CoordsGeoBounds} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CoordsGeoBounds::setupCoordsGeoBoundsDeserializer + ); + + protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { + + op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); + op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); + op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); + op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java index 89bfa132da..fa3511a98c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java @@ -37,36 +37,35 @@ @JsonpDeserializable public enum DistanceUnit implements JsonEnum { - Inches("in"), + Inches("in"), - Feet("ft"), + Feet("ft"), - Yards("yd"), + Yards("yd"), - Miles("mi"), + Miles("mi"), - NauticMiles("nmi"), + NauticMiles("nmi"), - Kilometers("km"), + Kilometers("km"), - Meters("m"), + Meters("m"), - Centimeters("cm"), + Centimeters("cm"), - Millimeters("mm"), + Millimeters("mm"), - ; + ; - private final String jsonValue; + private final String jsonValue; - DistanceUnit(String jsonValue) { - this.jsonValue = jsonValue; - } + DistanceUnit(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DistanceUnit.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(DistanceUnit.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java index 9cd3381b5b..25f5f8a39f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.DocStats @JsonpDeserializable public class DocStats implements JsonpSerializable { - private final long count; - - private final long deleted; - - // --------------------------------------------------------------------------------------------- + private final long count; - private DocStats(Builder builder) { + private final long deleted; + + // --------------------------------------------------------------------------------------------- - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); + private DocStats(Builder builder) { - } + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); - public static DocStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code count} - */ - public final long count() { - return this.count; - } + public static DocStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code deleted} - */ - public final long deleted() { - return this.deleted; - } + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code deleted} + */ + public final long deleted() { + return this.deleted; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("count"); - generator.write(this.count); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("deleted"); - generator.write(this.deleted); + generator.writeKey("count"); + generator.write(this.count); - } + generator.writeKey("deleted"); + generator.write(this.deleted); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link DocStats}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long count; + /** + * Builder for {@link DocStats}. + */ - private Long deleted; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long count; - /** - * Required - API name: {@code count} - */ - public final Builder count(long value) { - this.count = value; - return this; - } + private Long deleted; - /** - * Required - API name: {@code deleted} - */ - public final Builder deleted(long value) { - this.deleted = value; - return this; - } + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } - /** - * Builds a {@link DocStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DocStats build() { - _checkSingleUse(); + /** + * Required - API name: {@code deleted} + */ + public final Builder deleted(long value) { + this.deleted = value; + return this; + } - return new DocStats(this); - } - } + /** + * Builds a {@link DocStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DocStats build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new DocStats(this); + } + } - /** - * Json deserializer for {@link DocStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DocStats::setupDocStatsDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupDocStatsDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link DocStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DocStats::setupDocStatsDeserializer + ); - op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); - op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + protected static void setupDocStatsDeserializer(ObjectDeserializer op) { - } + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java index a4de144e2f..2bac7df617 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java @@ -32,41 +32,40 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; /** * For empty Class assignments - * + * */ @JsonpDeserializable public class EmptyObject implements JsonpSerializable { - public static final class Builder implements ObjectBuilder { - @Override - public EmptyObject build() { - return EmptyObject._INSTANCE; - } - } + public static final class Builder implements ObjectBuilder { + @Override + public EmptyObject build() { + return EmptyObject._INSTANCE; + } + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeEnd(); + } - /** - * Singleton instance for empty class {@link EmptyObject}. - */ - public static final EmptyObject _INSTANCE = new EmptyObject(); + /** + * Singleton instance for empty class {@link EmptyObject}. + */ + public static final EmptyObject _INSTANCE = new EmptyObject(); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyObject._INSTANCE); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(EmptyObject._INSTANCE); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java index 8baccedfaa..6d298b5a7c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java @@ -32,37 +32,36 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; @JsonpDeserializable public class EmptyTransform implements JsonpSerializable { - public static final class Builder implements ObjectBuilder { - @Override - public EmptyTransform build() { - return EmptyTransform._INSTANCE; - } - } + public static final class Builder implements ObjectBuilder { + @Override + public EmptyTransform build() { + return EmptyTransform._INSTANCE; + } + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeEnd(); + } - /** - * Singleton instance for empty class {@link EmptyTransform}. - */ - public static final EmptyTransform _INSTANCE = new EmptyTransform(); + /** + * Singleton instance for empty class {@link EmptyTransform}. + */ + public static final EmptyTransform _INSTANCE = new EmptyTransform(); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyTransform._INSTANCE); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(EmptyTransform._INSTANCE); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java index c2b4b1cd13..469134d325 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -32,6 +32,12 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,12 +48,6 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.ErrorCause @@ -58,342 +58,344 @@ */ @JsonpDeserializable public class ErrorCause implements JsonpSerializable { - private final Map metadata; - - private final String type; - - private final String reason; - - @Nullable - private final String stackTrace; - - @Nullable - private final ErrorCause causedBy; - - private final List rootCause; - - private final List suppressed; - - // --------------------------------------------------------------------------------------------- - - private ErrorCause(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); - this.stackTrace = builder.stackTrace; - this.causedBy = builder.causedBy; - this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); - this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); - - } - - public static ErrorCause of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Additional details about the error - */ - public final Map metadata() { - return this.metadata; - } - - /** - * Required - The type of error - *

- * API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - A human-readable explanation of the error, in english - *

- * API name: {@code reason} - */ - public final String reason() { - return this.reason; - } - - /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. - *

- * API name: {@code stack_trace} - */ - @Nullable - public final String stackTrace() { - return this.stackTrace; - } - - /** - * API name: {@code caused_by} - */ - @Nullable - public final ErrorCause causedBy() { - return this.causedBy; - } - - /** - * API name: {@code root_cause} - */ - public final List rootCause() { - return this.rootCause; - } - - /** - * API name: {@code suppressed} - */ - public final List suppressed() { - return this.suppressed; - } - - /** - * 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) { - - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - generator.writeKey("type"); - generator.write(this.type); - - generator.writeKey("reason"); - generator.write(this.reason); - - if (this.stackTrace != null) { - generator.writeKey("stack_trace"); - generator.write(this.stackTrace); - - } - if (this.causedBy != null) { - generator.writeKey("caused_by"); - this.causedBy.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.rootCause)) { - generator.writeKey("root_cause"); - generator.writeStartArray(); - for (ErrorCause item0 : this.rootCause) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.suppressed)) { - generator.writeKey("suppressed"); - generator.writeStartArray(); - for (ErrorCause item0 : this.suppressed) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ErrorCause}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Additional details about the error - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Additional details about the error - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - private String type; - - private String reason; - - @Nullable - private String stackTrace; - - @Nullable - private ErrorCause causedBy; - - @Nullable - private List rootCause; - - @Nullable - private List suppressed; - - /** - * Required - The type of error - *

- * API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Required - A human-readable explanation of the error, in english - *

- * API name: {@code reason} - */ - public final Builder reason(String value) { - this.reason = value; - return this; - } - - /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. - *

- * API name: {@code stack_trace} - */ - public final Builder stackTrace(@Nullable String value) { - this.stackTrace = value; - return this; - } - - /** - * API name: {@code caused_by} - */ - public final Builder causedBy(@Nullable ErrorCause value) { - this.causedBy = value; - return this; - } - - /** - * API name: {@code caused_by} - */ - public final Builder causedBy(Function> fn) { - return this.causedBy(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * API name: {@code root_cause} - *

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

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

- * Adds a value to rootCause using a builder lambda. - */ - public final Builder rootCause(Function> fn) { - return rootCause(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * API name: {@code suppressed} - *

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

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

- * Adds a value to suppressed using a builder lambda. - */ - public final Builder suppressed(Function> fn) { - return suppressed(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Builds a {@link ErrorCause}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorCause build() { - _checkSingleUse(); - - return new ErrorCause(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorCause} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorCause::setupErrorCauseDeserializer); - - protected static void setupErrorCauseDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); - op.add(Builder::stackTrace, JsonpDeserializer.stringDeserializer(), "stack_trace"); - op.add(Builder::causedBy, ErrorCause._DESERIALIZER, "caused_by"); - op.add(Builder::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); - op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - if (builder.metadata == null) { - builder.metadata = new HashMap<>(); - } - builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } + private final Map metadata; + + private final String type; + + private final String reason; + + @Nullable + private final String stackTrace; + + @Nullable + private final ErrorCause causedBy; + + private final List rootCause; + + private final List suppressed; + + // --------------------------------------------------------------------------------------------- + + private ErrorCause(Builder builder) { + + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.stackTrace = builder.stackTrace; + this.causedBy = builder.causedBy; + this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); + this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); + + } + + public static ErrorCause of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Additional details about the error + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Required - The type of error + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Required - A human-readable explanation of the error, in english + *

+ * API name: {@code reason} + */ + public final String reason() { + return this.reason; + } + + /** + * The server stack trace. Present only if the error_trace=true + * parameter was sent with the request. + *

+ * API name: {@code stack_trace} + */ + @Nullable + public final String stackTrace() { + return this.stackTrace; + } + + /** + * API name: {@code caused_by} + */ + @Nullable + public final ErrorCause causedBy() { + return this.causedBy; + } + + /** + * API name: {@code root_cause} + */ + public final List rootCause() { + return this.rootCause; + } + + /** + * API name: {@code suppressed} + */ + public final List suppressed() { + return this.suppressed; + } + + /** + * 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) { + + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + + generator.writeKey("type"); + generator.write(this.type); + + generator.writeKey("reason"); + generator.write(this.reason); + + if (this.stackTrace != null) { + generator.writeKey("stack_trace"); + generator.write(this.stackTrace); + + } + if (this.causedBy != null) { + generator.writeKey("caused_by"); + this.causedBy.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.rootCause)) { + generator.writeKey("root_cause"); + generator.writeStartArray(); + for (ErrorCause item0 : this.rootCause) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.suppressed)) { + generator.writeKey("suppressed"); + generator.writeStartArray(); + for (ErrorCause item0 : this.suppressed) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ErrorCause}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map metadata = new HashMap<>(); + + /** + * Additional details about the error + *

+ * Adds all entries of map to metadata. + */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * Additional details about the error + *

+ * Adds an entry to metadata. + */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + private String type; + + private String reason; + + @Nullable + private String stackTrace; + + @Nullable + private ErrorCause causedBy; + + @Nullable + private List rootCause; + + @Nullable + private List suppressed; + + /** + * Required - The type of error + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Required - A human-readable explanation of the error, in english + *

+ * API name: {@code reason} + */ + public final Builder reason(String value) { + this.reason = value; + return this; + } + + /** + * The server stack trace. Present only if the error_trace=true + * parameter was sent with the request. + *

+ * API name: {@code stack_trace} + */ + public final Builder stackTrace(@Nullable String value) { + this.stackTrace = value; + return this; + } + + /** + * API name: {@code caused_by} + */ + public final Builder causedBy(@Nullable ErrorCause value) { + this.causedBy = value; + return this; + } + + /** + * API name: {@code caused_by} + */ + public final Builder causedBy(Function> fn) { + return this.causedBy(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code root_cause} + *

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

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

+ * Adds a value to rootCause using a builder lambda. + */ + public final Builder rootCause(Function> fn) { + return rootCause(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code suppressed} + *

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

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

+ * Adds a value to suppressed using a builder lambda. + */ + public final Builder suppressed(Function> fn) { + return suppressed(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Builds a {@link ErrorCause}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ErrorCause build() { + _checkSingleUse(); + + return new ErrorCause(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ErrorCause} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ErrorCause::setupErrorCauseDeserializer + ); + + protected static void setupErrorCauseDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + op.add(Builder::stackTrace, JsonpDeserializer.stringDeserializer(), "stack_trace"); + op.add(Builder::causedBy, ErrorCause._DESERIALIZER, "caused_by"); + op.add(Builder::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); + op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java index 19d97fec9e..029d6a20c0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,147 +44,146 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; // typedef: _types.ErrorResponseBase /** * The response returned by Elasticsearch when request execution did not * succeed. - * + * */ @JsonpDeserializable public class ErrorResponse implements JsonpSerializable { - private enum Kind { - OBJECT, - STRING - } - private final ErrorCause error; - - private final int status; - - // --------------------------------------------------------------------------------------------- - - private ErrorResponse(Builder builder) { - - this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - - } + private enum Kind { + OBJECT, + STRING + } + + private final ErrorCause error; + + private final int status; + + // --------------------------------------------------------------------------------------------- + + private ErrorResponse(Builder builder) { + + this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + + } + + public static ErrorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } - public static ErrorResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code error} - */ - public final ErrorCause error() { - return this.error; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * 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("error"); - this.error.serialize(generator, mapper); - - generator.writeKey("status"); - generator.write(this.status); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ErrorResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ErrorCause error; - - private Integer status; - - /** - * Required - API name: {@code error} - */ - public final Builder error(ErrorCause value) { - this.error = value; - return this; - } - - /** - * Required - API name: {@code error} - */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - /** - * Builds a {@link ErrorResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorResponse build() { - _checkSingleUse(); - - return new ErrorResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorResponse::setupErrorResponseDeserializer); - - protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::error, buildErrorCauseDeserializers(), "error"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - - } - - protected static JsonpDeserializer buildErrorCauseDeserializers() { - return new UnionDeserializer.Builder<>(ErrorResponse::getErrorCause, false) - .addMember(Kind.OBJECT, ErrorCause._DESERIALIZER) - .addMember(Kind.STRING, JsonpDeserializer.stringDeserializer()) - .build(); - } - - private static ErrorCause getErrorCause(Kind kind, Object errorCause) { - return Kind.STRING.equals(kind) ? - ErrorCause.of(builder -> builder.type("string_error").reason((String) errorCause)) : - (ErrorCause) errorCause; - } + /** + * Required - API name: {@code error} + */ + public final ErrorCause error() { + return this.error; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * 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("error"); + this.error.serialize(generator, mapper); + + generator.writeKey("status"); + generator.write(this.status); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ErrorResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ErrorCause error; + + private Integer status; + + /** + * Required - API name: {@code error} + */ + public final Builder error(ErrorCause value) { + this.error = value; + return this; + } + + /** + * Required - API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Builds a {@link ErrorResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ErrorResponse build() { + _checkSingleUse(); + + return new ErrorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ErrorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ErrorResponse::setupErrorResponseDeserializer + ); + + protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::error, buildErrorCauseDeserializers(), "error"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + + } + + protected static JsonpDeserializer buildErrorCauseDeserializers() { + return new UnionDeserializer.Builder<>(ErrorResponse::getErrorCause, false).addMember(Kind.OBJECT, ErrorCause._DESERIALIZER) + .addMember(Kind.STRING, JsonpDeserializer.stringDeserializer()) + .build(); + } + + private static ErrorCause getErrorCause(Kind kind, Object errorCause) { + return Kind.STRING.equals(kind) + ? ErrorCause.of(builder -> builder.type("string_error").reason((String) errorCause)) + : (ErrorCause) errorCause; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java index 352063ee54..5b66a33bd2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java @@ -37,45 +37,44 @@ @JsonpDeserializable public enum ExpandWildcard implements JsonEnum { - /** - * Match any data stream or index, including hidden ones. - */ - All("all"), + /** + * Match any data stream or index, including hidden ones. + */ + All("all"), - /** - * Match open, non-hidden indices. Also matches any non-hidden data stream. - */ - Open("open"), + /** + * Match open, non-hidden indices. Also matches any non-hidden data stream. + */ + Open("open"), - /** - * Match closed, non-hidden indices. Also matches any non-hidden data stream. - * Data streams cannot be closed. - */ - Closed("closed"), + /** + * Match closed, non-hidden indices. Also matches any non-hidden data stream. + * Data streams cannot be closed. + */ + Closed("closed"), - /** - * Match hidden data streams and hidden indices. Must be combined with open, - * closed, or both. - */ - Hidden("hidden"), + /** + * Match hidden data streams and hidden indices. Must be combined with open, + * closed, or both. + */ + Hidden("hidden"), - /** - * Wildcard expressions are not accepted. - */ - None("none"), + /** + * Wildcard expressions are not accepted. + */ + None("none"), - ; + ; - private final String jsonValue; + private final String jsonValue; - ExpandWildcard(String jsonValue) { - this.jsonValue = jsonValue; - } + ExpandWildcard(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ExpandWildcard.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ExpandWildcard.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java index 0802fbdaa5..b202739387 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,122 +44,121 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldMemoryUsage @JsonpDeserializable public class FieldMemoryUsage implements JsonpSerializable { - @Nullable - private final String memorySize; - - private final long memorySizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private FieldMemoryUsage(Builder builder) { - - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - - } - - public static FieldMemoryUsage of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldMemoryUsage}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Builds a {@link FieldMemoryUsage}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldMemoryUsage build() { - _checkSingleUse(); - - return new FieldMemoryUsage(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldMemoryUsage} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldMemoryUsage::setupFieldMemoryUsageDeserializer); - - protected static void setupFieldMemoryUsageDeserializer(ObjectDeserializer op) { - - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - - } + @Nullable + private final String memorySize; + + private final long memorySizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private FieldMemoryUsage(Builder builder) { + + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + + } + + public static FieldMemoryUsage of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldMemoryUsage}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Builds a {@link FieldMemoryUsage}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldMemoryUsage build() { + _checkSingleUse(); + + return new FieldMemoryUsage(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldMemoryUsage} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldMemoryUsage::setupFieldMemoryUsageDeserializer + ); + + protected static void setupFieldMemoryUsageDeserializer(ObjectDeserializer op) { + + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java index edb66f531e..9d90e1e566 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,122 +44,121 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldSizeUsage @JsonpDeserializable public class FieldSizeUsage implements JsonpSerializable { - @Nullable - private final String size; - - private final long sizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private FieldSizeUsage(Builder builder) { - - this.size = builder.size; - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - - } - - public static FieldSizeUsage of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final long sizeInBytes() { - return this.sizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldSizeUsage}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String size; - - private Long sizeInBytes; - - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; - } - - /** - * Builds a {@link FieldSizeUsage}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldSizeUsage build() { - _checkSingleUse(); - - return new FieldSizeUsage(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldSizeUsage} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldSizeUsage::setupFieldSizeUsageDeserializer); - - protected static void setupFieldSizeUsageDeserializer(ObjectDeserializer op) { - - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - - } + @Nullable + private final String size; + + private final long sizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private FieldSizeUsage(Builder builder) { + + this.size = builder.size; + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); + + } + + public static FieldSizeUsage of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code size} + */ + @Nullable + public final String size() { + return this.size; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldSizeUsage}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String size; + + private Long sizeInBytes; + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + + /** + * Builds a {@link FieldSizeUsage}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldSizeUsage build() { + _checkSingleUse(); + + return new FieldSizeUsage(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldSizeUsage} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldSizeUsage::setupFieldSizeUsageDeserializer + ); + + protected static void setupFieldSizeUsageDeserializer(ObjectDeserializer op) { + + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java index c9ab537e29..08806a7cc8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java @@ -32,322 +32,323 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch._types.mapping.FieldType; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.mapping.FieldType; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldSort @JsonpDeserializable public class FieldSort implements JsonpSerializable { - // Single key dictionary - private final String field; - - @Nullable - private final FieldValue missing; - - @Nullable - private final SortMode mode; - - @Nullable - private final NestedSortValue nested; - - @Nullable - private final SortOrder order; - - @Nullable - private final FieldType unmappedType; - - @Nullable - private final FieldSortNumericType numericType; - - @Nullable - private final String format; - - // --------------------------------------------------------------------------------------------- - - private FieldSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - - this.missing = builder.missing; - this.mode = builder.mode; - this.nested = builder.nested; - this.order = builder.order; - this.unmappedType = builder.unmappedType; - this.numericType = builder.numericType; - this.format = builder.format; - - } - - public static FieldSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The target field - */ - public final String field() { - return this.field; - } - - /** - * API name: {@code missing} - */ - @Nullable - public final FieldValue missing() { - return this.missing; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unmapped_type} - */ - @Nullable - public final FieldType unmappedType() { - return this.unmappedType; - } - - /** - * API name: {@code numeric_type} - */ - @Nullable - public final FieldSortNumericType numericType() { - return this.numericType; - } - - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * 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.writeStartObject(this.field); - - if (this.missing != null) { - generator.writeKey("missing"); - this.missing.serialize(generator, mapper); - - } - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unmappedType != null) { - generator.writeKey("unmapped_type"); - this.unmappedType.serialize(generator, mapper); - } - if (this.numericType != null) { - generator.writeKey("numeric_type"); - this.numericType.serialize(generator, mapper); - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - - generator.writeEnd(); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String field; - - /** - * Required - The target field - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - @Nullable - private FieldValue missing; - - @Nullable - private SortMode mode; - - @Nullable - private NestedSortValue nested; - - @Nullable - private SortOrder order; - - @Nullable - private FieldType unmappedType; - - @Nullable - private FieldSortNumericType numericType; - - @Nullable - private String format; - - /** - * API name: {@code missing} - */ - public final Builder missing(@Nullable FieldValue value) { - this.missing = value; - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); - } - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unmapped_type} - */ - public final Builder unmappedType(@Nullable FieldType value) { - this.unmappedType = value; - return this; - } - - /** - * API name: {@code numeric_type} - */ - public final Builder numericType(@Nullable FieldSortNumericType value) { - this.numericType = value; - return this; - } - - /** - * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - /** - * Builds a {@link FieldSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldSort build() { - _checkSingleUse(); - - return new FieldSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldSort::setupFieldSortDeserializer); - - protected static void setupFieldSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unmappedType, FieldType._DESERIALIZER, "unmapped_type"); - op.add(Builder::numericType, FieldSortNumericType._DESERIALIZER, "numeric_type"); - op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); - - op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); - op.shortcutProperty("order"); - - } + // Single key dictionary + private final String field; + + @Nullable + private final FieldValue missing; + + @Nullable + private final SortMode mode; + + @Nullable + private final NestedSortValue nested; + + @Nullable + private final SortOrder order; + + @Nullable + private final FieldType unmappedType; + + @Nullable + private final FieldSortNumericType numericType; + + @Nullable + private final String format; + + // --------------------------------------------------------------------------------------------- + + private FieldSort(Builder builder) { + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + + this.missing = builder.missing; + this.mode = builder.mode; + this.nested = builder.nested; + this.order = builder.order; + this.unmappedType = builder.unmappedType; + this.numericType = builder.numericType; + this.format = builder.format; + + } + + public static FieldSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The target field + */ + public final String field() { + return this.field; + } + + /** + * API name: {@code missing} + */ + @Nullable + public final FieldValue missing() { + return this.missing; + } + + /** + * API name: {@code mode} + */ + @Nullable + public final SortMode mode() { + return this.mode; + } + + /** + * API name: {@code nested} + */ + @Nullable + public final NestedSortValue nested() { + return this.nested; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * API name: {@code unmapped_type} + */ + @Nullable + public final FieldType unmappedType() { + return this.unmappedType; + } + + /** + * API name: {@code numeric_type} + */ + @Nullable + public final FieldSortNumericType numericType() { + return this.numericType; + } + + /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * 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.writeStartObject(this.field); + + if (this.missing != null) { + generator.writeKey("missing"); + this.missing.serialize(generator, mapper); + + } + if (this.mode != null) { + generator.writeKey("mode"); + this.mode.serialize(generator, mapper); + } + if (this.nested != null) { + generator.writeKey("nested"); + this.nested.serialize(generator, mapper); + + } + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.unmappedType != null) { + generator.writeKey("unmapped_type"); + this.unmappedType.serialize(generator, mapper); + } + if (this.numericType != null) { + generator.writeKey("numeric_type"); + this.numericType.serialize(generator, mapper); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + + generator.writeEnd(); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String field; + + /** + * Required - The target field + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + @Nullable + private FieldValue missing; + + @Nullable + private SortMode mode; + + @Nullable + private NestedSortValue nested; + + @Nullable + private SortOrder order; + + @Nullable + private FieldType unmappedType; + + @Nullable + private FieldSortNumericType numericType; + + @Nullable + private String format; + + /** + * API name: {@code missing} + */ + public final Builder missing(@Nullable FieldValue value) { + this.missing = value; + return this; + } + + /** + * API name: {@code missing} + */ + public final Builder missing(Function> fn) { + return this.missing(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * API name: {@code mode} + */ + public final Builder mode(@Nullable SortMode value) { + this.mode = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(@Nullable NestedSortValue value) { + this.nested = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(Function> fn) { + return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + } + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * API name: {@code unmapped_type} + */ + public final Builder unmappedType(@Nullable FieldType value) { + this.unmappedType = value; + return this; + } + + /** + * API name: {@code numeric_type} + */ + public final Builder numericType(@Nullable FieldSortNumericType value) { + this.numericType = value; + return this; + } + + /** + * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Builds a {@link FieldSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldSort build() { + _checkSingleUse(); + + return new FieldSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldSort::setupFieldSortDeserializer + ); + + protected static void setupFieldSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); + op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); + op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + op.add(Builder::unmappedType, FieldType._DESERIALIZER, "unmapped_type"); + op.add(Builder::numericType, FieldSortNumericType._DESERIALIZER, "numeric_type"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + + op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); + op.shortcutProperty("order"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java index 776101e80c..faf7f9d667 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java @@ -37,26 +37,27 @@ @JsonpDeserializable public enum FieldSortNumericType implements JsonEnum { - Long("long"), + Long("long"), - Double("double"), + Double("double"), - Date("date"), + Date("date"), - DateNanos("date_nanos"), + DateNanos("date_nanos"), - ; + ; - private final String jsonValue; + private final String jsonValue; - FieldSortNumericType(String jsonValue) { - this.jsonValue = jsonValue; - } + FieldSortNumericType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - FieldSortNumericType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + FieldSortNumericType.values() + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java index c5efb8350e..fbf6808921 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import jakarta.json.stream.JsonParser; +import java.util.EnumSet; +import java.util.function.Consumer; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,245 +45,250 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; - -import java.util.EnumSet; -import java.util.function.Consumer; // typedef: _types.FieldValue @JsonpDeserializable public class FieldValue implements TaggedUnion, JsonpSerializable { - public static FieldValue of(long value) { - return new FieldValue(Kind.Long, value); - } - - public static FieldValue of(double value) { - return new FieldValue(Kind.Double, value); - } - - public static FieldValue of(boolean value) { - return value ? TRUE : FALSE; - } - - public static FieldValue of(String value) { - return new FieldValue(Kind.String, value); - } - - public static final FieldValue NULL = new FieldValue(Kind.Null, null); - public static final FieldValue TRUE = new FieldValue(Kind.Boolean, Boolean.TRUE); - public static final FieldValue FALSE = new FieldValue(Kind.Boolean, Boolean.FALSE); - - public enum Kind { - Double, Long, Boolean, String, Null - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public String _toJsonString() { - switch (_kind) { - case Double : - return String.valueOf(this.doubleValue()); - case Long : - return String.valueOf(this.longValue()); - case Boolean : - return String.valueOf(this.booleanValue()); - case String : - return this.stringValue(); - case Null : - return "null"; - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private FieldValue(Builder builder) { - this(builder._kind, builder._value); - } - - private FieldValue(Kind kind, Object value) { - this._kind = ApiTypeHelper.requireNonNull(kind, this, ""); - this._value = kind == Kind.Null ? null : ApiTypeHelper.requireNonNull(value, this, ""); - } - - public static FieldValue of(Consumer fn) { - Builder builder = new Builder(); - fn.accept(builder); - return builder.build(); - } - - /** - * Is this variant instance of kind {@code double}? - */ - public boolean isDouble() { - return _kind == Kind.Double; - } - - /** - * Get the {@code double} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code double} kind. - */ - public double doubleValue() { - return TaggedUnionUtils.get(this, Kind.Double); - } - - /** - * Is this variant instance of kind {@code long}? - */ - public boolean isLong() { - return _kind == Kind.Long; - } - - /** - * Get the {@code long} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code long} kind. - */ - public long longValue() { - return TaggedUnionUtils.get(this, Kind.Long); - } - - /** - * Is this variant instance of kind {@code boolean}? - */ - public boolean isBoolean() { - return _kind == Kind.Boolean; - } - - /** - * Get the {@code boolean} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code boolean} kind. - */ - public boolean booleanValue() { - return TaggedUnionUtils.get(this, Kind.Boolean); - } - - /** - * Is this variant instance of kind {@code string}? - */ - public boolean isString() { - return _kind == Kind.String; - } - - /** - * Get the {@code string} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code string} kind. - */ - public String stringValue() { - return TaggedUnionUtils.get(this, Kind.String); - } - - /** - * Is this variant instance of kind {@code null}? - */ - public boolean isNull() { - return _kind == Kind.Null; - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - switch (_kind) { - case Double : - generator.write(((Double) this._value)); - break; - case Long : - generator.write(((Long) this._value)); - break; - case Boolean : - generator.write(((Boolean) this._value)); - break; - case String : - generator.write(((String) this._value)); - break; - case Null : - generator.writeNull(); - break; - } - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder doubleValue(double v) { - this._kind = Kind.Double; - this._value = v; - return this; - } - - public ObjectBuilder longValue(long v) { - this._kind = Kind.Long; - this._value = v; - return this; - } - - public ObjectBuilder booleanValue(boolean v) { - this._kind = Kind.Boolean; - this._value = v; - return this; - } - - public ObjectBuilder stringValue(String v) { - this._kind = Kind.String; - this._value = v; - return this; - } - - public ObjectBuilder nullValue() { - this._kind = Kind.Null; - this._value = null; - return this; - } - - public FieldValue build() { - _checkSingleUse(); - return new FieldValue(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(() -> JsonpDeserializer.of( - EnumSet.of(JsonParser.Event.VALUE_STRING, JsonParser.Event.VALUE_NUMBER, - JsonParser.Event.VALUE_NULL, - JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE), - (parser, mapper, event) -> { - switch (event) { - case VALUE_NULL : - return NULL; - case VALUE_STRING : - return FieldValue.of(parser.getString()); - case VALUE_TRUE : - return FieldValue.of(true); - case VALUE_FALSE : - return FieldValue.of(false); - case VALUE_NUMBER : - if (parser.isIntegralNumber()) { - return FieldValue.of(parser.getLong()); - } else { - return FieldValue.of(parser.getBigDecimal().doubleValue()); - } - } - return null; - })); + public static FieldValue of(long value) { + return new FieldValue(Kind.Long, value); + } + + public static FieldValue of(double value) { + return new FieldValue(Kind.Double, value); + } + + public static FieldValue of(boolean value) { + return value ? TRUE : FALSE; + } + + public static FieldValue of(String value) { + return new FieldValue(Kind.String, value); + } + + public static final FieldValue NULL = new FieldValue(Kind.Null, null); + public static final FieldValue TRUE = new FieldValue(Kind.Boolean, Boolean.TRUE); + public static final FieldValue FALSE = new FieldValue(Kind.Boolean, Boolean.FALSE); + + public enum Kind { + Double, + Long, + Boolean, + String, + Null + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public String _toJsonString() { + switch (_kind) { + case Double: + return String.valueOf(this.doubleValue()); + case Long: + return String.valueOf(this.longValue()); + case Boolean: + return String.valueOf(this.booleanValue()); + case String: + return this.stringValue(); + case Null: + return "null"; + + default: + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private FieldValue(Builder builder) { + this(builder._kind, builder._value); + } + + private FieldValue(Kind kind, Object value) { + this._kind = ApiTypeHelper.requireNonNull(kind, this, ""); + this._value = kind == Kind.Null ? null : ApiTypeHelper.requireNonNull(value, this, ""); + } + + public static FieldValue of(Consumer fn) { + Builder builder = new Builder(); + fn.accept(builder); + return builder.build(); + } + + /** + * Is this variant instance of kind {@code double}? + */ + public boolean isDouble() { + return _kind == Kind.Double; + } + + /** + * Get the {@code double} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code double} kind. + */ + public double doubleValue() { + return TaggedUnionUtils.get(this, Kind.Double); + } + + /** + * Is this variant instance of kind {@code long}? + */ + public boolean isLong() { + return _kind == Kind.Long; + } + + /** + * Get the {@code long} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code long} kind. + */ + public long longValue() { + return TaggedUnionUtils.get(this, Kind.Long); + } + + /** + * Is this variant instance of kind {@code boolean}? + */ + public boolean isBoolean() { + return _kind == Kind.Boolean; + } + + /** + * Get the {@code boolean} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code boolean} kind. + */ + public boolean booleanValue() { + return TaggedUnionUtils.get(this, Kind.Boolean); + } + + /** + * Is this variant instance of kind {@code string}? + */ + public boolean isString() { + return _kind == Kind.String; + } + + /** + * Get the {@code string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code string} kind. + */ + public String stringValue() { + return TaggedUnionUtils.get(this, Kind.String); + } + + /** + * Is this variant instance of kind {@code null}? + */ + public boolean isNull() { + return _kind == Kind.Null; + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + switch (_kind) { + case Double: + generator.write(((Double) this._value)); + break; + case Long: + generator.write(((Long) this._value)); + break; + case Boolean: + generator.write(((Boolean) this._value)); + break; + case String: + generator.write(((String) this._value)); + break; + case Null: + generator.writeNull(); + break; + } + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder doubleValue(double v) { + this._kind = Kind.Double; + this._value = v; + return this; + } + + public ObjectBuilder longValue(long v) { + this._kind = Kind.Long; + this._value = v; + return this; + } + + public ObjectBuilder booleanValue(boolean v) { + this._kind = Kind.Boolean; + this._value = v; + return this; + } + + public ObjectBuilder stringValue(String v) { + this._kind = Kind.String; + this._value = v; + return this; + } + + public ObjectBuilder nullValue() { + this._kind = Kind.Null; + this._value = null; + return this; + } + + public FieldValue build() { + _checkSingleUse(); + return new FieldValue(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( + () -> JsonpDeserializer.of( + EnumSet.of( + JsonParser.Event.VALUE_STRING, + JsonParser.Event.VALUE_NUMBER, + JsonParser.Event.VALUE_NULL, + JsonParser.Event.VALUE_TRUE, + JsonParser.Event.VALUE_FALSE + ), + (parser, mapper, event) -> { + switch (event) { + case VALUE_NULL: + return NULL; + case VALUE_STRING: + return FieldValue.of(parser.getString()); + case VALUE_TRUE: + return FieldValue.of(true); + case VALUE_FALSE: + return FieldValue.of(false); + case VALUE_NUMBER: + if (parser.isIntegralNumber()) { + return FieldValue.of(parser.getLong()); + } else { + return FieldValue.of(parser.getBigDecimal().doubleValue()); + } + } + return null; + } + ) + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java index ea10424dd4..ece673c2b5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,208 +45,205 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FielddataStats @JsonpDeserializable public class FielddataStats implements JsonpSerializable { - @Nullable - private final Long evictions; + @Nullable + private final Long evictions; - @Nullable - private final String memorySize; + @Nullable + private final String memorySize; - private final long memorySizeInBytes; + private final long memorySizeInBytes; - private final Map fields; + private final Map fields; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private FielddataStats(Builder builder) { + private FielddataStats(Builder builder) { - this.evictions = builder.evictions; - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.evictions = builder.evictions; + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.fields = ApiTypeHelper.unmodifiable(builder.fields); - } - - public static FielddataStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code evictions} - */ - @Nullable - public final Long evictions() { - return this.evictions; - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.evictions != null) { - generator.writeKey("evictions"); - generator.write(this.evictions); - - } - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FielddataStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Long evictions; - - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - @Nullable - private Map fields; - - /** - * API name: {@code evictions} - */ - public final Builder evictions(@Nullable Long value) { - this.evictions = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * API name: {@code fields} - *

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

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

- * Adds an entry to fields using a builder lambda. - */ - public final Builder fields(String key, - Function> fn) { - return fields(key, fn.apply(new FieldMemoryUsage.Builder()).build()); - } - - /** - * Builds a {@link FielddataStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FielddataStats build() { - _checkSingleUse(); - - return new FielddataStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FielddataStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FielddataStats::setupFielddataStatsDeserializer); - - protected static void setupFielddataStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); - - } + } + + public static FielddataStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code evictions} + */ + @Nullable + public final Long evictions() { + return this.evictions; + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.evictions != null) { + generator.writeKey("evictions"); + generator.write(this.evictions); + + } + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FielddataStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Long evictions; + + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + @Nullable + private Map fields; + + /** + * API name: {@code evictions} + */ + public final Builder evictions(@Nullable Long value) { + this.evictions = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * API name: {@code fields} + *

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

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

+ * Adds an entry to fields using a builder lambda. + */ + public final Builder fields(String key, Function> fn) { + return fields(key, fn.apply(new FieldMemoryUsage.Builder()).build()); + } + + /** + * Builds a {@link FielddataStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FielddataStats build() { + _checkSingleUse(); + + return new FielddataStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FielddataStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FielddataStats::setupFielddataStatsDeserializer + ); + + protected static void setupFielddataStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java index 2747d47c4d..709cc8f81e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,170 +44,169 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FlushStats @JsonpDeserializable public class FlushStats implements JsonpSerializable { - private final long periodic; + private final long periodic; - private final long total; + private final long total; - @Nullable - private final String totalTime; + @Nullable + private final String totalTime; - private final long totalTimeInMillis; + private final long totalTimeInMillis; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private FlushStats(Builder builder) { + private FlushStats(Builder builder) { - this.periodic = ApiTypeHelper.requireNonNull(builder.periodic, this, "periodic"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - - } - - public static FlushStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code periodic} - */ - public final long periodic() { - return this.periodic; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * 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("periodic"); - generator.write(this.periodic); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FlushStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long periodic; - - private Long total; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code periodic} - */ - public final Builder periodic(long value) { - this.periodic = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link FlushStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FlushStats build() { - _checkSingleUse(); - - return new FlushStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FlushStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FlushStats::setupFlushStatsDeserializer); - - protected static void setupFlushStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::periodic, JsonpDeserializer.longDeserializer(), "periodic"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + this.periodic = ApiTypeHelper.requireNonNull(builder.periodic, this, "periodic"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + + } + + public static FlushStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code periodic} + */ + public final long periodic() { + return this.periodic; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * 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("periodic"); + generator.write(this.periodic); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FlushStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long periodic; + + private Long total; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code periodic} + */ + public final Builder periodic(long value) { + this.periodic = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link FlushStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FlushStats build() { + _checkSingleUse(); + + return new FlushStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FlushStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FlushStats::setupFlushStatsDeserializer + ); + + protected static void setupFlushStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::periodic, JsonpDeserializer.longDeserializer(), "periodic"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java index 7be1836e37..56f23b35d9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,8 +44,6 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoBounds @@ -60,177 +60,180 @@ @JsonpDeserializable public class GeoBounds implements TaggedUnion, JsonpSerializable { - public enum Kind { - Coords, Tlbr, Trbl, Wkt - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoBounds(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoBounds(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public CoordsGeoBounds coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code tlbr}? - */ - public boolean isTlbr() { - return _kind == Kind.Tlbr; - } - - /** - * Get the {@code tlbr} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code tlbr} kind. - */ - public TopLeftBottomRightGeoBounds tlbr() { - return TaggedUnionUtils.get(this, Kind.Tlbr); - } - - /** - * Is this variant instance of kind {@code trbl}? - */ - public boolean isTrbl() { - return _kind == Kind.Trbl; - } - - /** - * Get the {@code trbl} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code trbl} kind. - */ - public TopRightBottomLeftGeoBounds trbl() { - return TaggedUnionUtils.get(this, Kind.Trbl); - } - - /** - * Is this variant instance of kind {@code wkt}? - */ - public boolean isWkt() { - return _kind == Kind.Wkt; - } - - /** - * Get the {@code wkt} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code wkt} kind. - */ - public WktGeoBounds wkt() { - return TaggedUnionUtils.get(this, Kind.Wkt); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(CoordsGeoBounds v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder coords(Function> fn) { - return this.coords(fn.apply(new CoordsGeoBounds.Builder()).build()); - } - - public ObjectBuilder tlbr(TopLeftBottomRightGeoBounds v) { - this._kind = Kind.Tlbr; - this._value = v; - return this; - } - - public ObjectBuilder tlbr( - Function> fn) { - return this.tlbr(fn.apply(new TopLeftBottomRightGeoBounds.Builder()).build()); - } - - public ObjectBuilder trbl(TopRightBottomLeftGeoBounds v) { - this._kind = Kind.Trbl; - this._value = v; - return this; - } - - public ObjectBuilder trbl( - Function> fn) { - return this.trbl(fn.apply(new TopRightBottomLeftGeoBounds.Builder()).build()); - } - - public ObjectBuilder wkt(WktGeoBounds v) { - this._kind = Kind.Wkt; - this._value = v; - return this; - } - - public ObjectBuilder wkt(Function> fn) { - return this.wkt(fn.apply(new WktGeoBounds.Builder()).build()); - } - - public GeoBounds build() { - _checkSingleUse(); - return new GeoBounds(this); - } - - } - - private static JsonpDeserializer buildGeoBoundsDeserializer() { - return new UnionDeserializer.Builder(GeoBounds::new, false) - .addMember(Kind.Coords, CoordsGeoBounds._DESERIALIZER) - .addMember(Kind.Tlbr, TopLeftBottomRightGeoBounds._DESERIALIZER) - .addMember(Kind.Trbl, TopRightBottomLeftGeoBounds._DESERIALIZER) - .addMember(Kind.Wkt, WktGeoBounds._DESERIALIZER).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoBounds::buildGeoBoundsDeserializer); + public enum Kind { + Coords, + Tlbr, + Trbl, + Wkt + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoBounds(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private GeoBounds(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoBounds of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code coords}? + */ + public boolean isCoords() { + return _kind == Kind.Coords; + } + + /** + * Get the {@code coords} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code coords} kind. + */ + public CoordsGeoBounds coords() { + return TaggedUnionUtils.get(this, Kind.Coords); + } + + /** + * Is this variant instance of kind {@code tlbr}? + */ + public boolean isTlbr() { + return _kind == Kind.Tlbr; + } + + /** + * Get the {@code tlbr} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code tlbr} kind. + */ + public TopLeftBottomRightGeoBounds tlbr() { + return TaggedUnionUtils.get(this, Kind.Tlbr); + } + + /** + * Is this variant instance of kind {@code trbl}? + */ + public boolean isTrbl() { + return _kind == Kind.Trbl; + } + + /** + * Get the {@code trbl} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code trbl} kind. + */ + public TopRightBottomLeftGeoBounds trbl() { + return TaggedUnionUtils.get(this, Kind.Trbl); + } + + /** + * Is this variant instance of kind {@code wkt}? + */ + public boolean isWkt() { + return _kind == Kind.Wkt; + } + + /** + * Get the {@code wkt} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code wkt} kind. + */ + public WktGeoBounds wkt() { + return TaggedUnionUtils.get(this, Kind.Wkt); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder coords(CoordsGeoBounds v) { + this._kind = Kind.Coords; + this._value = v; + return this; + } + + public ObjectBuilder coords(Function> fn) { + return this.coords(fn.apply(new CoordsGeoBounds.Builder()).build()); + } + + public ObjectBuilder tlbr(TopLeftBottomRightGeoBounds v) { + this._kind = Kind.Tlbr; + this._value = v; + return this; + } + + public ObjectBuilder tlbr(Function> fn) { + return this.tlbr(fn.apply(new TopLeftBottomRightGeoBounds.Builder()).build()); + } + + public ObjectBuilder trbl(TopRightBottomLeftGeoBounds v) { + this._kind = Kind.Trbl; + this._value = v; + return this; + } + + public ObjectBuilder trbl(Function> fn) { + return this.trbl(fn.apply(new TopRightBottomLeftGeoBounds.Builder()).build()); + } + + public ObjectBuilder wkt(WktGeoBounds v) { + this._kind = Kind.Wkt; + this._value = v; + return this; + } + + public ObjectBuilder wkt(Function> fn) { + return this.wkt(fn.apply(new WktGeoBounds.Builder()).build()); + } + + public GeoBounds build() { + _checkSingleUse(); + return new GeoBounds(this); + } + + } + + private static JsonpDeserializer buildGeoBoundsDeserializer() { + return new UnionDeserializer.Builder(GeoBounds::new, false).addMember( + Kind.Coords, + CoordsGeoBounds._DESERIALIZER + ) + .addMember(Kind.Tlbr, TopLeftBottomRightGeoBounds._DESERIALIZER) + .addMember(Kind.Trbl, TopRightBottomLeftGeoBounds._DESERIALIZER) + .addMember(Kind.Wkt, WktGeoBounds._DESERIALIZER) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoBounds::buildGeoBoundsDeserializer); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java index 5c8c63f16c..614522f557 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java @@ -36,38 +36,37 @@ * Builders for {@link GeoBounds} variants. */ public class GeoBoundsBuilders { - private GeoBoundsBuilders() { - } + private GeoBoundsBuilders() {} - /** - * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} - * variant. - */ - public static CoordsGeoBounds.Builder coords() { - return new CoordsGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} + * variant. + */ + public static CoordsGeoBounds.Builder coords() { + return new CoordsGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} - * {@code GeoBounds} variant. - */ - public static TopLeftBottomRightGeoBounds.Builder tlbr() { - return new TopLeftBottomRightGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} + * {@code GeoBounds} variant. + */ + public static TopLeftBottomRightGeoBounds.Builder tlbr() { + return new TopLeftBottomRightGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} - * {@code GeoBounds} variant. - */ - public static TopRightBottomLeftGeoBounds.Builder trbl() { - return new TopRightBottomLeftGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} + * {@code GeoBounds} variant. + */ + public static TopRightBottomLeftGeoBounds.Builder trbl() { + return new TopRightBottomLeftGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link WktGeoBounds wkt} {@code GeoBounds} variant. - */ - public static WktGeoBounds.Builder wkt() { - return new WktGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link WktGeoBounds wkt} {@code GeoBounds} variant. + */ + public static WktGeoBounds.Builder wkt() { + return new WktGeoBounds.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java index c08ae130a6..6aaa338fb3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,289 +45,286 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.GeoDistanceSort @JsonpDeserializable public class GeoDistanceSort implements SortOptionsVariant, JsonpSerializable { - private final String field; - - private final List location; - - @Nullable - private final SortMode mode; - - @Nullable - private final GeoDistanceType distanceType; - - @Nullable - private final Boolean ignoreUnmapped; - - @Nullable - private final SortOrder order; - - @Nullable - private final DistanceUnit unit; - - // --------------------------------------------------------------------------------------------- - - private GeoDistanceSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.location = ApiTypeHelper.unmodifiableRequired(builder.location, this, "location"); - - this.mode = builder.mode; - this.distanceType = builder.distanceType; - this.ignoreUnmapped = builder.ignoreUnmapped; - this.order = builder.order; - this.unit = builder.unit; - - } - - public static GeoDistanceSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.GeoDistance; - } - - /** - * Required - - */ - public final String field() { - return this.field; - } - - /** - * Required - - */ - public final List location() { - return this.location; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code distance_type} - */ - @Nullable - public final GeoDistanceType distanceType() { - return this.distanceType; - } - - /** - * API name: {@code ignore_unmapped} - */ - @Nullable - public final Boolean ignoreUnmapped() { - return this.ignoreUnmapped; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unit} - */ - @Nullable - public final DistanceUnit unit() { - return this.unit; - } - - /** - * 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(this.field); - generator.writeStartArray(); - for (GeoLocation item0 : this.location) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.distanceType != null) { - generator.writeKey("distance_type"); - this.distanceType.serialize(generator, mapper); - } - if (this.ignoreUnmapped != null) { - generator.writeKey("ignore_unmapped"); - generator.write(this.ignoreUnmapped); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unit != null) { - generator.writeKey("unit"); - this.unit.serialize(generator, mapper); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoDistanceSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String field; - - private List location; - - /** - * Required - - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - Adds all elements of list to location. - */ - public final Builder location(List list) { - this.location = _listAddAll(this.location, list); - return this; - } - - /** - * Required - Adds one or more values to location. - */ - public final Builder location(GeoLocation value, GeoLocation... values) { - this.location = _listAdd(this.location, value, values); - return this; - } - - /** - * Required - Adds a value to location using a builder lambda. - */ - public final Builder location(Function> fn) { - return location(fn.apply(new GeoLocation.Builder()).build()); - } - - @Nullable - private SortMode mode; - - @Nullable - private GeoDistanceType distanceType; - - @Nullable - private Boolean ignoreUnmapped; - - @Nullable - private SortOrder order; - - @Nullable - private DistanceUnit unit; - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code distance_type} - */ - public final Builder distanceType(@Nullable GeoDistanceType value) { - this.distanceType = value; - return this; - } - - /** - * API name: {@code ignore_unmapped} - */ - public final Builder ignoreUnmapped(@Nullable Boolean value) { - this.ignoreUnmapped = value; - return this; - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unit} - */ - public final Builder unit(@Nullable DistanceUnit value) { - this.unit = value; - return this; - } - - /** - * Builds a {@link GeoDistanceSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoDistanceSort build() { - _checkSingleUse(); - - return new GeoDistanceSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoDistanceSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoDistanceSort::setupGeoDistanceSortDeserializer); - - protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); - op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unit, DistanceUnit._DESERIALIZER, "unit"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.field(name); - builder.location( - JsonpDeserializer.arrayDeserializer(GeoLocation._DESERIALIZER).deserialize(parser, mapper)); - }); - - } + private final String field; + + private final List location; + + @Nullable + private final SortMode mode; + + @Nullable + private final GeoDistanceType distanceType; + + @Nullable + private final Boolean ignoreUnmapped; + + @Nullable + private final SortOrder order; + + @Nullable + private final DistanceUnit unit; + + // --------------------------------------------------------------------------------------------- + + private GeoDistanceSort(Builder builder) { + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.location = ApiTypeHelper.unmodifiableRequired(builder.location, this, "location"); + + this.mode = builder.mode; + this.distanceType = builder.distanceType; + this.ignoreUnmapped = builder.ignoreUnmapped; + this.order = builder.order; + this.unit = builder.unit; + + } + + public static GeoDistanceSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * SortOptions variant kind. + */ + @Override + public SortOptions.Kind _sortOptionsKind() { + return SortOptions.Kind.GeoDistance; + } + + /** + * Required - + */ + public final String field() { + return this.field; + } + + /** + * Required - + */ + public final List location() { + return this.location; + } + + /** + * API name: {@code mode} + */ + @Nullable + public final SortMode mode() { + return this.mode; + } + + /** + * API name: {@code distance_type} + */ + @Nullable + public final GeoDistanceType distanceType() { + return this.distanceType; + } + + /** + * API name: {@code ignore_unmapped} + */ + @Nullable + public final Boolean ignoreUnmapped() { + return this.ignoreUnmapped; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * API name: {@code unit} + */ + @Nullable + public final DistanceUnit unit() { + return this.unit; + } + + /** + * 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(this.field); + generator.writeStartArray(); + for (GeoLocation item0 : this.location) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + if (this.mode != null) { + generator.writeKey("mode"); + this.mode.serialize(generator, mapper); + } + if (this.distanceType != null) { + generator.writeKey("distance_type"); + this.distanceType.serialize(generator, mapper); + } + if (this.ignoreUnmapped != null) { + generator.writeKey("ignore_unmapped"); + generator.write(this.ignoreUnmapped); + + } + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.unit != null) { + generator.writeKey("unit"); + this.unit.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoDistanceSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String field; + + private List location; + + /** + * Required - + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * Required - Adds all elements of list to location. + */ + public final Builder location(List list) { + this.location = _listAddAll(this.location, list); + return this; + } + + /** + * Required - Adds one or more values to location. + */ + public final Builder location(GeoLocation value, GeoLocation... values) { + this.location = _listAdd(this.location, value, values); + return this; + } + + /** + * Required - Adds a value to location using a builder lambda. + */ + public final Builder location(Function> fn) { + return location(fn.apply(new GeoLocation.Builder()).build()); + } + + @Nullable + private SortMode mode; + + @Nullable + private GeoDistanceType distanceType; + + @Nullable + private Boolean ignoreUnmapped; + + @Nullable + private SortOrder order; + + @Nullable + private DistanceUnit unit; + + /** + * API name: {@code mode} + */ + public final Builder mode(@Nullable SortMode value) { + this.mode = value; + return this; + } + + /** + * API name: {@code distance_type} + */ + public final Builder distanceType(@Nullable GeoDistanceType value) { + this.distanceType = value; + return this; + } + + /** + * API name: {@code ignore_unmapped} + */ + public final Builder ignoreUnmapped(@Nullable Boolean value) { + this.ignoreUnmapped = value; + return this; + } + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * API name: {@code unit} + */ + public final Builder unit(@Nullable DistanceUnit value) { + this.unit = value; + return this; + } + + /** + * Builds a {@link GeoDistanceSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoDistanceSort build() { + _checkSingleUse(); + + return new GeoDistanceSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoDistanceSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoDistanceSort::setupGeoDistanceSortDeserializer + ); + + protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); + op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); + op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped"); + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + op.add(Builder::unit, DistanceUnit._DESERIALIZER, "unit"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + builder.field(name); + builder.location(JsonpDeserializer.arrayDeserializer(GeoLocation._DESERIALIZER).deserialize(parser, mapper)); + }); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java index f9b0266251..ff616f352f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java @@ -37,22 +37,21 @@ @JsonpDeserializable public enum GeoDistanceType implements JsonEnum { - Arc("arc"), + Arc("arc"), - Plane("plane"), + Plane("plane"), - ; + ; - private final String jsonValue; + private final String jsonValue; - GeoDistanceType(String jsonValue) { - this.jsonValue = jsonValue; - } + GeoDistanceType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoDistanceType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(GeoDistanceType.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java index 47ba815a26..ddb345f60d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,92 +43,92 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoHashLocation @JsonpDeserializable public class GeoHashLocation implements JsonpSerializable { - private final String geohash; + private final String geohash; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private GeoHashLocation(Builder builder) { + private GeoHashLocation(Builder builder) { - this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); + this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); - } + } - public static GeoHashLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static GeoHashLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code geohash} - */ - public final String geohash() { - return this.geohash; - } + /** + * Required - API name: {@code geohash} + */ + public final String geohash() { + return this.geohash; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * 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) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("geohash"); - generator.write(this.geohash); + generator.writeKey("geohash"); + generator.write(this.geohash); - } + } - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - /** - * Builder for {@link GeoHashLocation}. - */ + /** + * Builder for {@link GeoHashLocation}. + */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String geohash; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String geohash; - /** - * Required - API name: {@code geohash} - */ - public final Builder geohash(String value) { - this.geohash = value; - return this; - } + /** + * Required - API name: {@code geohash} + */ + public final Builder geohash(String value) { + this.geohash = value; + return this; + } - /** - * Builds a {@link GeoHashLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoHashLocation build() { - _checkSingleUse(); + /** + * Builds a {@link GeoHashLocation}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoHashLocation build() { + _checkSingleUse(); - return new GeoHashLocation(this); - } - } + return new GeoHashLocation(this); + } + } - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link GeoHashLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoHashLocation::setupGeoHashLocationDeserializer); + /** + * Json deserializer for {@link GeoHashLocation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoHashLocation::setupGeoHashLocationDeserializer + ); - protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { + protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { - op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); + op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java index 9ab1939d53..0b25072c7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,147 +44,148 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoHashPrecision /** * A precision that can be expressed as a geohash length between 1 and 12, or a * distance measure like "1km", "10m". - * + * */ @JsonpDeserializable public class GeoHashPrecision implements TaggedUnion, JsonpSerializable { - public enum Kind { - GeohashLength, Distance - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoHashPrecision(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - public String _toJsonString() { - switch (_kind) { - case GeohashLength : - return this.geohashLength().toString(); - case Distance : - return this.distance(); - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private GeoHashPrecision(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoHashPrecision of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code geohash_length}? - */ - public boolean isGeohashLength() { - return _kind == Kind.GeohashLength; - } - - /** - * Get the {@code geohash_length} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash_length} kind. - */ - public Number geohashLength() { - return TaggedUnionUtils.get(this, Kind.GeohashLength); - } - - /** - * Is this variant instance of kind {@code distance}? - */ - public boolean isDistance() { - return _kind == Kind.Distance; - } - - /** - * Get the {@code distance} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code distance} kind. - */ - public String distance() { - return TaggedUnionUtils.get(this, Kind.Distance); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case GeohashLength : - generator.write(((Number) this._value).doubleValue()); - - break; - case Distance : - generator.write(((String) this._value)); - - break; - } - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder geohashLength(Number v) { - this._kind = Kind.GeohashLength; - this._value = v; - return this; - } - - public ObjectBuilder distance(String v) { - this._kind = Kind.Distance; - this._value = v; - return this; - } - - public GeoHashPrecision build() { - _checkSingleUse(); - return new GeoHashPrecision(this); - } - - } - - private static JsonpDeserializer buildGeoHashPrecisionDeserializer() { - return new UnionDeserializer.Builder(GeoHashPrecision::new, false) - .addMember(Kind.GeohashLength, JsonpDeserializer.numberDeserializer()) - .addMember(Kind.Distance, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoHashPrecision::buildGeoHashPrecisionDeserializer); + public enum Kind { + GeohashLength, + Distance + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoHashPrecision(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + public String _toJsonString() { + switch (_kind) { + case GeohashLength: + return this.geohashLength().toString(); + case Distance: + return this.distance(); + + default: + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private GeoHashPrecision(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoHashPrecision of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code geohash_length}? + */ + public boolean isGeohashLength() { + return _kind == Kind.GeohashLength; + } + + /** + * Get the {@code geohash_length} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geohash_length} kind. + */ + public Number geohashLength() { + return TaggedUnionUtils.get(this, Kind.GeohashLength); + } + + /** + * Is this variant instance of kind {@code distance}? + */ + public boolean isDistance() { + return _kind == Kind.Distance; + } + + /** + * Get the {@code distance} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code distance} kind. + */ + public String distance() { + return TaggedUnionUtils.get(this, Kind.Distance); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case GeohashLength: + generator.write(((Number) this._value).doubleValue()); + + break; + case Distance: + generator.write(((String) this._value)); + + break; + } + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder geohashLength(Number v) { + this._kind = Kind.GeohashLength; + this._value = v; + return this; + } + + public ObjectBuilder distance(String v) { + this._kind = Kind.Distance; + this._value = v; + return this; + } + + public GeoHashPrecision build() { + _checkSingleUse(); + return new GeoHashPrecision(this); + } + + } + + private static JsonpDeserializer buildGeoHashPrecisionDeserializer() { + return new UnionDeserializer.Builder(GeoHashPrecision::new, false).addMember( + Kind.GeohashLength, + JsonpDeserializer.numberDeserializer() + ).addMember(Kind.Distance, JsonpDeserializer.stringDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( + GeoHashPrecision::buildGeoHashPrecisionDeserializer + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java index 1a635a467c..be883f856f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java @@ -38,10 +38,9 @@ * Variants geohash_length, distance are not available * here as they don't have a dedicated class. Use {@link GeoHashPrecision}'s * builder for these. - * + * */ public class GeoHashPrecisionBuilders { - private GeoHashPrecisionBuilders() { - } + private GeoHashPrecisionBuilders() {} } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java index 872218cbf2..0b21c874f9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,159 +44,161 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.GeoLine /** * A GeoJson GeoLine. - * + * */ @JsonpDeserializable public class GeoLine implements JsonpSerializable { - private final String type; - - private final List> coordinates; - - // --------------------------------------------------------------------------------------------- - - private GeoLine(Builder builder) { - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.coordinates = ApiTypeHelper.unmodifiableRequired(builder.coordinates, this, "coordinates"); - - } - - public static GeoLine of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - */ - public final List> coordinates() { - return this.coordinates; - } - - /** - * 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("type"); - generator.write(this.type); - - if (ApiTypeHelper.isDefined(this.coordinates)) { - generator.writeKey("coordinates"); - generator.writeStartArray(); - for (List item0 : this.coordinates) { - generator.writeStartArray(); - if (item0 != null) { - for (Double item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoLine}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String type; - - private List> coordinates; - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

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

- * Adds all elements of list to coordinates. - */ - public final Builder coordinates(List> list) { - this.coordinates = _listAddAll(this.coordinates, list); - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

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

- * Adds one or more values to coordinates. - */ - public final Builder coordinates(List value, List... values) { - this.coordinates = _listAdd(this.coordinates, value, values); - return this; - } - - /** - * Builds a {@link GeoLine}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoLine build() { - _checkSingleUse(); - - return new GeoLine(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoLine} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoLine::setupGeoLineDeserializer); - - protected static void setupGeoLineDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), "coordinates"); - - } + private final String type; + + private final List> coordinates; + + // --------------------------------------------------------------------------------------------- + + private GeoLine(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.coordinates = ApiTypeHelper.unmodifiableRequired(builder.coordinates, this, "coordinates"); + + } + + public static GeoLine of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Always "LineString" + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Required - Array of [lon, lat] coordinates + *

+ * API name: {@code coordinates} + */ + public final List> coordinates() { + return this.coordinates; + } + + /** + * 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("type"); + generator.write(this.type); + + if (ApiTypeHelper.isDefined(this.coordinates)) { + generator.writeKey("coordinates"); + generator.writeStartArray(); + for (List item0 : this.coordinates) { + generator.writeStartArray(); + if (item0 != null) { + for (Double item1 : item0) { + generator.write(item1); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoLine}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String type; + + private List> coordinates; + + /** + * Required - Always "LineString" + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Required - Array of [lon, lat] coordinates + *

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

+ * Adds all elements of list to coordinates. + */ + public final Builder coordinates(List> list) { + this.coordinates = _listAddAll(this.coordinates, list); + return this; + } + + /** + * Required - Array of [lon, lat] coordinates + *

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

+ * Adds one or more values to coordinates. + */ + public final Builder coordinates(List value, List... values) { + this.coordinates = _listAdd(this.coordinates, value, values); + return this; + } + + /** + * Builds a {@link GeoLine}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoLine build() { + _checkSingleUse(); + + return new GeoLine(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoLine} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoLine::setupGeoLineDeserializer + ); + + protected static void setupGeoLineDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add( + Builder::coordinates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), + "coordinates" + ); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java index 41a8a107a0..f04f86d802 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,9 +45,6 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.GeoLocation @@ -63,185 +63,188 @@ @JsonpDeserializable public class GeoLocation implements TaggedUnion, JsonpSerializable { - public enum Kind { - Coords, Geohash, Latlon, Text - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoLocation(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoLocation(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public List coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code geohash}? - */ - public boolean isGeohash() { - return _kind == Kind.Geohash; - } - - /** - * Get the {@code geohash} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash} kind. - */ - public GeoHashLocation geohash() { - return TaggedUnionUtils.get(this, Kind.Geohash); - } - - /** - * Is this variant instance of kind {@code latlon}? - */ - public boolean isLatlon() { - return _kind == Kind.Latlon; - } - - /** - * Get the {@code latlon} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code latlon} kind. - */ - public LatLonGeoLocation latlon() { - return TaggedUnionUtils.get(this, Kind.Latlon); - } - - /** - * Is this variant instance of kind {@code text}? - */ - public boolean isText() { - return _kind == Kind.Text; - } - - /** - * Get the {@code text} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code text} kind. - */ - public String text() { - return TaggedUnionUtils.get(this, Kind.Text); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Coords : - generator.writeStartArray(); - for (Double item0 : ((List) this._value)) { - generator.write(item0); - - } - generator.writeEnd(); - - break; - case Text : - generator.write(((String) this._value)); - - break; - } - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(List v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder geohash(GeoHashLocation v) { - this._kind = Kind.Geohash; - this._value = v; - return this; - } - - public ObjectBuilder geohash( - Function> fn) { - return this.geohash(fn.apply(new GeoHashLocation.Builder()).build()); - } - - public ObjectBuilder latlon(LatLonGeoLocation v) { - this._kind = Kind.Latlon; - this._value = v; - return this; - } - - public ObjectBuilder latlon( - Function> fn) { - return this.latlon(fn.apply(new LatLonGeoLocation.Builder()).build()); - } - - public ObjectBuilder text(String v) { - this._kind = Kind.Text; - this._value = v; - return this; - } - - public GeoLocation build() { - _checkSingleUse(); - return new GeoLocation(this); - } - - } - - private static JsonpDeserializer buildGeoLocationDeserializer() { - return new UnionDeserializer.Builder(GeoLocation::new, false) - .addMember(Kind.Coords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())) - .addMember(Kind.Geohash, GeoHashLocation._DESERIALIZER) - .addMember(Kind.Latlon, LatLonGeoLocation._DESERIALIZER) - .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoLocation::buildGeoLocationDeserializer); + public enum Kind { + Coords, + Geohash, + Latlon, + Text + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoLocation(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private GeoLocation(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code coords}? + */ + public boolean isCoords() { + return _kind == Kind.Coords; + } + + /** + * Get the {@code coords} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code coords} kind. + */ + public List coords() { + return TaggedUnionUtils.get(this, Kind.Coords); + } + + /** + * Is this variant instance of kind {@code geohash}? + */ + public boolean isGeohash() { + return _kind == Kind.Geohash; + } + + /** + * Get the {@code geohash} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geohash} kind. + */ + public GeoHashLocation geohash() { + return TaggedUnionUtils.get(this, Kind.Geohash); + } + + /** + * Is this variant instance of kind {@code latlon}? + */ + public boolean isLatlon() { + return _kind == Kind.Latlon; + } + + /** + * Get the {@code latlon} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code latlon} kind. + */ + public LatLonGeoLocation latlon() { + return TaggedUnionUtils.get(this, Kind.Latlon); + } + + /** + * Is this variant instance of kind {@code text}? + */ + public boolean isText() { + return _kind == Kind.Text; + } + + /** + * Get the {@code text} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text} kind. + */ + public String text() { + return TaggedUnionUtils.get(this, Kind.Text); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Coords: + generator.writeStartArray(); + for (Double item0 : ((List) this._value)) { + generator.write(item0); + + } + generator.writeEnd(); + + break; + case Text: + generator.write(((String) this._value)); + + break; + } + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder coords(List v) { + this._kind = Kind.Coords; + this._value = v; + return this; + } + + public ObjectBuilder geohash(GeoHashLocation v) { + this._kind = Kind.Geohash; + this._value = v; + return this; + } + + public ObjectBuilder geohash(Function> fn) { + return this.geohash(fn.apply(new GeoHashLocation.Builder()).build()); + } + + public ObjectBuilder latlon(LatLonGeoLocation v) { + this._kind = Kind.Latlon; + this._value = v; + return this; + } + + public ObjectBuilder latlon(Function> fn) { + return this.latlon(fn.apply(new LatLonGeoLocation.Builder()).build()); + } + + public ObjectBuilder text(String v) { + this._kind = Kind.Text; + this._value = v; + return this; + } + + public GeoLocation build() { + _checkSingleUse(); + return new GeoLocation(this); + } + + } + + private static JsonpDeserializer buildGeoLocationDeserializer() { + return new UnionDeserializer.Builder(GeoLocation::new, false).addMember( + Kind.Coords, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()) + ) + .addMember(Kind.Geohash, GeoHashLocation._DESERIALIZER) + .addMember(Kind.Latlon, LatLonGeoLocation._DESERIALIZER) + .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoLocation::buildGeoLocationDeserializer); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java index 602c5f1ff8..7568ad87a6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java @@ -38,26 +38,25 @@ * Variants coords, text are not available here as * they don't have a dedicated class. Use {@link GeoLocation}'s builder for * these. - * + * */ public class GeoLocationBuilders { - private GeoLocationBuilders() { - } + private GeoLocationBuilders() {} - /** - * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} - * variant. - */ - public static GeoHashLocation.Builder geohash() { - return new GeoHashLocation.Builder(); - } + /** + * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} + * variant. + */ + public static GeoHashLocation.Builder geohash() { + return new GeoHashLocation.Builder(); + } - /** - * Creates a builder for the {@link LatLonGeoLocation latlon} - * {@code GeoLocation} variant. - */ - public static LatLonGeoLocation.Builder latlon() { - return new LatLonGeoLocation.Builder(); - } + /** + * Creates a builder for the {@link LatLonGeoLocation latlon} + * {@code GeoLocation} variant. + */ + public static LatLonGeoLocation.Builder latlon() { + return new LatLonGeoLocation.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java index 1098174b2b..f51d42a238 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java @@ -37,26 +37,25 @@ @JsonpDeserializable public enum GeoShapeRelation implements JsonEnum { - Intersects("intersects"), + Intersects("intersects"), - Disjoint("disjoint"), + Disjoint("disjoint"), - Within("within"), + Within("within"), - Contains("contains"), + Contains("contains"), - ; + ; - private final String jsonValue; + private final String jsonValue; - GeoShapeRelation(String jsonValue) { - this.jsonValue = jsonValue; - } + GeoShapeRelation(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoShapeRelation.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(GeoShapeRelation.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java index 42f595cb30..4e53545c95 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,325 +44,323 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.GetStats @JsonpDeserializable public class GetStats implements JsonpSerializable { - private final long current; - - @Nullable - private final String existsTime; - - private final long existsTimeInMillis; - - private final long existsTotal; - - @Nullable - private final String missingTime; - - private final long missingTimeInMillis; - - private final long missingTotal; - - @Nullable - private final String time; - - private final long timeInMillis; - - private final long total; - - // --------------------------------------------------------------------------------------------- - - private GetStats(Builder builder) { - - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); - this.existsTime = builder.existsTime; - this.existsTimeInMillis = ApiTypeHelper.requireNonNull(builder.existsTimeInMillis, this, "existsTimeInMillis"); - this.existsTotal = ApiTypeHelper.requireNonNull(builder.existsTotal, this, "existsTotal"); - this.missingTime = builder.missingTime; - this.missingTimeInMillis = ApiTypeHelper.requireNonNull(builder.missingTimeInMillis, this, - "missingTimeInMillis"); - this.missingTotal = ApiTypeHelper.requireNonNull(builder.missingTotal, this, "missingTotal"); - this.time = builder.time; - this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - - } - - public static GetStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current} - */ - public final long current() { - return this.current; - } - - /** - * API name: {@code exists_time} - */ - @Nullable - public final String existsTime() { - return this.existsTime; - } - - /** - * Required - API name: {@code exists_time_in_millis} - */ - public final long existsTimeInMillis() { - return this.existsTimeInMillis; - } - - /** - * Required - API name: {@code exists_total} - */ - public final long existsTotal() { - return this.existsTotal; - } - - /** - * API name: {@code missing_time} - */ - @Nullable - public final String missingTime() { - return this.missingTime; - } - - /** - * Required - API name: {@code missing_time_in_millis} - */ - public final long missingTimeInMillis() { - return this.missingTimeInMillis; - } - - /** - * Required - API name: {@code missing_total} - */ - public final long missingTotal() { - return this.missingTotal; - } + private final long current; + + @Nullable + private final String existsTime; + + private final long existsTimeInMillis; + + private final long existsTotal; + + @Nullable + private final String missingTime; + + private final long missingTimeInMillis; + + private final long missingTotal; + + @Nullable + private final String time; + + private final long timeInMillis; + + private final long total; + + // --------------------------------------------------------------------------------------------- + + private GetStats(Builder builder) { + + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.existsTime = builder.existsTime; + this.existsTimeInMillis = ApiTypeHelper.requireNonNull(builder.existsTimeInMillis, this, "existsTimeInMillis"); + this.existsTotal = ApiTypeHelper.requireNonNull(builder.existsTotal, this, "existsTotal"); + this.missingTime = builder.missingTime; + this.missingTimeInMillis = ApiTypeHelper.requireNonNull(builder.missingTimeInMillis, this, "missingTimeInMillis"); + this.missingTotal = ApiTypeHelper.requireNonNull(builder.missingTotal, this, "missingTotal"); + this.time = builder.time; + this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + + } + + public static GetStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current} + */ + public final long current() { + return this.current; + } + + /** + * API name: {@code exists_time} + */ + @Nullable + public final String existsTime() { + return this.existsTime; + } + + /** + * Required - API name: {@code exists_time_in_millis} + */ + public final long existsTimeInMillis() { + return this.existsTimeInMillis; + } + + /** + * Required - API name: {@code exists_total} + */ + public final long existsTotal() { + return this.existsTotal; + } + + /** + * API name: {@code missing_time} + */ + @Nullable + public final String missingTime() { + return this.missingTime; + } + + /** + * Required - API name: {@code missing_time_in_millis} + */ + public final long missingTimeInMillis() { + return this.missingTimeInMillis; + } + + /** + * Required - API name: {@code missing_total} + */ + public final long missingTotal() { + return this.missingTotal; + } - /** - * API name: {@code time} - */ - @Nullable - public final String time() { - return this.time; - } - - /** - * Required - API name: {@code time_in_millis} - */ - public final long timeInMillis() { - return this.timeInMillis; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * 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("current"); - generator.write(this.current); - - if (this.existsTime != null) { - generator.writeKey("exists_time"); - generator.write(this.existsTime); - - } - generator.writeKey("exists_time_in_millis"); - generator.write(this.existsTimeInMillis); - - generator.writeKey("exists_total"); - generator.write(this.existsTotal); - - if (this.missingTime != null) { - generator.writeKey("missing_time"); - generator.write(this.missingTime); - - } - generator.writeKey("missing_time_in_millis"); - generator.write(this.missingTimeInMillis); - - generator.writeKey("missing_total"); - generator.write(this.missingTotal); - - if (this.time != null) { - generator.writeKey("time"); - generator.write(this.time); - - } - generator.writeKey("time_in_millis"); - generator.write(this.timeInMillis); - - generator.writeKey("total"); - generator.write(this.total); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long current; - - @Nullable - private String existsTime; - - private Long existsTimeInMillis; - - private Long existsTotal; - - @Nullable - private String missingTime; - - private Long missingTimeInMillis; - - private Long missingTotal; - - @Nullable - private String time; - - private Long timeInMillis; - - private Long total; - - /** - * Required - API name: {@code current} - */ - public final Builder current(long value) { - this.current = value; - return this; - } - - /** - * API name: {@code exists_time} - */ - public final Builder existsTime(@Nullable String value) { - this.existsTime = value; - return this; - } - - /** - * Required - API name: {@code exists_time_in_millis} - */ - public final Builder existsTimeInMillis(long value) { - this.existsTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code exists_total} - */ - public final Builder existsTotal(long value) { - this.existsTotal = value; - return this; - } - - /** - * API name: {@code missing_time} - */ - public final Builder missingTime(@Nullable String value) { - this.missingTime = value; - return this; - } - - /** - * Required - API name: {@code missing_time_in_millis} - */ - public final Builder missingTimeInMillis(long value) { - this.missingTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code missing_total} - */ - public final Builder missingTotal(long value) { - this.missingTotal = value; - return this; - } - - /** - * API name: {@code time} - */ - public final Builder time(@Nullable String value) { - this.time = value; - return this; - } - - /** - * Required - API name: {@code time_in_millis} - */ - public final Builder timeInMillis(long value) { - this.timeInMillis = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * Builds a {@link GetStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetStats build() { - _checkSingleUse(); - - return new GetStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GetStats::setupGetStatsDeserializer); - - protected static void setupGetStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); - op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); - op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); - op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); - op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); - op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); - op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); - op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - - } + /** + * API name: {@code time} + */ + @Nullable + public final String time() { + return this.time; + } + + /** + * Required - API name: {@code time_in_millis} + */ + public final long timeInMillis() { + return this.timeInMillis; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * 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("current"); + generator.write(this.current); + + if (this.existsTime != null) { + generator.writeKey("exists_time"); + generator.write(this.existsTime); + + } + generator.writeKey("exists_time_in_millis"); + generator.write(this.existsTimeInMillis); + + generator.writeKey("exists_total"); + generator.write(this.existsTotal); + + if (this.missingTime != null) { + generator.writeKey("missing_time"); + generator.write(this.missingTime); + + } + generator.writeKey("missing_time_in_millis"); + generator.write(this.missingTimeInMillis); + + generator.writeKey("missing_total"); + generator.write(this.missingTotal); + + if (this.time != null) { + generator.writeKey("time"); + generator.write(this.time); + + } + generator.writeKey("time_in_millis"); + generator.write(this.timeInMillis); + + generator.writeKey("total"); + generator.write(this.total); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long current; + + @Nullable + private String existsTime; + + private Long existsTimeInMillis; + + private Long existsTotal; + + @Nullable + private String missingTime; + + private Long missingTimeInMillis; + + private Long missingTotal; + + @Nullable + private String time; + + private Long timeInMillis; + + private Long total; + + /** + * Required - API name: {@code current} + */ + public final Builder current(long value) { + this.current = value; + return this; + } + + /** + * API name: {@code exists_time} + */ + public final Builder existsTime(@Nullable String value) { + this.existsTime = value; + return this; + } + + /** + * Required - API name: {@code exists_time_in_millis} + */ + public final Builder existsTimeInMillis(long value) { + this.existsTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code exists_total} + */ + public final Builder existsTotal(long value) { + this.existsTotal = value; + return this; + } + + /** + * API name: {@code missing_time} + */ + public final Builder missingTime(@Nullable String value) { + this.missingTime = value; + return this; + } + + /** + * Required - API name: {@code missing_time_in_millis} + */ + public final Builder missingTimeInMillis(long value) { + this.missingTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code missing_total} + */ + public final Builder missingTotal(long value) { + this.missingTotal = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(@Nullable String value) { + this.time = value; + return this; + } + + /** + * Required - API name: {@code time_in_millis} + */ + public final Builder timeInMillis(long value) { + this.timeInMillis = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * Builds a {@link GetStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetStats build() { + _checkSingleUse(); + + return new GetStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetStats::setupGetStatsDeserializer + ); + + protected static void setupGetStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); + op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); + op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); + op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); + op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); + op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); + op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); + op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java index 371497cf65..09a9914a63 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java @@ -37,42 +37,41 @@ @JsonpDeserializable public enum HealthStatus implements JsonEnum { - /** - * All shards are assigned. - */ - Green("green", "GREEN"), + /** + * All shards are assigned. + */ + Green("green", "GREEN"), - /** - * All primary shards are assigned, but one or more replica shards are - * unassigned. If a node in the cluster fails, some data could be unavailable - * until that node is repaired. - */ - Yellow("yellow", "YELLOW"), + /** + * All primary shards are assigned, but one or more replica shards are + * unassigned. If a node in the cluster fails, some data could be unavailable + * until that node is repaired. + */ + Yellow("yellow", "YELLOW"), - /** - * One or more primary shards are unassigned, so some data is unavailable. This - * can occur briefly during cluster startup as primary shards are assigned. - */ - Red("red", "RED"), + /** + * One or more primary shards are unassigned, so some data is unavailable. This + * can occur briefly during cluster startup as primary shards are assigned. + */ + Red("red", "RED"), - ; + ; - private final String jsonValue; - private final String[] aliases; + private final String jsonValue; + private final String[] aliases; - HealthStatus(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } + HealthStatus(String jsonValue, String... aliases) { + this.jsonValue = jsonValue; + this.aliases = aliases; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public String[] aliases() { - return this.aliases; - } + public String[] aliases() { + return this.aliases; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - HealthStatus.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(HealthStatus.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java index 85dd47c932..9c81681f7a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,453 +45,450 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.IndexingStats @JsonpDeserializable public class IndexingStats implements JsonpSerializable { - private final long indexCurrent; + private final long indexCurrent; - private final long deleteCurrent; - - @Nullable - private final String deleteTime; + private final long deleteCurrent; + + @Nullable + private final String deleteTime; - private final long deleteTimeInMillis; - - private final long deleteTotal; - - private final boolean isThrottled; - - private final long noopUpdateTotal; - - @Nullable - private final String throttleTime; - - private final long throttleTimeInMillis; - - @Nullable - private final String indexTime; - - private final long indexTimeInMillis; - - private final long indexTotal; - - private final long indexFailed; - - private final Map types; - - // --------------------------------------------------------------------------------------------- - - private IndexingStats(Builder builder) { - - this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); - this.deleteCurrent = ApiTypeHelper.requireNonNull(builder.deleteCurrent, this, "deleteCurrent"); - this.deleteTime = builder.deleteTime; - this.deleteTimeInMillis = ApiTypeHelper.requireNonNull(builder.deleteTimeInMillis, this, "deleteTimeInMillis"); - this.deleteTotal = ApiTypeHelper.requireNonNull(builder.deleteTotal, this, "deleteTotal"); - this.isThrottled = ApiTypeHelper.requireNonNull(builder.isThrottled, this, "isThrottled"); - this.noopUpdateTotal = ApiTypeHelper.requireNonNull(builder.noopUpdateTotal, this, "noopUpdateTotal"); - this.throttleTime = builder.throttleTime; - this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, - "throttleTimeInMillis"); - this.indexTime = builder.indexTime; - this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); - this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); - this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); - this.types = ApiTypeHelper.unmodifiable(builder.types); - - } - - public static IndexingStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index_current} - */ - public final long indexCurrent() { - return this.indexCurrent; - } - - /** - * Required - API name: {@code delete_current} - */ - public final long deleteCurrent() { - return this.deleteCurrent; - } - - /** - * API name: {@code delete_time} - */ - @Nullable - public final String deleteTime() { - return this.deleteTime; - } - - /** - * Required - API name: {@code delete_time_in_millis} - */ - public final long deleteTimeInMillis() { - return this.deleteTimeInMillis; - } - - /** - * Required - API name: {@code delete_total} - */ - public final long deleteTotal() { - return this.deleteTotal; - } - - /** - * Required - API name: {@code is_throttled} - */ - public final boolean isThrottled() { - return this.isThrottled; - } - - /** - * Required - API name: {@code noop_update_total} - */ - public final long noopUpdateTotal() { - return this.noopUpdateTotal; - } - - /** - * API name: {@code throttle_time} - */ - @Nullable - public final String throttleTime() { - return this.throttleTime; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final long throttleTimeInMillis() { - return this.throttleTimeInMillis; - } - - /** - * API name: {@code index_time} - */ - @Nullable - public final String indexTime() { - return this.indexTime; - } - - /** - * Required - API name: {@code index_time_in_millis} - */ - public final long indexTimeInMillis() { - return this.indexTimeInMillis; - } - - /** - * Required - API name: {@code index_total} - */ - public final long indexTotal() { - return this.indexTotal; - } - - /** - * Required - API name: {@code index_failed} - */ - public final long indexFailed() { - return this.indexFailed; - } - - /** - * API name: {@code types} - */ - public final Map types() { - return this.types; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index_current"); - generator.write(this.indexCurrent); - - generator.writeKey("delete_current"); - generator.write(this.deleteCurrent); - - if (this.deleteTime != null) { - generator.writeKey("delete_time"); - generator.write(this.deleteTime); - - } - generator.writeKey("delete_time_in_millis"); - generator.write(this.deleteTimeInMillis); - - generator.writeKey("delete_total"); - generator.write(this.deleteTotal); - - generator.writeKey("is_throttled"); - generator.write(this.isThrottled); - - generator.writeKey("noop_update_total"); - generator.write(this.noopUpdateTotal); - - if (this.throttleTime != null) { - generator.writeKey("throttle_time"); - generator.write(this.throttleTime); - - } - generator.writeKey("throttle_time_in_millis"); - generator.write(this.throttleTimeInMillis); - - if (this.indexTime != null) { - generator.writeKey("index_time"); - generator.write(this.indexTime); - - } - generator.writeKey("index_time_in_millis"); - generator.write(this.indexTimeInMillis); - - generator.writeKey("index_total"); - generator.write(this.indexTotal); - - generator.writeKey("index_failed"); - generator.write(this.indexFailed); - - if (ApiTypeHelper.isDefined(this.types)) { - generator.writeKey("types"); - generator.writeStartObject(); - for (Map.Entry item0 : this.types.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long indexCurrent; - - private Long deleteCurrent; - - @Nullable - private String deleteTime; - - private Long deleteTimeInMillis; - - private Long deleteTotal; - - private Boolean isThrottled; - - private Long noopUpdateTotal; - - @Nullable - private String throttleTime; - - private Long throttleTimeInMillis; - - @Nullable - private String indexTime; - - private Long indexTimeInMillis; - - private Long indexTotal; - - private Long indexFailed; - - @Nullable - private Map types; - - /** - * Required - API name: {@code index_current} - */ - public final Builder indexCurrent(long value) { - this.indexCurrent = value; - return this; - } - - /** - * Required - API name: {@code delete_current} - */ - public final Builder deleteCurrent(long value) { - this.deleteCurrent = value; - return this; - } - - /** - * API name: {@code delete_time} - */ - public final Builder deleteTime(@Nullable String value) { - this.deleteTime = value; - return this; - } - - /** - * Required - API name: {@code delete_time_in_millis} - */ - public final Builder deleteTimeInMillis(long value) { - this.deleteTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code delete_total} - */ - public final Builder deleteTotal(long value) { - this.deleteTotal = value; - return this; - } - - /** - * Required - API name: {@code is_throttled} - */ - public final Builder isThrottled(boolean value) { - this.isThrottled = value; - return this; - } - - /** - * Required - API name: {@code noop_update_total} - */ - public final Builder noopUpdateTotal(long value) { - this.noopUpdateTotal = value; - return this; - } - - /** - * API name: {@code throttle_time} - */ - public final Builder throttleTime(@Nullable String value) { - this.throttleTime = value; - return this; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final Builder throttleTimeInMillis(long value) { - this.throttleTimeInMillis = value; - return this; - } - - /** - * API name: {@code index_time} - */ - public final Builder indexTime(@Nullable String value) { - this.indexTime = value; - return this; - } - - /** - * Required - API name: {@code index_time_in_millis} - */ - public final Builder indexTimeInMillis(long value) { - this.indexTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code index_total} - */ - public final Builder indexTotal(long value) { - this.indexTotal = value; - return this; - } - - /** - * Required - API name: {@code index_failed} - */ - public final Builder indexFailed(long value) { - this.indexFailed = value; - return this; - } - - /** - * API name: {@code types} - *

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

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

- * Adds an entry to types using a builder lambda. - */ - public final Builder types(String key, Function> fn) { - return types(key, fn.apply(new IndexingStats.Builder()).build()); - } - - /** - * Builds a {@link IndexingStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingStats build() { - _checkSingleUse(); - - return new IndexingStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexingStats::setupIndexingStatsDeserializer); - - protected static void setupIndexingStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); - op.add(Builder::deleteCurrent, JsonpDeserializer.longDeserializer(), "delete_current"); - op.add(Builder::deleteTime, JsonpDeserializer.stringDeserializer(), "delete_time"); - op.add(Builder::deleteTimeInMillis, JsonpDeserializer.longDeserializer(), "delete_time_in_millis"); - op.add(Builder::deleteTotal, JsonpDeserializer.longDeserializer(), "delete_total"); - op.add(Builder::isThrottled, JsonpDeserializer.booleanDeserializer(), "is_throttled"); - op.add(Builder::noopUpdateTotal, JsonpDeserializer.longDeserializer(), "noop_update_total"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); - op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); - op.add(Builder::indexTime, JsonpDeserializer.stringDeserializer(), "index_time"); - op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); - op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); - op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); - op.add(Builder::types, JsonpDeserializer.stringMapDeserializer(IndexingStats._DESERIALIZER), "types"); - - } + private final long deleteTimeInMillis; + + private final long deleteTotal; + + private final boolean isThrottled; + + private final long noopUpdateTotal; + + @Nullable + private final String throttleTime; + + private final long throttleTimeInMillis; + + @Nullable + private final String indexTime; + + private final long indexTimeInMillis; + + private final long indexTotal; + + private final long indexFailed; + + private final Map types; + + // --------------------------------------------------------------------------------------------- + + private IndexingStats(Builder builder) { + + this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); + this.deleteCurrent = ApiTypeHelper.requireNonNull(builder.deleteCurrent, this, "deleteCurrent"); + this.deleteTime = builder.deleteTime; + this.deleteTimeInMillis = ApiTypeHelper.requireNonNull(builder.deleteTimeInMillis, this, "deleteTimeInMillis"); + this.deleteTotal = ApiTypeHelper.requireNonNull(builder.deleteTotal, this, "deleteTotal"); + this.isThrottled = ApiTypeHelper.requireNonNull(builder.isThrottled, this, "isThrottled"); + this.noopUpdateTotal = ApiTypeHelper.requireNonNull(builder.noopUpdateTotal, this, "noopUpdateTotal"); + this.throttleTime = builder.throttleTime; + this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); + this.indexTime = builder.indexTime; + this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); + this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); + this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); + this.types = ApiTypeHelper.unmodifiable(builder.types); + + } + + public static IndexingStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code index_current} + */ + public final long indexCurrent() { + return this.indexCurrent; + } + + /** + * Required - API name: {@code delete_current} + */ + public final long deleteCurrent() { + return this.deleteCurrent; + } + + /** + * API name: {@code delete_time} + */ + @Nullable + public final String deleteTime() { + return this.deleteTime; + } + + /** + * Required - API name: {@code delete_time_in_millis} + */ + public final long deleteTimeInMillis() { + return this.deleteTimeInMillis; + } + + /** + * Required - API name: {@code delete_total} + */ + public final long deleteTotal() { + return this.deleteTotal; + } + + /** + * Required - API name: {@code is_throttled} + */ + public final boolean isThrottled() { + return this.isThrottled; + } + + /** + * Required - API name: {@code noop_update_total} + */ + public final long noopUpdateTotal() { + return this.noopUpdateTotal; + } + + /** + * API name: {@code throttle_time} + */ + @Nullable + public final String throttleTime() { + return this.throttleTime; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final long throttleTimeInMillis() { + return this.throttleTimeInMillis; + } + + /** + * API name: {@code index_time} + */ + @Nullable + public final String indexTime() { + return this.indexTime; + } + + /** + * Required - API name: {@code index_time_in_millis} + */ + public final long indexTimeInMillis() { + return this.indexTimeInMillis; + } + + /** + * Required - API name: {@code index_total} + */ + public final long indexTotal() { + return this.indexTotal; + } + + /** + * Required - API name: {@code index_failed} + */ + public final long indexFailed() { + return this.indexFailed; + } + + /** + * API name: {@code types} + */ + public final Map types() { + return this.types; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("index_current"); + generator.write(this.indexCurrent); + + generator.writeKey("delete_current"); + generator.write(this.deleteCurrent); + + if (this.deleteTime != null) { + generator.writeKey("delete_time"); + generator.write(this.deleteTime); + + } + generator.writeKey("delete_time_in_millis"); + generator.write(this.deleteTimeInMillis); + + generator.writeKey("delete_total"); + generator.write(this.deleteTotal); + + generator.writeKey("is_throttled"); + generator.write(this.isThrottled); + + generator.writeKey("noop_update_total"); + generator.write(this.noopUpdateTotal); + + if (this.throttleTime != null) { + generator.writeKey("throttle_time"); + generator.write(this.throttleTime); + + } + generator.writeKey("throttle_time_in_millis"); + generator.write(this.throttleTimeInMillis); + + if (this.indexTime != null) { + generator.writeKey("index_time"); + generator.write(this.indexTime); + + } + generator.writeKey("index_time_in_millis"); + generator.write(this.indexTimeInMillis); + + generator.writeKey("index_total"); + generator.write(this.indexTotal); + + generator.writeKey("index_failed"); + generator.write(this.indexFailed); + + if (ApiTypeHelper.isDefined(this.types)) { + generator.writeKey("types"); + generator.writeStartObject(); + for (Map.Entry item0 : this.types.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexingStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long indexCurrent; + + private Long deleteCurrent; + + @Nullable + private String deleteTime; + + private Long deleteTimeInMillis; + + private Long deleteTotal; + + private Boolean isThrottled; + + private Long noopUpdateTotal; + + @Nullable + private String throttleTime; + + private Long throttleTimeInMillis; + + @Nullable + private String indexTime; + + private Long indexTimeInMillis; + + private Long indexTotal; + + private Long indexFailed; + + @Nullable + private Map types; + + /** + * Required - API name: {@code index_current} + */ + public final Builder indexCurrent(long value) { + this.indexCurrent = value; + return this; + } + + /** + * Required - API name: {@code delete_current} + */ + public final Builder deleteCurrent(long value) { + this.deleteCurrent = value; + return this; + } + + /** + * API name: {@code delete_time} + */ + public final Builder deleteTime(@Nullable String value) { + this.deleteTime = value; + return this; + } + + /** + * Required - API name: {@code delete_time_in_millis} + */ + public final Builder deleteTimeInMillis(long value) { + this.deleteTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code delete_total} + */ + public final Builder deleteTotal(long value) { + this.deleteTotal = value; + return this; + } + + /** + * Required - API name: {@code is_throttled} + */ + public final Builder isThrottled(boolean value) { + this.isThrottled = value; + return this; + } + + /** + * Required - API name: {@code noop_update_total} + */ + public final Builder noopUpdateTotal(long value) { + this.noopUpdateTotal = value; + return this; + } + + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(@Nullable String value) { + this.throttleTime = value; + return this; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final Builder throttleTimeInMillis(long value) { + this.throttleTimeInMillis = value; + return this; + } + + /** + * API name: {@code index_time} + */ + public final Builder indexTime(@Nullable String value) { + this.indexTime = value; + return this; + } + + /** + * Required - API name: {@code index_time_in_millis} + */ + public final Builder indexTimeInMillis(long value) { + this.indexTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code index_total} + */ + public final Builder indexTotal(long value) { + this.indexTotal = value; + return this; + } + + /** + * Required - API name: {@code index_failed} + */ + public final Builder indexFailed(long value) { + this.indexFailed = value; + return this; + } + + /** + * API name: {@code types} + *

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

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

+ * Adds an entry to types using a builder lambda. + */ + public final Builder types(String key, Function> fn) { + return types(key, fn.apply(new IndexingStats.Builder()).build()); + } + + /** + * Builds a {@link IndexingStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexingStats build() { + _checkSingleUse(); + + return new IndexingStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexingStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexingStats::setupIndexingStatsDeserializer + ); + + protected static void setupIndexingStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); + op.add(Builder::deleteCurrent, JsonpDeserializer.longDeserializer(), "delete_current"); + op.add(Builder::deleteTime, JsonpDeserializer.stringDeserializer(), "delete_time"); + op.add(Builder::deleteTimeInMillis, JsonpDeserializer.longDeserializer(), "delete_time_in_millis"); + op.add(Builder::deleteTotal, JsonpDeserializer.longDeserializer(), "delete_total"); + op.add(Builder::isThrottled, JsonpDeserializer.booleanDeserializer(), "is_throttled"); + op.add(Builder::noopUpdateTotal, JsonpDeserializer.longDeserializer(), "noop_update_total"); + op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); + op.add(Builder::indexTime, JsonpDeserializer.stringDeserializer(), "index_time"); + op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); + op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); + op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); + op.add(Builder::types, JsonpDeserializer.stringMapDeserializer(IndexingStats._DESERIALIZER), "types"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java index 3c72c61935..ba251d885a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java @@ -32,78 +32,76 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; - import java.util.function.Function; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ObjectBuilder; // typedef: _types.IndicesResponseBase - public abstract class IndicesResponseBase extends AcknowledgedResponseBase { - @Nullable - private final ShardStatistics shards; + @Nullable + private final ShardStatistics shards; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - protected IndicesResponseBase(AbstractBuilder builder) { - super(builder); + protected IndicesResponseBase(AbstractBuilder builder) { + super(builder); - this.shards = builder.shards; + this.shards = builder.shards; - } + } - /** - * API name: {@code _shards} - */ - @Nullable - public final ShardStatistics shards() { - return this.shards; - } + /** + * API name: {@code _shards} + */ + @Nullable + public final ShardStatistics shards() { + return this.shards; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.shards != null) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); + super.serializeInternal(generator, mapper); + if (this.shards != null) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); - } + } - } + } - protected abstract static class AbstractBuilder> - extends - AcknowledgedResponseBase.AbstractBuilder { - @Nullable - private ShardStatistics shards; + protected abstract static class AbstractBuilder> extends + AcknowledgedResponseBase.AbstractBuilder { + @Nullable + private ShardStatistics shards; - /** - * API name: {@code _shards} - */ - public final BuilderT shards(@Nullable ShardStatistics value) { - this.shards = value; - return self(); - } + /** + * API name: {@code _shards} + */ + public final BuilderT shards(@Nullable ShardStatistics value) { + this.shards = value; + return self(); + } - /** - * API name: {@code _shards} - */ - public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } + /** + * API name: {@code _shards} + */ + public final BuilderT shards(Function> fn) { + return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + } - } + } - // --------------------------------------------------------------------------------------------- - protected static > void setupIndicesResponseBaseDeserializer( - ObjectDeserializer op) { - setupAcknowledgedResponseBaseDeserializer(op); - op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); + // --------------------------------------------------------------------------------------------- + protected static > void setupIndicesResponseBaseDeserializer( + ObjectDeserializer op + ) { + setupAcknowledgedResponseBaseDeserializer(op); + op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java index 57ae78d5b1..cdebb2c397 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java @@ -32,6 +32,12 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,321 +49,317 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; // typedef: _types.InlineGet - public class InlineGet implements JsonpSerializable { - private final Map metadata; - - private final Map fields; - - private final boolean found; - - @Nullable - private final Long seqNo; - - @Nullable - private final Long primaryTerm; - - @Nullable - private final String routing; - - private final TDocument source; - - @Nullable - private final JsonpSerializer tDocumentSerializer; - - // --------------------------------------------------------------------------------------------- - - private InlineGet(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); - this.seqNo = builder.seqNo; - this.primaryTerm = builder.primaryTerm; - this.routing = builder.routing; - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.tDocumentSerializer = builder.tDocumentSerializer; - - } - - public static InlineGet of( - Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Document metadata - */ - public final Map metadata() { - return this.metadata; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Required - API name: {@code found} - */ - public final boolean found() { - return this.found; - } - - /** - * API name: {@code _seq_no} - */ - @Nullable - public final Long seqNo() { - return this.seqNo; - } - - /** - * API name: {@code _primary_term} - */ - @Nullable - public final Long primaryTerm() { - return this.primaryTerm; - } - - /** - * API name: {@code _routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * Required - API name: {@code _source} - */ - public final TDocument source() { - return this.source; - } - - /** - * 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) { - - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("found"); - generator.write(this.found); - - if (this.seqNo != null) { - generator.writeKey("_seq_no"); - generator.write(this.seqNo); - - } - if (this.primaryTerm != null) { - generator.writeKey("_primary_term"); - generator.write(this.primaryTerm); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - generator.write(this.routing); - - } - generator.writeKey("_source"); - JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InlineGet}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder> { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Document metadata - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Document metadata - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - @Nullable - private Map fields; - - private Boolean found; - - @Nullable - private Long seqNo; - - @Nullable - private Long primaryTerm; - - @Nullable - private String routing; - - private TDocument source; - - @Nullable - private JsonpSerializer tDocumentSerializer; - - /** - * API name: {@code fields} - *

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

- * Adds an entry to fields. - */ - public final Builder fields(String key, JsonData value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * Required - API name: {@code found} - */ - public final Builder found(boolean value) { - this.found = value; - return this; - } - - /** - * API name: {@code _seq_no} - */ - public final Builder seqNo(@Nullable Long value) { - this.seqNo = value; - return this; - } - - /** - * API name: {@code _primary_term} - */ - public final Builder primaryTerm(@Nullable Long value) { - this.primaryTerm = value; - return this; - } - - /** - * API name: {@code _routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * Required - API name: {@code _source} - */ - public final Builder source(TDocument value) { - this.source = value; - return this; - } - - /** - * Serializer for TDocument. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) { - this.tDocumentSerializer = value; - return this; - } - - /** - * Builds a {@link InlineGet}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InlineGet build() { - _checkSingleUse(); - - return new InlineGet(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for InlineGet - */ - public static JsonpDeserializer> createInlineGetDeserializer( - JsonpDeserializer tDocumentDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> InlineGet.setupInlineGetDeserializer(op, tDocumentDeserializer)); - }; - - protected static void setupInlineGetDeserializer(ObjectDeserializer> op, - JsonpDeserializer tDocumentDeserializer) { - - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields"); - op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); - op.add(Builder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); - op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); - op.add(Builder::source, tDocumentDeserializer, "_source"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - if (builder.metadata == null) { - builder.metadata = new HashMap<>(); - } - builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } + private final Map metadata; + + private final Map fields; + + private final boolean found; + + @Nullable + private final Long seqNo; + + @Nullable + private final Long primaryTerm; + + @Nullable + private final String routing; + + private final TDocument source; + + @Nullable + private final JsonpSerializer tDocumentSerializer; + + // --------------------------------------------------------------------------------------------- + + private InlineGet(Builder builder) { + + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); + this.seqNo = builder.seqNo; + this.primaryTerm = builder.primaryTerm; + this.routing = builder.routing; + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.tDocumentSerializer = builder.tDocumentSerializer; + + } + + public static InlineGet of(Function, ObjectBuilder>> fn) { + return fn.apply(new Builder<>()).build(); + } + + /** + * Document metadata + */ + public final Map metadata() { + return this.metadata; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Required - API name: {@code found} + */ + public final boolean found() { + return this.found; + } + + /** + * API name: {@code _seq_no} + */ + @Nullable + public final Long seqNo() { + return this.seqNo; + } + + /** + * API name: {@code _primary_term} + */ + @Nullable + public final Long primaryTerm() { + return this.primaryTerm; + } + + /** + * API name: {@code _routing} + */ + @Nullable + public final String routing() { + return this.routing; + } + + /** + * Required - API name: {@code _source} + */ + public final TDocument source() { + return this.source; + } + + /** + * 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) { + + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("found"); + generator.write(this.found); + + if (this.seqNo != null) { + generator.writeKey("_seq_no"); + generator.write(this.seqNo); + + } + if (this.primaryTerm != null) { + generator.writeKey("_primary_term"); + generator.write(this.primaryTerm); + + } + if (this.routing != null) { + generator.writeKey("_routing"); + generator.write(this.routing); + + } + generator.writeKey("_source"); + JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InlineGet}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder> { + @Nullable + private Map metadata = new HashMap<>(); + + /** + * Document metadata + *

+ * Adds all entries of map to metadata. + */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * Document metadata + *

+ * Adds an entry to metadata. + */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + @Nullable + private Map fields; + + private Boolean found; + + @Nullable + private Long seqNo; + + @Nullable + private Long primaryTerm; + + @Nullable + private String routing; + + private TDocument source; + + @Nullable + private JsonpSerializer tDocumentSerializer; + + /** + * API name: {@code fields} + *

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

+ * Adds an entry to fields. + */ + public final Builder fields(String key, JsonData value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * Required - API name: {@code found} + */ + public final Builder found(boolean value) { + this.found = value; + return this; + } + + /** + * API name: {@code _seq_no} + */ + public final Builder seqNo(@Nullable Long value) { + this.seqNo = value; + return this; + } + + /** + * API name: {@code _primary_term} + */ + public final Builder primaryTerm(@Nullable Long value) { + this.primaryTerm = value; + return this; + } + + /** + * API name: {@code _routing} + */ + public final Builder routing(@Nullable String value) { + this.routing = value; + return this; + } + + /** + * Required - API name: {@code _source} + */ + public final Builder source(TDocument value) { + this.source = value; + return this; + } + + /** + * Serializer for TDocument. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) { + this.tDocumentSerializer = value; + return this; + } + + /** + * Builds a {@link InlineGet}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InlineGet build() { + _checkSingleUse(); + + return new InlineGet(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Create a JSON deserializer for InlineGet + */ + public static JsonpDeserializer> createInlineGetDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + (Supplier>) Builder::new, + op -> InlineGet.setupInlineGetDeserializer(op, tDocumentDeserializer) + ); + }; + + protected static void setupInlineGetDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields"); + op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); + op.add(Builder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); + op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); + op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); + op.add(Builder::source, tDocumentDeserializer, "_source"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java index f6aafdd58f..be2177029b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -39,169 +43,166 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.InlineScript @JsonpDeserializable public class InlineScript extends ScriptBase { - @Nullable - private final String lang; - - private final Map options; - - private final String source; - - // --------------------------------------------------------------------------------------------- - - private InlineScript(Builder builder) { - super(builder); - - this.lang = builder.lang; - this.options = ApiTypeHelper.unmodifiable(builder.options); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - - } - - public static InlineScript of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code lang} - */ - @Nullable - public final String lang() { - return this.lang; - } - - /** - * API name: {@code options} - */ - public final Map options() { - return this.options; - } - - /** - * Required - API name: {@code source} - */ - public final String source() { - return this.source; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.lang != null) { - generator.writeKey("lang"); - generator.write(this.lang); - - } - if (ApiTypeHelper.isDefined(this.options)) { - generator.writeKey("options"); - generator.writeStartObject(); - for (Map.Entry item0 : this.options.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("source"); - generator.write(this.source); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InlineScript}. - */ - - public static class Builder extends ScriptBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private String lang; - - @Nullable - private Map options; - - private String source; - - /** - * API name: {@code lang} - */ - public final Builder lang(@Nullable String value) { - this.lang = value; - return this; - } - - /** - * API name: {@code options} - *

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

- * Adds an entry to options. - */ - public final Builder options(String key, String value) { - this.options = _mapPut(this.options, key, value); - return this; - } - - /** - * Required - API name: {@code source} - */ - public final Builder source(String value) { - this.source = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link InlineScript}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InlineScript build() { - _checkSingleUse(); - - return new InlineScript(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InlineScript} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - InlineScript::setupInlineScriptDeserializer); - - protected static void setupInlineScriptDeserializer(ObjectDeserializer op) { - ScriptBase.setupScriptBaseDeserializer(op); - op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); - op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "options"); - op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); - - op.shortcutProperty("source"); - - } + @Nullable + private final String lang; + + private final Map options; + + private final String source; + + // --------------------------------------------------------------------------------------------- + + private InlineScript(Builder builder) { + super(builder); + + this.lang = builder.lang; + this.options = ApiTypeHelper.unmodifiable(builder.options); + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + + } + + public static InlineScript of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code lang} + */ + @Nullable + public final String lang() { + return this.lang; + } + + /** + * API name: {@code options} + */ + public final Map options() { + return this.options; + } + + /** + * Required - API name: {@code source} + */ + public final String source() { + return this.source; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + + } + if (ApiTypeHelper.isDefined(this.options)) { + generator.writeKey("options"); + generator.writeStartObject(); + for (Map.Entry item0 : this.options.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("source"); + generator.write(this.source); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InlineScript}. + */ + + public static class Builder extends ScriptBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private String lang; + + @Nullable + private Map options; + + private String source; + + /** + * API name: {@code lang} + */ + public final Builder lang(@Nullable String value) { + this.lang = value; + return this; + } + + /** + * API name: {@code options} + *

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

+ * Adds an entry to options. + */ + public final Builder options(String key, String value) { + this.options = _mapPut(this.options, key, value); + return this; + } + + /** + * Required - API name: {@code source} + */ + public final Builder source(String value) { + this.source = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InlineScript}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InlineScript build() { + _checkSingleUse(); + + return new InlineScript(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link InlineScript} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + InlineScript::setupInlineScriptDeserializer + ); + + protected static void setupInlineScriptDeserializer(ObjectDeserializer op) { + ScriptBase.setupScriptBaseDeserializer(op); + op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); + op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "options"); + op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); + + op.shortcutProperty("source"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java index d100024525..986416874a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.LatLonGeoLocation @JsonpDeserializable public class LatLonGeoLocation implements JsonpSerializable { - private final double lat; - - private final double lon; - - // --------------------------------------------------------------------------------------------- + private final double lat; - private LatLonGeoLocation(Builder builder) { + private final double lon; + + // --------------------------------------------------------------------------------------------- - this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); - this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); + private LatLonGeoLocation(Builder builder) { - } + this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); + this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); - public static LatLonGeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code lat} - */ - public final double lat() { - return this.lat; - } + public static LatLonGeoLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code lon} - */ - public final double lon() { - return this.lon; - } + /** + * Required - API name: {@code lat} + */ + public final double lat() { + return this.lat; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code lon} + */ + public final double lon() { + return this.lon; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("lat"); - generator.write(this.lat); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("lon"); - generator.write(this.lon); + generator.writeKey("lat"); + generator.write(this.lat); - } + generator.writeKey("lon"); + generator.write(this.lon); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link LatLonGeoLocation}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Double lat; + /** + * Builder for {@link LatLonGeoLocation}. + */ - private Double lon; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Double lat; - /** - * Required - API name: {@code lat} - */ - public final Builder lat(double value) { - this.lat = value; - return this; - } + private Double lon; - /** - * Required - API name: {@code lon} - */ - public final Builder lon(double value) { - this.lon = value; - return this; - } + /** + * Required - API name: {@code lat} + */ + public final Builder lat(double value) { + this.lat = value; + return this; + } - /** - * Builds a {@link LatLonGeoLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public LatLonGeoLocation build() { - _checkSingleUse(); + /** + * Required - API name: {@code lon} + */ + public final Builder lon(double value) { + this.lon = value; + return this; + } - return new LatLonGeoLocation(this); - } - } + /** + * Builds a {@link LatLonGeoLocation}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public LatLonGeoLocation build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new LatLonGeoLocation(this); + } + } - /** - * Json deserializer for {@link LatLonGeoLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, LatLonGeoLocation::setupLatLonGeoLocationDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link LatLonGeoLocation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + LatLonGeoLocation::setupLatLonGeoLocationDeserializer + ); - op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); - op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); + protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { - } + op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); + op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java index 0987308078..a7df990bb7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java @@ -37,23 +37,23 @@ @JsonpDeserializable public enum Level implements JsonEnum { - Cluster("cluster"), + Cluster("cluster"), - Indices("indices"), + Indices("indices"), - Shards("shards"), + Shards("shards"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Level(String jsonValue) { - this.jsonValue = jsonValue; - } + Level(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Level.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Level.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java index 85e8b718e2..71cd0307ce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java @@ -37,24 +37,25 @@ @JsonpDeserializable public enum LifecycleOperationMode implements JsonEnum { - Running("RUNNING"), + Running("RUNNING"), - Stopping("STOPPING"), + Stopping("STOPPING"), - Stopped("STOPPED"), + Stopped("STOPPED"), - ; + ; - private final String jsonValue; + private final String jsonValue; - LifecycleOperationMode(String jsonValue) { - this.jsonValue = jsonValue; - } + LifecycleOperationMode(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - LifecycleOperationMode.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + LifecycleOperationMode.values() + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java index d98b62be8a..7a09b9de4a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,487 +44,486 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.MergesStats @JsonpDeserializable public class MergesStats implements JsonpSerializable { - private final long current; - - private final long currentDocs; + private final long current; - @Nullable - private final String currentSize; + private final long currentDocs; + + @Nullable + private final String currentSize; - private final long currentSizeInBytes; - - private final long total; - - @Nullable - private final String totalAutoThrottle; - - private final long totalAutoThrottleInBytes; - - private final long totalDocs; - - @Nullable - private final String totalSize; - - private final long totalSizeInBytes; - - @Nullable - private final String totalStoppedTime; - - private final long totalStoppedTimeInMillis; - - @Nullable - private final String totalThrottledTime; - - private final long totalThrottledTimeInMillis; - - @Nullable - private final String totalTime; - - private final long totalTimeInMillis; - - // --------------------------------------------------------------------------------------------- - - private MergesStats(Builder builder) { - - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); - this.currentDocs = ApiTypeHelper.requireNonNull(builder.currentDocs, this, "currentDocs"); - this.currentSize = builder.currentSize; - this.currentSizeInBytes = ApiTypeHelper.requireNonNull(builder.currentSizeInBytes, this, "currentSizeInBytes"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalAutoThrottle = builder.totalAutoThrottle; - this.totalAutoThrottleInBytes = ApiTypeHelper.requireNonNull(builder.totalAutoThrottleInBytes, this, - "totalAutoThrottleInBytes"); - this.totalDocs = ApiTypeHelper.requireNonNull(builder.totalDocs, this, "totalDocs"); - this.totalSize = builder.totalSize; - this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); - this.totalStoppedTime = builder.totalStoppedTime; - this.totalStoppedTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalStoppedTimeInMillis, this, - "totalStoppedTimeInMillis"); - this.totalThrottledTime = builder.totalThrottledTime; - this.totalThrottledTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalThrottledTimeInMillis, this, - "totalThrottledTimeInMillis"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - - } - - public static MergesStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current} - */ - public final long current() { - return this.current; - } - - /** - * Required - API name: {@code current_docs} - */ - public final long currentDocs() { - return this.currentDocs; - } - - /** - * API name: {@code current_size} - */ - @Nullable - public final String currentSize() { - return this.currentSize; - } - - /** - * Required - API name: {@code current_size_in_bytes} - */ - public final long currentSizeInBytes() { - return this.currentSizeInBytes; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_auto_throttle} - */ - @Nullable - public final String totalAutoThrottle() { - return this.totalAutoThrottle; - } - - /** - * Required - API name: {@code total_auto_throttle_in_bytes} - */ - public final long totalAutoThrottleInBytes() { - return this.totalAutoThrottleInBytes; - } - - /** - * Required - API name: {@code total_docs} - */ - public final long totalDocs() { - return this.totalDocs; - } - - /** - * API name: {@code total_size} - */ - @Nullable - public final String totalSize() { - return this.totalSize; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final long totalSizeInBytes() { - return this.totalSizeInBytes; - } - - /** - * API name: {@code total_stopped_time} - */ - @Nullable - public final String totalStoppedTime() { - return this.totalStoppedTime; - } - - /** - * Required - API name: {@code total_stopped_time_in_millis} - */ - public final long totalStoppedTimeInMillis() { - return this.totalStoppedTimeInMillis; - } - - /** - * API name: {@code total_throttled_time} - */ - @Nullable - public final String totalThrottledTime() { - return this.totalThrottledTime; - } - - /** - * Required - API name: {@code total_throttled_time_in_millis} - */ - public final long totalThrottledTimeInMillis() { - return this.totalThrottledTimeInMillis; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * 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("current"); - generator.write(this.current); - - generator.writeKey("current_docs"); - generator.write(this.currentDocs); - - if (this.currentSize != null) { - generator.writeKey("current_size"); - generator.write(this.currentSize); - - } - generator.writeKey("current_size_in_bytes"); - generator.write(this.currentSizeInBytes); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalAutoThrottle != null) { - generator.writeKey("total_auto_throttle"); - generator.write(this.totalAutoThrottle); - - } - generator.writeKey("total_auto_throttle_in_bytes"); - generator.write(this.totalAutoThrottleInBytes); - - generator.writeKey("total_docs"); - generator.write(this.totalDocs); - - if (this.totalSize != null) { - generator.writeKey("total_size"); - generator.write(this.totalSize); - - } - generator.writeKey("total_size_in_bytes"); - generator.write(this.totalSizeInBytes); - - if (this.totalStoppedTime != null) { - generator.writeKey("total_stopped_time"); - generator.write(this.totalStoppedTime); - - } - generator.writeKey("total_stopped_time_in_millis"); - generator.write(this.totalStoppedTimeInMillis); - - if (this.totalThrottledTime != null) { - generator.writeKey("total_throttled_time"); - generator.write(this.totalThrottledTime); - - } - generator.writeKey("total_throttled_time_in_millis"); - generator.write(this.totalThrottledTimeInMillis); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MergesStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long current; - - private Long currentDocs; - - @Nullable - private String currentSize; - - private Long currentSizeInBytes; - - private Long total; - - @Nullable - private String totalAutoThrottle; - - private Long totalAutoThrottleInBytes; - - private Long totalDocs; - - @Nullable - private String totalSize; - - private Long totalSizeInBytes; - - @Nullable - private String totalStoppedTime; - - private Long totalStoppedTimeInMillis; - - @Nullable - private String totalThrottledTime; - - private Long totalThrottledTimeInMillis; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code current} - */ - public final Builder current(long value) { - this.current = value; - return this; - } - - /** - * Required - API name: {@code current_docs} - */ - public final Builder currentDocs(long value) { - this.currentDocs = value; - return this; - } - - /** - * API name: {@code current_size} - */ - public final Builder currentSize(@Nullable String value) { - this.currentSize = value; - return this; - } - - /** - * Required - API name: {@code current_size_in_bytes} - */ - public final Builder currentSizeInBytes(long value) { - this.currentSizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_auto_throttle} - */ - public final Builder totalAutoThrottle(@Nullable String value) { - this.totalAutoThrottle = value; - return this; - } - - /** - * Required - API name: {@code total_auto_throttle_in_bytes} - */ - public final Builder totalAutoThrottleInBytes(long value) { - this.totalAutoThrottleInBytes = value; - return this; - } - - /** - * Required - API name: {@code total_docs} - */ - public final Builder totalDocs(long value) { - this.totalDocs = value; - return this; - } - - /** - * API name: {@code total_size} - */ - public final Builder totalSize(@Nullable String value) { - this.totalSize = value; - return this; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final Builder totalSizeInBytes(long value) { - this.totalSizeInBytes = value; - return this; - } - - /** - * API name: {@code total_stopped_time} - */ - public final Builder totalStoppedTime(@Nullable String value) { - this.totalStoppedTime = value; - return this; - } - - /** - * Required - API name: {@code total_stopped_time_in_millis} - */ - public final Builder totalStoppedTimeInMillis(long value) { - this.totalStoppedTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_throttled_time} - */ - public final Builder totalThrottledTime(@Nullable String value) { - this.totalThrottledTime = value; - return this; - } - - /** - * Required - API name: {@code total_throttled_time_in_millis} - */ - public final Builder totalThrottledTimeInMillis(long value) { - this.totalThrottledTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link MergesStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MergesStats build() { - _checkSingleUse(); - - return new MergesStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MergesStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - MergesStats::setupMergesStatsDeserializer); - - protected static void setupMergesStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::currentDocs, JsonpDeserializer.longDeserializer(), "current_docs"); - op.add(Builder::currentSize, JsonpDeserializer.stringDeserializer(), "current_size"); - op.add(Builder::currentSizeInBytes, JsonpDeserializer.longDeserializer(), "current_size_in_bytes"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalAutoThrottle, JsonpDeserializer.stringDeserializer(), "total_auto_throttle"); - op.add(Builder::totalAutoThrottleInBytes, JsonpDeserializer.longDeserializer(), "total_auto_throttle_in_bytes"); - op.add(Builder::totalDocs, JsonpDeserializer.longDeserializer(), "total_docs"); - op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); - op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::totalStoppedTime, JsonpDeserializer.stringDeserializer(), "total_stopped_time"); - op.add(Builder::totalStoppedTimeInMillis, JsonpDeserializer.longDeserializer(), "total_stopped_time_in_millis"); - op.add(Builder::totalThrottledTime, JsonpDeserializer.stringDeserializer(), "total_throttled_time"); - op.add(Builder::totalThrottledTimeInMillis, JsonpDeserializer.longDeserializer(), - "total_throttled_time_in_millis"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + private final long currentSizeInBytes; + + private final long total; + + @Nullable + private final String totalAutoThrottle; + + private final long totalAutoThrottleInBytes; + + private final long totalDocs; + + @Nullable + private final String totalSize; + + private final long totalSizeInBytes; + + @Nullable + private final String totalStoppedTime; + + private final long totalStoppedTimeInMillis; + + @Nullable + private final String totalThrottledTime; + + private final long totalThrottledTimeInMillis; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; + + // --------------------------------------------------------------------------------------------- + + private MergesStats(Builder builder) { + + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.currentDocs = ApiTypeHelper.requireNonNull(builder.currentDocs, this, "currentDocs"); + this.currentSize = builder.currentSize; + this.currentSizeInBytes = ApiTypeHelper.requireNonNull(builder.currentSizeInBytes, this, "currentSizeInBytes"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalAutoThrottle = builder.totalAutoThrottle; + this.totalAutoThrottleInBytes = ApiTypeHelper.requireNonNull(builder.totalAutoThrottleInBytes, this, "totalAutoThrottleInBytes"); + this.totalDocs = ApiTypeHelper.requireNonNull(builder.totalDocs, this, "totalDocs"); + this.totalSize = builder.totalSize; + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.totalStoppedTime = builder.totalStoppedTime; + this.totalStoppedTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalStoppedTimeInMillis, this, "totalStoppedTimeInMillis"); + this.totalThrottledTime = builder.totalThrottledTime; + this.totalThrottledTimeInMillis = ApiTypeHelper.requireNonNull( + builder.totalThrottledTimeInMillis, + this, + "totalThrottledTimeInMillis" + ); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + + } + + public static MergesStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current} + */ + public final long current() { + return this.current; + } + + /** + * Required - API name: {@code current_docs} + */ + public final long currentDocs() { + return this.currentDocs; + } + + /** + * API name: {@code current_size} + */ + @Nullable + public final String currentSize() { + return this.currentSize; + } + + /** + * Required - API name: {@code current_size_in_bytes} + */ + public final long currentSizeInBytes() { + return this.currentSizeInBytes; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_auto_throttle} + */ + @Nullable + public final String totalAutoThrottle() { + return this.totalAutoThrottle; + } + + /** + * Required - API name: {@code total_auto_throttle_in_bytes} + */ + public final long totalAutoThrottleInBytes() { + return this.totalAutoThrottleInBytes; + } + + /** + * Required - API name: {@code total_docs} + */ + public final long totalDocs() { + return this.totalDocs; + } + + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * API name: {@code total_stopped_time} + */ + @Nullable + public final String totalStoppedTime() { + return this.totalStoppedTime; + } + + /** + * Required - API name: {@code total_stopped_time_in_millis} + */ + public final long totalStoppedTimeInMillis() { + return this.totalStoppedTimeInMillis; + } + + /** + * API name: {@code total_throttled_time} + */ + @Nullable + public final String totalThrottledTime() { + return this.totalThrottledTime; + } + + /** + * Required - API name: {@code total_throttled_time_in_millis} + */ + public final long totalThrottledTimeInMillis() { + return this.totalThrottledTimeInMillis; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * 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("current"); + generator.write(this.current); + + generator.writeKey("current_docs"); + generator.write(this.currentDocs); + + if (this.currentSize != null) { + generator.writeKey("current_size"); + generator.write(this.currentSize); + + } + generator.writeKey("current_size_in_bytes"); + generator.write(this.currentSizeInBytes); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalAutoThrottle != null) { + generator.writeKey("total_auto_throttle"); + generator.write(this.totalAutoThrottle); + + } + generator.writeKey("total_auto_throttle_in_bytes"); + generator.write(this.totalAutoThrottleInBytes); + + generator.writeKey("total_docs"); + generator.write(this.totalDocs); + + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (this.totalStoppedTime != null) { + generator.writeKey("total_stopped_time"); + generator.write(this.totalStoppedTime); + + } + generator.writeKey("total_stopped_time_in_millis"); + generator.write(this.totalStoppedTimeInMillis); + + if (this.totalThrottledTime != null) { + generator.writeKey("total_throttled_time"); + generator.write(this.totalThrottledTime); + + } + generator.writeKey("total_throttled_time_in_millis"); + generator.write(this.totalThrottledTimeInMillis); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MergesStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long current; + + private Long currentDocs; + + @Nullable + private String currentSize; + + private Long currentSizeInBytes; + + private Long total; + + @Nullable + private String totalAutoThrottle; + + private Long totalAutoThrottleInBytes; + + private Long totalDocs; + + @Nullable + private String totalSize; + + private Long totalSizeInBytes; + + @Nullable + private String totalStoppedTime; + + private Long totalStoppedTimeInMillis; + + @Nullable + private String totalThrottledTime; + + private Long totalThrottledTimeInMillis; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code current} + */ + public final Builder current(long value) { + this.current = value; + return this; + } + + /** + * Required - API name: {@code current_docs} + */ + public final Builder currentDocs(long value) { + this.currentDocs = value; + return this; + } + + /** + * API name: {@code current_size} + */ + public final Builder currentSize(@Nullable String value) { + this.currentSize = value; + return this; + } + + /** + * Required - API name: {@code current_size_in_bytes} + */ + public final Builder currentSizeInBytes(long value) { + this.currentSizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_auto_throttle} + */ + public final Builder totalAutoThrottle(@Nullable String value) { + this.totalAutoThrottle = value; + return this; + } + + /** + * Required - API name: {@code total_auto_throttle_in_bytes} + */ + public final Builder totalAutoThrottleInBytes(long value) { + this.totalAutoThrottleInBytes = value; + return this; + } + + /** + * Required - API name: {@code total_docs} + */ + public final Builder totalDocs(long value) { + this.totalDocs = value; + return this; + } + + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * API name: {@code total_stopped_time} + */ + public final Builder totalStoppedTime(@Nullable String value) { + this.totalStoppedTime = value; + return this; + } + + /** + * Required - API name: {@code total_stopped_time_in_millis} + */ + public final Builder totalStoppedTimeInMillis(long value) { + this.totalStoppedTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_throttled_time} + */ + public final Builder totalThrottledTime(@Nullable String value) { + this.totalThrottledTime = value; + return this; + } + + /** + * Required - API name: {@code total_throttled_time_in_millis} + */ + public final Builder totalThrottledTimeInMillis(long value) { + this.totalThrottledTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link MergesStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MergesStats build() { + _checkSingleUse(); + + return new MergesStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MergesStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + MergesStats::setupMergesStatsDeserializer + ); + + protected static void setupMergesStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::currentDocs, JsonpDeserializer.longDeserializer(), "current_docs"); + op.add(Builder::currentSize, JsonpDeserializer.stringDeserializer(), "current_size"); + op.add(Builder::currentSizeInBytes, JsonpDeserializer.longDeserializer(), "current_size_in_bytes"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalAutoThrottle, JsonpDeserializer.stringDeserializer(), "total_auto_throttle"); + op.add(Builder::totalAutoThrottleInBytes, JsonpDeserializer.longDeserializer(), "total_auto_throttle_in_bytes"); + op.add(Builder::totalDocs, JsonpDeserializer.longDeserializer(), "total_docs"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::totalStoppedTime, JsonpDeserializer.stringDeserializer(), "total_stopped_time"); + op.add(Builder::totalStoppedTimeInMillis, JsonpDeserializer.longDeserializer(), "total_stopped_time_in_millis"); + op.add(Builder::totalThrottledTime, JsonpDeserializer.stringDeserializer(), "total_throttled_time"); + op.add(Builder::totalThrottledTimeInMillis, JsonpDeserializer.longDeserializer(), "total_throttled_time_in_millis"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java index b1f16ea6bb..366abbca50 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java @@ -32,205 +32,206 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch._types.query_dsl.Query; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.query_dsl.Query; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NestedSortValue @JsonpDeserializable public class NestedSortValue implements JsonpSerializable { - @Nullable - private final Query filter; - - @Nullable - private final Integer maxChildren; + @Nullable + private final Query filter; + + @Nullable + private final Integer maxChildren; - @Nullable - private final NestedSortValue nested; - - private final String path; - - // --------------------------------------------------------------------------------------------- - - private NestedSortValue(Builder builder) { - - this.filter = builder.filter; - this.maxChildren = builder.maxChildren; - this.nested = builder.nested; - this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); - - } - - public static NestedSortValue of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * API name: {@code max_children} - */ - @Nullable - public final Integer maxChildren() { - return this.maxChildren; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * Required - API name: {@code path} - */ - public final String path() { - return this.path; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.maxChildren != null) { - generator.writeKey("max_children"); - generator.write(this.maxChildren); - - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - generator.writeKey("path"); - generator.write(this.path); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NestedSortValue}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Query filter; - - @Nullable - private Integer maxChildren; - - @Nullable - private NestedSortValue nested; - - private String path; - - /** - * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * API name: {@code max_children} - */ - public final Builder maxChildren(@Nullable Integer value) { - this.maxChildren = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * Required - API name: {@code path} - */ - public final Builder path(String value) { - this.path = value; - return this; - } - - /** - * Builds a {@link NestedSortValue}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NestedSortValue build() { - _checkSingleUse(); - - return new NestedSortValue(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NestedSortValue} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NestedSortValue::setupNestedSortValueDeserializer); - - protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); - - } + @Nullable + private final NestedSortValue nested; + + private final String path; + + // --------------------------------------------------------------------------------------------- + + private NestedSortValue(Builder builder) { + + this.filter = builder.filter; + this.maxChildren = builder.maxChildren; + this.nested = builder.nested; + this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); + + } + + public static NestedSortValue of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code filter} + */ + @Nullable + public final Query filter() { + return this.filter; + } + + /** + * API name: {@code max_children} + */ + @Nullable + public final Integer maxChildren() { + return this.maxChildren; + } + + /** + * API name: {@code nested} + */ + @Nullable + public final NestedSortValue nested() { + return this.nested; + } + + /** + * Required - API name: {@code path} + */ + public final String path() { + return this.path; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.filter != null) { + generator.writeKey("filter"); + this.filter.serialize(generator, mapper); + + } + if (this.maxChildren != null) { + generator.writeKey("max_children"); + generator.write(this.maxChildren); + + } + if (this.nested != null) { + generator.writeKey("nested"); + this.nested.serialize(generator, mapper); + + } + generator.writeKey("path"); + generator.write(this.path); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NestedSortValue}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Query filter; + + @Nullable + private Integer maxChildren; + + @Nullable + private NestedSortValue nested; + + private String path; + + /** + * API name: {@code filter} + */ + public final Builder filter(@Nullable Query value) { + this.filter = value; + return this; + } + + /** + * API name: {@code filter} + */ + public final Builder filter(Function> fn) { + return this.filter(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code max_children} + */ + public final Builder maxChildren(@Nullable Integer value) { + this.maxChildren = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(@Nullable NestedSortValue value) { + this.nested = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(Function> fn) { + return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + } + + /** + * Required - API name: {@code path} + */ + public final Builder path(String value) { + this.path = value; + return this; + } + + /** + * Builds a {@link NestedSortValue}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NestedSortValue build() { + _checkSingleUse(); + + return new NestedSortValue(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NestedSortValue} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NestedSortValue::setupNestedSortValueDeserializer + ); + + protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { + + op.add(Builder::filter, Query._DESERIALIZER, "filter"); + op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); + op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java index 53f19e7382..ac02a7b1d3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java @@ -32,6 +32,11 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,283 +46,279 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeAttributes @JsonpDeserializable public class NodeAttributes implements JsonpSerializable { - private final Map attributes; - - private final String ephemeralId; - - @Nullable - private final String id; - - private final String name; - - private final String transportAddress; - - private final List roles; - - // --------------------------------------------------------------------------------------------- - - private NodeAttributes(Builder builder) { - - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); - this.ephemeralId = ApiTypeHelper.requireNonNull(builder.ephemeralId, this, "ephemeralId"); - this.id = builder.id; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); - this.roles = ApiTypeHelper.unmodifiable(builder.roles); - - } - - public static NodeAttributes of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Lists node attributes. - *

- * API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - - /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} - */ - public final String ephemeralId() { - return this.ephemeralId; - } - - /** - * The unique identifier of the node. - *

- * API name: {@code id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} - */ - public final String transportAddress() { - return this.transportAddress; - } - - /** - * API name: {@code roles} - */ - public final List roles() { - return this.roles; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("ephemeral_id"); - generator.write(this.ephemeralId); - - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); - - } - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("transport_address"); - generator.write(this.transportAddress); - - if (ApiTypeHelper.isDefined(this.roles)) { - generator.writeKey("roles"); - generator.writeStartArray(); - for (NodeRole item0 : this.roles) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeAttributes}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Map attributes; - - private String ephemeralId; - - @Nullable - private String id; - - private String name; - - private String transportAddress; - - @Nullable - private List roles; - - /** - * Required - Lists node attributes. - *

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

- * Adds all entries of map to attributes. - */ - public final Builder attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); - return this; - } - - /** - * Required - Lists node attributes. - *

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

- * Adds an entry to attributes. - */ - public final Builder attributes(String key, String value) { - this.attributes = _mapPut(this.attributes, key, value); - return this; - } - - /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} - */ - public final Builder ephemeralId(String value) { - this.ephemeralId = value; - return this; - } - - /** - * The unique identifier of the node. - *

- * API name: {@code id} - */ - public final Builder id(@Nullable String value) { - this.id = value; - return this; - } - - /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} - */ - public final Builder transportAddress(String value) { - this.transportAddress = value; - return this; - } - - /** - * API name: {@code roles} - *

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

- * Adds one or more values to roles. - */ - public final Builder roles(NodeRole value, NodeRole... values) { - this.roles = _listAdd(this.roles, value, values); - return this; - } - - /** - * Builds a {@link NodeAttributes}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeAttributes build() { - _checkSingleUse(); - - return new NodeAttributes(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeAttributes} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeAttributes::setupNodeAttributesDeserializer); - - protected static void setupNodeAttributesDeserializer(ObjectDeserializer op) { - - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "attributes"); - op.add(Builder::ephemeralId, JsonpDeserializer.stringDeserializer(), "ephemeral_id"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); - op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); - - } + private final Map attributes; + + private final String ephemeralId; + + @Nullable + private final String id; + + private final String name; + + private final String transportAddress; + + private final List roles; + + // --------------------------------------------------------------------------------------------- + + private NodeAttributes(Builder builder) { + + this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); + this.ephemeralId = ApiTypeHelper.requireNonNull(builder.ephemeralId, this, "ephemeralId"); + this.id = builder.id; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); + this.roles = ApiTypeHelper.unmodifiable(builder.roles); + + } + + public static NodeAttributes of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Lists node attributes. + *

+ * API name: {@code attributes} + */ + public final Map attributes() { + return this.attributes; + } + + /** + * Required - The ephemeral ID of the node. + *

+ * API name: {@code ephemeral_id} + */ + public final String ephemeralId() { + return this.ephemeralId; + } + + /** + * The unique identifier of the node. + *

+ * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + + /** + * Required - The unique identifier of the node. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The host and port where transport HTTP connections are accepted. + *

+ * API name: {@code transport_address} + */ + public final String transportAddress() { + return this.transportAddress; + } + + /** + * API name: {@code roles} + */ + public final List roles() { + return this.roles; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.attributes)) { + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("ephemeral_id"); + generator.write(this.ephemeralId); + + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("transport_address"); + generator.write(this.transportAddress); + + if (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartArray(); + for (NodeRole item0 : this.roles) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeAttributes}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Map attributes; + + private String ephemeralId; + + @Nullable + private String id; + + private String name; + + private String transportAddress; + + @Nullable + private List roles; + + /** + * Required - Lists node attributes. + *

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

+ * Adds all entries of map to attributes. + */ + public final Builder attributes(Map map) { + this.attributes = _mapPutAll(this.attributes, map); + return this; + } + + /** + * Required - Lists node attributes. + *

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

+ * Adds an entry to attributes. + */ + public final Builder attributes(String key, String value) { + this.attributes = _mapPut(this.attributes, key, value); + return this; + } + + /** + * Required - The ephemeral ID of the node. + *

+ * API name: {@code ephemeral_id} + */ + public final Builder ephemeralId(String value) { + this.ephemeralId = value; + return this; + } + + /** + * The unique identifier of the node. + *

+ * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * Required - The unique identifier of the node. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The host and port where transport HTTP connections are accepted. + *

+ * API name: {@code transport_address} + */ + public final Builder transportAddress(String value) { + this.transportAddress = value; + return this; + } + + /** + * API name: {@code roles} + *

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

+ * Adds one or more values to roles. + */ + public final Builder roles(NodeRole value, NodeRole... values) { + this.roles = _listAdd(this.roles, value, values); + return this; + } + + /** + * Builds a {@link NodeAttributes}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeAttributes build() { + _checkSingleUse(); + + return new NodeAttributes(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeAttributes} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeAttributes::setupNodeAttributesDeserializer + ); + + protected static void setupNodeAttributesDeserializer(ObjectDeserializer op) { + + op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); + op.add(Builder::ephemeralId, JsonpDeserializer.stringDeserializer(), "ephemeral_id"); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java index f00cbc9146..530603353f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java @@ -37,48 +37,48 @@ @JsonpDeserializable public enum NodeRole implements JsonEnum { - @Deprecated - Master("master"), + @Deprecated + Master("master"), - ClusterManager("cluster_manager"), + ClusterManager("cluster_manager"), - Data("data"), + Data("data"), - DataCold("data_cold"), + DataCold("data_cold"), - DataContent("data_content"), + DataContent("data_content"), - DataFrozen("data_frozen"), + DataFrozen("data_frozen"), - DataHot("data_hot"), + DataHot("data_hot"), - DataWarm("data_warm"), + DataWarm("data_warm"), - Client("client"), + Client("client"), - Ingest("ingest"), + Ingest("ingest"), - Ml("ml"), + Ml("ml"), - VotingOnly("voting_only"), + VotingOnly("voting_only"), - Transform("transform"), + Transform("transform"), - RemoteClusterClient("remote_cluster_client"), + RemoteClusterClient("remote_cluster_client"), - CoordinatingOnly("coordinating_only"), + CoordinatingOnly("coordinating_only"), - ; + ; - private final String jsonValue; + private final String jsonValue; - NodeRole(String jsonValue) { - this.jsonValue = jsonValue; - } + NodeRole(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(NodeRole.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(NodeRole.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java index 1c77110356..2e504aa517 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java @@ -32,336 +32,334 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch.cluster.allocation_explain.UnassignedInformation; -import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch.cluster.allocation_explain.UnassignedInformation; +import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeShard @JsonpDeserializable public class NodeShard implements JsonpSerializable { - private final ShardRoutingState state; - - private final boolean primary; - - @Nullable - private final String node; - - private final int shard; - - private final String index; - - private final Map allocationId; - - private final Map recoverySource; - - @Nullable - private final UnassignedInformation unassignedInfo; - - // --------------------------------------------------------------------------------------------- - - private NodeShard(Builder builder) { - - this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); - this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); - this.node = builder.node; - this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.allocationId = ApiTypeHelper.unmodifiable(builder.allocationId); - this.recoverySource = ApiTypeHelper.unmodifiable(builder.recoverySource); - this.unassignedInfo = builder.unassignedInfo; - - } - - public static NodeShard of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code state} - */ - public final ShardRoutingState state() { - return this.state; - } - - /** - * Required - API name: {@code primary} - */ - public final boolean primary() { - return this.primary; - } - - /** - * API name: {@code node} - */ - @Nullable - public final String node() { - return this.node; - } - - /** - * Required - API name: {@code shard} - */ - public final int shard() { - return this.shard; - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * API name: {@code allocation_id} - */ - public final Map allocationId() { - return this.allocationId; - } - - /** - * API name: {@code recovery_source} - */ - public final Map recoverySource() { - return this.recoverySource; - } - - /** - * API name: {@code unassigned_info} - */ - @Nullable - public final UnassignedInformation unassignedInfo() { - return this.unassignedInfo; - } - - /** - * 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("state"); - this.state.serialize(generator, mapper); - generator.writeKey("primary"); - generator.write(this.primary); - - if (this.node != null) { - generator.writeKey("node"); - generator.write(this.node); - - } - generator.writeKey("shard"); - generator.write(this.shard); - - generator.writeKey("index"); - generator.write(this.index); - - if (ApiTypeHelper.isDefined(this.allocationId)) { - generator.writeKey("allocation_id"); - generator.writeStartObject(); - for (Map.Entry item0 : this.allocationId.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.recoverySource)) { - generator.writeKey("recovery_source"); - generator.writeStartObject(); - for (Map.Entry item0 : this.recoverySource.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - if (this.unassignedInfo != null) { - generator.writeKey("unassigned_info"); - this.unassignedInfo.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeShard}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ShardRoutingState state; - - private Boolean primary; - - @Nullable - private String node; - - private Integer shard; - - private String index; - - @Nullable - private Map allocationId; - - @Nullable - private Map recoverySource; - - @Nullable - private UnassignedInformation unassignedInfo; - - /** - * Required - API name: {@code state} - */ - public final Builder state(ShardRoutingState value) { - this.state = value; - return this; - } - - /** - * Required - API name: {@code primary} - */ - public final Builder primary(boolean value) { - this.primary = value; - return this; - } - - /** - * API name: {@code node} - */ - public final Builder node(@Nullable String value) { - this.node = value; - return this; - } - - /** - * Required - API name: {@code shard} - */ - public final Builder shard(int value) { - this.shard = value; - return this; - } - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * API name: {@code allocation_id} - *

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

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

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

- * Adds an entry to recoverySource. - */ - public final Builder recoverySource(String key, String value) { - this.recoverySource = _mapPut(this.recoverySource, key, value); - return this; - } - - /** - * API name: {@code unassigned_info} - */ - public final Builder unassignedInfo(@Nullable UnassignedInformation value) { - this.unassignedInfo = value; - return this; - } - - /** - * API name: {@code unassigned_info} - */ - public final Builder unassignedInfo( - Function> fn) { - return this.unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); - } - - /** - * Builds a {@link NodeShard}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeShard build() { - _checkSingleUse(); - - return new NodeShard(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeShard} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeShard::setupNodeShardDeserializer); - - protected static void setupNodeShardDeserializer(ObjectDeserializer op) { - - op.add(Builder::state, ShardRoutingState._DESERIALIZER, "state"); - op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::allocationId, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "allocation_id"); - op.add(Builder::recoverySource, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "recovery_source"); - op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); - - } + private final ShardRoutingState state; + + private final boolean primary; + + @Nullable + private final String node; + + private final int shard; + + private final String index; + + private final Map allocationId; + + private final Map recoverySource; + + @Nullable + private final UnassignedInformation unassignedInfo; + + // --------------------------------------------------------------------------------------------- + + private NodeShard(Builder builder) { + + this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); + this.node = builder.node; + this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.allocationId = ApiTypeHelper.unmodifiable(builder.allocationId); + this.recoverySource = ApiTypeHelper.unmodifiable(builder.recoverySource); + this.unassignedInfo = builder.unassignedInfo; + + } + + public static NodeShard of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code state} + */ + public final ShardRoutingState state() { + return this.state; + } + + /** + * Required - API name: {@code primary} + */ + public final boolean primary() { + return this.primary; + } + + /** + * API name: {@code node} + */ + @Nullable + public final String node() { + return this.node; + } + + /** + * Required - API name: {@code shard} + */ + public final int shard() { + return this.shard; + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * API name: {@code allocation_id} + */ + public final Map allocationId() { + return this.allocationId; + } + + /** + * API name: {@code recovery_source} + */ + public final Map recoverySource() { + return this.recoverySource; + } + + /** + * API name: {@code unassigned_info} + */ + @Nullable + public final UnassignedInformation unassignedInfo() { + return this.unassignedInfo; + } + + /** + * 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("state"); + this.state.serialize(generator, mapper); + generator.writeKey("primary"); + generator.write(this.primary); + + if (this.node != null) { + generator.writeKey("node"); + generator.write(this.node); + + } + generator.writeKey("shard"); + generator.write(this.shard); + + generator.writeKey("index"); + generator.write(this.index); + + if (ApiTypeHelper.isDefined(this.allocationId)) { + generator.writeKey("allocation_id"); + generator.writeStartObject(); + for (Map.Entry item0 : this.allocationId.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.recoverySource)) { + generator.writeKey("recovery_source"); + generator.writeStartObject(); + for (Map.Entry item0 : this.recoverySource.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (this.unassignedInfo != null) { + generator.writeKey("unassigned_info"); + this.unassignedInfo.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeShard}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ShardRoutingState state; + + private Boolean primary; + + @Nullable + private String node; + + private Integer shard; + + private String index; + + @Nullable + private Map allocationId; + + @Nullable + private Map recoverySource; + + @Nullable + private UnassignedInformation unassignedInfo; + + /** + * Required - API name: {@code state} + */ + public final Builder state(ShardRoutingState value) { + this.state = value; + return this; + } + + /** + * Required - API name: {@code primary} + */ + public final Builder primary(boolean value) { + this.primary = value; + return this; + } + + /** + * API name: {@code node} + */ + public final Builder node(@Nullable String value) { + this.node = value; + return this; + } + + /** + * Required - API name: {@code shard} + */ + public final Builder shard(int value) { + this.shard = value; + return this; + } + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * API name: {@code allocation_id} + *

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

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

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

+ * Adds an entry to recoverySource. + */ + public final Builder recoverySource(String key, String value) { + this.recoverySource = _mapPut(this.recoverySource, key, value); + return this; + } + + /** + * API name: {@code unassigned_info} + */ + public final Builder unassignedInfo(@Nullable UnassignedInformation value) { + this.unassignedInfo = value; + return this; + } + + /** + * API name: {@code unassigned_info} + */ + public final Builder unassignedInfo(Function> fn) { + return this.unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); + } + + /** + * Builds a {@link NodeShard}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeShard build() { + _checkSingleUse(); + + return new NodeShard(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeShard} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeShard::setupNodeShardDeserializer + ); + + protected static void setupNodeShardDeserializer(ObjectDeserializer op) { + + op.add(Builder::state, ShardRoutingState._DESERIALIZER, "state"); + op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); + op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::allocationId, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "allocation_id"); + op.add(Builder::recoverySource, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "recovery_source"); + op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index ea17496835..61bc2e5fc1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,211 +45,209 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeStatistics @JsonpDeserializable public class NodeStatistics implements JsonpSerializable { - private final List failures; - - private final int total; - - private final int successful; + private final List failures; + + private final int total; + + private final int successful; - private final int failed; + private final int failed; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private NodeStatistics(Builder builder) { - - this.failures = ApiTypeHelper.unmodifiable(builder.failures); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); - - } - - public static NodeStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - Total number of nodes selected by the request. - *

- * API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * Required - Number of nodes that responded successfully to the request. - *

- * API name: {@code successful} - */ - public final int successful() { - return this.successful; - } - - /** - * Required - Number of nodes that rejected the request or failed to respond. If - * this value is not 0, a reason for the rejection or failure is included in the - * response. - *

- * API name: {@code failed} - */ - public final int failed() { - return this.failed; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (ErrorCause item0 : this.failures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("successful"); - generator.write(this.successful); - - generator.writeKey("failed"); - generator.write(this.failed); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeStatistics}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private List failures; - - private Integer total; - - private Integer successful; - - private Integer failed; - - /** - * API name: {@code failures} - *

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

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

- * Adds a value to failures using a builder lambda. - */ - public final Builder failures(Function> fn) { - return failures(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - Total number of nodes selected by the request. - *

- * API name: {@code total} - */ - public final Builder total(int value) { - this.total = value; - return this; - } - - /** - * Required - Number of nodes that responded successfully to the request. - *

- * API name: {@code successful} - */ - public final Builder successful(int value) { - this.successful = value; - return this; - } - - /** - * Required - Number of nodes that rejected the request or failed to respond. If - * this value is not 0, a reason for the rejection or failure is included in the - * response. - *

- * API name: {@code failed} - */ - public final Builder failed(int value) { - this.failed = value; - return this; - } - - /** - * Builds a {@link NodeStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeStatistics build() { - _checkSingleUse(); - - return new NodeStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeStatistics::setupNodeStatisticsDeserializer); - - protected static void setupNodeStatisticsDeserializer(ObjectDeserializer op) { - - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "failures"); - op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); - op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); - op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); - - } + private NodeStatistics(Builder builder) { + + this.failures = ApiTypeHelper.unmodifiable(builder.failures); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + + } + + public static NodeStatistics of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code failures} + */ + public final List failures() { + return this.failures; + } + + /** + * Required - Total number of nodes selected by the request. + *

+ * API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * Required - Number of nodes that responded successfully to the request. + *

+ * API name: {@code successful} + */ + public final int successful() { + return this.successful; + } + + /** + * Required - Number of nodes that rejected the request or failed to respond. If + * this value is not 0, a reason for the rejection or failure is included in the + * response. + *

+ * API name: {@code failed} + */ + public final int failed() { + return this.failed; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.failures)) { + generator.writeKey("failures"); + generator.writeStartArray(); + for (ErrorCause item0 : this.failures) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("total"); + generator.write(this.total); + + generator.writeKey("successful"); + generator.write(this.successful); + + generator.writeKey("failed"); + generator.write(this.failed); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeStatistics}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private List failures; + + private Integer total; + + private Integer successful; + + private Integer failed; + + /** + * API name: {@code failures} + *

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

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

+ * Adds a value to failures using a builder lambda. + */ + public final Builder failures(Function> fn) { + return failures(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - Total number of nodes selected by the request. + *

+ * API name: {@code total} + */ + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * Required - Number of nodes that responded successfully to the request. + *

+ * API name: {@code successful} + */ + public final Builder successful(int value) { + this.successful = value; + return this; + } + + /** + * Required - Number of nodes that rejected the request or failed to respond. If + * this value is not 0, a reason for the rejection or failure is included in the + * response. + *

+ * API name: {@code failed} + */ + public final Builder failed(int value) { + this.failed = value; + return this; + } + + /** + * Builds a {@link NodeStatistics}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeStatistics build() { + _checkSingleUse(); + + return new NodeStatistics(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeStatistics} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeStatistics::setupNodeStatisticsDeserializer + ); + + protected static void setupNodeStatisticsDeserializer(ObjectDeserializer op) { + + op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "failures"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); + op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java index e415250039..0a3151caa2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java @@ -37,21 +37,21 @@ @JsonpDeserializable public enum OpType implements JsonEnum { - Index("index"), + Index("index"), - Create("create"), + Create("create"), - ; + ; - private final String jsonValue; + private final String jsonValue; - OpType(String jsonValue) { - this.jsonValue = jsonValue; - } + OpType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OpType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OpType.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java index 993d68989d..e2addab959 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java @@ -42,32 +42,32 @@ */ public class OpenSearchException extends RuntimeException { - private final ErrorResponse response; + private final ErrorResponse response; - public OpenSearchException(ErrorResponse response) { - super("Request failed: [" + response.error().type() + "] " + response.error().reason()); - this.response = response; - } + public OpenSearchException(ErrorResponse response) { + super("Request failed: [" + response.error().type() + "] " + response.error().reason()); + this.response = response; + } - /** - * The error response sent by Elasticsearch - */ - public ErrorResponse response() { - return this.response; - } + /** + * The error response sent by Elasticsearch + */ + public ErrorResponse response() { + return this.response; + } - /** - * The cause of the error. Shortcut for {@code response().error()}. - */ - public ErrorCause error() { - return this.response.error(); - } + /** + * The cause of the error. Shortcut for {@code response().error()}. + */ + public ErrorCause error() { + return this.response.error(); + } - /** - * Status code returned by Elasticsearch. Shortcut for - * {@code response().status()}. - */ - public int status() { - return this.response.status(); - } + /** + * Status code returned by Elasticsearch. Shortcut for + * {@code response().status()}. + */ + public int status() { + return this.response.status(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 3995461826..12f9e60a7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,310 +43,313 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; @JsonpDeserializable public final class OpenSearchVersionInfo implements JsonpSerializable { - private final String buildDate; - - private final String buildFlavor; - - private final String buildHash; - - private final boolean buildSnapshot; - - private final String buildType; - - private final String distribution; - - private final String luceneVersion; - - private final String minimumIndexCompatibilityVersion; - - private final String minimumWireCompatibilityVersion; - - private final String number; - - // --------------------------------------------------------------------------------------------- - - private OpenSearchVersionInfo(Builder builder) { - - this.buildDate = ApiTypeHelper.requireNonNull(builder.buildDate, this, "buildDate"); - this.buildFlavor = builder.buildFlavor; - this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); - this.buildSnapshot = ApiTypeHelper.requireNonNull(builder.buildSnapshot, this, "buildSnapshot"); - this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.distribution = ApiTypeHelper.requireNonNull(builder.distribution, this, "distribution"); - this.luceneVersion = ApiTypeHelper.requireNonNull(builder.luceneVersion, this, "luceneVersion"); - this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumIndexCompatibilityVersion, - this, "minimumIndexCompatibilityVersion"); - this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumWireCompatibilityVersion, - this, "minimumWireCompatibilityVersion"); - this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); - - } - - public static OpenSearchVersionInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code build_date} - */ - public String buildDate() { - return this.buildDate; - } - - /** - * API name: {@code build_flavor} - */ - public String buildFlavor() { - return this.buildFlavor; - } - - /** - * API name: {@code build_hash} - */ - public String buildHash() { - return this.buildHash; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public boolean buildSnapshot() { - return this.buildSnapshot; - } - - /** - * Required - API name: {@code build_type} - */ - public String buildType() { - return this.buildType; - } - - /** - * API name: {@code distribution} - */ - public String distribution() { - return this.distribution; - } - - /** - * API name: {@code lucene_version} - */ - public String luceneVersion() { - return this.luceneVersion; - } + private final String buildDate; + + private final String buildFlavor; + + private final String buildHash; + + private final boolean buildSnapshot; + + private final String buildType; + + private final String distribution; + + private final String luceneVersion; + + private final String minimumIndexCompatibilityVersion; + + private final String minimumWireCompatibilityVersion; + + private final String number; + + // --------------------------------------------------------------------------------------------- + + private OpenSearchVersionInfo(Builder builder) { + + this.buildDate = ApiTypeHelper.requireNonNull(builder.buildDate, this, "buildDate"); + this.buildFlavor = builder.buildFlavor; + this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); + this.buildSnapshot = ApiTypeHelper.requireNonNull(builder.buildSnapshot, this, "buildSnapshot"); + this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); + this.distribution = ApiTypeHelper.requireNonNull(builder.distribution, this, "distribution"); + this.luceneVersion = ApiTypeHelper.requireNonNull(builder.luceneVersion, this, "luceneVersion"); + this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull( + builder.minimumIndexCompatibilityVersion, + this, + "minimumIndexCompatibilityVersion" + ); + this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull( + builder.minimumWireCompatibilityVersion, + this, + "minimumWireCompatibilityVersion" + ); + this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); + + } + + public static OpenSearchVersionInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code build_date} + */ + public String buildDate() { + return this.buildDate; + } + + /** + * API name: {@code build_flavor} + */ + public String buildFlavor() { + return this.buildFlavor; + } + + /** + * API name: {@code build_hash} + */ + public String buildHash() { + return this.buildHash; + } + + /** + * Required - API name: {@code build_snapshot} + */ + public boolean buildSnapshot() { + return this.buildSnapshot; + } + + /** + * Required - API name: {@code build_type} + */ + public String buildType() { + return this.buildType; + } - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public String minimumIndexCompatibilityVersion() { - return this.minimumIndexCompatibilityVersion; - } + /** + * API name: {@code distribution} + */ + public String distribution() { + return this.distribution; + } - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public String minimumWireCompatibilityVersion() { - return this.minimumWireCompatibilityVersion; - } + /** + * API name: {@code lucene_version} + */ + public String luceneVersion() { + return this.luceneVersion; + } - /** - * Required - API name: {@code number} - */ - public String number() { - return this.number; - } - - /** - * 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("build_date"); - generator.write(this.buildDate); - - generator.writeKey("build_flavor"); - generator.write(this.buildFlavor); - - generator.writeKey("build_hash"); - generator.write(this.buildHash); - - generator.writeKey("build_snapshot"); - generator.write(this.buildSnapshot); - - generator.writeKey("build_type"); - generator.write(this.buildType); - - generator.writeKey("distribution"); - generator.write(this.distribution); - - generator.writeKey("lucene_version"); - generator.write(this.luceneVersion); - - generator.writeKey("minimum_index_compatibility_version"); - generator.write(this.minimumIndexCompatibilityVersion); - - generator.writeKey("minimum_wire_compatibility_version"); - generator.write(this.minimumWireCompatibilityVersion); - - generator.writeKey("number"); - generator.write(this.number); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OpenSearchVersionInfo}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String buildDate; - - private String buildFlavor; - - private String buildHash; - - private Boolean buildSnapshot; - - private String buildType; - - private String distribution; - - private String luceneVersion; - - private String minimumIndexCompatibilityVersion; - - private String minimumWireCompatibilityVersion; - - private String number; - - /** - * Required - API name: {@code build_date} - */ - public final Builder buildDate(String value) { - this.buildDate = value; - return this; - } - - /** - * API name: {@code build_flavor} - */ - public Builder buildFlavor(String value) { - this.buildFlavor = value; - return this; - } - - /** - * API name: {@code build_hash} - */ - public final Builder buildHash(String value) { - this.buildHash = value; - return this; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public final Builder buildSnapshot(boolean value) { - this.buildSnapshot = value; - return this; - } - - /** - * Required - API name: {@code build_type} - */ - public final Builder buildType(String value) { - this.buildType = value; - return this; - } - - /** - * API name: {@code distribution} - */ - public Builder distribution(String value) { - this.distribution = value; - return this; - } - - /** - * API name: {@code lucene_version} - */ - public final Builder luceneVersion(String value) { - this.luceneVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public final Builder minimumIndexCompatibilityVersion(String value) { - this.minimumIndexCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public final Builder minimumWireCompatibilityVersion(String value) { - this.minimumWireCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code number} - */ - public final Builder number(String value) { - this.number = value; - return this; - } - - /** - * Builds a {@link OpenSearchVersionInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - - public OpenSearchVersionInfo build() { - _checkSingleUse(); - return new OpenSearchVersionInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for OpenSearchVersionInfo - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, OpenSearchVersionInfo::setupOpenSearchVersionInfoDeserializer); - - protected static void setupOpenSearchVersionInfoDeserializer( - ObjectDeserializer op) { - - op.add(Builder::buildDate, JsonpDeserializer.stringDeserializer(), "build_date"); - op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); - op.add(Builder::buildHash, JsonpDeserializer.stringDeserializer(), "build_hash"); - op.add(Builder::buildSnapshot, JsonpDeserializer.booleanDeserializer(), "build_snapshot"); - op.add(Builder::buildType, JsonpDeserializer.stringDeserializer(), "build_type"); - op.add(Builder::distribution, JsonpDeserializer.stringDeserializer(), "distribution"); - op.add(Builder::luceneVersion, JsonpDeserializer.stringDeserializer(), "lucene_version"); - op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_index_compatibility_version"); - op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_wire_compatibility_version"); - op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); - - } + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public String minimumIndexCompatibilityVersion() { + return this.minimumIndexCompatibilityVersion; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public String minimumWireCompatibilityVersion() { + return this.minimumWireCompatibilityVersion; + } + + /** + * Required - API name: {@code number} + */ + public String number() { + return this.number; + } + + /** + * 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("build_date"); + generator.write(this.buildDate); + + generator.writeKey("build_flavor"); + generator.write(this.buildFlavor); + + generator.writeKey("build_hash"); + generator.write(this.buildHash); + + generator.writeKey("build_snapshot"); + generator.write(this.buildSnapshot); + + generator.writeKey("build_type"); + generator.write(this.buildType); + + generator.writeKey("distribution"); + generator.write(this.distribution); + + generator.writeKey("lucene_version"); + generator.write(this.luceneVersion); + + generator.writeKey("minimum_index_compatibility_version"); + generator.write(this.minimumIndexCompatibilityVersion); + + generator.writeKey("minimum_wire_compatibility_version"); + generator.write(this.minimumWireCompatibilityVersion); + + generator.writeKey("number"); + generator.write(this.number); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link OpenSearchVersionInfo}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String buildDate; + + private String buildFlavor; + + private String buildHash; + + private Boolean buildSnapshot; + + private String buildType; + + private String distribution; + + private String luceneVersion; + + private String minimumIndexCompatibilityVersion; + + private String minimumWireCompatibilityVersion; + + private String number; + + /** + * Required - API name: {@code build_date} + */ + public final Builder buildDate(String value) { + this.buildDate = value; + return this; + } + + /** + * API name: {@code build_flavor} + */ + public Builder buildFlavor(String value) { + this.buildFlavor = value; + return this; + } + + /** + * API name: {@code build_hash} + */ + public final Builder buildHash(String value) { + this.buildHash = value; + return this; + } + + /** + * Required - API name: {@code build_snapshot} + */ + public final Builder buildSnapshot(boolean value) { + this.buildSnapshot = value; + return this; + } + + /** + * Required - API name: {@code build_type} + */ + public final Builder buildType(String value) { + this.buildType = value; + return this; + } + + /** + * API name: {@code distribution} + */ + public Builder distribution(String value) { + this.distribution = value; + return this; + } + + /** + * API name: {@code lucene_version} + */ + public final Builder luceneVersion(String value) { + this.luceneVersion = value; + return this; + } + + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public final Builder minimumIndexCompatibilityVersion(String value) { + this.minimumIndexCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public final Builder minimumWireCompatibilityVersion(String value) { + this.minimumWireCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code number} + */ + public final Builder number(String value) { + this.number = value; + return this; + } + + /** + * Builds a {@link OpenSearchVersionInfo}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + + public OpenSearchVersionInfo build() { + _checkSingleUse(); + return new OpenSearchVersionInfo(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for OpenSearchVersionInfo + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + OpenSearchVersionInfo::setupOpenSearchVersionInfoDeserializer + ); + + protected static void setupOpenSearchVersionInfoDeserializer(ObjectDeserializer op) { + + op.add(Builder::buildDate, JsonpDeserializer.stringDeserializer(), "build_date"); + op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); + op.add(Builder::buildHash, JsonpDeserializer.stringDeserializer(), "build_hash"); + op.add(Builder::buildSnapshot, JsonpDeserializer.booleanDeserializer(), "build_snapshot"); + op.add(Builder::buildType, JsonpDeserializer.stringDeserializer(), "build_type"); + op.add(Builder::distribution, JsonpDeserializer.stringDeserializer(), "distribution"); + op.add(Builder::luceneVersion, JsonpDeserializer.stringDeserializer(), "lucene_version"); + op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), "minimum_index_compatibility_version"); + op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), "minimum_wire_compatibility_version"); + op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java index d421b224fe..9ed07791d4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,282 +44,278 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.PluginStats @JsonpDeserializable public class PluginStats implements JsonpSerializable { - private final String classname; - - private final String description; - - private final String opensearchVersion; - - private final List extendedPlugins; - - private final boolean hasNativeController; - - private final String javaVersion; - - private final String name; - - private final String version; - - // --------------------------------------------------------------------------------------------- - - private PluginStats(Builder builder) { - - this.classname = ApiTypeHelper.requireNonNull(builder.classname, this, "classname"); - this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); - this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, - "opensearchVersion"); - this.extendedPlugins = ApiTypeHelper.unmodifiableRequired(builder.extendedPlugins, this, "extendedPlugins"); - this.hasNativeController = ApiTypeHelper.requireNonNull(builder.hasNativeController, this, - "hasNativeController"); - this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - - } - - public static PluginStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code classname} - */ - public final String classname() { - return this.classname; - } - - /** - * Required - API name: {@code description} - */ - public final String description() { - return this.description; - } + private final String classname; + + private final String description; + + private final String opensearchVersion; + + private final List extendedPlugins; + + private final boolean hasNativeController; + + private final String javaVersion; + + private final String name; + + private final String version; + + // --------------------------------------------------------------------------------------------- + + private PluginStats(Builder builder) { + + this.classname = ApiTypeHelper.requireNonNull(builder.classname, this, "classname"); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, "opensearchVersion"); + this.extendedPlugins = ApiTypeHelper.unmodifiableRequired(builder.extendedPlugins, this, "extendedPlugins"); + this.hasNativeController = ApiTypeHelper.requireNonNull(builder.hasNativeController, this, "hasNativeController"); + this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion"); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + + } + + public static PluginStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code classname} + */ + public final String classname() { + return this.classname; + } + + /** + * Required - API name: {@code description} + */ + public final String description() { + return this.description; + } - /** - * API name: {@code opensearch_version} - */ - public String opensearchVersion() { - return this.opensearchVersion; - } + /** + * API name: {@code opensearch_version} + */ + public String opensearchVersion() { + return this.opensearchVersion; + } - /** - * Required - API name: {@code extended_plugins} - */ - public final List extendedPlugins() { - return this.extendedPlugins; - } + /** + * Required - API name: {@code extended_plugins} + */ + public final List extendedPlugins() { + return this.extendedPlugins; + } - /** - * Required - API name: {@code has_native_controller} - */ - public final boolean hasNativeController() { - return this.hasNativeController; - } + /** + * Required - API name: {@code has_native_controller} + */ + public final boolean hasNativeController() { + return this.hasNativeController; + } - /** - * Required - API name: {@code java_version} - */ - public final String javaVersion() { - return this.javaVersion; - } + /** + * Required - API name: {@code java_version} + */ + public final String javaVersion() { + return this.javaVersion; + } - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code version} - */ - public final String version() { - return this.version; - } - - /** - * 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("classname"); - generator.write(this.classname); - - generator.writeKey("description"); - generator.write(this.description); - - generator.writeKey("opensearch_version"); - generator.write(this.opensearchVersion); - - if (ApiTypeHelper.isDefined(this.extendedPlugins)) { - generator.writeKey("extended_plugins"); - generator.writeStartArray(); - for (String item0 : this.extendedPlugins) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("has_native_controller"); - generator.write(this.hasNativeController); - - generator.writeKey("java_version"); - generator.write(this.javaVersion); - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("version"); - generator.write(this.version); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PluginStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String classname; - - private String description; - - private String opensearchVersion; - - private List extendedPlugins; - - private Boolean hasNativeController; - - private String javaVersion; - - private String name; - - private String version; - - /** - * Required - API name: {@code classname} - */ - public final Builder classname(String value) { - this.classname = value; - return this; - } - - /** - * Required - API name: {@code description} - */ - public final Builder description(String value) { - this.description = value; - return this; - } - - /** - * Required - API name: {@code opensearch_version} - */ - public final Builder opensearchVersion(String value) { - this.opensearchVersion = value; - return this; - } - - /** - * Required - API name: {@code extended_plugins} - *

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

- * Adds one or more values to extendedPlugins. - */ - public final Builder extendedPlugins(String value, String... values) { - this.extendedPlugins = _listAdd(this.extendedPlugins, value, values); - return this; - } - - /** - * Required - API name: {@code has_native_controller} - */ - public final Builder hasNativeController(boolean value) { - this.hasNativeController = value; - return this; - } - - /** - * Required - API name: {@code java_version} - */ - public final Builder javaVersion(String value) { - this.javaVersion = value; - return this; - } - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code version} - */ - public final Builder version(String value) { - this.version = value; - return this; - } - - /** - * Builds a {@link PluginStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PluginStats build() { - _checkSingleUse(); - - return new PluginStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PluginStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PluginStats::setupPluginStatsDeserializer); - - protected static void setupPluginStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::classname, JsonpDeserializer.stringDeserializer(), "classname"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); - op.add(Builder::extendedPlugins, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "extended_plugins"); - op.add(Builder::hasNativeController, JsonpDeserializer.booleanDeserializer(), "has_native_controller"); - op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); - - } + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code version} + */ + public final String version() { + return this.version; + } + + /** + * 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("classname"); + generator.write(this.classname); + + generator.writeKey("description"); + generator.write(this.description); + + generator.writeKey("opensearch_version"); + generator.write(this.opensearchVersion); + + if (ApiTypeHelper.isDefined(this.extendedPlugins)) { + generator.writeKey("extended_plugins"); + generator.writeStartArray(); + for (String item0 : this.extendedPlugins) { + generator.write(item0); + + } + generator.writeEnd(); + + } + generator.writeKey("has_native_controller"); + generator.write(this.hasNativeController); + + generator.writeKey("java_version"); + generator.write(this.javaVersion); + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("version"); + generator.write(this.version); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PluginStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String classname; + + private String description; + + private String opensearchVersion; + + private List extendedPlugins; + + private Boolean hasNativeController; + + private String javaVersion; + + private String name; + + private String version; + + /** + * Required - API name: {@code classname} + */ + public final Builder classname(String value) { + this.classname = value; + return this; + } + + /** + * Required - API name: {@code description} + */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code opensearch_version} + */ + public final Builder opensearchVersion(String value) { + this.opensearchVersion = value; + return this; + } + + /** + * Required - API name: {@code extended_plugins} + *

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

+ * Adds one or more values to extendedPlugins. + */ + public final Builder extendedPlugins(String value, String... values) { + this.extendedPlugins = _listAdd(this.extendedPlugins, value, values); + return this; + } + + /** + * Required - API name: {@code has_native_controller} + */ + public final Builder hasNativeController(boolean value) { + this.hasNativeController = value; + return this; + } + + /** + * Required - API name: {@code java_version} + */ + public final Builder javaVersion(String value) { + this.javaVersion = value; + return this; + } + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link PluginStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PluginStats build() { + _checkSingleUse(); + + return new PluginStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PluginStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PluginStats::setupPluginStatsDeserializer + ); + + protected static void setupPluginStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::classname, JsonpDeserializer.stringDeserializer(), "classname"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); + op.add(Builder::extendedPlugins, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "extended_plugins"); + op.add(Builder::hasNativeController, JsonpDeserializer.booleanDeserializer(), "has_native_controller"); + op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java index 6b3df16c7e..d5ba4b1224 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,266 +44,265 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.QueryCacheStats @JsonpDeserializable public class QueryCacheStats implements JsonpSerializable { - private final int cacheCount; - - private final int cacheSize; - - private final int evictions; - - private final int hitCount; - - @Nullable - private final String memorySize; - - private final int memorySizeInBytes; - - private final int missCount; - - private final int totalCount; - - // --------------------------------------------------------------------------------------------- - - private QueryCacheStats(Builder builder) { - - this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); - this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); - - } - - public static QueryCacheStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code cache_count} - */ - public final int cacheCount() { - return this.cacheCount; - } + private final int cacheCount; + + private final int cacheSize; + + private final int evictions; + + private final int hitCount; + + @Nullable + private final String memorySize; + + private final int memorySizeInBytes; + + private final int missCount; + + private final int totalCount; + + // --------------------------------------------------------------------------------------------- + + private QueryCacheStats(Builder builder) { + + this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); + this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); + this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); + this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); + + } + + public static QueryCacheStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code cache_count} + */ + public final int cacheCount() { + return this.cacheCount; + } - /** - * Required - API name: {@code cache_size} - */ - public final int cacheSize() { - return this.cacheSize; - } + /** + * Required - API name: {@code cache_size} + */ + public final int cacheSize() { + return this.cacheSize; + } - /** - * Required - API name: {@code evictions} - */ - public final int evictions() { - return this.evictions; - } + /** + * Required - API name: {@code evictions} + */ + public final int evictions() { + return this.evictions; + } - /** - * Required - API name: {@code hit_count} - */ - public final int hitCount() { - return this.hitCount; - } + /** + * Required - API name: {@code hit_count} + */ + public final int hitCount() { + return this.hitCount; + } - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final int memorySizeInBytes() { - return this.memorySizeInBytes; - } + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final int memorySizeInBytes() { + return this.memorySizeInBytes; + } - /** - * Required - API name: {@code miss_count} - */ - public final int missCount() { - return this.missCount; - } - - /** - * Required - API name: {@code total_count} - */ - public final int totalCount() { - return this.totalCount; - } - - /** - * 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("cache_count"); - generator.write(this.cacheCount); - - generator.writeKey("cache_size"); - generator.write(this.cacheSize); - - generator.writeKey("evictions"); - generator.write(this.evictions); - - generator.writeKey("hit_count"); - generator.write(this.hitCount); - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - generator.writeKey("miss_count"); - generator.write(this.missCount); - - generator.writeKey("total_count"); - generator.write(this.totalCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link QueryCacheStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer cacheCount; - - private Integer cacheSize; - - private Integer evictions; - - private Integer hitCount; - - @Nullable - private String memorySize; - - private Integer memorySizeInBytes; - - private Integer missCount; - - private Integer totalCount; - - /** - * Required - API name: {@code cache_count} - */ - public final Builder cacheCount(int value) { - this.cacheCount = value; - return this; - } - - /** - * Required - API name: {@code cache_size} - */ - public final Builder cacheSize(int value) { - this.cacheSize = value; - return this; - } - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(int value) { - this.evictions = value; - return this; - } - - /** - * Required - API name: {@code hit_count} - */ - public final Builder hitCount(int value) { - this.hitCount = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(int value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code miss_count} - */ - public final Builder missCount(int value) { - this.missCount = value; - return this; - } - - /** - * Required - API name: {@code total_count} - */ - public final Builder totalCount(int value) { - this.totalCount = value; - return this; - } - - /** - * Builds a {@link QueryCacheStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public QueryCacheStats build() { - _checkSingleUse(); - - return new QueryCacheStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link QueryCacheStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - QueryCacheStats::setupQueryCacheStatsDeserializer); - - protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::cacheCount, JsonpDeserializer.integerDeserializer(), "cache_count"); - op.add(Builder::cacheSize, JsonpDeserializer.integerDeserializer(), "cache_size"); - op.add(Builder::evictions, JsonpDeserializer.integerDeserializer(), "evictions"); - op.add(Builder::hitCount, JsonpDeserializer.integerDeserializer(), "hit_count"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.integerDeserializer(), "memory_size_in_bytes"); - op.add(Builder::missCount, JsonpDeserializer.integerDeserializer(), "miss_count"); - op.add(Builder::totalCount, JsonpDeserializer.integerDeserializer(), "total_count"); - - } + /** + * Required - API name: {@code miss_count} + */ + public final int missCount() { + return this.missCount; + } + + /** + * Required - API name: {@code total_count} + */ + public final int totalCount() { + return this.totalCount; + } + + /** + * 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("cache_count"); + generator.write(this.cacheCount); + + generator.writeKey("cache_size"); + generator.write(this.cacheSize); + + generator.writeKey("evictions"); + generator.write(this.evictions); + + generator.writeKey("hit_count"); + generator.write(this.hitCount); + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + generator.writeKey("miss_count"); + generator.write(this.missCount); + + generator.writeKey("total_count"); + generator.write(this.totalCount); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryCacheStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer cacheCount; + + private Integer cacheSize; + + private Integer evictions; + + private Integer hitCount; + + @Nullable + private String memorySize; + + private Integer memorySizeInBytes; + + private Integer missCount; + + private Integer totalCount; + + /** + * Required - API name: {@code cache_count} + */ + public final Builder cacheCount(int value) { + this.cacheCount = value; + return this; + } + + /** + * Required - API name: {@code cache_size} + */ + public final Builder cacheSize(int value) { + this.cacheSize = value; + return this; + } + + /** + * Required - API name: {@code evictions} + */ + public final Builder evictions(int value) { + this.evictions = value; + return this; + } + + /** + * Required - API name: {@code hit_count} + */ + public final Builder hitCount(int value) { + this.hitCount = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(int value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code miss_count} + */ + public final Builder missCount(int value) { + this.missCount = value; + return this; + } + + /** + * Required - API name: {@code total_count} + */ + public final Builder totalCount(int value) { + this.totalCount = value; + return this; + } + + /** + * Builds a {@link QueryCacheStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryCacheStats build() { + _checkSingleUse(); + + return new QueryCacheStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryCacheStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + QueryCacheStats::setupQueryCacheStatsDeserializer + ); + + protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::cacheCount, JsonpDeserializer.integerDeserializer(), "cache_count"); + op.add(Builder::cacheSize, JsonpDeserializer.integerDeserializer(), "cache_size"); + op.add(Builder::evictions, JsonpDeserializer.integerDeserializer(), "evictions"); + op.add(Builder::hitCount, JsonpDeserializer.integerDeserializer(), "hit_count"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.integerDeserializer(), "memory_size_in_bytes"); + op.add(Builder::missCount, JsonpDeserializer.integerDeserializer(), "miss_count"); + op.add(Builder::totalCount, JsonpDeserializer.integerDeserializer(), "total_count"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java index 475d640048..80f4d182ff 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,171 +44,169 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RecoveryStats @JsonpDeserializable public class RecoveryStats implements JsonpSerializable { - private final long currentAsSource; + private final long currentAsSource; - private final long currentAsTarget; + private final long currentAsTarget; - @Nullable - private final String throttleTime; + @Nullable + private final String throttleTime; - private final long throttleTimeInMillis; + private final long throttleTimeInMillis; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private RecoveryStats(Builder builder) { + private RecoveryStats(Builder builder) { - this.currentAsSource = ApiTypeHelper.requireNonNull(builder.currentAsSource, this, "currentAsSource"); - this.currentAsTarget = ApiTypeHelper.requireNonNull(builder.currentAsTarget, this, "currentAsTarget"); - this.throttleTime = builder.throttleTime; - this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, - "throttleTimeInMillis"); - - } - - public static RecoveryStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current_as_source} - */ - public final long currentAsSource() { - return this.currentAsSource; - } - - /** - * Required - API name: {@code current_as_target} - */ - public final long currentAsTarget() { - return this.currentAsTarget; - } - - /** - * API name: {@code throttle_time} - */ - @Nullable - public final String throttleTime() { - return this.throttleTime; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final long throttleTimeInMillis() { - return this.throttleTimeInMillis; - } - - /** - * 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("current_as_source"); - generator.write(this.currentAsSource); - - generator.writeKey("current_as_target"); - generator.write(this.currentAsTarget); - - if (this.throttleTime != null) { - generator.writeKey("throttle_time"); - generator.write(this.throttleTime); - - } - generator.writeKey("throttle_time_in_millis"); - generator.write(this.throttleTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RecoveryStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long currentAsSource; - - private Long currentAsTarget; - - @Nullable - private String throttleTime; - - private Long throttleTimeInMillis; - - /** - * Required - API name: {@code current_as_source} - */ - public final Builder currentAsSource(long value) { - this.currentAsSource = value; - return this; - } - - /** - * Required - API name: {@code current_as_target} - */ - public final Builder currentAsTarget(long value) { - this.currentAsTarget = value; - return this; - } - - /** - * API name: {@code throttle_time} - */ - public final Builder throttleTime(@Nullable String value) { - this.throttleTime = value; - return this; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final Builder throttleTimeInMillis(long value) { - this.throttleTimeInMillis = value; - return this; - } - - /** - * Builds a {@link RecoveryStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RecoveryStats build() { - _checkSingleUse(); - - return new RecoveryStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RecoveryStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RecoveryStats::setupRecoveryStatsDeserializer); - - protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); - op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); - op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); - - } + this.currentAsSource = ApiTypeHelper.requireNonNull(builder.currentAsSource, this, "currentAsSource"); + this.currentAsTarget = ApiTypeHelper.requireNonNull(builder.currentAsTarget, this, "currentAsTarget"); + this.throttleTime = builder.throttleTime; + this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); + + } + + public static RecoveryStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current_as_source} + */ + public final long currentAsSource() { + return this.currentAsSource; + } + + /** + * Required - API name: {@code current_as_target} + */ + public final long currentAsTarget() { + return this.currentAsTarget; + } + + /** + * API name: {@code throttle_time} + */ + @Nullable + public final String throttleTime() { + return this.throttleTime; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final long throttleTimeInMillis() { + return this.throttleTimeInMillis; + } + + /** + * 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("current_as_source"); + generator.write(this.currentAsSource); + + generator.writeKey("current_as_target"); + generator.write(this.currentAsTarget); + + if (this.throttleTime != null) { + generator.writeKey("throttle_time"); + generator.write(this.throttleTime); + + } + generator.writeKey("throttle_time_in_millis"); + generator.write(this.throttleTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RecoveryStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long currentAsSource; + + private Long currentAsTarget; + + @Nullable + private String throttleTime; + + private Long throttleTimeInMillis; + + /** + * Required - API name: {@code current_as_source} + */ + public final Builder currentAsSource(long value) { + this.currentAsSource = value; + return this; + } + + /** + * Required - API name: {@code current_as_target} + */ + public final Builder currentAsTarget(long value) { + this.currentAsTarget = value; + return this; + } + + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(@Nullable String value) { + this.throttleTime = value; + return this; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final Builder throttleTimeInMillis(long value) { + this.throttleTimeInMillis = value; + return this; + } + + /** + * Builds a {@link RecoveryStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RecoveryStats build() { + _checkSingleUse(); + + return new RecoveryStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RecoveryStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RecoveryStats::setupRecoveryStatsDeserializer + ); + + protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); + op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); + op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java index 190d4c62c5..b1b78d0305 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java @@ -37,23 +37,23 @@ @JsonpDeserializable public enum Refresh implements JsonEnum { - True("true"), + True("true"), - False("false"), + False("false"), - WaitFor("wait_for"), + WaitFor("wait_for"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Refresh(String jsonValue) { - this.jsonValue = jsonValue; - } + Refresh(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Refresh.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Refresh.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java index f811195f56..bfa6015a4b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,221 +44,217 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RefreshStats - @JsonpDeserializable public class RefreshStats implements JsonpSerializable { - private final long externalTotal; - - private final long externalTotalTimeInMillis; - - private final long listeners; - - private final long total; - - @Nullable - private final String totalTime; + private final long externalTotal; + + private final long externalTotalTimeInMillis; + + private final long listeners; + + private final long total; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; - private final long totalTimeInMillis; + // --------------------------------------------------------------------------------------------- - // --------------------------------------------------------------------------------------------- + private RefreshStats(Builder builder) { - private RefreshStats(Builder builder) { + this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal"); + this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, "externalTotalTimeInMillis"); + this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal"); - this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, - "externalTotalTimeInMillis"); - this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + } - } + public static RefreshStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - public static RefreshStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + /** + * Required - API name: {@code external_total} + */ + public final long externalTotal() { + return this.externalTotal; + } - /** - * Required - API name: {@code external_total} - */ - public final long externalTotal() { - return this.externalTotal; - } + /** + * Required - API name: {@code external_total_time_in_millis} + */ + public final long externalTotalTimeInMillis() { + return this.externalTotalTimeInMillis; + } - /** - * Required - API name: {@code external_total_time_in_millis} - */ - public final long externalTotalTimeInMillis() { - return this.externalTotalTimeInMillis; - } + /** + * Required - API name: {@code listeners} + */ + public final long listeners() { + return this.listeners; + } - /** - * Required - API name: {@code listeners} - */ - public final long listeners() { - return this.listeners; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * 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("external_total"); - generator.write(this.externalTotal); - - generator.writeKey("external_total_time_in_millis"); - generator.write(this.externalTotalTimeInMillis); - - generator.writeKey("listeners"); - generator.write(this.listeners); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RefreshStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long externalTotal; - - private Long externalTotalTimeInMillis; - - private Long listeners; - - private Long total; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code external_total} - */ - public final Builder externalTotal(long value) { - this.externalTotal = value; - return this; - } - - /** - * Required - API name: {@code external_total_time_in_millis} - */ - public final Builder externalTotalTimeInMillis(long value) { - this.externalTotalTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code listeners} - */ - public final Builder listeners(long value) { - this.listeners = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link RefreshStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RefreshStats build() { - _checkSingleUse(); - - return new RefreshStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RefreshStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RefreshStats::setupRefreshStatsDeserializer); - - protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); - op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), - "external_total_time_in_millis"); - op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * 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("external_total"); + generator.write(this.externalTotal); + + generator.writeKey("external_total_time_in_millis"); + generator.write(this.externalTotalTimeInMillis); + + generator.writeKey("listeners"); + generator.write(this.listeners); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RefreshStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long externalTotal; + + private Long externalTotalTimeInMillis; + + private Long listeners; + + private Long total; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code external_total} + */ + public final Builder externalTotal(long value) { + this.externalTotal = value; + return this; + } + + /** + * Required - API name: {@code external_total_time_in_millis} + */ + public final Builder externalTotalTimeInMillis(long value) { + this.externalTotalTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code listeners} + */ + public final Builder listeners(long value) { + this.listeners = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link RefreshStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RefreshStats build() { + _checkSingleUse(); + + return new RefreshStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RefreshStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RefreshStats::setupRefreshStatsDeserializer + ); + + protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); + op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), "external_total_time_in_millis"); + op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java index bb57c5de8c..165c5258a0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java @@ -36,16 +36,12 @@ // typedef: _types.RequestBase - public abstract class RequestBase { - public RequestBase() { - } + public RequestBase() {} - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - protected abstract BuilderT self(); + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + protected abstract BuilderT self(); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java index ace6ed3e06..1b7a25c28f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,194 +44,193 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RequestCacheStats @JsonpDeserializable public class RequestCacheStats implements JsonpSerializable { - private final long evictions; + private final long evictions; - private final long hitCount; + private final long hitCount; - @Nullable - private final String memorySize; + @Nullable + private final String memorySize; - private final long memorySizeInBytes; + private final long memorySizeInBytes; - private final long missCount; + private final long missCount; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private RequestCacheStats(Builder builder) { + private RequestCacheStats(Builder builder) { - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); + this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - } + } - public static RequestCacheStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static RequestCacheStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code evictions} - */ - public final long evictions() { - return this.evictions; - } - - /** - * Required - API name: {@code hit_count} - */ - public final long hitCount() { - return this.hitCount; - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * Required - API name: {@code miss_count} - */ - public final long missCount() { - return this.missCount; - } - - /** - * 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("evictions"); - generator.write(this.evictions); - - generator.writeKey("hit_count"); - generator.write(this.hitCount); - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - generator.writeKey("miss_count"); - generator.write(this.missCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RequestCacheStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long evictions; - - private Long hitCount; - - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - private Long missCount; - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(long value) { - this.evictions = value; - return this; - } - - /** - * Required - API name: {@code hit_count} - */ - public final Builder hitCount(long value) { - this.hitCount = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code miss_count} - */ - public final Builder missCount(long value) { - this.missCount = value; - return this; - } - - /** - * Builds a {@link RequestCacheStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RequestCacheStats build() { - _checkSingleUse(); - - return new RequestCacheStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RequestCacheStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, RequestCacheStats::setupRequestCacheStatsDeserializer); - - protected static void setupRequestCacheStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); - op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); - - } + /** + * Required - API name: {@code evictions} + */ + public final long evictions() { + return this.evictions; + } + + /** + * Required - API name: {@code hit_count} + */ + public final long hitCount() { + return this.hitCount; + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * Required - API name: {@code miss_count} + */ + public final long missCount() { + return this.missCount; + } + + /** + * 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("evictions"); + generator.write(this.evictions); + + generator.writeKey("hit_count"); + generator.write(this.hitCount); + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + generator.writeKey("miss_count"); + generator.write(this.missCount); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RequestCacheStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long evictions; + + private Long hitCount; + + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + private Long missCount; + + /** + * Required - API name: {@code evictions} + */ + public final Builder evictions(long value) { + this.evictions = value; + return this; + } + + /** + * Required - API name: {@code hit_count} + */ + public final Builder hitCount(long value) { + this.hitCount = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code miss_count} + */ + public final Builder missCount(long value) { + this.missCount = value; + return this; + } + + /** + * Builds a {@link RequestCacheStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RequestCacheStats build() { + _checkSingleUse(); + + return new RequestCacheStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RequestCacheStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RequestCacheStats::setupRequestCacheStatsDeserializer + ); + + protected static void setupRequestCacheStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java index 6d2a026a12..54b408cf76 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java @@ -37,27 +37,27 @@ @JsonpDeserializable public enum Result implements JsonEnum { - Created("created"), + Created("created"), - Updated("updated"), + Updated("updated"), - Deleted("deleted"), + Deleted("deleted"), - NotFound("not_found"), + NotFound("not_found"), - NoOp("noop"), + NoOp("noop"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Result(String jsonValue) { - this.jsonValue = jsonValue; - } + Result(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Result.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Result.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java index 677fbd2707..235a05576c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.Retries @JsonpDeserializable public class Retries implements JsonpSerializable { - private final long bulk; - - private final long search; - - // --------------------------------------------------------------------------------------------- + private final long bulk; - private Retries(Builder builder) { + private final long search; + + // --------------------------------------------------------------------------------------------- - this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); - this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); + private Retries(Builder builder) { - } + this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); + this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); - public static Retries of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code bulk} - */ - public final long bulk() { - return this.bulk; - } + public static Retries of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code search} - */ - public final long search() { - return this.search; - } + /** + * Required - API name: {@code bulk} + */ + public final long bulk() { + return this.bulk; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code search} + */ + public final long search() { + return this.search; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("bulk"); - generator.write(this.bulk); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("search"); - generator.write(this.search); + generator.writeKey("bulk"); + generator.write(this.bulk); - } + generator.writeKey("search"); + generator.write(this.search); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link Retries}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long bulk; + /** + * Builder for {@link Retries}. + */ - private Long search; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long bulk; - /** - * Required - API name: {@code bulk} - */ - public final Builder bulk(long value) { - this.bulk = value; - return this; - } + private Long search; - /** - * Required - API name: {@code search} - */ - public final Builder search(long value) { - this.search = value; - return this; - } + /** + * Required - API name: {@code bulk} + */ + public final Builder bulk(long value) { + this.bulk = value; + return this; + } - /** - * Builds a {@link Retries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Retries build() { - _checkSingleUse(); + /** + * Required - API name: {@code search} + */ + public final Builder search(long value) { + this.search = value; + return this; + } - return new Retries(this); - } - } + /** + * Builds a {@link Retries}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Retries build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new Retries(this); + } + } - /** - * Json deserializer for {@link Retries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Retries::setupRetriesDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupRetriesDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link Retries} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Retries::setupRetriesDeserializer + ); - op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); - op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); + protected static void setupRetriesDeserializer(ObjectDeserializer op) { - } + op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); + op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java index 5e1a86fc87..b432f1dfd1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,107 +43,105 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.ScoreSort @JsonpDeserializable public class ScoreSort implements SortOptionsVariant, JsonpSerializable { - @Nullable - private final SortOrder order; - - // --------------------------------------------------------------------------------------------- - - private ScoreSort(Builder builder) { - - this.order = builder.order; - - } - - public static ScoreSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.Doc; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ScoreSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private SortOrder order; - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * Builds a {@link ScoreSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ScoreSort build() { - _checkSingleUse(); - - return new ScoreSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ScoreSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ScoreSort::setupScoreSortDeserializer); - - protected static void setupScoreSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - - } + @Nullable + private final SortOrder order; + + // --------------------------------------------------------------------------------------------- + + private ScoreSort(Builder builder) { + + this.order = builder.order; + + } + + public static ScoreSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * SortOptions variant kind. + */ + @Override + public SortOptions.Kind _sortOptionsKind() { + return SortOptions.Kind.Doc; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ScoreSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private SortOrder order; + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * Builds a {@link ScoreSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ScoreSort build() { + _checkSingleUse(); + + return new ScoreSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ScoreSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ScoreSort::setupScoreSortDeserializer + ); + + protected static void setupScoreSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java index 0f6250be36..6f969b8f5a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,127 +44,125 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.Script @JsonpDeserializable public class Script implements TaggedUnion, JsonpSerializable { - public enum Kind { - Inline, Stored - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private Script(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private Script(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Script of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code inline}? - */ - public boolean isInline() { - return _kind == Kind.Inline; - } - - /** - * Get the {@code inline} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code inline} kind. - */ - public InlineScript inline() { - return TaggedUnionUtils.get(this, Kind.Inline); - } - - /** - * Is this variant instance of kind {@code stored}? - */ - public boolean isStored() { - return _kind == Kind.Stored; - } - - /** - * Get the {@code stored} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code stored} kind. - */ - public StoredScriptId stored() { - return TaggedUnionUtils.get(this, Kind.Stored); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder