From 786e58d422717e41b56d35715899183116d44cb9 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 21 Jan 2025 11:24:10 +1300 Subject: [PATCH] Generate aggregation types (#1392) * Generating Signed-off-by: Thomas Farr * Re-generate Signed-off-by: Thomas Farr * Generating 2 Signed-off-by: Thomas Farr * Generating 3 Signed-off-by: Thomas Farr * Generating 4 Signed-off-by: Thomas Farr * Fix build Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- UPGRADING.md | 20 +- .../opensearch/_types/GeoHashPrecision.java | 136 ++- .../AdjacencyMatrixAggregation.java | 119 ++- .../_types/aggregations/Aggregation.java | 683 ++++++------ .../_types/aggregations/AggregationBase.java | 66 +- .../aggregations/AggregationBuilders.java | 258 ++--- .../_types/aggregations/AggregationRange.java | 103 +- .../aggregations/AggregationVariant.java | 11 +- .../AutoDateHistogramAggregation.java | 190 +++- .../aggregations/AverageAggregation.java | 73 +- .../AverageBucketAggregation.java | 73 +- .../aggregations/BoxplotAggregation.java | 102 +- .../aggregations/BucketAggregationBase.java | 47 +- .../aggregations/BucketPathAggregation.java} | 112 +- .../aggregations/BucketScriptAggregation.java | 97 +- .../BucketSelectorAggregation.java | 95 +- .../aggregations/BucketSortAggregation.java | 138 ++- .../_types/aggregations/BucketsPath.java | 74 +- .../_types/aggregations/CalendarInterval.java | 22 +- .../aggregations/CardinalityAggregation.java | 139 ++- .../CardinalityExecutionMode.java} | 45 +- .../aggregations/ChiSquareHeuristic.java | 98 +- .../aggregations/ChildrenAggregation.java | 94 +- .../ClassificationInferenceOptions.java | 155 ++- .../aggregations/CompositeAggregation.java | 173 ++- .../CompositeAggregationSource.java | 223 ++-- ...mpositeDateHistogramAggregationSource.java | 354 +++++++ ...CompositeGeoTileGridAggregationSource.java | 238 +++++ .../CompositeHistogramAggregationSource.java | 191 ++++ .../CompositeTermsAggregationSource.java | 155 +++ .../aggregations/CompositeValuesSource.java | 239 +++-- .../CumulativeCardinalityAggregation.java | 75 +- .../CumulativeSumAggregation.java | 73 +- .../DateHistogramAggregation.java | 370 +++++-- .../aggregations/DateRangeAggregation.java | 218 +++- .../aggregations/DateRangeExpression.java | 97 +- .../aggregations/DerivativeAggregation.java | 73 +- .../DiversifiedSamplerAggregation.java | 190 +++- .../aggregations/EwmaModelSettings.java | 71 +- .../EwmaMovingAverageAggregation.java | 98 +- .../ExtendedStatsAggregation.java | 96 +- .../ExtendedStatsBucketAggregation.java | 100 +- .../_types/aggregations/FieldDateMath.java | 83 +- .../aggregations/FiltersAggregation.java | 192 +++- .../FormatMetricAggregationBase.java | 49 +- .../FormattableMetricAggregation.java | 49 +- .../_types/aggregations/GapPolicy.java | 14 +- .../aggregations/GeoBoundsAggregation.java | 100 +- .../aggregations/GeoCentroidAggregation.java | 102 +- .../aggregations/GeoDistanceAggregation.java | 148 ++- .../aggregations/GeoHashGridAggregation.java | 144 ++- .../aggregations/GeoLineAggregation.java | 228 ++-- .../_types/aggregations/GeoLinePoint.java | 71 +- .../_types/aggregations/GeoLineSort.java | 71 +- .../aggregations/GeoTileGridAggregation.java | 205 +++- .../aggregations/GlobalAggregation.java | 71 +- .../GoogleNormalizedDistanceHeuristic.java | 84 +- .../_types/aggregations/HdrMethod.java | 77 +- .../aggregations/HistogramAggregation.java | 362 +++++-- .../_types/aggregations/HistogramOrder.java | 76 +- .../aggregations/HoltLinearModelSettings.java | 81 +- .../HoltMovingAverageAggregation.java | 98 +- .../HoltWintersModelSettings.java | 113 +- .../HoltWintersMovingAverageAggregation.java | 98 +- .../_types/aggregations/HoltWintersType.java | 12 +- .../aggregations/InferenceAggregation.java | 134 ++- .../_types/aggregations/InferenceConfig.java | 229 ++++ .../InferenceConfigBuilders.java} | 30 +- .../aggregations/InferenceConfigVariant.java} | 21 +- .../aggregations/IpRangeAggregation.java | 124 ++- .../aggregations/IpRangeAggregationRange.java | 106 +- .../LinearMovingAverageAggregation.java | 98 +- .../aggregations/MatrixAggregation.java | 81 +- .../aggregations/MatrixStatsAggregation.java | 93 +- .../_types/aggregations/MaxAggregation.java | 71 +- .../aggregations/MaxBucketAggregation.java | 73 +- .../MedianAbsoluteDeviationAggregation.java | 100 +- .../aggregations/MetricAggregationBase.java | 71 +- .../_types/aggregations/MinAggregation.java | 73 +- .../aggregations/MinBucketAggregation.java | 73 +- .../_types/aggregations/MinimumInterval.java | 18 +- .../aggregations/MissingAggregation.java | 104 +- .../_types/aggregations/MissingOrder.java | 16 +- .../MovingAverageAggregation.java | 95 +- .../MovingAverageAggregationBase.java | 65 +- .../MovingAverageAggregationBuilders.java | 23 +- .../MovingAverageAggregationVariant.java | 10 +- .../MovingFunctionAggregation.java | 128 ++- .../MovingPercentilesAggregation.java | 174 ++- .../_types/aggregations/MultiTermLookup.java | 112 +- .../aggregations/MultiTermsAggregation.java | 517 +++++++++ .../MutualInformationHeuristic.java | 98 +- .../aggregations/NestedAggregation.java | 92 +- .../aggregations/NormalizeAggregation.java | 93 +- .../_types/aggregations/NormalizeMethod.java | 18 +- .../aggregations/ParentAggregation.java | 92 +- .../PercentileRanksAggregation.java | 241 +++-- .../aggregations/PercentilesAggregation.java | 209 +++- .../PercentilesBucketAggregation.java | 111 +- .../aggregations/PipelineAggregationBase.java | 174 +++ .../_types/aggregations/RangeAggregation.java | 243 ++++- .../aggregations/RareTermsAggregation.java | 163 ++- .../_types/aggregations/RateAggregation.java | 129 ++- .../_types/aggregations/RateMode.java | 12 +- .../RegressionInferenceOptions.java | 141 ++- .../ReverseNestedAggregation.java | 92 +- .../aggregations/SamplerAggregation.java | 100 +- .../SamplerAggregationExecutionHint.java | 14 +- .../aggregations/ScriptedHeuristic.java | 74 +- .../ScriptedMetricAggregation.java | 160 ++- .../SerialDifferencingAggregation.java | 98 +- .../SignificantTermsAggregation.java | 323 ++++-- .../SignificantTextAggregation.java | 351 +++++-- .../SimpleMovingAverageAggregation.java | 98 +- .../_types/aggregations/StatsAggregation.java | 73 +- .../aggregations/StatsBucketAggregation.java | 73 +- .../aggregations/StringStatsAggregation.java | 98 +- .../_types/aggregations/SumAggregation.java | 71 +- .../aggregations/SumBucketAggregation.java | 73 +- .../_types/aggregations/TDigest.java | 79 +- .../_types/aggregations/TTestAggregation.java | 109 +- .../_types/aggregations/TTestType.java | 14 +- .../_types/aggregations/TermsAggregation.java | 356 +++++-- .../TermsAggregationCollectMode.java | 12 +- .../TermsAggregationExecutionHint.java | 12 +- .../_types/aggregations/TermsExclude.java | 131 ++- .../_types/aggregations/TermsInclude.java | 123 ++- .../aggregations/TermsIncludeBuilders.java | 20 +- .../_types/aggregations/TermsPartition.java | 94 +- .../_types/aggregations/TestPopulation.java | 139 ++- .../aggregations/TopHitsAggregation.java | 326 ++++-- .../aggregations/TopMetricsAggregation.java | 150 ++- .../_types/aggregations/TopMetricsValue.java | 71 +- .../aggregations/ValueCountAggregation.java | 73 +- .../_types/aggregations/ValueType.java | 28 +- .../VariableWidthHistogramAggregation.java | 191 +++- .../WeightedAverageAggregation.java | 129 ++- .../aggregations/WeightedAverageValue.java | 96 +- .../client/opensearch/core/CountRequest.java | 9 +- .../opensearch/ml/AlgorithmOperations.java | 335 ++++++ .../client/opensearch/ml/Deploy.java | 247 +++++ .../opensearch/ml/GetAllMemoriesRequest.java | 18 + .../client/opensearch/ml/GetStatsRequest.java | 223 ++++ .../opensearch/ml/GetStatsResponse.java | 472 +++++++++ .../client/opensearch/ml/ModelProfile.java | 207 +++- .../opensearch/ml/NodeStatsDetails.java | 500 +++++++++ .../ml/OpenSearchMlAsyncClient.java | 26 + .../opensearch/ml/OpenSearchMlClient.java | 26 + .../client/opensearch/ml/Predict.java | 247 +++++ .../client/opensearch/ml/Register.java | 247 +++++ .../client/opensearch/ml/Train.java | 247 +++++ .../client/opensearch/ml/Undeploy.java | 247 +++++ .../_types/GeoHashPrecisionBuilders.java | 46 - ...mpositeDateHistogramAggregationSource.java | 218 ---- ...CompositeGeoTileGridAggregationSource.java | 150 --- .../CompositeHistogramAggregationSource.java | 107 -- .../CompositeTermsAggregationSource.java | 84 -- .../_types/aggregations/InferenceConfig.java | 197 ---- .../aggregations/MultiTermsAggregation.java | 196 ---- .../opensearch/model/ClassStructureTest.java | 6 +- .../integTest/AbstractRequestIT.java | 2 +- java-codegen/opensearch-openapi.yaml | 990 +++++++++--------- .../client/codegen/model/EnumShape.java | 13 +- .../client/codegen/model/ObjectShapeBase.java | 4 + .../client/codegen/model/RequestShape.java | 1 + .../client/codegen/model/SpecTransformer.java | 29 +- .../codegen/model/TaggedUnionShape.java | 4 +- .../opensearch/client/codegen/model/Type.java | 4 + .../client/codegen/model/Types.java | 25 + .../codegen/model/overrides/Overrides.java | 30 +- .../codegen/openapi/OpenApiParameter.java | 14 + .../client/codegen/openapi/OpenApiSchema.java | 11 + .../templates/TaggedUnionShape.mustache | 9 +- .../templates/Type/deserializer.mustache | 7 +- 174 files changed, 16868 insertions(+), 5148 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java (87%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java (75%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java (82%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java (65%) rename java-client/src/{main/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java => generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketPathAggregation.java} (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java (76%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java (56%) rename java-client/src/{main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPathBuilders.java => generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityExecutionMode.java} (52%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java (69%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java (55%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeExpression.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java (75%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java (82%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoHashGridAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HistogramOrder.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java (67%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java rename java-client/src/{main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMathBuilders.java => generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigBuilders.java} (55%) rename java-client/src/{main/java/org/opensearch/client/opensearch/_types/aggregations/TermsExcludeBuilders.java => generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigVariant.java} (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java (74%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java (82%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java (56%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/RateAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TTestType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsAggregation.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsAggregationCollectMode.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsAggregationExecutionHint.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsExclude.java (72%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java (73%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java (75%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java (69%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/AlgorithmOperations.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Deploy.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/NodeStatsDetails.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Predict.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Register.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Train.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Undeploy.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java diff --git a/UPGRADING.md b/UPGRADING.md index 8d0f41ecc3..7150fd76f5 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -561,4 +561,22 @@ After: - The `file` property has been removed as it is not supported by OpenSearch. ### SearchShardsRequest -- The `routing` property is now of type `List` instead of `String`. \ No newline at end of file +- The `routing` property is now of type `List` instead of `String`. + +### CompositeAggregation +- The `after` property is now of type `Map` instead of `Map`. + +### CompositeDateHistogramAggregationSource +- The `offset` property has been corrected to be of type `Time` instead of `Long`. + +### CompositeValuesSource +- The `format` property has been removed as it only applies to certain subclasses. + +### InferenceConfig +- The `InferenceConfig` class has been changed to a tagged union. + +### SignificantTermsAggregation +- The `include` property is now of type `TermsInclude` instead of `List`. + +### SignificantTextAggregation +- The `include` property is now of type `TermsInclude` instead of `List`. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java index 0b25072c7e..6f1a643a93 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java @@ -30,14 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.PlainJsonSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -48,17 +56,18 @@ // typedef: _types.GeoHashPrecision /** - * A precision that can be expressed as a geohash length between 1 and 12, or a - * distance measure like "1km", "10m". - * + * The level of geohash precision, which can be expressed as a geohash length between 1 and 12 or as a distance measure, such as + * "1km" or "10m". */ @JsonpDeserializable -public class GeoHashPrecision implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoHashPrecision implements TaggedUnion, PlainJsonSerializable { + /** + * {@link GeoHashPrecision} variant kinds. + */ public enum Kind { - GeohashLength, - Distance - + Distance, + GeohashLength } private final Kind _kind; @@ -79,61 +88,56 @@ private GeoHashPrecision(Kind kind, Object value) { this._value = value; } + 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(); + } + public String _toJsonString() { switch (_kind) { - case GeohashLength: - return this.geohashLength().toString(); case Distance: return this.distance(); - + case GeohashLength: + return String.valueOf(this.geohashLength()); 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}? + * Is this variant instance of kind {@code distance}? */ - public boolean isGeohashLength() { - return _kind == Kind.GeohashLength; + public boolean isDistance() { + return _kind == Kind.Distance; } /** - * Get the {@code geohash_length} variant value. + * Get the {@code distance} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash_length} kind. + * @throws IllegalStateException if the current variant is not the {@code distance} kind. */ - public Number geohashLength() { - return TaggedUnionUtils.get(this, Kind.GeohashLength); + public String distance() { + return TaggedUnionUtils.get(this, Kind.Distance); } /** - * Is this variant instance of kind {@code distance}? + * Is this variant instance of kind {@code geohash_length}? */ - public boolean isDistance() { - return _kind == Kind.Distance; + public boolean isGeohashLength() { + return _kind == Kind.GeohashLength; } /** - * Get the {@code distance} variant value. + * Get the {@code geohash_length} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code distance} kind. + * @throws IllegalStateException if the current variant is not the {@code geohash_length} kind. */ - public String distance() { - return TaggedUnionUtils.get(this, Kind.Distance); + public Integer geohashLength() { + return TaggedUnionUtils.get(this, Kind.GeohashLength); } @Override @@ -142,27 +146,35 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { ((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; + case GeohashLength: + generator.write(((Integer) this._value)); break; } } + } + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); } 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 Builder() {} + + private Builder(GeoHashPrecision o) { + this._kind = o._kind; + this._value = o._value; } public ObjectBuilder distance(String v) { @@ -171,21 +183,43 @@ public ObjectBuilder distance(String v) { return this; } + public ObjectBuilder geohashLength(Integer v) { + this._kind = Kind.GeohashLength; + this._value = v; + return this; + } + + @Override 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(); + Kind.Distance, + JsonpDeserializer.stringDeserializer() + ).addMember(Kind.GeohashLength, JsonpDeserializer.integerDeserializer()).build(); } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( GeoHashPrecision::buildGeoHashPrecisionDeserializer ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoHashPrecision other = (GeoHashPrecision) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java index 2d36024495..37b5a21fc4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AdjacencyMatrixAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,29 +50,37 @@ 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.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.AdjacencyMatrixAggregation @JsonpDeserializable -public class AdjacencyMatrixAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AdjacencyMatrixAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nonnull private final Map filters; // --------------------------------------------------------------------------------------------- private AdjacencyMatrixAggregation(Builder builder) { super(builder); - this.filters = ApiTypeHelper.unmodifiable(builder.filters); - } - public static AdjacencyMatrixAggregation of(Function> fn) { + public static AdjacencyMatrixAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -73,14 +88,17 @@ public Aggregation.Kind _aggregationKind() { } /** + * Filters used to create buckets. At least one filter is required. + *

* API name: {@code filters} + *

*/ + @Nonnull public final Map filters() { return this.filters; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.filters)) { generator.writeKey("filters"); @@ -88,66 +106,111 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.filters.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AdjacencyMatrixAggregation}. */ - public static class Builder extends BucketAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Map filters; + public Builder() {} + + private Builder(AdjacencyMatrixAggregation o) { + super(o); + this.filters = _mapCopy(o.filters); + } + + private Builder(Builder o) { + super(o); + this.filters = _mapCopy(o.filters); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Filters used to create buckets. At least one filter is required. + *

* API name: {@code filters} + *

+ * *

- * Adds all entries of map to filters. + * Adds all elements of map to filters. + *

*/ + @Nonnull public final Builder filters(Map map) { this.filters = _mapPutAll(this.filters, map); return this; } /** + * Filters used to create buckets. At least one filter is required. + *

* API name: {@code filters} + *

+ * *

* Adds an entry to filters. + *

*/ + @Nonnull public final Builder filters(String key, Query value) { this.filters = _mapPut(this.filters, key, value); return this; } /** + * Filters used to create buckets. At least one filter is required. + *

* API name: {@code filters} + *

+ * *

- * Adds an entry to filters using a builder lambda. + * Adds a value to filters using a builder lambda. + *

*/ + @Nonnull public final Builder filters(String key, Function> fn) { return filters(key, fn.apply(new Query.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link AdjacencyMatrixAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AdjacencyMatrixAggregation build() { _checkSingleUse(); @@ -168,7 +231,23 @@ public AdjacencyMatrixAggregation build() { protected static void setupAdjacencyMatrixAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); op.add(Builder::filters, JsonpDeserializer.stringMapDeserializer(Query._DESERIALIZER), "filters"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.filters); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AdjacencyMatrixAggregation other = (AdjacencyMatrixAggregation) o; + return Objects.equals(this.filters, other.filters); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java similarity index 87% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java index 9e596a954c..09ce4fc298 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/Aggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonEnum; @@ -44,6 +51,7 @@ import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.query_dsl.Query; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -54,155 +62,82 @@ // typedef: _types.aggregations.AggregationContainer @JsonpDeserializable -public class Aggregation implements TaggedUnion, JsonpSerializable { - - /** - * {@link Aggregation} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Aggregation implements TaggedUnion, PlainJsonSerializable { /** * {@link Aggregation} variant kinds. */ - public enum Kind implements JsonEnum { AdjacencyMatrix("adjacency_matrix"), - AutoDateHistogram("auto_date_histogram"), - Avg("avg"), - AvgBucket("avg_bucket"), - Boxplot("boxplot"), - BucketScript("bucket_script"), - BucketSelector("bucket_selector"), - BucketSort("bucket_sort"), - Cardinality("cardinality"), - Children("children"), - Composite("composite"), - CumulativeCardinality("cumulative_cardinality"), - CumulativeSum("cumulative_sum"), - DateHistogram("date_histogram"), - DateRange("date_range"), - Derivative("derivative"), - DiversifiedSampler("diversified_sampler"), - ExtendedStats("extended_stats"), - ExtendedStatsBucket("extended_stats_bucket"), - Filter("filter"), - Filters("filters"), - GeoBounds("geo_bounds"), - GeoCentroid("geo_centroid"), - GeoDistance("geo_distance"), - - GeohashGrid("geohash_grid"), - GeoLine("geo_line"), - + GeohashGrid("geohash_grid"), GeotileGrid("geotile_grid"), - Global("global"), - Histogram("histogram"), - - IpRange("ip_range"), - Inference("inference"), - + IpRange("ip_range"), + Line("line"), MatrixStats("matrix_stats"), - Max("max"), - MaxBucket("max_bucket"), - MedianAbsoluteDeviation("median_absolute_deviation"), - Min("min"), - MinBucket("min_bucket"), - Missing("missing"), - MovingAvg("moving_avg"), - - MovingPercentiles("moving_percentiles"), - MovingFn("moving_fn"), - + MovingPercentiles("moving_percentiles"), MultiTerms("multi_terms"), - Nested("nested"), - Normalize("normalize"), - Parent("parent"), - PercentileRanks("percentile_ranks"), - Percentiles("percentiles"), - PercentilesBucket("percentiles_bucket"), - Range("range"), - RareTerms("rare_terms"), - Rate("rate"), - ReverseNested("reverse_nested"), - Sampler("sampler"), - ScriptedMetric("scripted_metric"), - SerialDiff("serial_diff"), - SignificantTerms("significant_terms"), - SignificantText("significant_text"), - Stats("stats"), - StatsBucket("stats_bucket"), - StringStats("string_stats"), - Sum("sum"), - SumBucket("sum_bucket"), - + TTest("t_test"), Terms("terms"), - TopHits("top_hits"), - - TTest("t_test"), - TopMetrics("top_metrics"), - ValueCount("value_count"), - - WeightedAvg("weighted_avg"), - VariableWidthHistogram("variable_width_histogram"), - - ; + WeightedAvg("weighted_avg"); private final String jsonValue; @@ -210,14 +145,14 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; - private final Object _value; + private final AggregationVariant _value; @Override public final Kind _kind() { @@ -225,35 +160,31 @@ public final Kind _kind() { } @Override - public final Object _get() { + public final AggregationVariant _get() { return _value; } + @Nonnull private final Map aggregations; + @Nonnull private final Map meta; public Aggregation(AggregationVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._aggregationKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - this.aggregations = null; this.meta = null; - } private Aggregation(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); this.meta = ApiTypeHelper.unmodifiable(builder.meta); - + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); } - public static Aggregation of(Function> fn) { + public static Aggregation of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -261,7 +192,9 @@ public static Aggregation of(Function> fn) { * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

*/ + @Nonnull public final Map aggregations() { return this.aggregations; } @@ -269,6 +202,7 @@ public final Map aggregations() { /** * API name: {@code meta} */ + @Nonnull public final Map meta() { return this.meta; } @@ -283,9 +217,7 @@ public boolean isAdjacencyMatrix() { /** * Get the {@code adjacency_matrix} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code adjacency_matrix} - * kind. + * @throws IllegalStateException if the current variant is not the {@code adjacency_matrix} kind. */ public AdjacencyMatrixAggregation adjacencyMatrix() { return TaggedUnionUtils.get(this, Kind.AdjacencyMatrix); @@ -301,9 +233,7 @@ public boolean isAutoDateHistogram() { /** * Get the {@code auto_date_histogram} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code auto_date_histogram} - * kind. + * @throws IllegalStateException if the current variant is not the {@code auto_date_histogram} kind. */ public AutoDateHistogramAggregation autoDateHistogram() { return TaggedUnionUtils.get(this, Kind.AutoDateHistogram); @@ -319,8 +249,7 @@ public boolean isAvg() { /** * Get the {@code avg} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code avg} kind. + * @throws IllegalStateException if the current variant is not the {@code avg} kind. */ public AverageAggregation avg() { return TaggedUnionUtils.get(this, Kind.Avg); @@ -336,8 +265,7 @@ public boolean isAvgBucket() { /** * Get the {@code avg_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code avg_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code avg_bucket} kind. */ public AverageBucketAggregation avgBucket() { return TaggedUnionUtils.get(this, Kind.AvgBucket); @@ -353,8 +281,7 @@ public boolean isBoxplot() { /** * Get the {@code boxplot} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code boxplot} kind. + * @throws IllegalStateException if the current variant is not the {@code boxplot} kind. */ public BoxplotAggregation boxplot() { return TaggedUnionUtils.get(this, Kind.Boxplot); @@ -370,8 +297,7 @@ public boolean isBucketScript() { /** * Get the {@code bucket_script} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code bucket_script} kind. + * @throws IllegalStateException if the current variant is not the {@code bucket_script} kind. */ public BucketScriptAggregation bucketScript() { return TaggedUnionUtils.get(this, Kind.BucketScript); @@ -387,9 +313,7 @@ public boolean isBucketSelector() { /** * Get the {@code bucket_selector} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code bucket_selector} - * kind. + * @throws IllegalStateException if the current variant is not the {@code bucket_selector} kind. */ public BucketSelectorAggregation bucketSelector() { return TaggedUnionUtils.get(this, Kind.BucketSelector); @@ -405,8 +329,7 @@ public boolean isBucketSort() { /** * Get the {@code bucket_sort} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code bucket_sort} kind. + * @throws IllegalStateException if the current variant is not the {@code bucket_sort} kind. */ public BucketSortAggregation bucketSort() { return TaggedUnionUtils.get(this, Kind.BucketSort); @@ -422,8 +345,7 @@ public boolean isCardinality() { /** * Get the {@code cardinality} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code cardinality} kind. + * @throws IllegalStateException if the current variant is not the {@code cardinality} kind. */ public CardinalityAggregation cardinality() { return TaggedUnionUtils.get(this, Kind.Cardinality); @@ -439,8 +361,7 @@ public boolean isChildren() { /** * Get the {@code children} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code children} kind. + * @throws IllegalStateException if the current variant is not the {@code children} kind. */ public ChildrenAggregation children() { return TaggedUnionUtils.get(this, Kind.Children); @@ -456,8 +377,7 @@ public boolean isComposite() { /** * Get the {@code composite} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code composite} kind. + * @throws IllegalStateException if the current variant is not the {@code composite} kind. */ public CompositeAggregation composite() { return TaggedUnionUtils.get(this, Kind.Composite); @@ -473,9 +393,7 @@ public boolean isCumulativeCardinality() { /** * Get the {@code cumulative_cardinality} variant value. * - * @throws IllegalStateException - * if the current variant is not of the - * {@code cumulative_cardinality} kind. + * @throws IllegalStateException if the current variant is not the {@code cumulative_cardinality} kind. */ public CumulativeCardinalityAggregation cumulativeCardinality() { return TaggedUnionUtils.get(this, Kind.CumulativeCardinality); @@ -491,8 +409,7 @@ public boolean isCumulativeSum() { /** * Get the {@code cumulative_sum} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code cumulative_sum} kind. + * @throws IllegalStateException if the current variant is not the {@code cumulative_sum} kind. */ public CumulativeSumAggregation cumulativeSum() { return TaggedUnionUtils.get(this, Kind.CumulativeSum); @@ -508,8 +425,7 @@ public boolean isDateHistogram() { /** * Get the {@code date_histogram} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date_histogram} kind. + * @throws IllegalStateException if the current variant is not the {@code date_histogram} kind. */ public DateHistogramAggregation dateHistogram() { return TaggedUnionUtils.get(this, Kind.DateHistogram); @@ -525,8 +441,7 @@ public boolean isDateRange() { /** * Get the {@code date_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code date_range} kind. + * @throws IllegalStateException if the current variant is not the {@code date_range} kind. */ public DateRangeAggregation dateRange() { return TaggedUnionUtils.get(this, Kind.DateRange); @@ -542,8 +457,7 @@ public boolean isDerivative() { /** * Get the {@code derivative} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code derivative} kind. + * @throws IllegalStateException if the current variant is not the {@code derivative} kind. */ public DerivativeAggregation derivative() { return TaggedUnionUtils.get(this, Kind.Derivative); @@ -559,9 +473,7 @@ public boolean isDiversifiedSampler() { /** * Get the {@code diversified_sampler} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code diversified_sampler} - * kind. + * @throws IllegalStateException if the current variant is not the {@code diversified_sampler} kind. */ public DiversifiedSamplerAggregation diversifiedSampler() { return TaggedUnionUtils.get(this, Kind.DiversifiedSampler); @@ -577,8 +489,7 @@ public boolean isExtendedStats() { /** * Get the {@code extended_stats} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code extended_stats} kind. + * @throws IllegalStateException if the current variant is not the {@code extended_stats} kind. */ public ExtendedStatsAggregation extendedStats() { return TaggedUnionUtils.get(this, Kind.ExtendedStats); @@ -594,9 +505,7 @@ public boolean isExtendedStatsBucket() { /** * Get the {@code extended_stats_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the - * {@code extended_stats_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code extended_stats_bucket} kind. */ public ExtendedStatsBucketAggregation extendedStatsBucket() { return TaggedUnionUtils.get(this, Kind.ExtendedStatsBucket); @@ -612,8 +521,7 @@ public boolean isFilter() { /** * Get the {@code filter} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code filter} kind. + * @throws IllegalStateException if the current variant is not the {@code filter} kind. */ public Query filter() { return TaggedUnionUtils.get(this, Kind.Filter); @@ -629,8 +537,7 @@ public boolean isFilters() { /** * Get the {@code filters} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code filters} kind. + * @throws IllegalStateException if the current variant is not the {@code filters} kind. */ public FiltersAggregation filters() { return TaggedUnionUtils.get(this, Kind.Filters); @@ -646,8 +553,7 @@ public boolean isGeoBounds() { /** * Get the {@code geo_bounds} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_bounds} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_bounds} kind. */ public GeoBoundsAggregation geoBounds() { return TaggedUnionUtils.get(this, Kind.GeoBounds); @@ -663,8 +569,7 @@ public boolean isGeoCentroid() { /** * Get the {@code geo_centroid} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_centroid} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_centroid} kind. */ public GeoCentroidAggregation geoCentroid() { return TaggedUnionUtils.get(this, Kind.GeoCentroid); @@ -680,45 +585,42 @@ public boolean isGeoDistance() { /** * Get the {@code geo_distance} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_distance} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_distance} kind. */ public GeoDistanceAggregation geoDistance() { return TaggedUnionUtils.get(this, Kind.GeoDistance); } /** - * Is this variant instance of kind {@code geohash_grid}? + * Is this variant instance of kind {@code geo_line}? */ - public boolean isGeohashGrid() { - return _kind == Kind.GeohashGrid; + public boolean isGeoLine() { + return _kind == Kind.GeoLine; } /** - * Get the {@code geohash_grid} variant value. + * Get the {@code geo_line} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash_grid} kind. + * @throws IllegalStateException if the current variant is not the {@code geo_line} kind. */ - public GeoHashGridAggregation geohashGrid() { - return TaggedUnionUtils.get(this, Kind.GeohashGrid); + public GeoLineAggregation geoLine() { + return TaggedUnionUtils.get(this, Kind.GeoLine); } /** - * Is this variant instance of kind {@code geo_line}? + * Is this variant instance of kind {@code geohash_grid}? */ - public boolean isGeoLine() { - return _kind == Kind.GeoLine; + public boolean isGeohashGrid() { + return _kind == Kind.GeohashGrid; } /** - * Get the {@code geo_line} variant value. + * Get the {@code geohash_grid} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geo_line} kind. + * @throws IllegalStateException if the current variant is not the {@code geohash_grid} kind. */ - public GeoLineAggregation geoLine() { - return TaggedUnionUtils.get(this, Kind.GeoLine); + public GeoHashGridAggregation geohashGrid() { + return TaggedUnionUtils.get(this, Kind.GeohashGrid); } /** @@ -731,8 +633,7 @@ public boolean isGeotileGrid() { /** * Get the {@code geotile_grid} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code geotile_grid} kind. + * @throws IllegalStateException if the current variant is not the {@code geotile_grid} kind. */ public GeoTileGridAggregation geotileGrid() { return TaggedUnionUtils.get(this, Kind.GeotileGrid); @@ -748,8 +649,7 @@ public boolean isGlobal() { /** * Get the {@code global} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code global} kind. + * @throws IllegalStateException if the current variant is not the {@code global} kind. */ public GlobalAggregation global() { return TaggedUnionUtils.get(this, Kind.Global); @@ -765,13 +665,28 @@ public boolean isHistogram() { /** * Get the {@code histogram} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code histogram} kind. + * @throws IllegalStateException if the current variant is not the {@code histogram} kind. */ public HistogramAggregation histogram() { return TaggedUnionUtils.get(this, Kind.Histogram); } + /** + * Is this variant instance of kind {@code inference}? + */ + public boolean isInference() { + return _kind == Kind.Inference; + } + + /** + * Get the {@code inference} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code inference} kind. + */ + public InferenceAggregation inference() { + return TaggedUnionUtils.get(this, Kind.Inference); + } + /** * Is this variant instance of kind {@code ip_range}? */ @@ -782,28 +697,26 @@ public boolean isIpRange() { /** * Get the {@code ip_range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code ip_range} kind. + * @throws IllegalStateException if the current variant is not the {@code ip_range} kind. */ public IpRangeAggregation ipRange() { return TaggedUnionUtils.get(this, Kind.IpRange); } /** - * Is this variant instance of kind {@code inference}? + * Is this variant instance of kind {@code line}? */ - public boolean isInference() { - return _kind == Kind.Inference; + public boolean isLine() { + return _kind == Kind.Line; } /** - * Get the {@code inference} variant value. + * Get the {@code line} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code inference} kind. + * @throws IllegalStateException if the current variant is not the {@code line} kind. */ - public InferenceAggregation inference() { - return TaggedUnionUtils.get(this, Kind.Inference); + public GeoLineAggregation line() { + return TaggedUnionUtils.get(this, Kind.Line); } /** @@ -816,8 +729,7 @@ public boolean isMatrixStats() { /** * Get the {@code matrix_stats} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code matrix_stats} kind. + * @throws IllegalStateException if the current variant is not the {@code matrix_stats} kind. */ public MatrixStatsAggregation matrixStats() { return TaggedUnionUtils.get(this, Kind.MatrixStats); @@ -833,8 +745,7 @@ public boolean isMax() { /** * Get the {@code max} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code max} kind. + * @throws IllegalStateException if the current variant is not the {@code max} kind. */ public MaxAggregation max() { return TaggedUnionUtils.get(this, Kind.Max); @@ -850,8 +761,7 @@ public boolean isMaxBucket() { /** * Get the {@code max_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code max_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code max_bucket} kind. */ public MaxBucketAggregation maxBucket() { return TaggedUnionUtils.get(this, Kind.MaxBucket); @@ -867,9 +777,7 @@ public boolean isMedianAbsoluteDeviation() { /** * Get the {@code median_absolute_deviation} variant value. * - * @throws IllegalStateException - * if the current variant is not of the - * {@code median_absolute_deviation} kind. + * @throws IllegalStateException if the current variant is not the {@code median_absolute_deviation} kind. */ public MedianAbsoluteDeviationAggregation medianAbsoluteDeviation() { return TaggedUnionUtils.get(this, Kind.MedianAbsoluteDeviation); @@ -885,8 +793,7 @@ public boolean isMin() { /** * Get the {@code min} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code min} kind. + * @throws IllegalStateException if the current variant is not the {@code min} kind. */ public MinAggregation min() { return TaggedUnionUtils.get(this, Kind.Min); @@ -902,8 +809,7 @@ public boolean isMinBucket() { /** * Get the {@code min_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code min_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code min_bucket} kind. */ public MinBucketAggregation minBucket() { return TaggedUnionUtils.get(this, Kind.MinBucket); @@ -919,8 +825,7 @@ public boolean isMissing() { /** * Get the {@code missing} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code missing} kind. + * @throws IllegalStateException if the current variant is not the {@code missing} kind. */ public MissingAggregation missing() { return TaggedUnionUtils.get(this, Kind.Missing); @@ -936,46 +841,42 @@ public boolean isMovingAvg() { /** * Get the {@code moving_avg} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code moving_avg} kind. + * @throws IllegalStateException if the current variant is not the {@code moving_avg} kind. */ public MovingAverageAggregation movingAvg() { return TaggedUnionUtils.get(this, Kind.MovingAvg); } /** - * Is this variant instance of kind {@code moving_percentiles}? + * Is this variant instance of kind {@code moving_fn}? */ - public boolean isMovingPercentiles() { - return _kind == Kind.MovingPercentiles; + public boolean isMovingFn() { + return _kind == Kind.MovingFn; } /** - * Get the {@code moving_percentiles} variant value. + * Get the {@code moving_fn} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code moving_percentiles} - * kind. + * @throws IllegalStateException if the current variant is not the {@code moving_fn} kind. */ - public MovingPercentilesAggregation movingPercentiles() { - return TaggedUnionUtils.get(this, Kind.MovingPercentiles); + public MovingFunctionAggregation movingFn() { + return TaggedUnionUtils.get(this, Kind.MovingFn); } /** - * Is this variant instance of kind {@code moving_fn}? + * Is this variant instance of kind {@code moving_percentiles}? */ - public boolean isMovingFn() { - return _kind == Kind.MovingFn; + public boolean isMovingPercentiles() { + return _kind == Kind.MovingPercentiles; } /** - * Get the {@code moving_fn} variant value. + * Get the {@code moving_percentiles} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code moving_fn} kind. + * @throws IllegalStateException if the current variant is not the {@code moving_percentiles} kind. */ - public MovingFunctionAggregation movingFn() { - return TaggedUnionUtils.get(this, Kind.MovingFn); + public MovingPercentilesAggregation movingPercentiles() { + return TaggedUnionUtils.get(this, Kind.MovingPercentiles); } /** @@ -988,8 +889,7 @@ public boolean isMultiTerms() { /** * Get the {@code multi_terms} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code multi_terms} kind. + * @throws IllegalStateException if the current variant is not the {@code multi_terms} kind. */ public MultiTermsAggregation multiTerms() { return TaggedUnionUtils.get(this, Kind.MultiTerms); @@ -1005,8 +905,7 @@ public boolean isNested() { /** * Get the {@code nested} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code nested} kind. + * @throws IllegalStateException if the current variant is not the {@code nested} kind. */ public NestedAggregation nested() { return TaggedUnionUtils.get(this, Kind.Nested); @@ -1022,8 +921,7 @@ public boolean isNormalize() { /** * Get the {@code normalize} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code normalize} kind. + * @throws IllegalStateException if the current variant is not the {@code normalize} kind. */ public NormalizeAggregation normalize() { return TaggedUnionUtils.get(this, Kind.Normalize); @@ -1039,8 +937,7 @@ public boolean isParent() { /** * Get the {@code parent} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code parent} kind. + * @throws IllegalStateException if the current variant is not the {@code parent} kind. */ public ParentAggregation parent() { return TaggedUnionUtils.get(this, Kind.Parent); @@ -1056,9 +953,7 @@ public boolean isPercentileRanks() { /** * Get the {@code percentile_ranks} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code percentile_ranks} - * kind. + * @throws IllegalStateException if the current variant is not the {@code percentile_ranks} kind. */ public PercentileRanksAggregation percentileRanks() { return TaggedUnionUtils.get(this, Kind.PercentileRanks); @@ -1074,8 +969,7 @@ public boolean isPercentiles() { /** * Get the {@code percentiles} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code percentiles} kind. + * @throws IllegalStateException if the current variant is not the {@code percentiles} kind. */ public PercentilesAggregation percentiles() { return TaggedUnionUtils.get(this, Kind.Percentiles); @@ -1091,9 +985,7 @@ public boolean isPercentilesBucket() { /** * Get the {@code percentiles_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code percentiles_bucket} - * kind. + * @throws IllegalStateException if the current variant is not the {@code percentiles_bucket} kind. */ public PercentilesBucketAggregation percentilesBucket() { return TaggedUnionUtils.get(this, Kind.PercentilesBucket); @@ -1109,8 +1001,7 @@ public boolean isRange() { /** * Get the {@code range} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code range} kind. + * @throws IllegalStateException if the current variant is not the {@code range} kind. */ public RangeAggregation range() { return TaggedUnionUtils.get(this, Kind.Range); @@ -1126,8 +1017,7 @@ public boolean isRareTerms() { /** * Get the {@code rare_terms} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code rare_terms} kind. + * @throws IllegalStateException if the current variant is not the {@code rare_terms} kind. */ public RareTermsAggregation rareTerms() { return TaggedUnionUtils.get(this, Kind.RareTerms); @@ -1143,8 +1033,7 @@ public boolean isRate() { /** * Get the {@code rate} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code rate} kind. + * @throws IllegalStateException if the current variant is not the {@code rate} kind. */ public RateAggregation rate() { return TaggedUnionUtils.get(this, Kind.Rate); @@ -1160,8 +1049,7 @@ public boolean isReverseNested() { /** * Get the {@code reverse_nested} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code reverse_nested} kind. + * @throws IllegalStateException if the current variant is not the {@code reverse_nested} kind. */ public ReverseNestedAggregation reverseNested() { return TaggedUnionUtils.get(this, Kind.ReverseNested); @@ -1177,8 +1065,7 @@ public boolean isSampler() { /** * Get the {@code sampler} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code sampler} kind. + * @throws IllegalStateException if the current variant is not the {@code sampler} kind. */ public SamplerAggregation sampler() { return TaggedUnionUtils.get(this, Kind.Sampler); @@ -1194,9 +1081,7 @@ public boolean isScriptedMetric() { /** * Get the {@code scripted_metric} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code scripted_metric} - * kind. + * @throws IllegalStateException if the current variant is not the {@code scripted_metric} kind. */ public ScriptedMetricAggregation scriptedMetric() { return TaggedUnionUtils.get(this, Kind.ScriptedMetric); @@ -1212,8 +1097,7 @@ public boolean isSerialDiff() { /** * Get the {@code serial_diff} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code serial_diff} kind. + * @throws IllegalStateException if the current variant is not the {@code serial_diff} kind. */ public SerialDifferencingAggregation serialDiff() { return TaggedUnionUtils.get(this, Kind.SerialDiff); @@ -1229,9 +1113,7 @@ public boolean isSignificantTerms() { /** * Get the {@code significant_terms} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code significant_terms} - * kind. + * @throws IllegalStateException if the current variant is not the {@code significant_terms} kind. */ public SignificantTermsAggregation significantTerms() { return TaggedUnionUtils.get(this, Kind.SignificantTerms); @@ -1247,9 +1129,7 @@ public boolean isSignificantText() { /** * Get the {@code significant_text} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code significant_text} - * kind. + * @throws IllegalStateException if the current variant is not the {@code significant_text} kind. */ public SignificantTextAggregation significantText() { return TaggedUnionUtils.get(this, Kind.SignificantText); @@ -1265,8 +1145,7 @@ public boolean isStats() { /** * Get the {@code stats} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code stats} kind. + * @throws IllegalStateException if the current variant is not the {@code stats} kind. */ public StatsAggregation stats() { return TaggedUnionUtils.get(this, Kind.Stats); @@ -1282,8 +1161,7 @@ public boolean isStatsBucket() { /** * Get the {@code stats_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code stats_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code stats_bucket} kind. */ public StatsBucketAggregation statsBucket() { return TaggedUnionUtils.get(this, Kind.StatsBucket); @@ -1299,8 +1177,7 @@ public boolean isStringStats() { /** * Get the {@code string_stats} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code string_stats} kind. + * @throws IllegalStateException if the current variant is not the {@code string_stats} kind. */ public StringStatsAggregation stringStats() { return TaggedUnionUtils.get(this, Kind.StringStats); @@ -1316,8 +1193,7 @@ public boolean isSum() { /** * Get the {@code sum} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code sum} kind. + * @throws IllegalStateException if the current variant is not the {@code sum} kind. */ public SumAggregation sum() { return TaggedUnionUtils.get(this, Kind.Sum); @@ -1333,13 +1209,28 @@ public boolean isSumBucket() { /** * Get the {@code sum_bucket} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code sum_bucket} kind. + * @throws IllegalStateException if the current variant is not the {@code sum_bucket} kind. */ public SumBucketAggregation sumBucket() { return TaggedUnionUtils.get(this, Kind.SumBucket); } + /** + * Is this variant instance of kind {@code t_test}? + */ + public boolean isTTest() { + return _kind == Kind.TTest; + } + + /** + * Get the {@code t_test} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code t_test} kind. + */ + public TTestAggregation tTest() { + return TaggedUnionUtils.get(this, Kind.TTest); + } + /** * Is this variant instance of kind {@code terms}? */ @@ -1350,8 +1241,7 @@ public boolean isTerms() { /** * Get the {@code terms} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code terms} kind. + * @throws IllegalStateException if the current variant is not the {@code terms} kind. */ public TermsAggregation terms() { return TaggedUnionUtils.get(this, Kind.Terms); @@ -1367,30 +1257,12 @@ public boolean isTopHits() { /** * Get the {@code top_hits} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code top_hits} kind. + * @throws IllegalStateException if the current variant is not the {@code top_hits} kind. */ public TopHitsAggregation topHits() { return TaggedUnionUtils.get(this, Kind.TopHits); } - /** - * Is this variant instance of kind {@code t_test}? - */ - public boolean isTTest() { - return _kind == Kind.TTest; - } - - /** - * Get the {@code t_test} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code t_test} kind. - */ - public TTestAggregation tTest() { - return TaggedUnionUtils.get(this, Kind.TTest); - } - /** * Is this variant instance of kind {@code top_metrics}? */ @@ -1401,8 +1273,7 @@ public boolean isTopMetrics() { /** * Get the {@code top_metrics} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code top_metrics} kind. + * @throws IllegalStateException if the current variant is not the {@code top_metrics} kind. */ public TopMetricsAggregation topMetrics() { return TaggedUnionUtils.get(this, Kind.TopMetrics); @@ -1418,103 +1289,111 @@ public boolean isValueCount() { /** * Get the {@code value_count} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code value_count} kind. + * @throws IllegalStateException if the current variant is not the {@code value_count} kind. */ public ValueCountAggregation valueCount() { return TaggedUnionUtils.get(this, Kind.ValueCount); } /** - * Is this variant instance of kind {@code weighted_avg}? + * Is this variant instance of kind {@code variable_width_histogram}? */ - public boolean isWeightedAvg() { - return _kind == Kind.WeightedAvg; + public boolean isVariableWidthHistogram() { + return _kind == Kind.VariableWidthHistogram; } /** - * Get the {@code weighted_avg} variant value. + * Get the {@code variable_width_histogram} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code weighted_avg} kind. + * @throws IllegalStateException if the current variant is not the {@code variable_width_histogram} kind. */ - public WeightedAverageAggregation weightedAvg() { - return TaggedUnionUtils.get(this, Kind.WeightedAvg); + public VariableWidthHistogramAggregation variableWidthHistogram() { + return TaggedUnionUtils.get(this, Kind.VariableWidthHistogram); } /** - * Is this variant instance of kind {@code variable_width_histogram}? + * Is this variant instance of kind {@code weighted_avg}? */ - public boolean isVariableWidthHistogram() { - return _kind == Kind.VariableWidthHistogram; + public boolean isWeightedAvg() { + return _kind == Kind.WeightedAvg; } /** - * Get the {@code variable_width_histogram} variant value. + * Get the {@code weighted_avg} variant value. * - * @throws IllegalStateException - * if the current variant is not of the - * {@code variable_width_histogram} kind. + * @throws IllegalStateException if the current variant is not the {@code weighted_avg} kind. */ - public VariableWidthHistogramAggregation variableWidthHistogram() { - return TaggedUnionUtils.get(this, Kind.VariableWidthHistogram); + public WeightedAverageAggregation weightedAvg() { + return TaggedUnionUtils.get(this, Kind.WeightedAvg); } @Override - @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - if (ApiTypeHelper.isDefined(this.aggregations)) { generator.writeKey("aggregations"); generator.writeStartObject(); for (Map.Entry item0 : this.aggregations.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("meta"); generator.writeStartObject(); for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - generator.writeKey(_kind.jsonValue()); if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } - generator.writeEnd(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase { private Kind _kind; - private Object _value; - + private AggregationVariant _value; @Nullable private Map aggregations; - @Nullable private Map meta; + public Builder() {} + + private Builder(Aggregation o) { + this.aggregations = _mapCopy(o.aggregations); + this.meta = _mapCopy(o.meta); + this._kind = o._kind; + this._value = o._value; + } + /** * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

- * Adds all entries of map to aggregations. + * Adds all elements of map to aggregations. + *

*/ + @Nonnull public final Builder aggregations(Map map) { this.aggregations = _mapPutAll(this.aggregations, map); return this; @@ -1524,9 +1403,13 @@ public final Builder aggregations(Map map) { * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

* Adds an entry to aggregations. + *

*/ + @Nonnull public final Builder aggregations(String key, Aggregation value) { this.aggregations = _mapPut(this.aggregations, key, value); return this; @@ -1536,18 +1419,25 @@ public final Builder aggregations(String key, Aggregation value) { * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

- * Adds an entry to aggregations using a builder lambda. + * Adds a value to aggregations using a builder lambda. + *

*/ + @Nonnull public final Builder aggregations(String key, Function> fn) { return aggregations(key, fn.apply(new Aggregation.Builder()).build()); } /** * API name: {@code meta} + * *

- * Adds all entries of map to meta. + * Adds all elements of map to meta. + *

*/ + @Nonnull public final Builder meta(Map map) { this.meta = _mapPutAll(this.meta, map); return this; @@ -1555,9 +1445,12 @@ public final Builder meta(Map map) { /** * API name: {@code meta} + * *

* Adds an entry to meta. + *

*/ + @Nonnull public final Builder meta(String key, JsonData value) { this.meta = _mapPut(this.meta, key, value); return this; @@ -1813,24 +1706,24 @@ public ContainerBuilder geoDistance(Function> fn) { - return this.geohashGrid(fn.apply(new GeoHashGridAggregation.Builder()).build()); + public ContainerBuilder geoLine(Function> fn) { + return this.geoLine(fn.apply(new GeoLineAggregation.Builder()).build()); } - public ContainerBuilder geoLine(GeoLineAggregation v) { - this._kind = Kind.GeoLine; + public ContainerBuilder geohashGrid(GeoHashGridAggregation v) { + this._kind = Kind.GeohashGrid; this._value = v; return new ContainerBuilder(); } - public ContainerBuilder geoLine(Function> fn) { - return this.geoLine(fn.apply(new GeoLineAggregation.Builder()).build()); + public ContainerBuilder geohashGrid(Function> fn) { + return this.geohashGrid(fn.apply(new GeoHashGridAggregation.Builder()).build()); } public ContainerBuilder geotileGrid(GeoTileGridAggregation v) { @@ -1863,6 +1756,16 @@ public ContainerBuilder histogram(Function> fn) { + return this.inference(fn.apply(new InferenceAggregation.Builder()).build()); + } + public ContainerBuilder ipRange(IpRangeAggregation v) { this._kind = Kind.IpRange; this._value = v; @@ -1873,14 +1776,14 @@ public ContainerBuilder ipRange(Function> fn) { - return this.inference(fn.apply(new InferenceAggregation.Builder()).build()); + public ContainerBuilder line(Function> fn) { + return this.line(fn.apply(new GeoLineAggregation.Builder()).build()); } public ContainerBuilder matrixStats(MatrixStatsAggregation v) { @@ -1965,26 +1868,26 @@ public ContainerBuilder movingAvg(Function> fn - ) { - return this.movingPercentiles(fn.apply(new MovingPercentilesAggregation.Builder()).build()); + public ContainerBuilder movingFn(Function> fn) { + return this.movingFn(fn.apply(new MovingFunctionAggregation.Builder()).build()); } - public ContainerBuilder movingFn(MovingFunctionAggregation v) { - this._kind = Kind.MovingFn; + public ContainerBuilder movingPercentiles(MovingPercentilesAggregation v) { + this._kind = Kind.MovingPercentiles; this._value = v; return new ContainerBuilder(); } - public ContainerBuilder movingFn(Function> fn) { - return this.movingFn(fn.apply(new MovingFunctionAggregation.Builder()).build()); + public ContainerBuilder movingPercentiles( + Function> fn + ) { + return this.movingPercentiles(fn.apply(new MovingPercentilesAggregation.Builder()).build()); } public ContainerBuilder multiTerms(MultiTermsAggregation v) { @@ -2207,6 +2110,16 @@ public ContainerBuilder sumBucket(Function> fn) { + return this.tTest(fn.apply(new TTestAggregation.Builder()).build()); + } + public ContainerBuilder terms(TermsAggregation v) { this._kind = Kind.Terms; this._value = v; @@ -2227,16 +2140,6 @@ public ContainerBuilder topHits(Function> fn) { - return this.tTest(fn.apply(new TTestAggregation.Builder()).build()); - } - public ContainerBuilder topMetrics(TopMetricsAggregation v) { this._kind = Kind.TopMetrics; this._value = v; @@ -2257,16 +2160,6 @@ public ContainerBuilder valueCount(Function> fn) { - return this.weightedAvg(fn.apply(new WeightedAverageAggregation.Builder()).build()); - } - public ContainerBuilder variableWidthHistogram(VariableWidthHistogramAggregation v) { this._kind = Kind.VariableWidthHistogram; this._value = v; @@ -2279,20 +2172,35 @@ public ContainerBuilder variableWidthHistogram( return this.variableWidthHistogram(fn.apply(new VariableWidthHistogramAggregation.Builder()).build()); } + public ContainerBuilder weightedAvg(WeightedAverageAggregation v) { + this._kind = Kind.WeightedAvg; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder weightedAvg(Function> fn) { + return this.weightedAvg(fn.apply(new WeightedAverageAggregation.Builder()).build()); + } + protected Aggregation build() { _checkSingleUse(); return new Aggregation(this); } public class ContainerBuilder implements ObjectBuilder { + private ContainerBuilder() {} /** * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

- * Adds all entries of map to aggregations. + * Adds all elements of map to aggregations. + *

*/ + @Nonnull public final ContainerBuilder aggregations(Map map) { Builder.this.aggregations = _mapPutAll(Builder.this.aggregations, map); return this; @@ -2302,9 +2210,13 @@ public final ContainerBuilder aggregations(Map map) { * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

* Adds an entry to aggregations. + *

*/ + @Nonnull public final ContainerBuilder aggregations(String key, Aggregation value) { Builder.this.aggregations = _mapPut(Builder.this.aggregations, key, value); return this; @@ -2314,18 +2226,25 @@ public final ContainerBuilder aggregations(String key, Aggregation value) { * Sub-aggregations for this aggregation. Only applies to bucket aggregations. *

* API name: {@code aggregations} + *

+ * *

- * Adds an entry to aggregations using a builder lambda. + * Adds a value to aggregations using a builder lambda. + *

*/ + @Nonnull public final ContainerBuilder aggregations(String key, Function> fn) { return aggregations(key, fn.apply(new Aggregation.Builder()).build()); } /** * API name: {@code meta} + * *

- * Adds all entries of map to meta. + * Adds all elements of map to meta. + *

*/ + @Nonnull public final ContainerBuilder meta(Map map) { Builder.this.meta = _mapPutAll(Builder.this.meta, map); return this; @@ -2333,14 +2252,18 @@ public final ContainerBuilder meta(Map map) { /** * API name: {@code meta} + * *

* Adds an entry to meta. + *

*/ + @Nonnull public final ContainerBuilder meta(String key, JsonData value) { Builder.this.meta = _mapPut(Builder.this.meta, key, value); return this; } + @Override public Aggregation build() { return Builder.this.build(); } @@ -2348,7 +2271,6 @@ public Aggregation build() { } protected static void setupAggregationDeserializer(ObjectDeserializer op) { - op.add(Builder::aggregations, JsonpDeserializer.stringMapDeserializer(Aggregation._DESERIALIZER), "aggregations", "aggs"); op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "meta"); op.add(Builder::adjacencyMatrix, AdjacencyMatrixAggregation._DESERIALIZER, "adjacency_matrix"); @@ -2375,13 +2297,14 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o op.add(Builder::geoBounds, GeoBoundsAggregation._DESERIALIZER, "geo_bounds"); op.add(Builder::geoCentroid, GeoCentroidAggregation._DESERIALIZER, "geo_centroid"); op.add(Builder::geoDistance, GeoDistanceAggregation._DESERIALIZER, "geo_distance"); - op.add(Builder::geohashGrid, GeoHashGridAggregation._DESERIALIZER, "geohash_grid"); op.add(Builder::geoLine, GeoLineAggregation._DESERIALIZER, "geo_line"); + op.add(Builder::geohashGrid, GeoHashGridAggregation._DESERIALIZER, "geohash_grid"); op.add(Builder::geotileGrid, GeoTileGridAggregation._DESERIALIZER, "geotile_grid"); op.add(Builder::global, GlobalAggregation._DESERIALIZER, "global"); op.add(Builder::histogram, HistogramAggregation._DESERIALIZER, "histogram"); - op.add(Builder::ipRange, IpRangeAggregation._DESERIALIZER, "ip_range"); op.add(Builder::inference, InferenceAggregation._DESERIALIZER, "inference"); + op.add(Builder::ipRange, IpRangeAggregation._DESERIALIZER, "ip_range"); + op.add(Builder::line, GeoLineAggregation._DESERIALIZER, "line"); op.add(Builder::matrixStats, MatrixStatsAggregation._DESERIALIZER, "matrix_stats"); op.add(Builder::max, MaxAggregation._DESERIALIZER, "max"); op.add(Builder::maxBucket, MaxBucketAggregation._DESERIALIZER, "max_bucket"); @@ -2390,8 +2313,8 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o op.add(Builder::minBucket, MinBucketAggregation._DESERIALIZER, "min_bucket"); op.add(Builder::missing, MissingAggregation._DESERIALIZER, "missing"); op.add(Builder::movingAvg, MovingAverageAggregation._DESERIALIZER, "moving_avg"); - op.add(Builder::movingPercentiles, MovingPercentilesAggregation._DESERIALIZER, "moving_percentiles"); op.add(Builder::movingFn, MovingFunctionAggregation._DESERIALIZER, "moving_fn"); + op.add(Builder::movingPercentiles, MovingPercentilesAggregation._DESERIALIZER, "moving_percentiles"); op.add(Builder::multiTerms, MultiTermsAggregation._DESERIALIZER, "multi_terms"); op.add(Builder::nested, NestedAggregation._DESERIALIZER, "nested"); op.add(Builder::normalize, NormalizeAggregation._DESERIALIZER, "normalize"); @@ -2413,14 +2336,13 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o op.add(Builder::stringStats, StringStatsAggregation._DESERIALIZER, "string_stats"); op.add(Builder::sum, SumAggregation._DESERIALIZER, "sum"); op.add(Builder::sumBucket, SumBucketAggregation._DESERIALIZER, "sum_bucket"); + op.add(Builder::tTest, TTestAggregation._DESERIALIZER, "t_test"); op.add(Builder::terms, TermsAggregation._DESERIALIZER, "terms"); op.add(Builder::topHits, TopHitsAggregation._DESERIALIZER, "top_hits"); - op.add(Builder::tTest, TTestAggregation._DESERIALIZER, "t_test"); op.add(Builder::topMetrics, TopMetricsAggregation._DESERIALIZER, "top_metrics"); op.add(Builder::valueCount, ValueCountAggregation._DESERIALIZER, "value_count"); - op.add(Builder::weightedAvg, WeightedAverageAggregation._DESERIALIZER, "weighted_avg"); op.add(Builder::variableWidthHistogram, VariableWidthHistogramAggregation._DESERIALIZER, "variable_width_histogram"); - + op.add(Builder::weightedAvg, WeightedAverageAggregation._DESERIALIZER, "weighted_avg"); } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -2428,4 +2350,25 @@ protected static void setupAggregationDeserializer(ObjectDeserializer o Aggregation::setupAggregationDeserializer, Builder::build ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.meta); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Aggregation other = (Aggregation) o; + return Objects.equals(this._kind, other._kind) + && Objects.equals(this._value, other._value) + && Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.meta, other.meta); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java index 3308e003e9..90788ec3d6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBase.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializer; @@ -45,7 +52,10 @@ // typedef: _types.aggregations.Aggregation +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class AggregationBase implements PlainJsonSerializable { + + @Nonnull private final Map meta; @Nullable @@ -54,15 +64,14 @@ public abstract class AggregationBase implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- protected AggregationBase(AbstractBuilder builder) { - this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.name = builder.name; - } /** * API name: {@code meta} */ + @Nonnull public final Map meta() { return this.meta; } @@ -78,6 +87,7 @@ public final String name() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -85,38 +95,53 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("meta"); generator.writeStartObject(); for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.name != null) { generator.writeKey("name"); generator.write(this.name); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private Map meta; - @Nullable private String name; + protected AbstractBuilder() {} + + protected AbstractBuilder(AggregationBase o) { + this.meta = _mapCopy(o.meta); + this.name = o.name; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.meta = _mapCopy(o.meta); + this.name = o.name; + } + + @Nonnull + protected abstract BuilderT self(); + /** * API name: {@code meta} + * *

- * Adds all entries of map to meta. + * Adds all elements of map to meta. + *

*/ + @Nonnull public final BuilderT meta(Map map) { this.meta = _mapPutAll(this.meta, map); return self(); @@ -124,9 +149,12 @@ public final BuilderT meta(Map map) { /** * API name: {@code meta} + * *

* Adds an entry to meta. + *

*/ + @Nonnull public final BuilderT meta(String key, JsonData value) { this.meta = _mapPut(this.meta, key, value); return self(); @@ -135,21 +163,33 @@ public final BuilderT meta(String key, JsonData value) { /** * API name: {@code name} */ + @Nonnull public final BuilderT name(@Nullable String value) { this.name = value; return self(); } - - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- - protected static > void setupAggregationBaseDeserializer(ObjectDeserializer op) { + protected static > void setupAggregationBaseDeserializer(ObjectDeserializer op) { op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "meta"); op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + Objects.hashCode(this.name); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AggregationBase other = (AggregationBase) o; + return Objects.equals(this.meta, other.meta) && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java index 68121b10f2..5f98a68bc6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationBuilders.java @@ -30,163 +30,150 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.opensearch._types.query_dsl.Query; /** * Builders for {@link Aggregation} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class AggregationBuilders { private AggregationBuilders() {} /** - * Creates a builder for the {@link AdjacencyMatrixAggregation adjacency_matrix} - * {@code Aggregation} variant. + * Creates a builder for the {@link AdjacencyMatrixAggregation adjacency_matrix} {@code Aggregation} variant. */ public static AdjacencyMatrixAggregation.Builder adjacencyMatrix() { return new AdjacencyMatrixAggregation.Builder(); } /** - * Creates a builder for the {@link AutoDateHistogramAggregation - * auto_date_histogram} {@code Aggregation} variant. + * Creates a builder for the {@link AutoDateHistogramAggregation auto_date_histogram} {@code Aggregation} variant. */ public static AutoDateHistogramAggregation.Builder autoDateHistogram() { return new AutoDateHistogramAggregation.Builder(); } /** - * Creates a builder for the {@link AverageAggregation avg} {@code Aggregation} - * variant. + * Creates a builder for the {@link AverageAggregation avg} {@code Aggregation} variant. */ public static AverageAggregation.Builder avg() { return new AverageAggregation.Builder(); } /** - * Creates a builder for the {@link AverageBucketAggregation avg_bucket} - * {@code Aggregation} variant. + * Creates a builder for the {@link AverageBucketAggregation avg_bucket} {@code Aggregation} variant. */ public static AverageBucketAggregation.Builder avgBucket() { return new AverageBucketAggregation.Builder(); } /** - * Creates a builder for the {@link BoxplotAggregation boxplot} - * {@code Aggregation} variant. + * Creates a builder for the {@link BoxplotAggregation boxplot} {@code Aggregation} variant. */ public static BoxplotAggregation.Builder boxplot() { return new BoxplotAggregation.Builder(); } /** - * Creates a builder for the {@link BucketScriptAggregation bucket_script} - * {@code Aggregation} variant. + * Creates a builder for the {@link BucketScriptAggregation bucket_script} {@code Aggregation} variant. */ public static BucketScriptAggregation.Builder bucketScript() { return new BucketScriptAggregation.Builder(); } /** - * Creates a builder for the {@link BucketSelectorAggregation bucket_selector} - * {@code Aggregation} variant. + * Creates a builder for the {@link BucketSelectorAggregation bucket_selector} {@code Aggregation} variant. */ public static BucketSelectorAggregation.Builder bucketSelector() { return new BucketSelectorAggregation.Builder(); } /** - * Creates a builder for the {@link BucketSortAggregation bucket_sort} - * {@code Aggregation} variant. + * Creates a builder for the {@link BucketSortAggregation bucket_sort} {@code Aggregation} variant. */ public static BucketSortAggregation.Builder bucketSort() { return new BucketSortAggregation.Builder(); } /** - * Creates a builder for the {@link CardinalityAggregation cardinality} - * {@code Aggregation} variant. + * Creates a builder for the {@link CardinalityAggregation cardinality} {@code Aggregation} variant. */ public static CardinalityAggregation.Builder cardinality() { return new CardinalityAggregation.Builder(); } /** - * Creates a builder for the {@link ChildrenAggregation children} - * {@code Aggregation} variant. + * Creates a builder for the {@link ChildrenAggregation children} {@code Aggregation} variant. */ public static ChildrenAggregation.Builder children() { return new ChildrenAggregation.Builder(); } /** - * Creates a builder for the {@link CompositeAggregation composite} - * {@code Aggregation} variant. + * Creates a builder for the {@link CompositeAggregation composite} {@code Aggregation} variant. */ public static CompositeAggregation.Builder composite() { return new CompositeAggregation.Builder(); } /** - * Creates a builder for the {@link CumulativeCardinalityAggregation - * cumulative_cardinality} {@code Aggregation} variant. + * Creates a builder for the {@link CumulativeCardinalityAggregation cumulative_cardinality} {@code Aggregation} variant. */ public static CumulativeCardinalityAggregation.Builder cumulativeCardinality() { return new CumulativeCardinalityAggregation.Builder(); } /** - * Creates a builder for the {@link CumulativeSumAggregation cumulative_sum} - * {@code Aggregation} variant. + * Creates a builder for the {@link CumulativeSumAggregation cumulative_sum} {@code Aggregation} variant. */ public static CumulativeSumAggregation.Builder cumulativeSum() { return new CumulativeSumAggregation.Builder(); } /** - * Creates a builder for the {@link DateHistogramAggregation date_histogram} - * {@code Aggregation} variant. + * Creates a builder for the {@link DateHistogramAggregation date_histogram} {@code Aggregation} variant. */ public static DateHistogramAggregation.Builder dateHistogram() { return new DateHistogramAggregation.Builder(); } /** - * Creates a builder for the {@link DateRangeAggregation date_range} - * {@code Aggregation} variant. + * Creates a builder for the {@link DateRangeAggregation date_range} {@code Aggregation} variant. */ public static DateRangeAggregation.Builder dateRange() { return new DateRangeAggregation.Builder(); } /** - * Creates a builder for the {@link DerivativeAggregation derivative} - * {@code Aggregation} variant. + * Creates a builder for the {@link DerivativeAggregation derivative} {@code Aggregation} variant. */ public static DerivativeAggregation.Builder derivative() { return new DerivativeAggregation.Builder(); } /** - * Creates a builder for the {@link DiversifiedSamplerAggregation - * diversified_sampler} {@code Aggregation} variant. + * Creates a builder for the {@link DiversifiedSamplerAggregation diversified_sampler} {@code Aggregation} variant. */ public static DiversifiedSamplerAggregation.Builder diversifiedSampler() { return new DiversifiedSamplerAggregation.Builder(); } /** - * Creates a builder for the {@link ExtendedStatsAggregation extended_stats} - * {@code Aggregation} variant. + * Creates a builder for the {@link ExtendedStatsAggregation extended_stats} {@code Aggregation} variant. */ public static ExtendedStatsAggregation.Builder extendedStats() { return new ExtendedStatsAggregation.Builder(); } /** - * Creates a builder for the {@link ExtendedStatsBucketAggregation - * extended_stats_bucket} {@code Aggregation} variant. + * Creates a builder for the {@link ExtendedStatsBucketAggregation extended_stats_bucket} {@code Aggregation} variant. */ public static ExtendedStatsBucketAggregation.Builder extendedStatsBucket() { return new ExtendedStatsBucketAggregation.Builder(); @@ -200,395 +187,352 @@ public static Query.Builder filter() { } /** - * Creates a builder for the {@link FiltersAggregation filters} - * {@code Aggregation} variant. + * Creates a builder for the {@link FiltersAggregation filters} {@code Aggregation} variant. */ public static FiltersAggregation.Builder filters() { return new FiltersAggregation.Builder(); } /** - * Creates a builder for the {@link GeoBoundsAggregation geo_bounds} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoBoundsAggregation geo_bounds} {@code Aggregation} variant. */ public static GeoBoundsAggregation.Builder geoBounds() { return new GeoBoundsAggregation.Builder(); } /** - * Creates a builder for the {@link GeoCentroidAggregation geo_centroid} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoCentroidAggregation geo_centroid} {@code Aggregation} variant. */ public static GeoCentroidAggregation.Builder geoCentroid() { return new GeoCentroidAggregation.Builder(); } /** - * Creates a builder for the {@link GeoDistanceAggregation geo_distance} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoDistanceAggregation geo_distance} {@code Aggregation} variant. */ public static GeoDistanceAggregation.Builder geoDistance() { return new GeoDistanceAggregation.Builder(); } /** - * Creates a builder for the {@link GeoHashGridAggregation geohash_grid} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoLineAggregation geo_line} {@code Aggregation} variant. */ - public static GeoHashGridAggregation.Builder geohashGrid() { - return new GeoHashGridAggregation.Builder(); + public static GeoLineAggregation.Builder geoLine() { + return new GeoLineAggregation.Builder(); } /** - * Creates a builder for the {@link GeoLineAggregation geo_line} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoHashGridAggregation geohash_grid} {@code Aggregation} variant. */ - public static GeoLineAggregation.Builder geoLine() { - return new GeoLineAggregation.Builder(); + public static GeoHashGridAggregation.Builder geohashGrid() { + return new GeoHashGridAggregation.Builder(); } /** - * Creates a builder for the {@link GeoTileGridAggregation geotile_grid} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoTileGridAggregation geotile_grid} {@code Aggregation} variant. */ public static GeoTileGridAggregation.Builder geotileGrid() { return new GeoTileGridAggregation.Builder(); } /** - * Creates a builder for the {@link GlobalAggregation global} - * {@code Aggregation} variant. + * Creates a builder for the {@link GlobalAggregation global} {@code Aggregation} variant. */ public static GlobalAggregation.Builder global() { return new GlobalAggregation.Builder(); } /** - * Creates a builder for the {@link HistogramAggregation histogram} - * {@code Aggregation} variant. + * Creates a builder for the {@link HistogramAggregation histogram} {@code Aggregation} variant. */ public static HistogramAggregation.Builder histogram() { return new HistogramAggregation.Builder(); } /** - * Creates a builder for the {@link IpRangeAggregation ip_range} - * {@code Aggregation} variant. + * Creates a builder for the {@link InferenceAggregation inference} {@code Aggregation} variant. + */ + public static InferenceAggregation.Builder inference() { + return new InferenceAggregation.Builder(); + } + + /** + * Creates a builder for the {@link IpRangeAggregation ip_range} {@code Aggregation} variant. */ public static IpRangeAggregation.Builder ipRange() { return new IpRangeAggregation.Builder(); } /** - * Creates a builder for the {@link InferenceAggregation inference} - * {@code Aggregation} variant. + * Creates a builder for the {@link GeoLineAggregation line} {@code Aggregation} variant. */ - public static InferenceAggregation.Builder inference() { - return new InferenceAggregation.Builder(); + public static GeoLineAggregation.Builder line() { + return new GeoLineAggregation.Builder(); } /** - * Creates a builder for the {@link MatrixStatsAggregation matrix_stats} - * {@code Aggregation} variant. + * Creates a builder for the {@link MatrixStatsAggregation matrix_stats} {@code Aggregation} variant. */ public static MatrixStatsAggregation.Builder matrixStats() { return new MatrixStatsAggregation.Builder(); } /** - * Creates a builder for the {@link MaxAggregation max} {@code Aggregation} - * variant. + * Creates a builder for the {@link MaxAggregation max} {@code Aggregation} variant. */ public static MaxAggregation.Builder max() { return new MaxAggregation.Builder(); } /** - * Creates a builder for the {@link MaxBucketAggregation max_bucket} - * {@code Aggregation} variant. + * Creates a builder for the {@link MaxBucketAggregation max_bucket} {@code Aggregation} variant. */ public static MaxBucketAggregation.Builder maxBucket() { return new MaxBucketAggregation.Builder(); } /** - * Creates a builder for the {@link MedianAbsoluteDeviationAggregation - * median_absolute_deviation} {@code Aggregation} variant. + * Creates a builder for the {@link MedianAbsoluteDeviationAggregation median_absolute_deviation} {@code Aggregation} variant. */ public static MedianAbsoluteDeviationAggregation.Builder medianAbsoluteDeviation() { return new MedianAbsoluteDeviationAggregation.Builder(); } /** - * Creates a builder for the {@link MinAggregation min} {@code Aggregation} - * variant. + * Creates a builder for the {@link MinAggregation min} {@code Aggregation} variant. */ public static MinAggregation.Builder min() { return new MinAggregation.Builder(); } /** - * Creates a builder for the {@link MinBucketAggregation min_bucket} - * {@code Aggregation} variant. + * Creates a builder for the {@link MinBucketAggregation min_bucket} {@code Aggregation} variant. */ public static MinBucketAggregation.Builder minBucket() { return new MinBucketAggregation.Builder(); } /** - * Creates a builder for the {@link MissingAggregation missing} - * {@code Aggregation} variant. + * Creates a builder for the {@link MissingAggregation missing} {@code Aggregation} variant. */ public static MissingAggregation.Builder missing() { return new MissingAggregation.Builder(); } /** - * Creates a builder for the {@link MovingAverageAggregation moving_avg} - * {@code Aggregation} variant. + * Creates a builder for the {@link MovingAverageAggregation moving_avg} {@code Aggregation} variant. */ public static MovingAverageAggregation.Builder movingAvg() { return new MovingAverageAggregation.Builder(); } /** - * Creates a builder for the {@link MovingPercentilesAggregation - * moving_percentiles} {@code Aggregation} variant. + * Creates a builder for the {@link MovingFunctionAggregation moving_fn} {@code Aggregation} variant. */ - public static MovingPercentilesAggregation.Builder movingPercentiles() { - return new MovingPercentilesAggregation.Builder(); + public static MovingFunctionAggregation.Builder movingFn() { + return new MovingFunctionAggregation.Builder(); } /** - * Creates a builder for the {@link MovingFunctionAggregation moving_fn} - * {@code Aggregation} variant. + * Creates a builder for the {@link MovingPercentilesAggregation moving_percentiles} {@code Aggregation} variant. */ - public static MovingFunctionAggregation.Builder movingFn() { - return new MovingFunctionAggregation.Builder(); + public static MovingPercentilesAggregation.Builder movingPercentiles() { + return new MovingPercentilesAggregation.Builder(); } /** - * Creates a builder for the {@link MultiTermsAggregation multi_terms} - * {@code Aggregation} variant. + * Creates a builder for the {@link MultiTermsAggregation multi_terms} {@code Aggregation} variant. */ public static MultiTermsAggregation.Builder multiTerms() { return new MultiTermsAggregation.Builder(); } /** - * Creates a builder for the {@link NestedAggregation nested} - * {@code Aggregation} variant. + * Creates a builder for the {@link NestedAggregation nested} {@code Aggregation} variant. */ public static NestedAggregation.Builder nested() { return new NestedAggregation.Builder(); } /** - * Creates a builder for the {@link NormalizeAggregation normalize} - * {@code Aggregation} variant. + * Creates a builder for the {@link NormalizeAggregation normalize} {@code Aggregation} variant. */ public static NormalizeAggregation.Builder normalize() { return new NormalizeAggregation.Builder(); } /** - * Creates a builder for the {@link ParentAggregation parent} - * {@code Aggregation} variant. + * Creates a builder for the {@link ParentAggregation parent} {@code Aggregation} variant. */ public static ParentAggregation.Builder parent() { return new ParentAggregation.Builder(); } /** - * Creates a builder for the {@link PercentileRanksAggregation percentile_ranks} - * {@code Aggregation} variant. + * Creates a builder for the {@link PercentileRanksAggregation percentile_ranks} {@code Aggregation} variant. */ public static PercentileRanksAggregation.Builder percentileRanks() { return new PercentileRanksAggregation.Builder(); } /** - * Creates a builder for the {@link PercentilesAggregation percentiles} - * {@code Aggregation} variant. + * Creates a builder for the {@link PercentilesAggregation percentiles} {@code Aggregation} variant. */ public static PercentilesAggregation.Builder percentiles() { return new PercentilesAggregation.Builder(); } /** - * Creates a builder for the {@link PercentilesBucketAggregation - * percentiles_bucket} {@code Aggregation} variant. + * Creates a builder for the {@link PercentilesBucketAggregation percentiles_bucket} {@code Aggregation} variant. */ public static PercentilesBucketAggregation.Builder percentilesBucket() { return new PercentilesBucketAggregation.Builder(); } /** - * Creates a builder for the {@link RangeAggregation range} {@code Aggregation} - * variant. + * Creates a builder for the {@link RangeAggregation range} {@code Aggregation} variant. */ public static RangeAggregation.Builder range() { return new RangeAggregation.Builder(); } /** - * Creates a builder for the {@link RareTermsAggregation rare_terms} - * {@code Aggregation} variant. + * Creates a builder for the {@link RareTermsAggregation rare_terms} {@code Aggregation} variant. */ public static RareTermsAggregation.Builder rareTerms() { return new RareTermsAggregation.Builder(); } /** - * Creates a builder for the {@link RateAggregation rate} {@code Aggregation} - * variant. + * Creates a builder for the {@link RateAggregation rate} {@code Aggregation} variant. */ public static RateAggregation.Builder rate() { return new RateAggregation.Builder(); } /** - * Creates a builder for the {@link ReverseNestedAggregation reverse_nested} - * {@code Aggregation} variant. + * Creates a builder for the {@link ReverseNestedAggregation reverse_nested} {@code Aggregation} variant. */ public static ReverseNestedAggregation.Builder reverseNested() { return new ReverseNestedAggregation.Builder(); } /** - * Creates a builder for the {@link SamplerAggregation sampler} - * {@code Aggregation} variant. + * Creates a builder for the {@link SamplerAggregation sampler} {@code Aggregation} variant. */ public static SamplerAggregation.Builder sampler() { return new SamplerAggregation.Builder(); } /** - * Creates a builder for the {@link ScriptedMetricAggregation scripted_metric} - * {@code Aggregation} variant. + * Creates a builder for the {@link ScriptedMetricAggregation scripted_metric} {@code Aggregation} variant. */ public static ScriptedMetricAggregation.Builder scriptedMetric() { return new ScriptedMetricAggregation.Builder(); } /** - * Creates a builder for the {@link SerialDifferencingAggregation serial_diff} - * {@code Aggregation} variant. + * Creates a builder for the {@link SerialDifferencingAggregation serial_diff} {@code Aggregation} variant. */ public static SerialDifferencingAggregation.Builder serialDiff() { return new SerialDifferencingAggregation.Builder(); } /** - * Creates a builder for the {@link SignificantTermsAggregation - * significant_terms} {@code Aggregation} variant. + * Creates a builder for the {@link SignificantTermsAggregation significant_terms} {@code Aggregation} variant. */ public static SignificantTermsAggregation.Builder significantTerms() { return new SignificantTermsAggregation.Builder(); } /** - * Creates a builder for the {@link SignificantTextAggregation significant_text} - * {@code Aggregation} variant. + * Creates a builder for the {@link SignificantTextAggregation significant_text} {@code Aggregation} variant. */ public static SignificantTextAggregation.Builder significantText() { return new SignificantTextAggregation.Builder(); } /** - * Creates a builder for the {@link StatsAggregation stats} {@code Aggregation} - * variant. + * Creates a builder for the {@link StatsAggregation stats} {@code Aggregation} variant. */ public static StatsAggregation.Builder stats() { return new StatsAggregation.Builder(); } /** - * Creates a builder for the {@link StatsBucketAggregation stats_bucket} - * {@code Aggregation} variant. + * Creates a builder for the {@link StatsBucketAggregation stats_bucket} {@code Aggregation} variant. */ public static StatsBucketAggregation.Builder statsBucket() { return new StatsBucketAggregation.Builder(); } /** - * Creates a builder for the {@link StringStatsAggregation string_stats} - * {@code Aggregation} variant. + * Creates a builder for the {@link StringStatsAggregation string_stats} {@code Aggregation} variant. */ public static StringStatsAggregation.Builder stringStats() { return new StringStatsAggregation.Builder(); } /** - * Creates a builder for the {@link SumAggregation sum} {@code Aggregation} - * variant. + * Creates a builder for the {@link SumAggregation sum} {@code Aggregation} variant. */ public static SumAggregation.Builder sum() { return new SumAggregation.Builder(); } /** - * Creates a builder for the {@link SumBucketAggregation sum_bucket} - * {@code Aggregation} variant. + * Creates a builder for the {@link SumBucketAggregation sum_bucket} {@code Aggregation} variant. */ public static SumBucketAggregation.Builder sumBucket() { return new SumBucketAggregation.Builder(); } /** - * Creates a builder for the {@link TermsAggregation terms} {@code Aggregation} - * variant. + * Creates a builder for the {@link TTestAggregation t_test} {@code Aggregation} variant. */ - public static TermsAggregation.Builder terms() { - return new TermsAggregation.Builder(); + public static TTestAggregation.Builder tTest() { + return new TTestAggregation.Builder(); } /** - * Creates a builder for the {@link TopHitsAggregation top_hits} - * {@code Aggregation} variant. + * Creates a builder for the {@link TermsAggregation terms} {@code Aggregation} variant. */ - public static TopHitsAggregation.Builder topHits() { - return new TopHitsAggregation.Builder(); + public static TermsAggregation.Builder terms() { + return new TermsAggregation.Builder(); } /** - * Creates a builder for the {@link TTestAggregation t_test} {@code Aggregation} - * variant. + * Creates a builder for the {@link TopHitsAggregation top_hits} {@code Aggregation} variant. */ - public static TTestAggregation.Builder tTest() { - return new TTestAggregation.Builder(); + public static TopHitsAggregation.Builder topHits() { + return new TopHitsAggregation.Builder(); } /** - * Creates a builder for the {@link TopMetricsAggregation top_metrics} - * {@code Aggregation} variant. + * Creates a builder for the {@link TopMetricsAggregation top_metrics} {@code Aggregation} variant. */ public static TopMetricsAggregation.Builder topMetrics() { return new TopMetricsAggregation.Builder(); } /** - * Creates a builder for the {@link ValueCountAggregation value_count} - * {@code Aggregation} variant. + * Creates a builder for the {@link ValueCountAggregation value_count} {@code Aggregation} variant. */ public static ValueCountAggregation.Builder valueCount() { return new ValueCountAggregation.Builder(); } /** - * Creates a builder for the {@link WeightedAverageAggregation weighted_avg} - * {@code Aggregation} variant. + * Creates a builder for the {@link VariableWidthHistogramAggregation variable_width_histogram} {@code Aggregation} variant. */ - public static WeightedAverageAggregation.Builder weightedAvg() { - return new WeightedAverageAggregation.Builder(); + public static VariableWidthHistogramAggregation.Builder variableWidthHistogram() { + return new VariableWidthHistogramAggregation.Builder(); } /** - * Creates a builder for the {@link VariableWidthHistogramAggregation - * variable_width_histogram} {@code Aggregation} variant. + * Creates a builder for the {@link WeightedAverageAggregation weighted_avg} {@code Aggregation} variant. */ - public static VariableWidthHistogramAggregation.Builder variableWidthHistogram() { - return new VariableWidthHistogramAggregation.Builder(); + public static WeightedAverageAggregation.Builder weightedAvg() { + return new WeightedAverageAggregation.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java index 2175adc8ba..a8d95a93c4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationRange.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,17 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.AggregationRange @JsonpDeserializable -public class AggregationRange implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AggregationRange implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final String from; @@ -60,19 +71,20 @@ public class AggregationRange implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private AggregationRange(Builder builder) { - this.from = builder.from; this.key = builder.key; this.to = builder.to; - } - public static AggregationRange of(Function> fn) { + public static AggregationRange of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Start of the range (inclusive). + *

* API name: {@code from} + *

*/ @Nullable public final String from() { @@ -80,7 +92,10 @@ public final String from() { } /** + * Custom key to return the range with. + *

* API name: {@code key} + *

*/ @Nullable public final String key() { @@ -88,7 +103,10 @@ public final String key() { } /** + * End of the range (exclusive). + *

* API name: {@code to} + *

*/ @Nullable public final String to() { @@ -98,6 +116,7 @@ public final String to() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -105,60 +124,97 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.from != null) { generator.writeKey("from"); generator.write(this.from); - } + if (this.key != null) { generator.writeKey("key"); generator.write(this.key); - } + if (this.to != null) { generator.writeKey("to"); generator.write(this.to); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AggregationRange}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String from; - @Nullable private String key; - @Nullable private String to; + public Builder() {} + + private Builder(AggregationRange o) { + this.from = o.from; + this.key = o.key; + this.to = o.to; + } + + private Builder(Builder o) { + this.from = o.from; + this.key = o.key; + this.to = o.to; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Start of the range (inclusive). + *

* API name: {@code from} + *

*/ + @Nonnull public final Builder from(@Nullable String value) { this.from = value; return this; } /** + * Custom key to return the range with. + *

* API name: {@code key} + *

*/ + @Nonnull public final Builder key(@Nullable String value) { this.key = value; return this; } /** + * End of the range (exclusive). + *

* API name: {@code to} + *

*/ + @Nonnull public final Builder to(@Nullable String value) { this.to = value; return this; @@ -167,9 +223,10 @@ public final Builder to(@Nullable String value) { /** * Builds a {@link AggregationRange}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AggregationRange build() { _checkSingleUse(); @@ -188,11 +245,25 @@ public AggregationRange build() { ); protected static void setupAggregationRangeDeserializer(ObjectDeserializer op) { - op.add(Builder::from, JsonpDeserializer.stringDeserializer(), "from"); op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key"); op.add(Builder::to, JsonpDeserializer.stringDeserializer(), "to"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.from); + result = 31 * result + Objects.hashCode(this.key); + result = 31 * result + Objects.hashCode(this.to); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AggregationRange other = (AggregationRange) o; + return Objects.equals(this.from, other.from) && Objects.equals(this.key, other.key) && Objects.equals(this.to, other.to); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java index 48e1c4dbd3..7d867a279d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AggregationVariant.java @@ -30,17 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; + /** * Base interface for {@link Aggregation} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface AggregationVariant { - Aggregation.Kind _aggregationKind(); - default Aggregation _toAggregation() { + default Aggregation toAggregation() { return new Aggregation(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java index f369ca758b..b9a3c49f36 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AutoDateHistogramAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -44,12 +51,19 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.AutoDateHistogramAggregation @JsonpDeserializable -public class AutoDateHistogramAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AutoDateHistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Integer buckets; @@ -68,6 +82,7 @@ public class AutoDateHistogramAggregation extends BucketAggregationBase implemen @Nullable private final String offset; + @Nonnull private final Map params; @Nullable @@ -80,7 +95,6 @@ public class AutoDateHistogramAggregation extends BucketAggregationBase implemen private AutoDateHistogramAggregation(Builder builder) { super(builder); - this.buckets = builder.buckets; this.field = builder.field; this.format = builder.format; @@ -90,15 +104,16 @@ private AutoDateHistogramAggregation(Builder builder) { this.params = ApiTypeHelper.unmodifiable(builder.params); this.script = builder.script; this.timeZone = builder.timeZone; - } - public static AutoDateHistogramAggregation of(Function> fn) { + public static AutoDateHistogramAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -106,7 +121,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * The target number of buckets. + *

* API name: {@code buckets} + *

*/ @Nullable public final Integer buckets() { @@ -122,7 +140,11 @@ public final String field() { } /** + * The date format used to format key_as_string in the response. If no format is specified, the first date + * format specified in the field mapping is used. + *

* API name: {@code format} + *

*/ @Nullable public final String format() { @@ -146,7 +168,10 @@ public final String missing() { } /** + * Time zone specified as a ISO 8601 UTC offset. + *

* API name: {@code offset} + *

*/ @Nullable public final String offset() { @@ -156,6 +181,7 @@ public final String offset() { /** * API name: {@code params} */ + @Nonnull public final Map params() { return this.params; } @@ -177,100 +203,143 @@ public final String timeZone() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.buckets != null) { generator.writeKey("buckets"); generator.write(this.buckets); - } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } + if (this.minimumInterval != null) { generator.writeKey("minimum_interval"); this.minimumInterval.serialize(generator, mapper); } + if (this.missing != null) { generator.writeKey("missing"); generator.write(this.missing); - } + if (this.offset != null) { generator.writeKey("offset"); generator.write(this.offset); - } + if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); generator.writeStartObject(); for (Map.Entry item0 : this.params.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } + if (this.timeZone != null) { generator.writeKey("time_zone"); generator.write(this.timeZone); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AutoDateHistogramAggregation}. */ - public static class Builder extends BucketAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Integer buckets; - @Nullable private String field; - @Nullable private String format; - @Nullable private MinimumInterval minimumInterval; - @Nullable private String missing; - @Nullable private String offset; - @Nullable private Map params; - @Nullable private Script script; - @Nullable private String timeZone; + public Builder() {} + + private Builder(AutoDateHistogramAggregation o) { + super(o); + this.buckets = o.buckets; + this.field = o.field; + this.format = o.format; + this.minimumInterval = o.minimumInterval; + this.missing = o.missing; + this.offset = o.offset; + this.params = _mapCopy(o.params); + this.script = o.script; + this.timeZone = o.timeZone; + } + + private Builder(Builder o) { + super(o); + this.buckets = o.buckets; + this.field = o.field; + this.format = o.format; + this.minimumInterval = o.minimumInterval; + this.missing = o.missing; + this.offset = o.offset; + this.params = _mapCopy(o.params); + this.script = o.script; + this.timeZone = o.timeZone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The target number of buckets. + *

* API name: {@code buckets} + *

*/ + @Nonnull public final Builder buckets(@Nullable Integer value) { this.buckets = value; return this; @@ -279,14 +348,20 @@ public final Builder buckets(@Nullable Integer value) { /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * The date format used to format key_as_string in the response. If no format is specified, the first date + * format specified in the field mapping is used. + *

* API name: {@code format} + *

*/ + @Nonnull public final Builder format(@Nullable String value) { this.format = value; return this; @@ -295,6 +370,7 @@ public final Builder format(@Nullable String value) { /** * API name: {@code minimum_interval} */ + @Nonnull public final Builder minimumInterval(@Nullable MinimumInterval value) { this.minimumInterval = value; return this; @@ -303,14 +379,19 @@ public final Builder minimumInterval(@Nullable MinimumInterval value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable String value) { this.missing = value; return this; } /** + * Time zone specified as a ISO 8601 UTC offset. + *

* API name: {@code offset} + *

*/ + @Nonnull public final Builder offset(@Nullable String value) { this.offset = value; return this; @@ -318,9 +399,12 @@ public final Builder offset(@Nullable String value) { /** * API name: {@code params} + * *

- * Adds all entries of map to params. + * Adds all elements of map to params. + *

*/ + @Nonnull public final Builder params(Map map) { this.params = _mapPutAll(this.params, map); return this; @@ -328,9 +412,12 @@ public final Builder params(Map map) { /** * API name: {@code params} + * *

* Adds an entry to params. + *

*/ + @Nonnull public final Builder params(String key, JsonData value) { this.params = _mapPut(this.params, key, value); return this; @@ -339,6 +426,7 @@ public final Builder params(String key, JsonData value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -347,29 +435,27 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** * API name: {@code time_zone} */ + @Nonnull public final Builder timeZone(@Nullable String value) { this.timeZone = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link AutoDateHistogramAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AutoDateHistogramAggregation build() { _checkSingleUse(); @@ -388,7 +474,7 @@ public AutoDateHistogramAggregation build() { ); protected static void setupAutoDateHistogramAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::buckets, JsonpDeserializer.integerDeserializer(), "buckets"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); @@ -398,7 +484,39 @@ protected static void setupAutoDateHistogramAggregationDeserializer(ObjectDeseri op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.buckets); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.minimumInterval); + result = 31 * result + Objects.hashCode(this.missing); + result = 31 * result + Objects.hashCode(this.offset); + result = 31 * result + Objects.hashCode(this.params); + result = 31 * result + Objects.hashCode(this.script); + result = 31 * result + Objects.hashCode(this.timeZone); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AutoDateHistogramAggregation other = (AutoDateHistogramAggregation) o; + return Objects.equals(this.buckets, other.buckets) + && Objects.equals(this.field, other.field) + && Objects.equals(this.format, other.format) + && Objects.equals(this.minimumInterval, other.minimumInterval) + && Objects.equals(this.missing, other.missing) + && Objects.equals(this.offset, other.offset) + && Objects.equals(this.params, other.params) + && Objects.equals(this.script, other.script) + && Objects.equals(this.timeZone, other.timeZone); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java index e89d7738e7..00751b62c4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.AverageAggregation @JsonpDeserializable -public class AverageAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AverageAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private AverageAggregation(Builder builder) { super(builder); - } - public static AverageAggregation of(Function> fn) { + public static AverageAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AverageAggregation}. */ + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(AverageAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link AverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AverageAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public AverageAggregation build() { ); protected static void setupAverageAggregationDeserializer(ObjectDeserializer op) { - FormatMetricAggregationBase.setupFormatMetricAggregationBaseDeserializer(op); + setupFormatMetricAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java index b8e616706d..f68f27fd0a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/AverageBucketAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.AverageBucketAggregation @JsonpDeserializable -public class AverageBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AverageBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private AverageBucketAggregation(Builder builder) { super(builder); - } - public static AverageBucketAggregation of(Function> fn) { + public static AverageBucketAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,14 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AverageBucketAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(AverageBucketAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -79,9 +119,10 @@ protected Builder self() { /** * Builds a {@link AverageBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AverageBucketAggregation build() { _checkSingleUse(); @@ -100,8 +141,22 @@ public AverageBucketAggregation build() { ); protected static void setupAverageBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java index 17f0a6c239..66713b7f6e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BoxplotAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.BoxplotAggregation @JsonpDeserializable -public class BoxplotAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BoxplotAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Double compression; @@ -53,17 +67,15 @@ public class BoxplotAggregation extends MetricAggregationBase implements Aggrega private BoxplotAggregation(Builder builder) { super(builder); - this.compression = builder.compression; - } - public static BoxplotAggregation of(Function> fn) { + public static BoxplotAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +83,11 @@ public Aggregation.Kind _aggregationKind() { } /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ @Nullable public final Double compression() { @@ -79,45 +95,79 @@ public final Double compression() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.compression != null) { generator.writeKey("compression"); generator.write(this.compression); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link BoxplotAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Double compression; + public Builder() {} + + private Builder(BoxplotAggregation o) { + super(o); + this.compression = o.compression; + } + + private Builder(Builder o) { + super(o); + this.compression = o.compression; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ + @Nonnull public final Builder compression(@Nullable Double value) { this.compression = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link BoxplotAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public BoxplotAggregation build() { _checkSingleUse(); @@ -136,9 +186,25 @@ public BoxplotAggregation build() { ); protected static void setupBoxplotAggregationDeserializer(ObjectDeserializer op) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(Builder::compression, JsonpDeserializer.doubleDeserializer(), "compression"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.compression); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BoxplotAggregation other = (BoxplotAggregation) o; + return Objects.equals(this.compression, other.compression); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java index 3d35d09a44..30c9325228 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketAggregationBase.java @@ -30,35 +30,64 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.ObjectDeserializer; // typedef: _types.aggregations.BucketAggregationBase -/** - * Base type for bucket aggregations. These aggregations also accept - * sub-aggregations. - * - */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class BucketAggregationBase extends AggregationBase { + // --------------------------------------------------------------------------------------------- protected BucketAggregationBase(AbstractBuilder builder) { super(builder); - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder< - BuilderT> {} + BuilderT> { + + protected AbstractBuilder() {} + + protected AbstractBuilder(BucketAggregationBase o) { + super(o); + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + } + + } // --------------------------------------------------------------------------------------------- + protected static > void setupBucketAggregationBaseDeserializer( ObjectDeserializer op ) { - AggregationBase.setupAggregationBaseDeserializer(op); + setupAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketPathAggregation.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketPathAggregation.java index 367c548c5a..077b74ee06 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketPathAggregation.java @@ -30,37 +30,35 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ObjectBuilder; -// typedef: _types.aggregations.PipelineAggregationBase - -public abstract class PipelineAggregationBase extends AggregationBase { - @Nullable - private final BucketsPath bucketsPath; +// typedef: _types.aggregations.BucketPathAggregation - @Nullable - private final String format; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class BucketPathAggregation extends AggregationBase { @Nullable - private final GapPolicy gapPolicy; + private final BucketsPath bucketsPath; // --------------------------------------------------------------------------------------------- - protected PipelineAggregationBase(AbstractBuilder builder) { + protected BucketPathAggregation(AbstractBuilder builder) { super(builder); - this.bucketsPath = builder.bucketsPath; - this.format = builder.format; - this.gapPolicy = builder.gapPolicy; - } /** @@ -71,56 +69,37 @@ public final BucketsPath bucketsPath() { return this.bucketsPath; } - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * API name: {@code gap_policy} - */ - @Nullable - public final GapPolicy gapPolicy() { - return this.gapPolicy; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.bucketsPath != null) { generator.writeKey("buckets_path"); this.bucketsPath.serialize(generator, mapper); - - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - if (this.gapPolicy != null) { - generator.writeKey("gap_policy"); - this.gapPolicy.serialize(generator, mapper); } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder< BuilderT> { @Nullable private BucketsPath bucketsPath; - @Nullable - private String format; + protected AbstractBuilder() {} - @Nullable - private GapPolicy gapPolicy; + protected AbstractBuilder(BucketPathAggregation o) { + super(o); + this.bucketsPath = o.bucketsPath; + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.bucketsPath = o.bucketsPath; + } /** * API name: {@code buckets_path} */ + @Nonnull public final BuilderT bucketsPath(@Nullable BucketsPath value) { this.bucketsPath = value; return self(); @@ -129,37 +108,36 @@ public final BuilderT bucketsPath(@Nullable BucketsPath value) { /** * API name: {@code buckets_path} */ + @Nonnull public final BuilderT bucketsPath(Function> fn) { - return this.bucketsPath(fn.apply(new BucketsPath.Builder()).build()); + return bucketsPath(fn.apply(new BucketsPath.Builder()).build()); } - - /** - * API name: {@code format} - */ - public final BuilderT format(@Nullable String value) { - this.format = value; - return self(); - } - - /** - * API name: {@code gap_policy} - */ - public final BuilderT gapPolicy(@Nullable GapPolicy value) { - this.gapPolicy = value; - return self(); - } - } // --------------------------------------------------------------------------------------------- - protected static > void setupPipelineAggregationBaseDeserializer( + + protected static > void setupBucketPathAggregationDeserializer( ObjectDeserializer op ) { setupAggregationBaseDeserializer(op); op.add(AbstractBuilder::bucketsPath, BucketsPath._DESERIALIZER, "buckets_path"); - op.add(AbstractBuilder::format, JsonpDeserializer.stringDeserializer(), "format"); - op.add(AbstractBuilder::gapPolicy, GapPolicy._DESERIALIZER, "gap_policy"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.bucketsPath); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BucketPathAggregation other = (BucketPathAggregation) o; + return Objects.equals(this.bucketsPath, other.bucketsPath); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java index 69db250263..31e34a9b38 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketScriptAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.BucketScriptAggregation @JsonpDeserializable -public class BucketScriptAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BucketScriptAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Script script; @@ -54,17 +68,15 @@ public class BucketScriptAggregation extends PipelineAggregationBase implements private BucketScriptAggregation(Builder builder) { super(builder); - this.script = builder.script; - } - public static BucketScriptAggregation of(Function> fn) { + public static BucketScriptAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -80,29 +92,63 @@ public final Script script() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link BucketScriptAggregation}. */ - - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Script script; + public Builder() {} + + private Builder(BucketScriptAggregation o) { + super(o); + this.script = o.script; + } + + private Builder(Builder o) { + super(o); + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -111,21 +157,18 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link BucketScriptAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public BucketScriptAggregation build() { _checkSingleUse(); @@ -144,9 +187,25 @@ public BucketScriptAggregation build() { ); protected static void setupBucketScriptAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BucketScriptAggregation other = (BucketScriptAggregation) o; + return Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java index 5b244edb69..b28f495ecb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSelectorAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.BucketSelectorAggregation @JsonpDeserializable -public class BucketSelectorAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BucketSelectorAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Script script; @@ -54,17 +68,15 @@ public class BucketSelectorAggregation extends PipelineAggregationBase implement private BucketSelectorAggregation(Builder builder) { super(builder); - this.script = builder.script; - } - public static BucketSelectorAggregation of(Function> fn) { + public static BucketSelectorAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -80,31 +92,63 @@ public final Script script() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link BucketSelectorAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Script script; + public Builder() {} + + private Builder(BucketSelectorAggregation o) { + super(o); + this.script = o.script; + } + + private Builder(Builder o) { + super(o); + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -113,21 +157,18 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link BucketSelectorAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public BucketSelectorAggregation build() { _checkSingleUse(); @@ -146,9 +187,25 @@ public BucketSelectorAggregation build() { ); protected static void setupBucketSelectorAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BucketSelectorAggregation other = (BucketSelectorAggregation) o; + return Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java index 21542a0fd5..6350ce8041 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketSortAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,12 +50,19 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.SortOptions; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.BucketSortAggregation @JsonpDeserializable -public class BucketSortAggregation extends AggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BucketSortAggregation extends AggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Integer from; @@ -58,26 +72,25 @@ public class BucketSortAggregation extends AggregationBase implements Aggregatio @Nullable private final Integer size; + @Nonnull private final List sort; // --------------------------------------------------------------------------------------------- private BucketSortAggregation(Builder builder) { super(builder); - this.from = builder.from; this.gapPolicy = builder.gapPolicy; this.size = builder.size; this.sort = ApiTypeHelper.unmodifiable(builder.sort); - } - public static BucketSortAggregation of(Function> fn) { + public static BucketSortAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -85,7 +98,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * Buckets in positions prior to from will be truncated. + *

* API name: {@code from} + *

*/ @Nullable public final Integer from() { @@ -101,7 +117,10 @@ public final GapPolicy gapPolicy() { } /** + * The number of buckets to return. Defaults to all buckets of the parent aggregation. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -111,62 +130,103 @@ public final Integer size() { /** * API name: {@code sort} */ + @Nonnull public final List sort() { return this.sort; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.from != null) { generator.writeKey("from"); generator.write(this.from); - } + if (this.gapPolicy != null) { generator.writeKey("gap_policy"); this.gapPolicy.serialize(generator, mapper); } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (ApiTypeHelper.isDefined(this.sort)) { generator.writeKey("sort"); generator.writeStartArray(); for (SortOptions item0 : this.sort) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link BucketSortAggregation}. */ - - public static class Builder extends AggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Integer from; - @Nullable private GapPolicy gapPolicy; - @Nullable private Integer size; - @Nullable private List sort; + public Builder() {} + + private Builder(BucketSortAggregation o) { + super(o); + this.from = o.from; + this.gapPolicy = o.gapPolicy; + this.size = o.size; + this.sort = _listCopy(o.sort); + } + + private Builder(Builder o) { + super(o); + this.from = o.from; + this.gapPolicy = o.gapPolicy; + this.size = o.size; + this.sort = _listCopy(o.sort); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Buckets in positions prior to from will be truncated. + *

* API name: {@code from} + *

*/ + @Nonnull public final Builder from(@Nullable Integer value) { this.from = value; return this; @@ -175,14 +235,19 @@ public final Builder from(@Nullable Integer value) { /** * API name: {@code gap_policy} */ + @Nonnull public final Builder gapPolicy(@Nullable GapPolicy value) { this.gapPolicy = value; return this; } /** + * The number of buckets to return. Defaults to all buckets of the parent aggregation. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; @@ -190,9 +255,12 @@ public final Builder size(@Nullable Integer value) { /** * API name: {@code sort} + * *

* Adds all elements of list to sort. + *

*/ + @Nonnull public final Builder sort(List list) { this.sort = _listAddAll(this.sort, list); return this; @@ -200,9 +268,12 @@ public final Builder sort(List list) { /** * API name: {@code sort} + * *

* Adds one or more values to sort. + *

*/ + @Nonnull public final Builder sort(SortOptions value, SortOptions... values) { this.sort = _listAdd(this.sort, value, values); return this; @@ -210,24 +281,23 @@ public final Builder sort(SortOptions value, SortOptions... values) { /** * API name: {@code sort} + * *

* Adds a value to sort using a builder lambda. + *

*/ + @Nonnull public final Builder sort(Function> fn) { return sort(fn.apply(new SortOptions.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link BucketSortAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public BucketSortAggregation build() { _checkSingleUse(); @@ -251,7 +321,29 @@ protected static void setupBucketSortAggregationDeserializer(ObjectDeserializer< op.add(Builder::gapPolicy, GapPolicy._DESERIALIZER, "gap_policy"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.from); + result = 31 * result + Objects.hashCode(this.gapPolicy); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Objects.hashCode(this.sort); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BucketSortAggregation other = (BucketSortAggregation) o; + return Objects.equals(this.from, other.from) + && Objects.equals(this.gapPolicy, other.gapPolicy) + && Objects.equals(this.size, other.size) + && Objects.equals(this.sort, other.sort); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java similarity index 76% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java index 0ea0845f3a..94ebe0031c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPath.java @@ -30,16 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.PlainJsonSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -50,19 +58,19 @@ // typedef: _types.aggregations.BucketsPath /** - * Buckets path can be expressed in different ways, and an aggregation may - * accept some or all of these forms depending on its type. Please refer to each - * aggregation's documentation to know what buckets path forms they accept. - * + * Buckets path can be expressed in different ways, and an aggregation may accept some or all of these forms depending on its type. Refer to + * each aggregation's documentation to know what buckets path forms they accept. */ @JsonpDeserializable -public class BucketsPath implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BucketsPath implements TaggedUnion, PlainJsonSerializable { + /** + * {@link BucketsPath} variant kinds. + */ public enum Kind { Array, Dict, Single - } private final Kind _kind; @@ -84,13 +92,11 @@ private BucketsPath(Kind kind, Object value) { } private BucketsPath(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static BucketsPath of(Function> fn) { + public static BucketsPath of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -104,8 +110,7 @@ public boolean isArray() { /** * Get the {@code array} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code array} kind. + * @throws IllegalStateException if the current variant is not the {@code array} kind. */ public List array() { return TaggedUnionUtils.get(this, Kind.Array); @@ -121,8 +126,7 @@ public boolean isDict() { /** * Get the {@code dict} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code dict} kind. + * @throws IllegalStateException if the current variant is not the {@code dict} kind. */ public Map dict() { return TaggedUnionUtils.get(this, Kind.Dict); @@ -138,8 +142,7 @@ public boolean isSingle() { /** * Get the {@code single} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code single} kind. + * @throws IllegalStateException if the current variant is not the {@code single} kind. */ public String single() { return TaggedUnionUtils.get(this, Kind.Single); @@ -155,34 +158,45 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (String item0 : ((List) this._value)) { generator.write(item0); - } generator.writeEnd(); - break; case Dict: generator.writeStartObject(); for (Map.Entry item0 : ((Map) this._value).entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - break; case Single: generator.write(((String) this._value)); - break; } } + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + public Builder() {} + + private Builder(BucketsPath o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder array(List v) { this._kind = Kind.Array; this._value = v; @@ -201,11 +215,11 @@ public ObjectBuilder single(String v) { return this; } + @Override public BucketsPath build() { _checkSingleUse(); return new BucketsPath(this); } - } private static JsonpDeserializer buildBucketsPathDeserializer() { @@ -219,4 +233,20 @@ private static JsonpDeserializer buildBucketsPathDeserializer() { } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(BucketsPath::buildBucketsPathDeserializer); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + BucketsPath other = (BucketsPath) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java index 3fc101e364..0f0eebb00e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CalendarInterval.java @@ -30,30 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.CalendarInterval + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum CalendarInterval implements JsonEnum { - Second("second", "1s"), - - Minute("minute", "1m"), + Day("day", "1d"), Hour("hour", "1h"), - Day("day", "1d"), - - Week("week", "1w"), + Minute("minute", "1m"), Month("month", "1M"), Quarter("quarter", "1q"), - Year("year", "1Y"), + Second("second", "1s"), + + Week("week", "1w"), - ; + Year("year", "1Y"); private final String jsonValue; private final String[] aliases; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java index 3a7d5f12f2..ab3f5f2ea5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityAggregation.java @@ -30,22 +30,39 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.CardinalityAggregation @JsonpDeserializable -public class CardinalityAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CardinalityAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nullable + private final CardinalityExecutionMode executionHint; + @Nullable private final Integer precisionThreshold; @@ -56,18 +73,17 @@ public class CardinalityAggregation extends MetricAggregationBase implements Agg private CardinalityAggregation(Builder builder) { super(builder); - + this.executionHint = builder.executionHint; this.precisionThreshold = builder.precisionThreshold; this.rehash = builder.rehash; - } - public static CardinalityAggregation of(Function> fn) { + public static CardinalityAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -75,7 +91,18 @@ public Aggregation.Kind _aggregationKind() { } /** + * API name: {@code execution_hint} + */ + @Nullable + public final CardinalityExecutionMode executionHint() { + return this.executionHint; + } + + /** + * A unique count below which counts are expected to be close to accurate. This allows to trade memory for accuracy. + *

* API name: {@code precision_threshold} + *

*/ @Nullable public final Integer precisionThreshold() { @@ -91,37 +118,93 @@ public final Boolean rehash() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); + if (this.executionHint != null) { + generator.writeKey("execution_hint"); + this.executionHint.serialize(generator, mapper); + } + if (this.precisionThreshold != null) { generator.writeKey("precision_threshold"); generator.write(this.precisionThreshold); - } + if (this.rehash != null) { generator.writeKey("rehash"); generator.write(this.rehash); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CardinalityAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private CardinalityExecutionMode executionHint; @Nullable private Integer precisionThreshold; - @Nullable private Boolean rehash; + public Builder() {} + + private Builder(CardinalityAggregation o) { + super(o); + this.executionHint = o.executionHint; + this.precisionThreshold = o.precisionThreshold; + this.rehash = o.rehash; + } + + private Builder(Builder o) { + super(o); + this.executionHint = o.executionHint; + this.precisionThreshold = o.precisionThreshold; + this.rehash = o.rehash; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * API name: {@code execution_hint} + */ + @Nonnull + public final Builder executionHint(@Nullable CardinalityExecutionMode value) { + this.executionHint = value; + return this; + } + + /** + * A unique count below which counts are expected to be close to accurate. This allows to trade memory for accuracy. + *

* API name: {@code precision_threshold} + *

*/ + @Nonnull public final Builder precisionThreshold(@Nullable Integer value) { this.precisionThreshold = value; return this; @@ -130,22 +213,19 @@ public final Builder precisionThreshold(@Nullable Integer value) { /** * API name: {@code rehash} */ + @Nonnull public final Builder rehash(@Nullable Boolean value) { this.rehash = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link CardinalityAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CardinalityAggregation build() { _checkSingleUse(); @@ -165,9 +245,30 @@ public CardinalityAggregation build() { protected static void setupCardinalityAggregationDeserializer(ObjectDeserializer op) { setupMetricAggregationBaseDeserializer(op); + op.add(Builder::executionHint, CardinalityExecutionMode._DESERIALIZER, "execution_hint"); op.add(Builder::precisionThreshold, JsonpDeserializer.integerDeserializer(), "precision_threshold"); op.add(Builder::rehash, JsonpDeserializer.booleanDeserializer(), "rehash"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.executionHint); + result = 31 * result + Objects.hashCode(this.precisionThreshold); + result = 31 * result + Objects.hashCode(this.rehash); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CardinalityAggregation other = (CardinalityAggregation) o; + return Objects.equals(this.executionHint, other.executionHint) + && Objects.equals(this.precisionThreshold, other.precisionThreshold) + && Objects.equals(this.rehash, other.rehash); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPathBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityExecutionMode.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPathBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityExecutionMode.java index faa27bff84..7c631062a1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/BucketsPathBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CardinalityExecutionMode.java @@ -30,17 +30,42 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; -/** - * Builders for {@link BucketsPath} variants. - *

- * Variants array, dict, single are not - * available here as they don't have a dedicated class. Use - * {@link BucketsPath}'s builder for these. - * - */ -public class BucketsPathBuilders { - private BucketsPathBuilders() {} +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: _types.aggregations.CardinalityExecutionMode + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum CardinalityExecutionMode implements JsonEnum { + Direct("direct"), + + GlobalOrdinals("global_ordinals"), + + SaveMemoryHeuristic("save_memory_heuristic"), + + SaveTimeHeuristic("save_time_heuristic"), + + SegmentOrdinals("segment_ordinals"); + + private final String jsonValue; + + CardinalityExecutionMode(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + CardinalityExecutionMode.values() + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java index 613765b973..f96f77fe73 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChiSquareHeuristic.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ChiSquareHeuristic @JsonpDeserializable -public class ChiSquareHeuristic implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ChiSquareHeuristic implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean backgroundIsSuperset; private final boolean includeNegatives; @@ -55,25 +65,31 @@ public class ChiSquareHeuristic implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ChiSquareHeuristic(Builder builder) { - this.backgroundIsSuperset = ApiTypeHelper.requireNonNull(builder.backgroundIsSuperset, this, "backgroundIsSuperset"); this.includeNegatives = ApiTypeHelper.requireNonNull(builder.includeNegatives, this, "includeNegatives"); - } - public static ChiSquareHeuristic of(Function> fn) { + public static ChiSquareHeuristic of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code background_is_superset} + * Required - Set to false if you defined a custom background filter that represents a different set of documents that you + * want to compare to. + *

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

*/ public final boolean backgroundIsSuperset() { return this.backgroundIsSuperset; } /** - * Required - API name: {@code include_negatives} + * Required - Set to false to filter out the terms that appear less often in the subset than in documents outside the + * subset. + *

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

*/ public final boolean includeNegatives() { return this.includeNegatives; @@ -82,6 +98,7 @@ public final boolean includeNegatives() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,37 +106,72 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("background_is_superset"); generator.write(this.backgroundIsSuperset); generator.writeKey("include_negatives"); generator.write(this.includeNegatives); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ChiSquareHeuristic}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean backgroundIsSuperset; - private Boolean includeNegatives; + public Builder() {} + + private Builder(ChiSquareHeuristic o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + this.includeNegatives = o.includeNegatives; + } + + private Builder(Builder o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + this.includeNegatives = o.includeNegatives; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code background_is_superset} + * Required - Set to false if you defined a custom background filter that represents a different set of documents that + * you want to compare to. + *

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

*/ + @Nonnull public final Builder backgroundIsSuperset(boolean value) { this.backgroundIsSuperset = value; return this; } /** - * Required - API name: {@code include_negatives} + * Required - Set to false to filter out the terms that appear less often in the subset than in documents outside the + * subset. + *

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

*/ + @Nonnull public final Builder includeNegatives(boolean value) { this.includeNegatives = value; return this; @@ -128,9 +180,10 @@ public final Builder includeNegatives(boolean value) { /** * Builds a {@link ChiSquareHeuristic}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ChiSquareHeuristic build() { _checkSingleUse(); @@ -149,10 +202,23 @@ public ChiSquareHeuristic build() { ); protected static void setupChiSquareHeuristicDeserializer(ObjectDeserializer op) { - op.add(Builder::backgroundIsSuperset, JsonpDeserializer.booleanDeserializer(), "background_is_superset"); op.add(Builder::includeNegatives, JsonpDeserializer.booleanDeserializer(), "include_negatives"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.backgroundIsSuperset); + result = 31 * result + Boolean.hashCode(this.includeNegatives); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ChiSquareHeuristic other = (ChiSquareHeuristic) o; + return this.backgroundIsSuperset == other.backgroundIsSuperset && this.includeNegatives == other.includeNegatives; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java index 698a38bb2d..c30e69db8f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ChildrenAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ChildrenAggregation @JsonpDeserializable -public class ChildrenAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ChildrenAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String type; @@ -53,17 +67,15 @@ public class ChildrenAggregation extends BucketAggregationBase implements Aggreg private ChildrenAggregation(Builder builder) { super(builder); - this.type = builder.type; - } - public static ChildrenAggregation of(Function> fn) { + public static ChildrenAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,45 +91,75 @@ public final String type() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.type != null) { generator.writeKey("type"); generator.write(this.type); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ChildrenAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String type; + public Builder() {} + + private Builder(ChildrenAggregation o) { + super(o); + this.type = o.type; + } + + private Builder(Builder o) { + super(o); + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code type} */ + @Nonnull public final Builder type(@Nullable String value) { this.type = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ChildrenAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ChildrenAggregation build() { _checkSingleUse(); @@ -136,9 +178,25 @@ public ChildrenAggregation build() { ); protected static void setupChildrenAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.type); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ChildrenAggregation other = (ChildrenAggregation) o; + return Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java index d7cd918a01..7d771972e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ClassificationInferenceOptions.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,21 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ClassificationInferenceOptions @JsonpDeserializable -public class ClassificationInferenceOptions implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClassificationInferenceOptions + implements + InferenceConfigVariant, + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Integer numTopClasses; @@ -66,23 +81,32 @@ public class ClassificationInferenceOptions implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ClassificationInferenceOptions(Builder builder) { - this.numTopClasses = builder.numTopClasses; this.numTopFeatureImportanceValues = builder.numTopFeatureImportanceValues; this.predictionFieldType = builder.predictionFieldType; this.resultsField = builder.resultsField; this.topClassesResultsField = builder.topClassesResultsField; - } - public static ClassificationInferenceOptions of(Function> fn) { + public static ClassificationInferenceOptions of( + Function> fn + ) { return fn.apply(new Builder()).build(); } + /** + * {@link InferenceConfig} variant kind. + */ + @Override + public InferenceConfig.Kind _inferenceConfigKind() { + return InferenceConfig.Kind.Classification; + } + /** * Specifies the number of top class predictions to return. Defaults to 0. *

* API name: {@code num_top_classes} + *

*/ @Nullable public final Integer numTopClasses() { @@ -90,10 +114,10 @@ public final Integer numTopClasses() { } /** - * Specifies the maximum number of feature importance values per document. By - * default, it is zero and no feature importance calculation occurs. + * Specifies the maximum number of feature importance values per document. *

* API name: {@code num_top_feature_importance_values} + *

*/ @Nullable public final Integer numTopFeatureImportanceValues() { @@ -101,11 +125,11 @@ public final Integer numTopFeatureImportanceValues() { } /** - * Specifies the type of the predicted field to write. Acceptable values are: - * string, number, boolean. When boolean is provided 1.0 is transformed to true - * and 0.0 to false. + * Specifies the type of the predicted field to write. Acceptable values are: string, number, Boolean. When Boolean is provided 1.0 is + * transformed to true and 0.0 to false. *

* API name: {@code prediction_field_type} + *

*/ @Nullable public final String predictionFieldType() { @@ -113,10 +137,10 @@ public final String predictionFieldType() { } /** - * The field that is added to incoming documents to contain the inference - * prediction. Defaults to predicted_value. + * The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. *

* API name: {@code results_field} + *

*/ @Nullable public final String resultsField() { @@ -124,10 +148,10 @@ public final String resultsField() { } /** - * Specifies the field to which the top classes are written. Defaults to - * top_classes. + * Specifies the field to which the top classes are written. Defaults to top_classes. *

* API name: {@code top_classes_results_field} + *

*/ @Nullable public final String topClassesResultsField() { @@ -137,6 +161,7 @@ public final String topClassesResultsField() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -144,107 +169,140 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.numTopClasses != null) { generator.writeKey("num_top_classes"); generator.write(this.numTopClasses); - } + if (this.numTopFeatureImportanceValues != null) { generator.writeKey("num_top_feature_importance_values"); generator.write(this.numTopFeatureImportanceValues); - } + if (this.predictionFieldType != null) { generator.writeKey("prediction_field_type"); generator.write(this.predictionFieldType); - } + if (this.resultsField != null) { generator.writeKey("results_field"); generator.write(this.resultsField); - } + if (this.topClassesResultsField != null) { generator.writeKey("top_classes_results_field"); generator.write(this.topClassesResultsField); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClassificationInferenceOptions}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Integer numTopClasses; - @Nullable private Integer numTopFeatureImportanceValues; - @Nullable private String predictionFieldType; - @Nullable private String resultsField; - @Nullable private String topClassesResultsField; + public Builder() {} + + private Builder(ClassificationInferenceOptions o) { + this.numTopClasses = o.numTopClasses; + this.numTopFeatureImportanceValues = o.numTopFeatureImportanceValues; + this.predictionFieldType = o.predictionFieldType; + this.resultsField = o.resultsField; + this.topClassesResultsField = o.topClassesResultsField; + } + + private Builder(Builder o) { + this.numTopClasses = o.numTopClasses; + this.numTopFeatureImportanceValues = o.numTopFeatureImportanceValues; + this.predictionFieldType = o.predictionFieldType; + this.resultsField = o.resultsField; + this.topClassesResultsField = o.topClassesResultsField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Specifies the number of top class predictions to return. Defaults to 0. *

* API name: {@code num_top_classes} + *

*/ + @Nonnull public final Builder numTopClasses(@Nullable Integer value) { this.numTopClasses = value; return this; } /** - * Specifies the maximum number of feature importance values per document. By - * default, it is zero and no feature importance calculation occurs. + * Specifies the maximum number of feature importance values per document. *

* API name: {@code num_top_feature_importance_values} + *

*/ + @Nonnull public final Builder numTopFeatureImportanceValues(@Nullable Integer value) { this.numTopFeatureImportanceValues = value; return this; } /** - * Specifies the type of the predicted field to write. Acceptable values are: - * string, number, boolean. When boolean is provided 1.0 is transformed to true - * and 0.0 to false. + * Specifies the type of the predicted field to write. Acceptable values are: string, number, Boolean. When Boolean is provided 1.0 + * is transformed to true and 0.0 to false. *

* API name: {@code prediction_field_type} + *

*/ + @Nonnull public final Builder predictionFieldType(@Nullable String value) { this.predictionFieldType = value; return this; } /** - * The field that is added to incoming documents to contain the inference - * prediction. Defaults to predicted_value. + * The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value. *

* API name: {@code results_field} + *

*/ + @Nonnull public final Builder resultsField(@Nullable String value) { this.resultsField = value; return this; } /** - * Specifies the field to which the top classes are written. Defaults to - * top_classes. + * Specifies the field to which the top classes are written. Defaults to top_classes. *

* API name: {@code top_classes_results_field} + *

*/ + @Nonnull public final Builder topClassesResultsField(@Nullable String value) { this.topClassesResultsField = value; return this; @@ -253,9 +311,10 @@ public final Builder topClassesResultsField(@Nullable String value) { /** * Builds a {@link ClassificationInferenceOptions}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClassificationInferenceOptions build() { _checkSingleUse(); @@ -274,13 +333,33 @@ public ClassificationInferenceOptions build() { ); protected static void setupClassificationInferenceOptionsDeserializer(ObjectDeserializer op) { - op.add(Builder::numTopClasses, JsonpDeserializer.integerDeserializer(), "num_top_classes"); op.add(Builder::numTopFeatureImportanceValues, JsonpDeserializer.integerDeserializer(), "num_top_feature_importance_values"); op.add(Builder::predictionFieldType, JsonpDeserializer.stringDeserializer(), "prediction_field_type"); op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); op.add(Builder::topClassesResultsField, JsonpDeserializer.stringDeserializer(), "top_classes_results_field"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.numTopClasses); + result = 31 * result + Objects.hashCode(this.numTopFeatureImportanceValues); + result = 31 * result + Objects.hashCode(this.predictionFieldType); + result = 31 * result + Objects.hashCode(this.resultsField); + result = 31 * result + Objects.hashCode(this.topClassesResultsField); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClassificationInferenceOptions other = (ClassificationInferenceOptions) o; + return Objects.equals(this.numTopClasses, other.numTopClasses) + && Objects.equals(this.numTopFeatureImportanceValues, other.numTopFeatureImportanceValues) + && Objects.equals(this.predictionFieldType, other.predictionFieldType) + && Objects.equals(this.resultsField, other.resultsField) + && Objects.equals(this.topClassesResultsField, other.topClassesResultsField); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java index 66e742af1d..1f1e298db6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregation.java @@ -30,49 +30,64 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.FieldValue; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.CompositeAggregation @JsonpDeserializable -public class CompositeAggregation extends BucketAggregationBase implements AggregationVariant { - private final Map after; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nonnull + private final Map after; @Nullable private final Integer size; + @Nonnull private final List> sources; // --------------------------------------------------------------------------------------------- private CompositeAggregation(Builder builder) { super(builder); - this.after = ApiTypeHelper.unmodifiable(builder.after); this.size = builder.size; this.sources = ApiTypeHelper.unmodifiable(builder.sources); - } - public static CompositeAggregation of(Function> fn) { + public static CompositeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -82,12 +97,16 @@ public Aggregation.Kind _aggregationKind() { /** * API name: {@code after} */ - public final Map after() { + @Nonnull + public final Map after() { return this.after; } /** + * The number of composite buckets that should be returned. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -95,31 +114,33 @@ public final Integer size() { } /** + * The value sources used to build composite buckets. Keys are returned in the order of the sources definition. + *

* API name: {@code sources} + *

*/ + @Nonnull public final List> sources() { return this.sources; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.after)) { generator.writeKey("after"); generator.writeStartObject(); - for (Map.Entry item0 : this.after.entrySet()) { + for (Map.Entry item0 : this.after.entrySet()) { generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - + item0.getValue().serialize(generator, mapper); } generator.writeEnd(); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (ApiTypeHelper.isDefined(this.sources)) { generator.writeKey("sources"); generator.writeStartArray(); @@ -129,93 +150,157 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item1 : item0.entrySet()) { generator.writeKey(item1.getKey()); item1.getValue().serialize(generator, mapper); - } } generator.writeEnd(); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CompositeAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable - private Map after; - + private Map after; @Nullable private Integer size; - @Nullable private List> sources; + public Builder() {} + + private Builder(CompositeAggregation o) { + super(o); + this.after = _mapCopy(o.after); + this.size = o.size; + this.sources = _listCopy(o.sources); + } + + private Builder(Builder o) { + super(o); + this.after = _mapCopy(o.after); + this.size = o.size; + this.sources = _listCopy(o.sources); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code after} + * *

- * Adds all entries of map to after. + * Adds all elements of map to after. + *

*/ - public final Builder after(Map map) { + @Nonnull + public final Builder after(Map map) { this.after = _mapPutAll(this.after, map); return this; } /** * API name: {@code after} + * *

* Adds an entry to after. + *

*/ - public final Builder after(String key, String value) { + @Nonnull + public final Builder after(String key, FieldValue value) { this.after = _mapPut(this.after, key, value); return this; } /** + * API name: {@code after} + * + *

+ * Adds a value to after using a builder lambda. + *

+ */ + @Nonnull + public final Builder after(String key, Function> fn) { + return after(key, fn.apply(new FieldValue.Builder()).build()); + } + + /** + * The number of composite buckets that should be returned. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; } /** + * The value sources used to build composite buckets. Keys are returned in the order of the sources definition. + *

* API name: {@code sources} + *

+ * *

* Adds all elements of list to sources. + *

*/ + @Nonnull public final Builder sources(List> list) { this.sources = _listAddAll(this.sources, list); return this; } /** + * The value sources used to build composite buckets. Keys are returned in the order of the sources definition. + *

* API name: {@code sources} + *

+ * *

* Adds one or more values to sources. + *

*/ + @Nonnull public final Builder sources(Map value, Map... values) { this.sources = _listAdd(this.sources, value, values); return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link CompositeAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CompositeAggregation build() { _checkSingleUse(); @@ -234,15 +319,35 @@ public CompositeAggregation build() { ); protected static void setupCompositeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); - op.add(Builder::after, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "after"); + setupBucketAggregationBaseDeserializer(op); + op.add(Builder::after, JsonpDeserializer.stringMapDeserializer(FieldValue._DESERIALIZER), "after"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add( Builder::sources, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringMapDeserializer(CompositeAggregationSource._DESERIALIZER)), "sources" ); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.after); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Objects.hashCode(this.sources); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeAggregation other = (CompositeAggregation) o; + return Objects.equals(this.after, other.after) + && Objects.equals(this.size, other.size) + && Objects.equals(this.sources, other.sources); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java index e83a6d3087..bc2eb6c297 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeAggregationSource.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,73 +48,83 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.CompositeAggregationSource @JsonpDeserializable -public class CompositeAggregationSource implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeAggregationSource + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable - private final CompositeTermsAggregationSource terms; + private final CompositeDateHistogramAggregationSource dateHistogram; @Nullable - private final CompositeHistogramAggregationSource histogram; + private final CompositeGeoTileGridAggregationSource geotileGrid; @Nullable - private final CompositeDateHistogramAggregationSource dateHistogram; + private final CompositeHistogramAggregationSource histogram; @Nullable - private final CompositeGeoTileGridAggregationSource geotileGrid; + private final CompositeTermsAggregationSource terms; - private CompositeAggregationSource(Builder builder) { + // --------------------------------------------------------------------------------------------- - this.terms = builder.terms; - this.histogram = builder.histogram; + private CompositeAggregationSource(Builder builder) { this.dateHistogram = builder.dateHistogram; this.geotileGrid = builder.geotileGrid; - + this.histogram = builder.histogram; + this.terms = builder.terms; } - public static CompositeAggregationSource of(Function> fn) { + public static CompositeAggregationSource of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * API name: {@code terms} + * API name: {@code date_histogram} */ @Nullable - public final CompositeTermsAggregationSource terms() { - return this.terms; + public final CompositeDateHistogramAggregationSource dateHistogram() { + return this.dateHistogram; } /** - * API name: {@code histogram} + * API name: {@code geotile_grid} */ @Nullable - public final CompositeHistogramAggregationSource histogram() { - return this.histogram; + public final CompositeGeoTileGridAggregationSource geotileGrid() { + return this.geotileGrid; } /** - * API name: {@code date_histogram} + * API name: {@code histogram} */ @Nullable - public final CompositeDateHistogramAggregationSource dateHistogram() { - return this.dateHistogram; + public final CompositeHistogramAggregationSource histogram() { + return this.histogram; } /** - * API name: {@code geotile_grid} + * API name: {@code terms} */ @Nullable - public final CompositeGeoTileGridAggregationSource geotileGrid() { - return this.geotileGrid; + public final CompositeTermsAggregationSource terms() { + return this.terms; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -115,82 +132,79 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.terms != null) { - generator.writeKey("terms"); - this.terms.serialize(generator, mapper); - - } - if (this.histogram != null) { - generator.writeKey("histogram"); - this.histogram.serialize(generator, mapper); - - } if (this.dateHistogram != null) { generator.writeKey("date_histogram"); this.dateHistogram.serialize(generator, mapper); - } + if (this.geotileGrid != null) { generator.writeKey("geotile_grid"); this.geotileGrid.serialize(generator, mapper); + } + if (this.histogram != null) { + generator.writeKey("histogram"); + this.histogram.serialize(generator, mapper); } + if (this.terms != null) { + generator.writeKey("terms"); + this.terms.serialize(generator, mapper); + } } - /** - * Builder for {@link CompositeAggregationSource}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private CompositeTermsAggregationSource terms; + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } - @Nullable - private CompositeHistogramAggregationSource histogram; + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** + * Builder for {@link CompositeAggregationSource}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private CompositeDateHistogramAggregationSource dateHistogram; - @Nullable private CompositeGeoTileGridAggregationSource geotileGrid; + @Nullable + private CompositeHistogramAggregationSource histogram; + @Nullable + private CompositeTermsAggregationSource terms; - /** - * API name: {@code terms} - */ - public final Builder terms(@Nullable CompositeTermsAggregationSource value) { - this.terms = value; - return this; - } + public Builder() {} - /** - * API name: {@code terms} - */ - public final Builder terms(Function> fn) { - return this.terms(fn.apply(new CompositeTermsAggregationSource.Builder()).build()); + private Builder(CompositeAggregationSource o) { + this.dateHistogram = o.dateHistogram; + this.geotileGrid = o.geotileGrid; + this.histogram = o.histogram; + this.terms = o.terms; } - /** - * API name: {@code histogram} - */ - public final Builder histogram(@Nullable CompositeHistogramAggregationSource value) { - this.histogram = value; - return this; + private Builder(Builder o) { + this.dateHistogram = o.dateHistogram; + this.geotileGrid = o.geotileGrid; + this.histogram = o.histogram; + this.terms = o.terms; } - /** - * API name: {@code histogram} - */ - public final Builder histogram( - Function> fn - ) { - return this.histogram(fn.apply(new CompositeHistogramAggregationSource.Builder()).build()); + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code date_histogram} */ + @Nonnull public final Builder dateHistogram(@Nullable CompositeDateHistogramAggregationSource value) { this.dateHistogram = value; return this; @@ -199,15 +213,17 @@ public final Builder dateHistogram(@Nullable CompositeDateHistogramAggregationSo /** * API name: {@code date_histogram} */ + @Nonnull public final Builder dateHistogram( Function> fn ) { - return this.dateHistogram(fn.apply(new CompositeDateHistogramAggregationSource.Builder()).build()); + return dateHistogram(fn.apply(new CompositeDateHistogramAggregationSource.Builder()).build()); } /** * API name: {@code geotile_grid} */ + @Nonnull public final Builder geotileGrid(@Nullable CompositeGeoTileGridAggregationSource value) { this.geotileGrid = value; return this; @@ -216,18 +232,56 @@ public final Builder geotileGrid(@Nullable CompositeGeoTileGridAggregationSource /** * API name: {@code geotile_grid} */ + @Nonnull public final Builder geotileGrid( Function> fn ) { - return this.geotileGrid(fn.apply(new CompositeGeoTileGridAggregationSource.Builder()).build()); + return geotileGrid(fn.apply(new CompositeGeoTileGridAggregationSource.Builder()).build()); + } + + /** + * API name: {@code histogram} + */ + @Nonnull + public final Builder histogram(@Nullable CompositeHistogramAggregationSource value) { + this.histogram = value; + return this; + } + + /** + * API name: {@code histogram} + */ + @Nonnull + public final Builder histogram( + Function> fn + ) { + return histogram(fn.apply(new CompositeHistogramAggregationSource.Builder()).build()); + } + + /** + * API name: {@code terms} + */ + @Nonnull + public final Builder terms(@Nullable CompositeTermsAggregationSource value) { + this.terms = value; + return this; + } + + /** + * API name: {@code terms} + */ + @Nonnull + public final Builder terms(Function> fn) { + return terms(fn.apply(new CompositeTermsAggregationSource.Builder()).build()); } /** * Builds a {@link CompositeAggregationSource}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CompositeAggregationSource build() { _checkSingleUse(); @@ -246,11 +300,30 @@ public CompositeAggregationSource build() { ); protected static void setupCompositeAggregationSourceDeserializer(ObjectDeserializer op) { - - op.add(Builder::terms, CompositeTermsAggregationSource._DESERIALIZER, "terms"); - op.add(Builder::histogram, CompositeHistogramAggregationSource._DESERIALIZER, "histogram"); op.add(Builder::dateHistogram, CompositeDateHistogramAggregationSource._DESERIALIZER, "date_histogram"); op.add(Builder::geotileGrid, CompositeGeoTileGridAggregationSource._DESERIALIZER, "geotile_grid"); + op.add(Builder::histogram, CompositeHistogramAggregationSource._DESERIALIZER, "histogram"); + op.add(Builder::terms, CompositeTermsAggregationSource._DESERIALIZER, "terms"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.dateHistogram); + result = 31 * result + Objects.hashCode(this.geotileGrid); + result = 31 * result + Objects.hashCode(this.histogram); + result = 31 * result + Objects.hashCode(this.terms); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeAggregationSource other = (CompositeAggregationSource) o; + return Objects.equals(this.dateHistogram, other.dateHistogram) + && Objects.equals(this.geotileGrid, other.geotileGrid) + && Objects.equals(this.histogram, other.histogram) + && Objects.equals(this.terms, other.terms); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java new file mode 100644 index 0000000000..b75ed9f974 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java @@ -0,0 +1,354 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.aggregations.CompositeDateHistogramAggregationSource + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeDateHistogramAggregationSource extends CompositeValuesSource + implements + ToCopyableBuilder { + + @Nullable + private final Time calendarInterval; + + @Nullable + private final Time fixedInterval; + + @Nullable + private final String format; + + @Nullable + private final Time offset; + + @Nullable + private final String timeZone; + + // --------------------------------------------------------------------------------------------- + + private CompositeDateHistogramAggregationSource(Builder builder) { + super(builder); + this.calendarInterval = builder.calendarInterval; + this.fixedInterval = builder.fixedInterval; + this.format = builder.format; + this.offset = builder.offset; + this.timeZone = builder.timeZone; + } + + public static CompositeDateHistogramAggregationSource of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code calendar_interval} + */ + @Nullable + public final Time calendarInterval() { + return this.calendarInterval; + } + + /** + * API name: {@code fixed_interval} + */ + @Nullable + public final Time fixedInterval() { + return this.fixedInterval; + } + + /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * API name: {@code offset} + */ + @Nullable + public final Time offset() { + return this.offset; + } + + /** + * API name: {@code time_zone} + */ + @Nullable + public final String timeZone() { + return this.timeZone; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.calendarInterval != null) { + generator.writeKey("calendar_interval"); + this.calendarInterval.serialize(generator, mapper); + } + + if (this.fixedInterval != null) { + generator.writeKey("fixed_interval"); + this.fixedInterval.serialize(generator, mapper); + } + + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + } + + if (this.offset != null) { + generator.writeKey("offset"); + this.offset.serialize(generator, mapper); + } + + if (this.timeZone != null) { + generator.writeKey("time_zone"); + generator.write(this.timeZone); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CompositeDateHistogramAggregationSource}. + */ + public static class Builder extends CompositeValuesSource.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private Time calendarInterval; + @Nullable + private Time fixedInterval; + @Nullable + private String format; + @Nullable + private Time offset; + @Nullable + private String timeZone; + + public Builder() {} + + private Builder(CompositeDateHistogramAggregationSource o) { + super(o); + this.calendarInterval = o.calendarInterval; + this.fixedInterval = o.fixedInterval; + this.format = o.format; + this.offset = o.offset; + this.timeZone = o.timeZone; + } + + private Builder(Builder o) { + super(o); + this.calendarInterval = o.calendarInterval; + this.fixedInterval = o.fixedInterval; + this.format = o.format; + this.offset = o.offset; + this.timeZone = o.timeZone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code calendar_interval} + */ + @Nonnull + public final Builder calendarInterval(@Nullable Time value) { + this.calendarInterval = value; + return this; + } + + /** + * API name: {@code calendar_interval} + */ + @Nonnull + public final Builder calendarInterval(Function> fn) { + return calendarInterval(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code fixed_interval} + */ + @Nonnull + public final Builder fixedInterval(@Nullable Time value) { + this.fixedInterval = value; + return this; + } + + /** + * API name: {@code fixed_interval} + */ + @Nonnull + public final Builder fixedInterval(Function> fn) { + return fixedInterval(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code format} + */ + @Nonnull + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * API name: {@code offset} + */ + @Nonnull + public final Builder offset(@Nullable Time value) { + this.offset = value; + return this; + } + + /** + * API name: {@code offset} + */ + @Nonnull + public final Builder offset(Function> fn) { + return offset(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code time_zone} + */ + @Nonnull + public final Builder timeZone(@Nullable String value) { + this.timeZone = value; + return this; + } + + /** + * Builds a {@link CompositeDateHistogramAggregationSource}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CompositeDateHistogramAggregationSource build() { + _checkSingleUse(); + + return new CompositeDateHistogramAggregationSource(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompositeDateHistogramAggregationSource} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompositeDateHistogramAggregationSource::setupCompositeDateHistogramAggregationSourceDeserializer + ); + + protected static void setupCompositeDateHistogramAggregationSourceDeserializer( + ObjectDeserializer op + ) { + setupCompositeValuesSourceDeserializer(op); + op.add(Builder::calendarInterval, Time._DESERIALIZER, "calendar_interval"); + op.add(Builder::fixedInterval, Time._DESERIALIZER, "fixed_interval"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::offset, Time._DESERIALIZER, "offset"); + op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.calendarInterval); + result = 31 * result + Objects.hashCode(this.fixedInterval); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.offset); + result = 31 * result + Objects.hashCode(this.timeZone); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeDateHistogramAggregationSource other = (CompositeDateHistogramAggregationSource) o; + return Objects.equals(this.calendarInterval, other.calendarInterval) + && Objects.equals(this.fixedInterval, other.fixedInterval) + && Objects.equals(this.format, other.format) + && Objects.equals(this.offset, other.offset) + && Objects.equals(this.timeZone, other.timeZone); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java new file mode 100644 index 0000000000..5a3374db67 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java @@ -0,0 +1,238 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.GeoBounds; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.aggregations.CompositeGeoTileGridAggregationSource + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeGeoTileGridAggregationSource extends CompositeValuesSource + implements + ToCopyableBuilder { + + @Nullable + private final GeoBounds bounds; + + @Nullable + private final Integer precision; + + // --------------------------------------------------------------------------------------------- + + private CompositeGeoTileGridAggregationSource(Builder builder) { + super(builder); + this.bounds = builder.bounds; + this.precision = builder.precision; + } + + public static CompositeGeoTileGridAggregationSource of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code bounds} + */ + @Nullable + public final GeoBounds bounds() { + return this.bounds; + } + + /** + * API name: {@code precision} + */ + @Nullable + public final Integer precision() { + return this.precision; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.bounds != null) { + generator.writeKey("bounds"); + this.bounds.serialize(generator, mapper); + } + + if (this.precision != null) { + generator.writeKey("precision"); + generator.write(this.precision); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CompositeGeoTileGridAggregationSource}. + */ + public static class Builder extends CompositeValuesSource.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private GeoBounds bounds; + @Nullable + private Integer precision; + + public Builder() {} + + private Builder(CompositeGeoTileGridAggregationSource o) { + super(o); + this.bounds = o.bounds; + this.precision = o.precision; + } + + private Builder(Builder o) { + super(o); + this.bounds = o.bounds; + this.precision = o.precision; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code bounds} + */ + @Nonnull + public final Builder bounds(@Nullable GeoBounds value) { + this.bounds = value; + return this; + } + + /** + * API name: {@code bounds} + */ + @Nonnull + public final Builder bounds(Function> fn) { + return bounds(fn.apply(new GeoBounds.Builder()).build()); + } + + /** + * API name: {@code precision} + */ + @Nonnull + public final Builder precision(@Nullable Integer value) { + this.precision = value; + return this; + } + + /** + * Builds a {@link CompositeGeoTileGridAggregationSource}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CompositeGeoTileGridAggregationSource build() { + _checkSingleUse(); + + return new CompositeGeoTileGridAggregationSource(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompositeGeoTileGridAggregationSource} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompositeGeoTileGridAggregationSource::setupCompositeGeoTileGridAggregationSourceDeserializer + ); + + protected static void setupCompositeGeoTileGridAggregationSourceDeserializer( + ObjectDeserializer op + ) { + setupCompositeValuesSourceDeserializer(op); + op.add(Builder::bounds, GeoBounds._DESERIALIZER, "bounds"); + op.add(Builder::precision, JsonpDeserializer.integerDeserializer(), "precision"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.bounds); + result = 31 * result + Objects.hashCode(this.precision); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeGeoTileGridAggregationSource other = (CompositeGeoTileGridAggregationSource) o; + return Objects.equals(this.bounds, other.bounds) && Objects.equals(this.precision, other.precision); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java new file mode 100644 index 0000000000..f58af0517e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java @@ -0,0 +1,191 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.aggregations.CompositeHistogramAggregationSource + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeHistogramAggregationSource extends CompositeValuesSource + implements + ToCopyableBuilder { + + private final double interval; + + // --------------------------------------------------------------------------------------------- + + private CompositeHistogramAggregationSource(Builder builder) { + super(builder); + this.interval = ApiTypeHelper.requireNonNull(builder.interval, this, "interval"); + } + + public static CompositeHistogramAggregationSource of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code interval} + */ + public final double interval() { + return this.interval; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + generator.writeKey("interval"); + generator.write(this.interval); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CompositeHistogramAggregationSource}. + */ + public static class Builder extends CompositeValuesSource.AbstractBuilder + implements + CopyableBuilder { + private Double interval; + + public Builder() {} + + private Builder(CompositeHistogramAggregationSource o) { + super(o); + this.interval = o.interval; + } + + private Builder(Builder o) { + super(o); + this.interval = o.interval; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code interval} + */ + @Nonnull + public final Builder interval(double value) { + this.interval = value; + return this; + } + + /** + * Builds a {@link CompositeHistogramAggregationSource}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CompositeHistogramAggregationSource build() { + _checkSingleUse(); + + return new CompositeHistogramAggregationSource(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompositeHistogramAggregationSource} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompositeHistogramAggregationSource::setupCompositeHistogramAggregationSourceDeserializer + ); + + protected static void setupCompositeHistogramAggregationSourceDeserializer( + ObjectDeserializer op + ) { + setupCompositeValuesSourceDeserializer(op); + op.add(Builder::interval, JsonpDeserializer.doubleDeserializer(), "interval"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Double.hashCode(this.interval); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeHistogramAggregationSource other = (CompositeHistogramAggregationSource) o; + return this.interval == other.interval; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java new file mode 100644 index 0000000000..6b45f34eeb --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java @@ -0,0 +1,155 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.aggregations.CompositeTermsAggregationSource + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CompositeTermsAggregationSource extends CompositeValuesSource + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private CompositeTermsAggregationSource(Builder builder) { + super(builder); + } + + public static CompositeTermsAggregationSource of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CompositeTermsAggregationSource}. + */ + public static class Builder extends CompositeValuesSource.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(CompositeTermsAggregationSource o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link CompositeTermsAggregationSource}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CompositeTermsAggregationSource build() { + _checkSingleUse(); + + return new CompositeTermsAggregationSource(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompositeTermsAggregationSource} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompositeTermsAggregationSource::setupCompositeTermsAggregationSourceDeserializer + ); + + protected static void setupCompositeTermsAggregationSourceDeserializer(ObjectDeserializer op) { + setupCompositeValuesSourceDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java index d758be85fe..03c773138c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CompositeValuesSource.java @@ -6,10 +6,41 @@ * compatible open source license. */ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -20,37 +51,38 @@ import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +// typedef: _types.aggregations.CompositeValuesSource + +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class CompositeValuesSource implements PlainJsonSerializable { @Nullable private final String field; @Nullable - private final Script script; + private final Boolean missingBucket; @Nullable - private final ValueType valueType; + private final MissingOrder missingOrder; @Nullable - private Boolean missingBucket; + private final SortOrder order; @Nullable - private MissingOrder missingOrder; + private final Script script; @Nullable - private SortOrder order; + private final ValueType valueType; - @Nullable - private String format; + // --------------------------------------------------------------------------------------------- protected CompositeValuesSource(AbstractBuilder builder) { this.field = builder.field; - this.script = builder.script; - this.valueType = builder.valueType; this.missingBucket = builder.missingBucket; this.missingOrder = builder.missingOrder; this.order = builder.order; - this.format = builder.format; + this.script = builder.script; + this.valueType = builder.valueType; } /** @@ -62,23 +94,7 @@ public final String field() { } /** - * API name: {@code script} - */ - @Nullable - public final Script script() { - return this.script; - } - - /** - * API name: {@code date_histogram} - */ - @Nullable - public final ValueType valueType() { - return this.valueType; - } - - /** - * API name: {@code missingBucket} + * API name: {@code missing_bucket} */ @Nullable public final Boolean missingBucket() { @@ -86,7 +102,7 @@ public final Boolean missingBucket() { } /** - * API name: {@code missingOrder} + * API name: {@code missing_order} */ @Nullable public final MissingOrder missingOrder() { @@ -102,16 +118,25 @@ public final SortOrder order() { } /** - * API name: {@code format} + * API name: {@code script} */ @Nullable - public final String format() { - return this.format; + public final Script script() { + return this.script; + } + + /** + * API name: {@code value_type} + */ + @Nullable + public final ValueType valueType() { + return this.valueType; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -124,137 +149,169 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.field); } - if (this.script != null) { - generator.writeKey("script"); - this.script.serialize(generator, mapper); - - } - if (this.valueType != null) { - generator.writeKey("value_type"); - this.valueType.serialize(generator, mapper); - - } if (this.missingBucket != null) { generator.writeKey("missing_bucket"); generator.write(this.missingBucket); } + if (this.missingOrder != null) { generator.writeKey("missing_order"); this.missingOrder.serialize(generator, mapper); } + if (this.order != null) { generator.writeKey("order"); this.order.serialize(generator, mapper); } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); + + if (this.script != null) { + generator.writeKey("script"); + this.script.serialize(generator, mapper); + } + + if (this.valueType != null) { + generator.writeKey("value_type"); + this.valueType.serialize(generator, mapper); } } - /** - * Builder for {@link CompositeValuesSource}. - */ + // --------------------------------------------------------------------------------------------- protected abstract static class AbstractBuilder> extends ObjectBuilderBase { - @Nullable private String field; - + @Nullable + private Boolean missingBucket; + @Nullable + private MissingOrder missingOrder; + @Nullable + private SortOrder order; @Nullable private Script script; - @Nullable private ValueType valueType; - @Nullable - private Boolean missingBucket; + protected AbstractBuilder() {} - @Nullable - private MissingOrder missingOrder; + protected AbstractBuilder(CompositeValuesSource o) { + this.field = o.field; + this.missingBucket = o.missingBucket; + this.missingOrder = o.missingOrder; + this.order = o.order; + this.script = o.script; + this.valueType = o.valueType; + } - @Nullable - private SortOrder order; + protected AbstractBuilder(AbstractBuilder o) { + this.field = o.field; + this.missingBucket = o.missingBucket; + this.missingOrder = o.missingOrder; + this.order = o.order; + this.script = o.script; + this.valueType = o.valueType; + } - @Nullable - private String format; + @Nonnull + protected abstract BuilderT self(); /** * API name: {@code field} */ - public final BuilderT field(@Nullable String field) { - this.field = field; + @Nonnull + public final BuilderT field(@Nullable String value) { + this.field = value; return self(); } /** - * API name: {@code script} + * API name: {@code missing_bucket} */ - public final BuilderT script(@Nullable Script script) { - this.script = script; + @Nonnull + public final BuilderT missingBucket(@Nullable Boolean value) { + this.missingBucket = value; return self(); } /** - * API name: {@code script} - */ - public final BuilderT script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - /** - * API name: {@code valueType} + * API name: {@code missing_order} */ - public final BuilderT valueType(@Nullable ValueType valueType) { - this.valueType = valueType; + @Nonnull + public final BuilderT missingOrder(@Nullable MissingOrder value) { + this.missingOrder = value; return self(); } /** - * API name: {@code missingBucket} + * API name: {@code order} */ - public final BuilderT missingBucket(@Nullable Boolean missingBucket) { - this.missingBucket = missingBucket; + @Nonnull + public final BuilderT order(@Nullable SortOrder value) { + this.order = value; return self(); } /** - * API name: {@code missingOrder} + * API name: {@code script} */ - public final BuilderT missingOrder(@Nullable MissingOrder missingOrder) { - this.missingOrder = missingOrder; + @Nonnull + public final BuilderT script(@Nullable Script value) { + this.script = value; return self(); } /** - * API name: {@code order} + * API name: {@code script} */ - public final BuilderT order(@Nullable SortOrder order) { - this.order = order; - return self(); + @Nonnull + public final BuilderT script(Function> fn) { + return script(fn.apply(new Script.Builder()).build()); } /** - * API name: {@code format} + * API name: {@code value_type} */ - public final BuilderT format(@Nullable String format) { - this.format = format; + @Nonnull + public final BuilderT valueType(@Nullable ValueType value) { + this.valueType = value; return self(); } - - protected abstract BuilderT self(); } + // --------------------------------------------------------------------------------------------- + protected static > void setupCompositeValuesSourceDeserializer( ObjectDeserializer op ) { op.add(AbstractBuilder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(AbstractBuilder::script, Script._DESERIALIZER, "script"); - op.add(AbstractBuilder::valueType, ValueType._DESERIALIZER, "value_type"); op.add(AbstractBuilder::missingBucket, JsonpDeserializer.booleanDeserializer(), "missing_bucket"); op.add(AbstractBuilder::missingOrder, MissingOrder._DESERIALIZER, "missing_order"); op.add(AbstractBuilder::order, SortOrder._DESERIALIZER, "order"); - op.add(AbstractBuilder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(AbstractBuilder::script, Script._DESERIALIZER, "script"); + op.add(AbstractBuilder::valueType, ValueType._DESERIALIZER, "value_type"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.missingBucket); + result = 31 * result + Objects.hashCode(this.missingOrder); + result = 31 * result + Objects.hashCode(this.order); + result = 31 * result + Objects.hashCode(this.script); + result = 31 * result + Objects.hashCode(this.valueType); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CompositeValuesSource other = (CompositeValuesSource) o; + return Objects.equals(this.field, other.field) + && Objects.equals(this.missingBucket, other.missingBucket) + && Objects.equals(this.missingOrder, other.missingOrder) + && Objects.equals(this.order, other.order) + && Objects.equals(this.script, other.script) + && Objects.equals(this.valueType, other.valueType); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java index 7fa68d83fe..d26153aa32 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeCardinalityAggregation.java @@ -30,32 +30,46 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.CumulativeCardinalityAggregation @JsonpDeserializable -public class CumulativeCardinalityAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CumulativeCardinalityAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private CumulativeCardinalityAggregation(Builder builder) { super(builder); - } - public static CumulativeCardinalityAggregation of(Function> fn) { + public static CumulativeCardinalityAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,14 +78,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CumulativeCardinalityAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(CumulativeCardinalityAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -79,9 +121,10 @@ protected Builder self() { /** * Builds a {@link CumulativeCardinalityAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CumulativeCardinalityAggregation build() { _checkSingleUse(); @@ -102,8 +145,22 @@ public CumulativeCardinalityAggregation build() { protected static void setupCumulativeCardinalityAggregationDeserializer( ObjectDeserializer op ) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java index a78384e73a..194125a50d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/CumulativeSumAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.CumulativeSumAggregation @JsonpDeserializable -public class CumulativeSumAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CumulativeSumAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private CumulativeSumAggregation(Builder builder) { super(builder); - } - public static CumulativeSumAggregation of(Function> fn) { + public static CumulativeSumAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,14 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CumulativeSumAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(CumulativeSumAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -79,9 +119,10 @@ protected Builder self() { /** * Builds a {@link CumulativeSumAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CumulativeSumAggregation build() { _checkSingleUse(); @@ -100,8 +141,22 @@ public CumulativeSumAggregation build() { ); protected static void setupCumulativeSumAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java index 350d3582c0..63f3ce8faa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateHistogramAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -45,21 +52,25 @@ import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.DateHistogramAggregation @JsonpDeserializable -public class DateHistogramAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DateHistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final CalendarInterval calendarInterval; @Nullable private final ExtendedBounds extendedBounds; - @Nullable - private final ExtendedBounds hardBounds; - @Nullable private final String field; @@ -69,9 +80,15 @@ public class DateHistogramAggregation extends BucketAggregationBase implements A @Nullable private final String format; + @Nullable + private final ExtendedBounds hardBounds; + @Nullable private final Time interval; + @Nullable + private final Boolean keyed; + @Nullable private final Integer minDocCount; @@ -84,6 +101,7 @@ public class DateHistogramAggregation extends BucketAggregationBase implements A @Nullable private final HistogramOrder order; + @Nonnull private final Map params; @Nullable @@ -92,21 +110,18 @@ public class DateHistogramAggregation extends BucketAggregationBase implements A @Nullable private final String timeZone; - @Nullable - private final Boolean keyed; - // --------------------------------------------------------------------------------------------- private DateHistogramAggregation(Builder builder) { super(builder); - this.calendarInterval = builder.calendarInterval; this.extendedBounds = builder.extendedBounds; - this.hardBounds = builder.hardBounds; this.field = builder.field; this.fixedInterval = builder.fixedInterval; this.format = builder.format; + this.hardBounds = builder.hardBounds; this.interval = builder.interval; + this.keyed = builder.keyed; this.minDocCount = builder.minDocCount; this.missing = builder.missing; this.offset = builder.offset; @@ -114,16 +129,14 @@ private DateHistogramAggregation(Builder builder) { this.params = ApiTypeHelper.unmodifiable(builder.params); this.script = builder.script; this.timeZone = builder.timeZone; - this.keyed = builder.keyed; - } - public static DateHistogramAggregation of(Function> fn) { + public static DateHistogramAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -146,14 +159,6 @@ public final ExtendedBounds extendedBounds() { return this.extendedBounds; } - /** - * API name: {@code hard_bounds} - */ - @Nullable - public final ExtendedBounds hardBounds() { - return this.hardBounds; - } - /** * API name: {@code field} */ @@ -171,13 +176,25 @@ public final Time fixedInterval() { } /** + * The date format used to format key_as_string in the response. If no format is specified, the first date + * format specified in the field mapping is used. + *

* API name: {@code format} + *

*/ @Nullable public final String format() { return this.format; } + /** + * API name: {@code hard_bounds} + */ + @Nullable + public final ExtendedBounds hardBounds() { + return this.hardBounds; + } + /** * API name: {@code interval} */ @@ -187,7 +204,22 @@ public final Time interval() { } /** + * Set to true to associate a unique string key with each bucket and return the ranges as a hash rather than an array. + *

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

+ */ + @Nullable + public final Boolean keyed() { + return this.keyed; + } + + /** + * Only returns buckets that have min_doc_count number of documents. By default, all buckets between the first bucket that + * matches documents and the last one are returned. + *

* API name: {@code min_doc_count} + *

*/ @Nullable public final Integer minDocCount() { @@ -221,6 +253,7 @@ public final HistogramOrder order() { /** * API name: {@code params} */ + @Nonnull public final Map params() { return this.params; } @@ -241,155 +274,195 @@ public final String timeZone() { return this.timeZone; } - /** - * API name: {@code keyed} - */ - @Nullable - public final Boolean keyed() { - return this.keyed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.calendarInterval != null) { generator.writeKey("calendar_interval"); this.calendarInterval.serialize(generator, mapper); } + if (this.extendedBounds != null) { generator.writeKey("extended_bounds"); this.extendedBounds.serialize(generator, mapper); - } - if (this.hardBounds != null) { - generator.writeKey("hard_bounds"); - this.hardBounds.serialize(generator, mapper); - } if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.fixedInterval != null) { generator.writeKey("fixed_interval"); this.fixedInterval.serialize(generator, mapper); - } + if (this.format != null) { generator.writeKey("format"); generator.write(this.format); + } + if (this.hardBounds != null) { + generator.writeKey("hard_bounds"); + this.hardBounds.serialize(generator, mapper); } + if (this.interval != null) { generator.writeKey("interval"); this.interval.serialize(generator, mapper); + } + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } + if (this.minDocCount != null) { generator.writeKey("min_doc_count"); generator.write(this.minDocCount); - } + if (this.missing != null) { generator.writeKey("missing"); generator.write(this.missing); - } + if (this.offset != null) { generator.writeKey("offset"); this.offset.serialize(generator, mapper); - } + if (this.order != null) { generator.writeKey("order"); this.order.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); generator.writeStartObject(); for (Map.Entry item0 : this.params.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } + if (this.timeZone != null) { generator.writeKey("time_zone"); generator.write(this.timeZone); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link DateHistogramAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private CalendarInterval calendarInterval; - @Nullable private ExtendedBounds extendedBounds; - - @Nullable - private ExtendedBounds hardBounds; - @Nullable private String field; - @Nullable private Time fixedInterval; - @Nullable private String format; - + @Nullable + private ExtendedBounds hardBounds; @Nullable private Time interval; - + @Nullable + private Boolean keyed; @Nullable private Integer minDocCount; - @Nullable private String missing; - @Nullable private Time offset; - @Nullable private HistogramOrder order; - @Nullable private Map params; - @Nullable private Script script; - @Nullable private String timeZone; - @Nullable - private Boolean keyed; + public Builder() {} + + private Builder(DateHistogramAggregation o) { + super(o); + this.calendarInterval = o.calendarInterval; + this.extendedBounds = o.extendedBounds; + this.field = o.field; + this.fixedInterval = o.fixedInterval; + this.format = o.format; + this.hardBounds = o.hardBounds; + this.interval = o.interval; + this.keyed = o.keyed; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.offset = o.offset; + this.order = o.order; + this.params = _mapCopy(o.params); + this.script = o.script; + this.timeZone = o.timeZone; + } + + private Builder(Builder o) { + super(o); + this.calendarInterval = o.calendarInterval; + this.extendedBounds = o.extendedBounds; + this.field = o.field; + this.fixedInterval = o.fixedInterval; + this.format = o.format; + this.hardBounds = o.hardBounds; + this.interval = o.interval; + this.keyed = o.keyed; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.offset = o.offset; + this.order = o.order; + this.params = _mapCopy(o.params); + this.script = o.script; + this.timeZone = o.timeZone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code calendar_interval} */ + @Nonnull public final Builder calendarInterval(@Nullable CalendarInterval value) { this.calendarInterval = value; return this; @@ -398,6 +471,7 @@ public final Builder calendarInterval(@Nullable CalendarInterval value) { /** * API name: {@code extended_bounds} */ + @Nonnull public final Builder extendedBounds(@Nullable ExtendedBounds value) { this.extendedBounds = value; return this; @@ -406,30 +480,15 @@ public final Builder extendedBounds(@Nullable ExtendedBounds valu /** * API name: {@code extended_bounds} */ - public final Builder extendedBounds( - Function, ObjectBuilder>> fn - ) { - return this.extendedBounds(fn.apply(new ExtendedBounds.Builder()).build()); - } - - /** - * API name: {@code hard_bounds} - */ - public final Builder hardBounds(@Nullable ExtendedBounds value) { - this.hardBounds = value; - return this; - } - - /** - * API name: {@code hard_bounds} - */ - public final Builder hardBounds(Function, ObjectBuilder>> fn) { - return this.hardBounds(fn.apply(new ExtendedBounds.Builder()).build()); + @Nonnull + public final Builder extendedBounds(Function>> fn) { + return extendedBounds(fn.apply(new ExtendedBounds.Builder()).build()); } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -438,6 +497,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code fixed_interval} */ + @Nonnull public final Builder fixedInterval(@Nullable Time value) { this.fixedInterval = value; return this; @@ -446,21 +506,45 @@ public final Builder fixedInterval(@Nullable Time value) { /** * API name: {@code fixed_interval} */ + @Nonnull public final Builder fixedInterval(Function> fn) { - return this.fixedInterval(fn.apply(new Time.Builder()).build()); + return fixedInterval(fn.apply(new Time.Builder()).build()); } /** + * The date format used to format key_as_string in the response. If no format is specified, the first date + * format specified in the field mapping is used. + *

* API name: {@code format} + *

*/ + @Nonnull public final Builder format(@Nullable String value) { this.format = value; return this; } + /** + * API name: {@code hard_bounds} + */ + @Nonnull + public final Builder hardBounds(@Nullable ExtendedBounds value) { + this.hardBounds = value; + return this; + } + + /** + * API name: {@code hard_bounds} + */ + @Nonnull + public final Builder hardBounds(Function>> fn) { + return hardBounds(fn.apply(new ExtendedBounds.Builder()).build()); + } + /** * API name: {@code interval} */ + @Nonnull public final Builder interval(@Nullable Time value) { this.interval = value; return this; @@ -469,13 +553,31 @@ public final Builder interval(@Nullable Time value) { /** * API name: {@code interval} */ + @Nonnull public final Builder interval(Function> fn) { - return this.interval(fn.apply(new Time.Builder()).build()); + return interval(fn.apply(new Time.Builder()).build()); + } + + /** + * Set to true to associate a unique string key with each bucket and return the ranges as a hash rather than an array. + *

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

+ */ + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; + return this; } /** + * Only returns buckets that have min_doc_count number of documents. By default, all buckets between the first bucket + * that matches documents and the last one are returned. + *

* API name: {@code min_doc_count} + *

*/ + @Nonnull public final Builder minDocCount(@Nullable Integer value) { this.minDocCount = value; return this; @@ -484,6 +586,7 @@ public final Builder minDocCount(@Nullable Integer value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable String value) { this.missing = value; return this; @@ -492,6 +595,7 @@ public final Builder missing(@Nullable String value) { /** * API name: {@code offset} */ + @Nonnull public final Builder offset(@Nullable Time value) { this.offset = value; return this; @@ -500,13 +604,15 @@ public final Builder offset(@Nullable Time value) { /** * API name: {@code offset} */ + @Nonnull public final Builder offset(Function> fn) { - return this.offset(fn.apply(new Time.Builder()).build()); + return offset(fn.apply(new Time.Builder()).build()); } /** * API name: {@code order} */ + @Nonnull public final Builder order(@Nullable HistogramOrder value) { this.order = value; return this; @@ -515,15 +621,19 @@ public final Builder order(@Nullable HistogramOrder value) { /** * API name: {@code order} */ + @Nonnull public final Builder order(Function> fn) { - return this.order(fn.apply(new HistogramOrder.Builder()).build()); + return order(fn.apply(new HistogramOrder.Builder()).build()); } /** * API name: {@code params} + * *

- * Adds all entries of map to params. + * Adds all elements of map to params. + *

*/ + @Nonnull public final Builder params(Map map) { this.params = _mapPutAll(this.params, map); return this; @@ -531,9 +641,12 @@ public final Builder params(Map map) { /** * API name: {@code params} + * *

* Adds an entry to params. + *

*/ + @Nonnull public final Builder params(String key, JsonData value) { this.params = _mapPut(this.params, key, value); return this; @@ -542,6 +655,7 @@ public final Builder params(String key, JsonData value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -550,37 +664,27 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** * API name: {@code time_zone} */ + @Nonnull public final Builder timeZone(@Nullable String value) { this.timeZone = value; return this; } - /** - * API name: {@code keyed} - */ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link DateHistogramAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DateHistogramAggregation build() { _checkSingleUse(); @@ -602,11 +706,12 @@ protected static void setupDateHistogramAggregationDeserializer(ObjectDeserializ setupBucketAggregationBaseDeserializer(op); op.add(Builder::calendarInterval, CalendarInterval._DESERIALIZER, "calendar_interval"); op.add(Builder::extendedBounds, ExtendedBounds.createExtendedBoundsDeserializer(FieldDateMath._DESERIALIZER), "extended_bounds"); - op.add(Builder::hardBounds, ExtendedBounds.createExtendedBoundsDeserializer(FieldDateMath._DESERIALIZER), "hard_bounds"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::fixedInterval, Time._DESERIALIZER, "fixed_interval"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::hardBounds, ExtendedBounds.createExtendedBoundsDeserializer(FieldDateMath._DESERIALIZER), "hard_bounds"); op.add(Builder::interval, Time._DESERIALIZER, "interval"); + op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); op.add(Builder::minDocCount, JsonpDeserializer.integerDeserializer(), "min_doc_count"); op.add(Builder::missing, JsonpDeserializer.stringDeserializer(), "missing"); op.add(Builder::offset, Time._DESERIALIZER, "offset"); @@ -614,8 +719,51 @@ protected static void setupDateHistogramAggregationDeserializer(ObjectDeserializ op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); - op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.calendarInterval); + result = 31 * result + Objects.hashCode(this.extendedBounds); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.fixedInterval); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.hardBounds); + result = 31 * result + Objects.hashCode(this.interval); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.minDocCount); + result = 31 * result + Objects.hashCode(this.missing); + result = 31 * result + Objects.hashCode(this.offset); + result = 31 * result + Objects.hashCode(this.order); + result = 31 * result + Objects.hashCode(this.params); + result = 31 * result + Objects.hashCode(this.script); + result = 31 * result + Objects.hashCode(this.timeZone); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DateHistogramAggregation other = (DateHistogramAggregation) o; + return Objects.equals(this.calendarInterval, other.calendarInterval) + && Objects.equals(this.extendedBounds, other.extendedBounds) + && Objects.equals(this.field, other.field) + && Objects.equals(this.fixedInterval, other.fixedInterval) + && Objects.equals(this.format, other.format) + && Objects.equals(this.hardBounds, other.hardBounds) + && Objects.equals(this.interval, other.interval) + && Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.minDocCount, other.minDocCount) + && Objects.equals(this.missing, other.missing) + && Objects.equals(this.offset, other.offset) + && Objects.equals(this.order, other.order) + && Objects.equals(this.params, other.params) + && Objects.equals(this.script, other.script) + && Objects.equals(this.timeZone, other.timeZone); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java index 171a97d78d..7e5930a7a5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DateRangeAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,49 +50,55 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.FieldValue; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.DateRangeAggregation @JsonpDeserializable -public class DateRangeAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DateRangeAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String field; @Nullable private final String format; + @Nullable + private final Boolean keyed; + @Nullable private final FieldValue missing; + @Nonnull private final List ranges; @Nullable private final String timeZone; - @Nullable - private final Boolean keyed; - // --------------------------------------------------------------------------------------------- private DateRangeAggregation(Builder builder) { super(builder); - this.field = builder.field; this.format = builder.format; + this.keyed = builder.keyed; this.missing = builder.missing; this.ranges = ApiTypeHelper.unmodifiable(builder.ranges); this.timeZone = builder.timeZone; - this.keyed = builder.keyed; - } - public static DateRangeAggregation of(Function> fn) { + public static DateRangeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -101,13 +114,27 @@ public final String field() { } /** + * The date format used to format from and to in the response. + *

* API name: {@code format} + *

*/ @Nullable public final String format() { return this.format; } + /** + * Set to true to associate a unique string key with each bucket and returns the ranges as a hash rather than an array. + *

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

+ */ + @Nullable + public final Boolean keyed() { + return this.keyed; + } + /** * API name: {@code missing} */ @@ -117,8 +144,12 @@ public final FieldValue missing() { } /** + * Array of date ranges. + *

* API name: {@code ranges} + *

*/ + @Nonnull public final List ranges() { return this.ranges; } @@ -131,99 +162,146 @@ public final String timeZone() { return this.timeZone; } - /** - * API name: {@code keyed} - */ - @Nullable - public final Boolean keyed() { - return this.keyed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.format != null) { generator.writeKey("format"); generator.write(this.format); + } + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } + if (this.missing != null) { generator.writeKey("missing"); this.missing.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.ranges)) { generator.writeKey("ranges"); generator.writeStartArray(); for (DateRangeExpression item0 : this.ranges) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.timeZone != null) { generator.writeKey("time_zone"); generator.write(this.timeZone); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link DateRangeAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String field; - @Nullable private String format; - + @Nullable + private Boolean keyed; @Nullable private FieldValue missing; - @Nullable private List ranges; - @Nullable private String timeZone; - @Nullable - private Boolean keyed; + public Builder() {} + + private Builder(DateRangeAggregation o) { + super(o); + this.field = o.field; + this.format = o.format; + this.keyed = o.keyed; + this.missing = o.missing; + this.ranges = _listCopy(o.ranges); + this.timeZone = o.timeZone; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.format = o.format; + this.keyed = o.keyed; + this.missing = o.missing; + this.ranges = _listCopy(o.ranges); + this.timeZone = o.timeZone; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * The date format used to format from and to in the response. + *

* API name: {@code format} + *

*/ + @Nonnull public final Builder format(@Nullable String value) { this.format = value; return this; } + /** + * Set to true to associate a unique string key with each bucket and returns the ranges as a hash rather than an array. + *

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

+ */ + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; + return this; + } + /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable FieldValue value) { this.missing = value; return this; @@ -232,35 +310,54 @@ public final Builder missing(@Nullable FieldValue value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); + return missing(fn.apply(new FieldValue.Builder()).build()); } /** + * Array of date ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds all elements of list to ranges. + *

*/ + @Nonnull public final Builder ranges(List list) { this.ranges = _listAddAll(this.ranges, list); return this; } /** + * Array of date ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds one or more values to ranges. + *

*/ + @Nonnull public final Builder ranges(DateRangeExpression value, DateRangeExpression... values) { this.ranges = _listAdd(this.ranges, value, values); return this; } /** + * Array of date ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds a value to ranges using a builder lambda. + *

*/ + @Nonnull public final Builder ranges(Function> fn) { return ranges(fn.apply(new DateRangeExpression.Builder()).build()); } @@ -268,30 +365,19 @@ public final Builder ranges(Function { + @Nullable private final FieldDateMath from; @@ -60,14 +71,12 @@ public class DateRangeExpression implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private DateRangeExpression(Builder builder) { - this.from = builder.from; this.key = builder.key; this.to = builder.to; - } - public static DateRangeExpression of(Function> fn) { + public static DateRangeExpression of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -80,7 +89,10 @@ public final FieldDateMath from() { } /** + * Custom key to return the range with. + *

* API name: {@code key} + *

*/ @Nullable public final String key() { @@ -98,6 +110,7 @@ public final FieldDateMath to() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -105,44 +118,70 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.from != null) { generator.writeKey("from"); this.from.serialize(generator, mapper); - } + if (this.key != null) { generator.writeKey("key"); generator.write(this.key); - } + if (this.to != null) { generator.writeKey("to"); this.to.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DateRangeExpression}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private FieldDateMath from; - @Nullable private String key; - @Nullable private FieldDateMath to; + public Builder() {} + + private Builder(DateRangeExpression o) { + this.from = o.from; + this.key = o.key; + this.to = o.to; + } + + private Builder(Builder o) { + this.from = o.from; + this.key = o.key; + this.to = o.to; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code from} */ + @Nonnull public final Builder from(@Nullable FieldDateMath value) { this.from = value; return this; @@ -151,13 +190,18 @@ public final Builder from(@Nullable FieldDateMath value) { /** * API name: {@code from} */ + @Nonnull public final Builder from(Function> fn) { - return this.from(fn.apply(new FieldDateMath.Builder()).build()); + return from(fn.apply(new FieldDateMath.Builder()).build()); } /** + * Custom key to return the range with. + *

* API name: {@code key} + *

*/ + @Nonnull public final Builder key(@Nullable String value) { this.key = value; return this; @@ -166,6 +210,7 @@ public final Builder key(@Nullable String value) { /** * API name: {@code to} */ + @Nonnull public final Builder to(@Nullable FieldDateMath value) { this.to = value; return this; @@ -174,16 +219,18 @@ public final Builder to(@Nullable FieldDateMath value) { /** * API name: {@code to} */ + @Nonnull public final Builder to(Function> fn) { - return this.to(fn.apply(new FieldDateMath.Builder()).build()); + return to(fn.apply(new FieldDateMath.Builder()).build()); } /** * Builds a {@link DateRangeExpression}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DateRangeExpression build() { _checkSingleUse(); @@ -202,11 +249,25 @@ public DateRangeExpression build() { ); protected static void setupDateRangeExpressionDeserializer(ObjectDeserializer op) { - op.add(Builder::from, FieldDateMath._DESERIALIZER, "from"); op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key"); op.add(Builder::to, FieldDateMath._DESERIALIZER, "to"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.from); + result = 31 * result + Objects.hashCode(this.key); + result = 31 * result + Objects.hashCode(this.to); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DateRangeExpression other = (DateRangeExpression) o; + return Objects.equals(this.from, other.from) && Objects.equals(this.key, other.key) && Objects.equals(this.to, other.to); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java index c58e3842b6..5fbdfb6731 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DerivativeAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.DerivativeAggregation @JsonpDeserializable -public class DerivativeAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DerivativeAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DerivativeAggregation(Builder builder) { super(builder); - } - public static DerivativeAggregation of(Function> fn) { + public static DerivativeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DerivativeAggregation}. */ + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DerivativeAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link DerivativeAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DerivativeAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public DerivativeAggregation build() { ); protected static void setupDerivativeAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java index abc6dccca3..c8c80e48db 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/DiversifiedSamplerAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,15 +48,25 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.DiversifiedSamplerAggregation @JsonpDeserializable -public class DiversifiedSamplerAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DiversifiedSamplerAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final SamplerAggregationExecutionHint executionHint; + @Nullable + private final String field; + @Nullable private final Integer maxDocsPerValue; @@ -59,28 +76,25 @@ public class DiversifiedSamplerAggregation extends BucketAggregationBase impleme @Nullable private final Integer shardSize; - @Nullable - private final String field; - // --------------------------------------------------------------------------------------------- private DiversifiedSamplerAggregation(Builder builder) { super(builder); - this.executionHint = builder.executionHint; + this.field = builder.field; this.maxDocsPerValue = builder.maxDocsPerValue; this.script = builder.script; this.shardSize = builder.shardSize; - this.field = builder.field; - } - public static DiversifiedSamplerAggregation of(Function> fn) { + public static DiversifiedSamplerAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -96,7 +110,18 @@ public final SamplerAggregationExecutionHint executionHint() { } /** + * API name: {@code field} + */ + @Nullable + public final String field() { + return this.field; + } + + /** + * Limits how many documents are permitted per choice of de-duplicating value. + *

* API name: {@code max_docs_per_value} + *

*/ @Nullable public final Integer maxDocsPerValue() { @@ -112,86 +137,131 @@ public final Script script() { } /** + * Limits how many top-scoring documents are collected in the sample processed on each shard. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { return this.shardSize; } - /** - * API name: {@code field} - */ - @Nullable - public final String field() { - return this.field; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.executionHint != null) { generator.writeKey("execution_hint"); this.executionHint.serialize(generator, mapper); } + + if (this.field != null) { + generator.writeKey("field"); + generator.write(this.field); + } + if (this.maxDocsPerValue != null) { generator.writeKey("max_docs_per_value"); generator.write(this.maxDocsPerValue); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } - if (this.field != null) { - generator.writeKey("field"); - generator.write(this.field); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link DiversifiedSamplerAggregation}. */ - public static class Builder extends BucketAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private SamplerAggregationExecutionHint executionHint; - + @Nullable + private String field; @Nullable private Integer maxDocsPerValue; - @Nullable private Script script; - @Nullable private Integer shardSize; - @Nullable - private String field; + public Builder() {} + + private Builder(DiversifiedSamplerAggregation o) { + super(o); + this.executionHint = o.executionHint; + this.field = o.field; + this.maxDocsPerValue = o.maxDocsPerValue; + this.script = o.script; + this.shardSize = o.shardSize; + } + + private Builder(Builder o) { + super(o); + this.executionHint = o.executionHint; + this.field = o.field; + this.maxDocsPerValue = o.maxDocsPerValue; + this.script = o.script; + this.shardSize = o.shardSize; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code execution_hint} */ + @Nonnull public final Builder executionHint(@Nullable SamplerAggregationExecutionHint value) { this.executionHint = value; return this; } /** + * API name: {@code field} + */ + @Nonnull + public final Builder field(@Nullable String value) { + this.field = value; + return this; + } + + /** + * Limits how many documents are permitted per choice of de-duplicating value. + *

* API name: {@code max_docs_per_value} + *

*/ + @Nonnull public final Builder maxDocsPerValue(@Nullable Integer value) { this.maxDocsPerValue = value; return this; @@ -200,6 +270,7 @@ public final Builder maxDocsPerValue(@Nullable Integer value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -208,37 +279,30 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** + * Limits how many top-scoring documents are collected in the sample processed on each shard. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } - /** - * API name: {@code field} - */ - public final Builder field(@Nullable String value) { - this.field = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link DiversifiedSamplerAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DiversifiedSamplerAggregation build() { _checkSingleUse(); @@ -257,13 +321,37 @@ public DiversifiedSamplerAggregation build() { ); protected static void setupDiversifiedSamplerAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::executionHint, SamplerAggregationExecutionHint._DESERIALIZER, "execution_hint"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::maxDocsPerValue, JsonpDeserializer.integerDeserializer(), "max_docs_per_value"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.executionHint); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.maxDocsPerValue); + result = 31 * result + Objects.hashCode(this.script); + result = 31 * result + Objects.hashCode(this.shardSize); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DiversifiedSamplerAggregation other = (DiversifiedSamplerAggregation) o; + return Objects.equals(this.executionHint, other.executionHint) + && Objects.equals(this.field, other.field) + && Objects.equals(this.maxDocsPerValue, other.maxDocsPerValue) + && Objects.equals(this.script, other.script) + && Objects.equals(this.shardSize, other.shardSize); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java index 1301481666..fcdb1aed78 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaModelSettings.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,25 +48,27 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.EwmaModelSettings @JsonpDeserializable -public class EwmaModelSettings implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class EwmaModelSettings implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Float alpha; // --------------------------------------------------------------------------------------------- private EwmaModelSettings(Builder builder) { - this.alpha = builder.alpha; - } - public static EwmaModelSettings of(Function> fn) { + public static EwmaModelSettings of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -74,6 +83,7 @@ public final Float alpha() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,28 +91,52 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.alpha != null) { generator.writeKey("alpha"); generator.write(this.alpha); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link EwmaModelSettings}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Float alpha; + public Builder() {} + + private Builder(EwmaModelSettings o) { + this.alpha = o.alpha; + } + + private Builder(Builder o) { + this.alpha = o.alpha; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code alpha} */ + @Nonnull public final Builder alpha(@Nullable Float value) { this.alpha = value; return this; @@ -111,9 +145,10 @@ public final Builder alpha(@Nullable Float value) { /** * Builds a {@link EwmaModelSettings}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public EwmaModelSettings build() { _checkSingleUse(); @@ -132,9 +167,21 @@ public EwmaModelSettings build() { ); protected static void setupEwmaModelSettingsDeserializer(ObjectDeserializer op) { - op.add(Builder::alpha, JsonpDeserializer.floatDeserializer(), "alpha"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.alpha); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + EwmaModelSettings other = (EwmaModelSettings) o; + return Objects.equals(this.alpha, other.alpha); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java index 2ad3417df0..d31c899e0a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/EwmaMovingAverageAggregation.java @@ -30,39 +30,53 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.EwmaMovingAverageAggregation @JsonpDeserializable -public class EwmaMovingAverageAggregation extends MovingAverageAggregationBase implements MovingAverageAggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class EwmaMovingAverageAggregation extends MovingAverageAggregationBase + implements + MovingAverageAggregationVariant, + ToCopyableBuilder { + + @Nonnull private final EwmaModelSettings settings; // --------------------------------------------------------------------------------------------- private EwmaMovingAverageAggregation(Builder builder) { super(builder); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static EwmaMovingAverageAggregation of(Function> fn) { + public static EwmaMovingAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * MovingAverageAggregation variant kind. + * {@link MovingAverageAggregation} variant kind. */ @Override public MovingAverageAggregation.Kind _movingAverageAggregationKind() { @@ -72,33 +86,67 @@ public MovingAverageAggregation.Kind _movingAverageAggregationKind() { /** * Required - API name: {@code settings} */ + @Nonnull public final EwmaModelSettings settings() { return this.settings; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("model", "ewma"); super.serializeInternal(generator, mapper); generator.writeKey("settings"); this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link EwmaMovingAverageAggregation}. */ - public static class Builder extends MovingAverageAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { private EwmaModelSettings settings; + public Builder() {} + + private Builder(EwmaMovingAverageAggregation o) { + super(o); + this.settings = o.settings; + } + + private Builder(Builder o) { + super(o); + this.settings = o.settings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(EwmaModelSettings value) { this.settings = value; return this; @@ -107,21 +155,18 @@ public final Builder settings(EwmaModelSettings value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new EwmaModelSettings.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return settings(fn.apply(new EwmaModelSettings.Builder()).build()); } /** * Builds a {@link EwmaMovingAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public EwmaMovingAverageAggregation build() { _checkSingleUse(); @@ -140,10 +185,27 @@ public EwmaMovingAverageAggregation build() { ); protected static void setupEwmaMovingAverageAggregationDeserializer(ObjectDeserializer op) { - MovingAverageAggregationBase.setupMovingAverageAggregationBaseDeserializer(op); + setupMovingAverageAggregationBaseDeserializer(op); op.add(Builder::settings, EwmaModelSettings._DESERIALIZER, "settings"); op.ignore("model"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.settings.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + EwmaMovingAverageAggregation other = (EwmaMovingAverageAggregation) o; + return this.settings.equals(other.settings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java index 2f8ddcff1c..4621a6f05d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ExtendedStatsAggregation @JsonpDeserializable -public class ExtendedStatsAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ExtendedStatsAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Double sigma; @@ -53,17 +67,15 @@ public class ExtendedStatsAggregation extends FormatMetricAggregationBase implem private ExtendedStatsAggregation(Builder builder) { super(builder); - this.sigma = builder.sigma; - } - public static ExtendedStatsAggregation of(Function> fn) { + public static ExtendedStatsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +83,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * The number of standard deviations above/below the mean to display. + *

* API name: {@code sigma} + *

*/ @Nullable public final Double sigma() { @@ -79,47 +94,78 @@ public final Double sigma() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.sigma != null) { generator.writeKey("sigma"); generator.write(this.sigma); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ExtendedStatsAggregation}. */ - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Double sigma; + public Builder() {} + + private Builder(ExtendedStatsAggregation o) { + super(o); + this.sigma = o.sigma; + } + + private Builder(Builder o) { + super(o); + this.sigma = o.sigma; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The number of standard deviations above/below the mean to display. + *

* API name: {@code sigma} + *

*/ + @Nonnull public final Builder sigma(@Nullable Double value) { this.sigma = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ExtendedStatsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ExtendedStatsAggregation build() { _checkSingleUse(); @@ -140,7 +186,23 @@ public ExtendedStatsAggregation build() { protected static void setupExtendedStatsAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); op.add(Builder::sigma, JsonpDeserializer.doubleDeserializer(), "sigma"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.sigma); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ExtendedStatsAggregation other = (ExtendedStatsAggregation) o; + return Objects.equals(this.sigma, other.sigma); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java index 21f416a07c..2b4684b31f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ExtendedStatsBucketAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ExtendedStatsBucketAggregation @JsonpDeserializable -public class ExtendedStatsBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ExtendedStatsBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Double sigma; @@ -53,17 +67,17 @@ public class ExtendedStatsBucketAggregation extends PipelineAggregationBase impl private ExtendedStatsBucketAggregation(Builder builder) { super(builder); - this.sigma = builder.sigma; - } - public static ExtendedStatsBucketAggregation of(Function> fn) { + public static ExtendedStatsBucketAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +85,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * The number of standard deviations above/below the mean to display. + *

* API name: {@code sigma} + *

*/ @Nullable public final Double sigma() { @@ -79,47 +96,78 @@ public final Double sigma() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.sigma != null) { generator.writeKey("sigma"); generator.write(this.sigma); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ExtendedStatsBucketAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Double sigma; + public Builder() {} + + private Builder(ExtendedStatsBucketAggregation o) { + super(o); + this.sigma = o.sigma; + } + + private Builder(Builder o) { + super(o); + this.sigma = o.sigma; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The number of standard deviations above/below the mean to display. + *

* API name: {@code sigma} + *

*/ + @Nonnull public final Builder sigma(@Nullable Double value) { this.sigma = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ExtendedStatsBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ExtendedStatsBucketAggregation build() { _checkSingleUse(); @@ -138,9 +186,25 @@ public ExtendedStatsBucketAggregation build() { ); protected static void setupExtendedStatsBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::sigma, JsonpDeserializer.doubleDeserializer(), "sigma"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.sigma); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ExtendedStatsBucketAggregation other = (ExtendedStatsBucketAggregation) o; + return Objects.equals(this.sigma, other.sigma); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java index 775fb5e4ed..e5c8300215 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMath.java @@ -30,14 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.PlainJsonSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -48,17 +56,17 @@ // typedef: _types.aggregations.FieldDateMath /** - * A date range limit, represented either as a DateMath expression or a number - * expressed according to the target field's precision. - * + * A date range limit, represented either as a DateMath expression or a number expressed according to the target field's precision. */ @JsonpDeserializable -public class FieldDateMath implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FieldDateMath implements TaggedUnion, PlainJsonSerializable { + /** + * {@link FieldDateMath} variant kinds. + */ public enum Kind { Expr, Value - } private final Kind _kind; @@ -79,29 +87,26 @@ private FieldDateMath(Kind kind, Object value) { this._value = value; } + private FieldDateMath(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static FieldDateMath of(Function> fn) { + return fn.apply(new Builder()).build(); + } + public String _toJsonString() { switch (_kind) { case Expr: return this.expr(); case Value: return String.valueOf(this.value()); - default: throw new IllegalStateException("Unknown kind " + _kind); } } - private FieldDateMath(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static FieldDateMath of(Function> fn) { - return fn.apply(new Builder()).build(); - } - /** * Is this variant instance of kind {@code expr}? */ @@ -112,8 +117,7 @@ public boolean isExpr() { /** * Get the {@code expr} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code expr} kind. + * @throws IllegalStateException if the current variant is not the {@code expr} kind. */ public String expr() { return TaggedUnionUtils.get(this, Kind.Expr); @@ -129,8 +133,7 @@ public boolean isValue() { /** * Get the {@code value} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code value} kind. + * @throws IllegalStateException if the current variant is not the {@code value} kind. */ public Double value() { return TaggedUnionUtils.get(this, Kind.Value); @@ -144,21 +147,35 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { switch (_kind) { case Expr: generator.write(((String) this._value)); - break; case Value: generator.write(((Double) this._value)); - break; } } + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + public Builder() {} + + private Builder(FieldDateMath o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder expr(String v) { this._kind = Kind.Expr; this._value = v; @@ -171,11 +188,11 @@ public ObjectBuilder value(Double v) { return this; } + @Override public FieldDateMath build() { _checkSingleUse(); return new FieldDateMath(this); } - } private static JsonpDeserializer buildFieldDateMathDeserializer() { @@ -188,4 +205,20 @@ private static JsonpDeserializer buildFieldDateMathDeserializer() public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( FieldDateMath::buildFieldDateMathDeserializer ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldDateMath other = (FieldDateMath) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java index e55c7ed62f..047294a008 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FiltersAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,42 +48,47 @@ 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.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.FiltersAggregation @JsonpDeserializable -public class FiltersAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FiltersAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Buckets filters; @Nullable - private final Boolean otherBucket; + private final Boolean keyed; @Nullable - private final String otherBucketKey; + private final Boolean otherBucket; @Nullable - private final Boolean keyed; + private final String otherBucketKey; // --------------------------------------------------------------------------------------------- private FiltersAggregation(Builder builder) { super(builder); - this.filters = builder.filters; + this.keyed = builder.keyed; this.otherBucket = builder.otherBucket; this.otherBucketKey = builder.otherBucketKey; - this.keyed = builder.keyed; - } - public static FiltersAggregation of(Function> fn) { + public static FiltersAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -92,7 +104,22 @@ public final Buckets filters() { } /** + * By default, the named filters aggregation returns the buckets as an object. Set to false to return the buckets as an + * array of objects. + *

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

+ */ + @Nullable + public final Boolean keyed() { + return this.keyed; + } + + /** + * Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + *

* API name: {@code other_bucket} + *

*/ @Nullable public final Boolean otherBucket() { @@ -100,69 +127,101 @@ public final Boolean otherBucket() { } /** + * The key with which the other bucket is returned. + *

* API name: {@code other_bucket_key} + *

*/ @Nullable public final String otherBucketKey() { return this.otherBucketKey; } - /** - * API name: {@code keyed} - */ - @Nullable - public final Boolean keyed() { - return this.keyed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.filters != null) { generator.writeKey("filters"); this.filters.serialize(generator, mapper); + } + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } + if (this.otherBucket != null) { generator.writeKey("other_bucket"); generator.write(this.otherBucket); - } + if (this.otherBucketKey != null) { generator.writeKey("other_bucket_key"); generator.write(this.otherBucketKey); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link FiltersAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Buckets filters; - + @Nullable + private Boolean keyed; @Nullable private Boolean otherBucket; - @Nullable private String otherBucketKey; - @Nullable - private Boolean keyed; + public Builder() {} + + private Builder(FiltersAggregation o) { + super(o); + this.filters = o.filters; + this.keyed = o.keyed; + this.otherBucket = o.otherBucket; + this.otherBucketKey = o.otherBucketKey; + } + + private Builder(Builder o) { + super(o); + this.filters = o.filters; + this.keyed = o.keyed; + this.otherBucket = o.otherBucket; + this.otherBucketKey = o.otherBucketKey; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code filters} */ + @Nonnull public final Builder filters(@Nullable Buckets value) { this.filters = value; return this; @@ -171,45 +230,56 @@ public final Builder filters(@Nullable Buckets value) { /** * API name: {@code filters} */ - public final Builder filters(Function, ObjectBuilder>> fn) { - return this.filters(fn.apply(new Buckets.Builder()).build()); + @Nonnull + public final Builder filters(Function>> fn) { + return filters(fn.apply(new Buckets.Builder()).build()); } /** + * By default, the named filters aggregation returns the buckets as an object. Set to false to return the buckets as an + * array of objects. + *

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

+ */ + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; + return this; + } + + /** + * Set to true to add a bucket to the response which will contain all documents that do not match any of the given + * filters. + *

* API name: {@code other_bucket} + *

*/ + @Nonnull public final Builder otherBucket(@Nullable Boolean value) { this.otherBucket = value; return this; } /** + * The key with which the other bucket is returned. + *

* API name: {@code other_bucket_key} + *

*/ + @Nonnull public final Builder otherBucketKey(@Nullable String value) { this.otherBucketKey = value; return this; } - /** - * API name: {@code keyed} - */ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link FiltersAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FiltersAggregation build() { _checkSingleUse(); @@ -228,12 +298,34 @@ public FiltersAggregation build() { ); protected static void setupFiltersAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::filters, Buckets.createBucketsDeserializer(Query._DESERIALIZER), "filters"); + op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); op.add(Builder::otherBucket, JsonpDeserializer.booleanDeserializer(), "other_bucket"); op.add(Builder::otherBucketKey, JsonpDeserializer.stringDeserializer(), "other_bucket_key"); - op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.filters); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.otherBucket); + result = 31 * result + Objects.hashCode(this.otherBucketKey); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FiltersAggregation other = (FiltersAggregation) o; + return Objects.equals(this.filters, other.filters) + && Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.otherBucket, other.otherBucket) + && Objects.equals(this.otherBucketKey, other.otherBucketKey); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java index 1fbb2c8aa4..0dd8e1a60e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormatMetricAggregationBase.java @@ -30,9 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,7 +47,9 @@ // typedef: _types.aggregations.FormatMetricAggregationBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class FormatMetricAggregationBase extends MetricAggregationBase { + @Nullable private final String format; @@ -48,9 +57,7 @@ public abstract class FormatMetricAggregationBase extends MetricAggregationBase protected FormatMetricAggregationBase(AbstractBuilder builder) { super(builder); - this.format = builder.format; - } /** @@ -62,38 +69,66 @@ public final String format() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends MetricAggregationBase.AbstractBuilder { @Nullable private String format; + protected AbstractBuilder() {} + + protected AbstractBuilder(FormatMetricAggregationBase o) { + super(o); + this.format = o.format; + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.format = o.format; + } + /** * API name: {@code format} */ + @Nonnull public final BuilderT format(@Nullable String value) { this.format = value; return self(); } - } // --------------------------------------------------------------------------------------------- + protected static > void setupFormatMetricAggregationBaseDeserializer( ObjectDeserializer op ) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(AbstractBuilder::format, JsonpDeserializer.stringDeserializer(), "format"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.format); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FormatMetricAggregationBase other = (FormatMetricAggregationBase) o; + return Objects.equals(this.format, other.format); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java index 798f5f760f..5861f0e93f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/FormattableMetricAggregation.java @@ -30,9 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,7 +47,9 @@ // typedef: _types.aggregations.FormattableMetricAggregation +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class FormattableMetricAggregation extends MetricAggregationBase { + @Nullable private final String format; @@ -48,9 +57,7 @@ public abstract class FormattableMetricAggregation extends MetricAggregationBase protected FormattableMetricAggregation(AbstractBuilder builder) { super(builder); - this.format = builder.format; - } /** @@ -62,38 +69,66 @@ public final String format() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends MetricAggregationBase.AbstractBuilder { @Nullable private String format; + protected AbstractBuilder() {} + + protected AbstractBuilder(FormattableMetricAggregation o) { + super(o); + this.format = o.format; + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.format = o.format; + } + /** * API name: {@code format} */ + @Nonnull public final BuilderT format(@Nullable String value) { this.format = value; return self(); } - } // --------------------------------------------------------------------------------------------- + protected static > void setupFormattableMetricAggregationDeserializer( ObjectDeserializer op ) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(AbstractBuilder::format, JsonpDeserializer.stringDeserializer(), "format"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.format); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FormattableMetricAggregation other = (FormattableMetricAggregation) o; + return Objects.equals(this.format, other.format); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java index edd004266b..26c4bcd94e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GapPolicy.java @@ -30,18 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.GapPolicy + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum GapPolicy implements JsonEnum { - Skip("skip"), - InsertZeros("insert_zeros"), - ; + KeepValues("keep_values"), + + Skip("skip"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java index b295de9c40..92ec61194a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoBoundsAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoBoundsAggregation @JsonpDeserializable -public class GeoBoundsAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoBoundsAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Boolean wrapLongitude; @@ -53,17 +67,15 @@ public class GeoBoundsAggregation extends MetricAggregationBase implements Aggre private GeoBoundsAggregation(Builder builder) { super(builder); - this.wrapLongitude = builder.wrapLongitude; - } - public static GeoBoundsAggregation of(Function> fn) { + public static GeoBoundsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +83,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * Specifies whether the bounding box should be allowed to overlap the international date line. + *

* API name: {@code wrap_longitude} + *

*/ @Nullable public final Boolean wrapLongitude() { @@ -79,45 +94,78 @@ public final Boolean wrapLongitude() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.wrapLongitude != null) { generator.writeKey("wrap_longitude"); generator.write(this.wrapLongitude); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoBoundsAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Boolean wrapLongitude; + public Builder() {} + + private Builder(GeoBoundsAggregation o) { + super(o); + this.wrapLongitude = o.wrapLongitude; + } + + private Builder(Builder o) { + super(o); + this.wrapLongitude = o.wrapLongitude; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Specifies whether the bounding box should be allowed to overlap the international date line. + *

* API name: {@code wrap_longitude} + *

*/ + @Nonnull public final Builder wrapLongitude(@Nullable Boolean value) { this.wrapLongitude = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link GeoBoundsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoBoundsAggregation build() { _checkSingleUse(); @@ -136,9 +184,25 @@ public GeoBoundsAggregation build() { ); protected static void setupGeoBoundsAggregationDeserializer(ObjectDeserializer op) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(Builder::wrapLongitude, JsonpDeserializer.booleanDeserializer(), "wrap_longitude"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.wrapLongitude); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoBoundsAggregation other = (GeoBoundsAggregation) o; + return Objects.equals(this.wrapLongitude, other.wrapLongitude); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java index abbc56a3f4..0e5dcea1e9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoCentroidAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.GeoLocation; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoCentroidAggregation @JsonpDeserializable -public class GeoCentroidAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoCentroidAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Long count; @@ -57,18 +71,16 @@ public class GeoCentroidAggregation extends MetricAggregationBase implements Agg private GeoCentroidAggregation(Builder builder) { super(builder); - this.count = builder.count; this.location = builder.location; - } - public static GeoCentroidAggregation of(Function> fn) { + public static GeoCentroidAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -92,37 +104,72 @@ public final GeoLocation location() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.count != null) { generator.writeKey("count"); generator.write(this.count); - } + if (this.location != null) { generator.writeKey("location"); this.location.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoCentroidAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Long count; - @Nullable private GeoLocation location; + public Builder() {} + + private Builder(GeoCentroidAggregation o) { + super(o); + this.count = o.count; + this.location = o.location; + } + + private Builder(Builder o) { + super(o); + this.count = o.count; + this.location = o.location; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code count} */ + @Nonnull public final Builder count(@Nullable Long value) { this.count = value; return this; @@ -131,6 +178,7 @@ public final Builder count(@Nullable Long value) { /** * API name: {@code location} */ + @Nonnull public final Builder location(@Nullable GeoLocation value) { this.location = value; return this; @@ -139,21 +187,18 @@ public final Builder location(@Nullable GeoLocation value) { /** * API name: {@code location} */ + @Nonnull public final Builder location(Function> fn) { - return this.location(fn.apply(new GeoLocation.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return location(fn.apply(new GeoLocation.Builder()).build()); } /** * Builds a {@link GeoCentroidAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoCentroidAggregation build() { _checkSingleUse(); @@ -175,7 +220,24 @@ protected static void setupGeoCentroidAggregationDeserializer(ObjectDeserializer setupMetricAggregationBaseDeserializer(op); op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); op.add(Builder::location, GeoLocation._DESERIALIZER, "location"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.location); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoCentroidAggregation other = (GeoCentroidAggregation) o; + return Objects.equals(this.count, other.count) && Objects.equals(this.location, other.location); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java index 4d1acafacf..3ce6aca478 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoDistanceAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -45,12 +52,19 @@ import org.opensearch.client.opensearch._types.GeoDistanceType; import org.opensearch.client.opensearch._types.GeoLocation; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoDistanceAggregation @JsonpDeserializable -public class GeoDistanceAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoDistanceAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final GeoDistanceType distanceType; @@ -60,6 +74,7 @@ public class GeoDistanceAggregation extends BucketAggregationBase implements Agg @Nullable private final GeoLocation origin; + @Nonnull private final List ranges; @Nullable @@ -69,21 +84,19 @@ public class GeoDistanceAggregation extends BucketAggregationBase implements Agg private GeoDistanceAggregation(Builder builder) { super(builder); - this.distanceType = builder.distanceType; this.field = builder.field; this.origin = builder.origin; this.ranges = ApiTypeHelper.unmodifiable(builder.ranges); this.unit = builder.unit; - } - public static GeoDistanceAggregation of(Function> fn) { + public static GeoDistanceAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -115,8 +128,12 @@ public final GeoLocation origin() { } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

*/ + @Nonnull public final List ranges() { return this.ranges; } @@ -130,64 +147,103 @@ public final DistanceUnit unit() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.distanceType != null) { generator.writeKey("distance_type"); this.distanceType.serialize(generator, mapper); } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.origin != null) { generator.writeKey("origin"); this.origin.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.ranges)) { generator.writeKey("ranges"); generator.writeStartArray(); for (AggregationRange item0 : this.ranges) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.unit != null) { generator.writeKey("unit"); this.unit.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoDistanceAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private GeoDistanceType distanceType; - @Nullable private String field; - @Nullable private GeoLocation origin; - @Nullable private List ranges; - @Nullable private DistanceUnit unit; + public Builder() {} + + private Builder(GeoDistanceAggregation o) { + super(o); + this.distanceType = o.distanceType; + this.field = o.field; + this.origin = o.origin; + this.ranges = _listCopy(o.ranges); + this.unit = o.unit; + } + + private Builder(Builder o) { + super(o); + this.distanceType = o.distanceType; + this.field = o.field; + this.origin = o.origin; + this.ranges = _listCopy(o.ranges); + this.unit = o.unit; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code distance_type} */ + @Nonnull public final Builder distanceType(@Nullable GeoDistanceType value) { this.distanceType = value; return this; @@ -196,6 +252,7 @@ public final Builder distanceType(@Nullable GeoDistanceType value) { /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -204,6 +261,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code origin} */ + @Nonnull public final Builder origin(@Nullable GeoLocation value) { this.origin = value; return this; @@ -212,35 +270,54 @@ public final Builder origin(@Nullable GeoLocation value) { /** * API name: {@code origin} */ + @Nonnull public final Builder origin(Function> fn) { - return this.origin(fn.apply(new GeoLocation.Builder()).build()); + return origin(fn.apply(new GeoLocation.Builder()).build()); } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds all elements of list to ranges. + *

*/ + @Nonnull public final Builder ranges(List list) { this.ranges = _listAddAll(this.ranges, list); return this; } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds one or more values to ranges. + *

*/ + @Nonnull public final Builder ranges(AggregationRange value, AggregationRange... values) { this.ranges = _listAdd(this.ranges, value, values); return this; } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds a value to ranges using a builder lambda. + *

*/ + @Nonnull public final Builder ranges(Function> fn) { return ranges(fn.apply(new AggregationRange.Builder()).build()); } @@ -248,22 +325,19 @@ public final Builder ranges(Function { + @Nullable private final GeoBounds bounds; @@ -67,21 +81,19 @@ public class GeoHashGridAggregation extends BucketAggregationBase implements Agg private GeoHashGridAggregation(Builder builder) { super(builder); - this.bounds = builder.bounds; this.field = builder.field; this.precision = builder.precision; this.shardSize = builder.shardSize; this.size = builder.size; - } - public static GeoHashGridAggregation of(Function> fn) { + public static GeoHashGridAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -113,7 +125,11 @@ public final GeoHashPrecision precision() { } /** + * Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning + * max(10,(size x number-of-shards)) buckets from each shard. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -121,7 +137,10 @@ public final Integer shardSize() { } /** + * The maximum number of geohash buckets to return. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -129,61 +148,99 @@ public final Integer size() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.bounds != null) { generator.writeKey("bounds"); this.bounds.serialize(generator, mapper); - } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.precision != null) { generator.writeKey("precision"); this.precision.serialize(generator, mapper); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoHashGridAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private GeoBounds bounds; - @Nullable private String field; - @Nullable private GeoHashPrecision precision; - @Nullable private Integer shardSize; - @Nullable private Integer size; + public Builder() {} + + private Builder(GeoHashGridAggregation o) { + super(o); + this.bounds = o.bounds; + this.field = o.field; + this.precision = o.precision; + this.shardSize = o.shardSize; + this.size = o.size; + } + + private Builder(Builder o) { + super(o); + this.bounds = o.bounds; + this.field = o.field; + this.precision = o.precision; + this.shardSize = o.shardSize; + this.size = o.size; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code bounds} */ + @Nonnull public final Builder bounds(@Nullable GeoBounds value) { this.bounds = value; return this; @@ -192,13 +249,15 @@ public final Builder bounds(@Nullable GeoBounds value) { /** * API name: {@code bounds} */ + @Nonnull public final Builder bounds(Function> fn) { - return this.bounds(fn.apply(new GeoBounds.Builder()).build()); + return bounds(fn.apply(new GeoBounds.Builder()).build()); } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -207,6 +266,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code precision} */ + @Nonnull public final Builder precision(@Nullable GeoHashPrecision value) { this.precision = value; return this; @@ -215,37 +275,43 @@ public final Builder precision(@Nullable GeoHashPrecision value) { /** * API name: {@code precision} */ + @Nonnull public final Builder precision(Function> fn) { - return this.precision(fn.apply(new GeoHashPrecision.Builder()).build()); + return precision(fn.apply(new GeoHashPrecision.Builder()).build()); } /** + * Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning + * max(10,(size x number-of-shards)) buckets from each shard. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } /** + * The maximum number of geohash buckets to return. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link GeoHashGridAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoHashGridAggregation build() { _checkSingleUse(); @@ -270,7 +336,31 @@ protected static void setupGeoHashGridAggregationDeserializer(ObjectDeserializer op.add(Builder::precision, GeoHashPrecision._DESERIALIZER, "precision"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.bounds); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.precision); + result = 31 * result + Objects.hashCode(this.shardSize); + result = 31 * result + Objects.hashCode(this.size); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoHashGridAggregation other = (GeoHashGridAggregation) o; + return Objects.equals(this.bounds, other.bounds) + && Objects.equals(this.field, other.field) + && Objects.equals(this.precision, other.precision) + && Objects.equals(this.shardSize, other.shardSize) + && Objects.equals(this.size, other.size); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java index 37192388cc..381d82b63f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineAggregation.java @@ -30,83 +30,114 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.SortOrder; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoLineAggregation @JsonpDeserializable -public class GeoLineAggregation implements AggregationVariant, JsonpSerializable { - private final GeoLinePoint point; - - private final GeoLineSort sort; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoLineAggregation + implements + AggregationVariant, + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Boolean includeSort; - @Nullable - private final SortOrder sortOrder; + @Nonnull + private final GeoLinePoint point; @Nullable private final Integer size; + @Nonnull + private final GeoLineSort sort; + + @Nullable + private final SortOrder sortOrder; + // --------------------------------------------------------------------------------------------- private GeoLineAggregation(Builder builder) { - + this.includeSort = builder.includeSort; this.point = ApiTypeHelper.requireNonNull(builder.point, this, "point"); + this.size = builder.size; this.sort = ApiTypeHelper.requireNonNull(builder.sort, this, "sort"); - this.includeSort = builder.includeSort; this.sortOrder = builder.sortOrder; - this.size = builder.size; - } - public static GeoLineAggregation of(Function> fn) { + public static GeoLineAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { - return Aggregation.Kind.GeoLine; + return Aggregation.Kind.Line; + } + + /** + * When true, returns an additional array of the sort values in the feature properties. + *

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

+ */ + @Nullable + public final Boolean includeSort() { + return this.includeSort; } /** * Required - API name: {@code point} */ + @Nonnull public final GeoLinePoint point() { return this.point; } /** - * Required - API name: {@code sort} + * The maximum length of the line represented in the aggregation. Valid sizes are between 1 and 10000. + *

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

*/ - public final GeoLineSort sort() { - return this.sort; + @Nullable + public final Integer size() { + return this.size; } /** - * API name: {@code include_sort} + * Required - API name: {@code sort} */ - @Nullable - public final Boolean includeSort() { - return this.includeSort; + @Nonnull + public final GeoLineSort sort() { + return this.sort; } /** @@ -117,17 +148,10 @@ public final SortOrder sortOrder() { return this.sortOrder; } - /** - * API name: {@code size} - */ - @Nullable - public final Integer size() { - return this.size; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -135,53 +159,94 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.includeSort != null) { + generator.writeKey("include_sort"); + generator.write(this.includeSort); + } generator.writeKey("point"); this.point.serialize(generator, mapper); + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + } + generator.writeKey("sort"); this.sort.serialize(generator, mapper); - if (this.includeSort != null) { - generator.writeKey("include_sort"); - generator.write(this.includeSort); - - } if (this.sortOrder != null) { generator.writeKey("sort_order"); this.sortOrder.serialize(generator, mapper); } - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link GeoLineAggregation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private GeoLinePoint point; - - private GeoLineSort sort; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean includeSort; - + private GeoLinePoint point; + @Nullable + private Integer size; + private GeoLineSort sort; @Nullable private SortOrder sortOrder; - @Nullable - private Integer size; + public Builder() {} + + private Builder(GeoLineAggregation o) { + this.includeSort = o.includeSort; + this.point = o.point; + this.size = o.size; + this.sort = o.sort; + this.sortOrder = o.sortOrder; + } + + private Builder(Builder o) { + this.includeSort = o.includeSort; + this.point = o.point; + this.size = o.size; + this.sort = o.sort; + this.sortOrder = o.sortOrder; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * When true, returns an additional array of the sort values in the feature properties. + *

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

+ */ + @Nonnull + public final Builder includeSort(@Nullable Boolean value) { + this.includeSort = value; + return this; + } /** * Required - API name: {@code point} */ + @Nonnull public final Builder point(GeoLinePoint value) { this.point = value; return this; @@ -190,55 +255,56 @@ public final Builder point(GeoLinePoint value) { /** * Required - API name: {@code point} */ + @Nonnull public final Builder point(Function> fn) { - return this.point(fn.apply(new GeoLinePoint.Builder()).build()); + return point(fn.apply(new GeoLinePoint.Builder()).build()); } /** - * Required - API name: {@code sort} + * The maximum length of the line represented in the aggregation. Valid sizes are between 1 and 10000. + *

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

*/ - public final Builder sort(GeoLineSort value) { - this.sort = value; + @Nonnull + public final Builder size(@Nullable Integer value) { + this.size = value; return this; } /** * Required - API name: {@code sort} */ - public final Builder sort(Function> fn) { - return this.sort(fn.apply(new GeoLineSort.Builder()).build()); + @Nonnull + public final Builder sort(GeoLineSort value) { + this.sort = value; + return this; } /** - * API name: {@code include_sort} + * Required - API name: {@code sort} */ - public final Builder includeSort(@Nullable Boolean value) { - this.includeSort = value; - return this; + @Nonnull + public final Builder sort(Function> fn) { + return sort(fn.apply(new GeoLineSort.Builder()).build()); } /** * API name: {@code sort_order} */ + @Nonnull public final Builder sortOrder(@Nullable SortOrder value) { this.sortOrder = value; return this; } - /** - * API name: {@code size} - */ - public final Builder size(@Nullable Integer value) { - this.size = value; - return this; - } - /** * Builds a {@link GeoLineAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoLineAggregation build() { _checkSingleUse(); @@ -257,13 +323,33 @@ public GeoLineAggregation build() { ); protected static void setupGeoLineAggregationDeserializer(ObjectDeserializer op) { - + op.add(Builder::includeSort, JsonpDeserializer.booleanDeserializer(), "include_sort"); op.add(Builder::point, GeoLinePoint._DESERIALIZER, "point"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sort, GeoLineSort._DESERIALIZER, "sort"); - op.add(Builder::includeSort, JsonpDeserializer.booleanDeserializer(), "include_sort"); op.add(Builder::sortOrder, SortOrder._DESERIALIZER, "sort_order"); - op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.includeSort); + result = 31 * result + this.point.hashCode(); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + this.sort.hashCode(); + result = 31 * result + Objects.hashCode(this.sortOrder); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoLineAggregation other = (GeoLineAggregation) o; + return Objects.equals(this.includeSort, other.includeSort) + && this.point.equals(other.point) + && Objects.equals(this.size, other.size) + && this.sort.equals(other.sort) + && Objects.equals(this.sortOrder, other.sortOrder); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java index 99df9cbc55..7e257a6bc9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLinePoint.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,30 +47,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoLinePoint @JsonpDeserializable -public class GeoLinePoint implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoLinePoint implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String field; // --------------------------------------------------------------------------------------------- private GeoLinePoint(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - } - public static GeoLinePoint of(Function> fn) { + public static GeoLinePoint of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } @@ -72,6 +82,7 @@ public final String field() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,24 +90,49 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("field"); generator.write(this.field); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoLinePoint}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String field; + public Builder() {} + + private Builder(GeoLinePoint o) { + this.field = o.field; + } + + private Builder(Builder o) { + this.field = o.field; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; @@ -105,9 +141,10 @@ public final Builder field(String value) { /** * Builds a {@link GeoLinePoint}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoLinePoint build() { _checkSingleUse(); @@ -126,9 +163,21 @@ public GeoLinePoint build() { ); protected static void setupGeoLinePointDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.field.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoLinePoint other = (GeoLinePoint) o; + return this.field.equals(other.field); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java index d950d083eb..ffc7851fb1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoLineSort.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,30 +47,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoLineSort @JsonpDeserializable -public class GeoLineSort implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoLineSort implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String field; // --------------------------------------------------------------------------------------------- private GeoLineSort(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - } - public static GeoLineSort of(Function> fn) { + public static GeoLineSort of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } @@ -72,6 +82,7 @@ public final String field() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,24 +90,49 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("field"); generator.write(this.field); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GeoLineSort}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String field; + public Builder() {} + + private Builder(GeoLineSort o) { + this.field = o.field; + } + + private Builder(Builder o) { + this.field = o.field; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; @@ -105,9 +141,10 @@ public final Builder field(String value) { /** * Builds a {@link GeoLineSort}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoLineSort build() { _checkSingleUse(); @@ -126,9 +163,21 @@ public GeoLineSort build() { ); protected static void setupGeoLineSortDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.field.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoLineSort other = (GeoLineSort) o; + return this.field.equals(other.field); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java index d984506d5a..38f9b06173 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GeoTileGridAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,22 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.GeoBounds; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GeoTileGridAggregation @JsonpDeserializable -public class GeoTileGridAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoTileGridAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nullable + private final GeoBounds bounds; + @Nullable private final String field; @@ -59,34 +76,37 @@ public class GeoTileGridAggregation extends BucketAggregationBase implements Agg @Nullable private final Integer size; - @Nullable - private final GeoBounds bounds; - // --------------------------------------------------------------------------------------------- private GeoTileGridAggregation(Builder builder) { super(builder); - + this.bounds = builder.bounds; this.field = builder.field; this.precision = builder.precision; this.shardSize = builder.shardSize; this.size = builder.size; - this.bounds = builder.bounds; - } - public static GeoTileGridAggregation of(Function> fn) { + public static GeoTileGridAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { return Aggregation.Kind.GeotileGrid; } + /** + * API name: {@code bounds} + */ + @Nullable + public final GeoBounds bounds() { + return this.bounds; + } + /** * API name: {@code field} */ @@ -104,7 +124,11 @@ public final Number precision() { } /** + * Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning + * max(10,(size x number-of-shards)) buckets from each shard. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -112,77 +136,127 @@ public final Integer shardSize() { } /** + * The maximum number of buckets to return. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { return this.size; } - /** - * API name: {@code bounds} - */ - @Nullable - public final GeoBounds bounds() { - return this.bounds; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); + if (this.bounds != null) { + generator.writeKey("bounds"); + this.bounds.serialize(generator, mapper); + } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.precision != null) { generator.writeKey("precision"); generator.write(this.precision.doubleValue()); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } - if (this.bounds != null) { - generator.writeKey("bounds"); - this.bounds.serialize(generator, mapper); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link GeoTileGridAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private GeoBounds bounds; @Nullable private String field; - @Nullable private Number precision; - @Nullable private Integer shardSize; - @Nullable private Integer size; - @Nullable - private GeoBounds bounds; + public Builder() {} + + private Builder(GeoTileGridAggregation o) { + super(o); + this.bounds = o.bounds; + this.field = o.field; + this.precision = o.precision; + this.shardSize = o.shardSize; + this.size = o.size; + } + + private Builder(Builder o) { + super(o); + this.bounds = o.bounds; + this.field = o.field; + this.precision = o.precision; + this.shardSize = o.shardSize; + this.size = o.size; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code bounds} + */ + @Nonnull + public final Builder bounds(@Nullable GeoBounds value) { + this.bounds = value; + return this; + } + + /** + * API name: {@code bounds} + */ + @Nonnull + public final Builder bounds(Function> fn) { + return bounds(fn.apply(new GeoBounds.Builder()).build()); + } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -191,53 +265,44 @@ public final Builder field(@Nullable String value) { /** * API name: {@code precision} */ + @Nonnull public final Builder precision(@Nullable Number value) { this.precision = value; return this; } /** + * Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning + * max(10,(size x number-of-shards)) buckets from each shard. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } /** + * The maximum number of buckets to return. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; } - /** - * API name: {@code bounds} - */ - public final Builder bounds(@Nullable GeoBounds value) { - this.bounds = value; - return this; - } - - /** - * API name: {@code bounds} - */ - public final Builder bounds(Function> fn) { - return this.bounds(fn.apply(new GeoBounds.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link GeoTileGridAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GeoTileGridAggregation build() { _checkSingleUse(); @@ -256,13 +321,37 @@ public GeoTileGridAggregation build() { ); protected static void setupGeoTileGridAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); + op.add(Builder::bounds, GeoBounds._DESERIALIZER, "bounds"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::precision, JsonpDeserializer.numberDeserializer(), "precision"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); - op.add(Builder::bounds, GeoBounds._DESERIALIZER, "bounds"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.bounds); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.precision); + result = 31 * result + Objects.hashCode(this.shardSize); + result = 31 * result + Objects.hashCode(this.size); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GeoTileGridAggregation other = (GeoTileGridAggregation) o; + return Objects.equals(this.bounds, other.bounds) + && Objects.equals(this.field, other.field) + && Objects.equals(this.precision, other.precision) + && Objects.equals(this.shardSize, other.shardSize) + && Objects.equals(this.size, other.size); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java index 29c7e9c9ac..b2e42621fc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GlobalAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GlobalAggregation @JsonpDeserializable -public class GlobalAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GlobalAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private GlobalAggregation(Builder builder) { super(builder); - } - public static GlobalAggregation of(Function> fn) { + public static GlobalAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GlobalAggregation}. */ + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(GlobalAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link GlobalAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GlobalAggregation build() { _checkSingleUse(); @@ -99,7 +142,21 @@ public GlobalAggregation build() { protected static void setupGlobalAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java index 4cd3413f2b..6268eec413 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/GoogleNormalizedDistanceHeuristic.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,30 +48,41 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.GoogleNormalizedDistanceHeuristic @JsonpDeserializable -public class GoogleNormalizedDistanceHeuristic implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GoogleNormalizedDistanceHeuristic + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Boolean backgroundIsSuperset; // --------------------------------------------------------------------------------------------- private GoogleNormalizedDistanceHeuristic(Builder builder) { - this.backgroundIsSuperset = builder.backgroundIsSuperset; - } - public static GoogleNormalizedDistanceHeuristic of(Function> fn) { + public static GoogleNormalizedDistanceHeuristic of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** + * Set to false if you defined a custom background filter that represents a different set of documents that you want to + * compare to. + *

* API name: {@code background_is_superset} + *

*/ @Nullable public final Boolean backgroundIsSuperset() { @@ -74,6 +92,7 @@ public final Boolean backgroundIsSuperset() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,28 +100,56 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.backgroundIsSuperset != null) { generator.writeKey("background_is_superset"); generator.write(this.backgroundIsSuperset); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GoogleNormalizedDistanceHeuristic}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean backgroundIsSuperset; + public Builder() {} + + private Builder(GoogleNormalizedDistanceHeuristic o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + } + + private Builder(Builder o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Set to false if you defined a custom background filter that represents a different set of documents that you want to + * compare to. + *

* API name: {@code background_is_superset} + *

*/ + @Nonnull public final Builder backgroundIsSuperset(@Nullable Boolean value) { this.backgroundIsSuperset = value; return this; @@ -111,9 +158,10 @@ public final Builder backgroundIsSuperset(@Nullable Boolean value) { /** * Builds a {@link GoogleNormalizedDistanceHeuristic}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GoogleNormalizedDistanceHeuristic build() { _checkSingleUse(); @@ -134,9 +182,21 @@ public GoogleNormalizedDistanceHeuristic build() { protected static void setupGoogleNormalizedDistanceHeuristicDeserializer( ObjectDeserializer op ) { - op.add(Builder::backgroundIsSuperset, JsonpDeserializer.booleanDeserializer(), "background_is_superset"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.backgroundIsSuperset); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GoogleNormalizedDistanceHeuristic other = (GoogleNormalizedDistanceHeuristic) o; + return Objects.equals(this.backgroundIsSuperset, other.backgroundIsSuperset); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java index a4d0c1d8c5..e4399e0573 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HdrMethod.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,30 +48,35 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HdrMethod @JsonpDeserializable -public class HdrMethod implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HdrMethod implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Integer numberOfSignificantValueDigits; // --------------------------------------------------------------------------------------------- private HdrMethod(Builder builder) { - this.numberOfSignificantValueDigits = builder.numberOfSignificantValueDigits; - } - public static HdrMethod of(Function> fn) { + public static HdrMethod of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Specifies the resolution of values for the histogram in number of significant digits. + *

* API name: {@code number_of_significant_value_digits} + *

*/ @Nullable public final Integer numberOfSignificantValueDigits() { @@ -74,6 +86,7 @@ public final Integer numberOfSignificantValueDigits() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,28 +94,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.numberOfSignificantValueDigits != null) { generator.writeKey("number_of_significant_value_digits"); generator.write(this.numberOfSignificantValueDigits); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HdrMethod}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Integer numberOfSignificantValueDigits; + public Builder() {} + + private Builder(HdrMethod o) { + this.numberOfSignificantValueDigits = o.numberOfSignificantValueDigits; + } + + private Builder(Builder o) { + this.numberOfSignificantValueDigits = o.numberOfSignificantValueDigits; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Specifies the resolution of values for the histogram in number of significant digits. + *

* API name: {@code number_of_significant_value_digits} + *

*/ + @Nonnull public final Builder numberOfSignificantValueDigits(@Nullable Integer value) { this.numberOfSignificantValueDigits = value; return this; @@ -111,9 +151,10 @@ public final Builder numberOfSignificantValueDigits(@Nullable Integer value) { /** * Builds a {@link HdrMethod}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HdrMethod build() { _checkSingleUse(); @@ -132,9 +173,21 @@ public HdrMethod build() { ); protected static void setupHdrMethodDeserializer(ObjectDeserializer op) { - op.add(Builder::numberOfSignificantValueDigits, JsonpDeserializer.integerDeserializer(), "number_of_significant_value_digits"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.numberOfSignificantValueDigits); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HdrMethod other = (HdrMethod) o; + return Objects.equals(this.numberOfSignificantValueDigits, other.numberOfSignificantValueDigits); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java index 0c5603947b..974dfc7bcb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HistogramAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,24 +48,37 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HistogramAggregation @JsonpDeserializable -public class HistogramAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final ExtendedBounds extendedBounds; @Nullable - private final ExtendedBounds hardBounds; + private final String field; @Nullable - private final String field; + private final String format; + + @Nullable + private final ExtendedBounds hardBounds; @Nullable private final Double interval; + @Nullable + private final Boolean keyed; + @Nullable private final Integer minDocCount; @@ -74,37 +94,29 @@ public class HistogramAggregation extends BucketAggregationBase implements Aggre @Nullable private final Script script; - @Nullable - private final String format; - - @Nullable - private final Boolean keyed; - // --------------------------------------------------------------------------------------------- private HistogramAggregation(Builder builder) { super(builder); - this.extendedBounds = builder.extendedBounds; - this.hardBounds = builder.hardBounds; this.field = builder.field; + this.format = builder.format; + this.hardBounds = builder.hardBounds; this.interval = builder.interval; + this.keyed = builder.keyed; this.minDocCount = builder.minDocCount; this.missing = builder.missing; this.offset = builder.offset; this.order = builder.order; this.script = builder.script; - this.format = builder.format; - this.keyed = builder.keyed; - } - public static HistogramAggregation of(Function> fn) { + public static HistogramAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -120,23 +132,34 @@ public final ExtendedBounds extendedBounds() { } /** - * API name: {@code hard_bounds} + * API name: {@code field} */ @Nullable - public final ExtendedBounds hardBounds() { - return this.hardBounds; + public final String field() { + return this.field; } /** - * API name: {@code field} + * API name: {@code format} */ @Nullable - public final String field() { - return this.field; + public final String format() { + return this.format; + } + + /** + * API name: {@code hard_bounds} + */ + @Nullable + public final ExtendedBounds hardBounds() { + return this.hardBounds; } /** + * The interval for the buckets. Must be a positive decimal. + *

* API name: {@code interval} + *

*/ @Nullable public final Double interval() { @@ -144,7 +167,22 @@ public final Double interval() { } /** + * If true, returns buckets as a hash instead of an array, keyed by the bucket keys. + *

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

+ */ + @Nullable + public final Boolean keyed() { + return this.keyed; + } + + /** + * Only returns buckets that have min_doc_count number of documents. By default, the response will fill gaps in the + * histogram with empty buckets. + *

* API name: {@code min_doc_count} + *

*/ @Nullable public final Integer minDocCount() { @@ -152,7 +190,10 @@ public final Integer minDocCount() { } /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

*/ @Nullable public final Double missing() { @@ -160,7 +201,11 @@ public final Double missing() { } /** + * By default, the bucket keys start with 0 and then continue in even spaced steps of interval. The bucket boundaries can + * be shifted by using the offset option. + *

* API name: {@code offset} + *

*/ @Nullable public final Double offset() { @@ -183,126 +228,154 @@ public final Script script() { return this.script; } - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * API name: {@code keyed} - */ - @Nullable - public final Boolean keyed() { - return this.keyed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.extendedBounds != null) { generator.writeKey("extended_bounds"); this.extendedBounds.serialize(generator, mapper); - } - if (this.hardBounds != null) { - generator.writeKey("hard_bounds"); - this.hardBounds.serialize(generator, mapper); - } if (this.field != null) { generator.writeKey("field"); generator.write(this.field); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + } + + if (this.hardBounds != null) { + generator.writeKey("hard_bounds"); + this.hardBounds.serialize(generator, mapper); } + if (this.interval != null) { generator.writeKey("interval"); generator.write(this.interval); + } + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } + if (this.minDocCount != null) { generator.writeKey("min_doc_count"); generator.write(this.minDocCount); - } + if (this.missing != null) { generator.writeKey("missing"); generator.write(this.missing); - } + if (this.offset != null) { generator.writeKey("offset"); generator.write(this.offset); - } + if (this.order != null) { generator.writeKey("order"); this.order.serialize(generator, mapper); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link HistogramAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private ExtendedBounds extendedBounds; - - @Nullable - private ExtendedBounds hardBounds; - @Nullable private String field; - + @Nullable + private String format; + @Nullable + private ExtendedBounds hardBounds; @Nullable private Double interval; - + @Nullable + private Boolean keyed; @Nullable private Integer minDocCount; - @Nullable private Double missing; - @Nullable private Double offset; - @Nullable private HistogramOrder order; - @Nullable private Script script; - @Nullable - private String format; + public Builder() {} + + private Builder(HistogramAggregation o) { + super(o); + this.extendedBounds = o.extendedBounds; + this.field = o.field; + this.format = o.format; + this.hardBounds = o.hardBounds; + this.interval = o.interval; + this.keyed = o.keyed; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.offset = o.offset; + this.order = o.order; + this.script = o.script; + } - @Nullable - private Boolean keyed; + private Builder(Builder o) { + super(o); + this.extendedBounds = o.extendedBounds; + this.field = o.field; + this.format = o.format; + this.hardBounds = o.hardBounds; + this.interval = o.interval; + this.keyed = o.keyed; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.offset = o.offset; + this.order = o.order; + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code extended_bounds} */ + @Nonnull public final Builder extendedBounds(@Nullable ExtendedBounds value) { this.extendedBounds = value; return this; @@ -311,13 +384,33 @@ public final Builder extendedBounds(@Nullable ExtendedBounds value) { /** * API name: {@code extended_bounds} */ - public final Builder extendedBounds(Function, ObjectBuilder>> fn) { - return this.extendedBounds(fn.apply(new ExtendedBounds.Builder()).build()); + @Nonnull + public final Builder extendedBounds(Function>> fn) { + return extendedBounds(fn.apply(new ExtendedBounds.Builder()).build()); + } + + /** + * API name: {@code field} + */ + @Nonnull + public final Builder field(@Nullable String value) { + this.field = value; + return this; + } + + /** + * API name: {@code format} + */ + @Nonnull + public final Builder format(@Nullable String value) { + this.format = value; + return this; } /** * API name: {@code hard_bounds} */ + @Nonnull public final Builder hardBounds(@Nullable ExtendedBounds value) { this.hardBounds = value; return this; @@ -326,45 +419,68 @@ public final Builder hardBounds(@Nullable ExtendedBounds value) { /** * API name: {@code hard_bounds} */ - public final Builder hardBounds(Function, ObjectBuilder>> fn) { - return this.hardBounds(fn.apply(new ExtendedBounds.Builder()).build()); + @Nonnull + public final Builder hardBounds(Function>> fn) { + return hardBounds(fn.apply(new ExtendedBounds.Builder()).build()); } /** - * API name: {@code field} + * The interval for the buckets. Must be a positive decimal. + *

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

*/ - public final Builder field(@Nullable String value) { - this.field = value; + @Nonnull + public final Builder interval(@Nullable Double value) { + this.interval = value; return this; } /** - * API name: {@code interval} + * If true, returns buckets as a hash instead of an array, keyed by the bucket keys. + *

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

*/ - public final Builder interval(@Nullable Double value) { - this.interval = value; + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; return this; } /** + * Only returns buckets that have min_doc_count number of documents. By default, the response will fill gaps in the + * histogram with empty buckets. + *

* API name: {@code min_doc_count} + *

*/ + @Nonnull public final Builder minDocCount(@Nullable Integer value) { this.minDocCount = value; return this; } /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

*/ + @Nonnull public final Builder missing(@Nullable Double value) { this.missing = value; return this; } /** + * By default, the bucket keys start with 0 and then continue in even spaced steps of interval. The bucket boundaries + * can be shifted by using the offset option. + *

* API name: {@code offset} + *

*/ + @Nonnull public final Builder offset(@Nullable Double value) { this.offset = value; return this; @@ -373,6 +489,7 @@ public final Builder offset(@Nullable Double value) { /** * API name: {@code order} */ + @Nonnull public final Builder order(@Nullable HistogramOrder value) { this.order = value; return this; @@ -381,13 +498,15 @@ public final Builder order(@Nullable HistogramOrder value) { /** * API name: {@code order} */ + @Nonnull public final Builder order(Function> fn) { - return this.order(fn.apply(new HistogramOrder.Builder()).build()); + return order(fn.apply(new HistogramOrder.Builder()).build()); } /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -396,37 +515,18 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - /** - * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - /** - * API name: {@code keyed} - */ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; - } - - @Override - protected Builder self() { - return this; + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link HistogramAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HistogramAggregation build() { _checkSingleUse(); @@ -451,17 +551,53 @@ protected static void setupHistogramAggregationDeserializer(ObjectDeserializer { + @Nullable private final SortOrder count; @@ -58,13 +69,11 @@ public class HistogramOrder implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private HistogramOrder(Builder builder) { - this.count = builder.count; this.key = builder.key; - } - public static HistogramOrder of(Function> fn) { + public static HistogramOrder of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -87,6 +96,7 @@ public final SortOrder key() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -94,34 +104,61 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.count != null) { generator.writeKey("_count"); this.count.serialize(generator, mapper); } + if (this.key != null) { generator.writeKey("_key"); this.key.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HistogramOrder}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private SortOrder count; - @Nullable private SortOrder key; + public Builder() {} + + private Builder(HistogramOrder o) { + this.count = o.count; + this.key = o.key; + } + + private Builder(Builder o) { + this.count = o.count; + this.key = o.key; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code _count} */ + @Nonnull public final Builder count(@Nullable SortOrder value) { this.count = value; return this; @@ -130,6 +167,7 @@ public final Builder count(@Nullable SortOrder value) { /** * API name: {@code _key} */ + @Nonnull public final Builder key(@Nullable SortOrder value) { this.key = value; return this; @@ -138,9 +176,10 @@ public final Builder key(@Nullable SortOrder value) { /** * Builds a {@link HistogramOrder}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HistogramOrder build() { _checkSingleUse(); @@ -159,10 +198,23 @@ public HistogramOrder build() { ); protected static void setupHistogramOrderDeserializer(ObjectDeserializer op) { - op.add(Builder::count, SortOrder._DESERIALIZER, "_count"); op.add(Builder::key, SortOrder._DESERIALIZER, "_key"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.key); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HistogramOrder other = (HistogramOrder) o; + return Objects.equals(this.count, other.count) && Objects.equals(this.key, other.key); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java index 83c91d8b1e..013db25102 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltLinearModelSettings.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HoltLinearModelSettings @JsonpDeserializable -public class HoltLinearModelSettings implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HoltLinearModelSettings + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Float alpha; @@ -57,13 +71,11 @@ public class HoltLinearModelSettings implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private HoltLinearModelSettings(Builder builder) { - this.alpha = builder.alpha; this.beta = builder.beta; - } - public static HoltLinearModelSettings of(Function> fn) { + public static HoltLinearModelSettings of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -86,6 +98,7 @@ public final Float beta() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -93,36 +106,61 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.alpha != null) { generator.writeKey("alpha"); generator.write(this.alpha); - } + if (this.beta != null) { generator.writeKey("beta"); generator.write(this.beta); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HoltLinearModelSettings}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Float alpha; - @Nullable private Float beta; + public Builder() {} + + private Builder(HoltLinearModelSettings o) { + this.alpha = o.alpha; + this.beta = o.beta; + } + + private Builder(Builder o) { + this.alpha = o.alpha; + this.beta = o.beta; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code alpha} */ + @Nonnull public final Builder alpha(@Nullable Float value) { this.alpha = value; return this; @@ -131,6 +169,7 @@ public final Builder alpha(@Nullable Float value) { /** * API name: {@code beta} */ + @Nonnull public final Builder beta(@Nullable Float value) { this.beta = value; return this; @@ -139,9 +178,10 @@ public final Builder beta(@Nullable Float value) { /** * Builds a {@link HoltLinearModelSettings}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HoltLinearModelSettings build() { _checkSingleUse(); @@ -160,10 +200,23 @@ public HoltLinearModelSettings build() { ); protected static void setupHoltLinearModelSettingsDeserializer(ObjectDeserializer op) { - op.add(Builder::alpha, JsonpDeserializer.floatDeserializer(), "alpha"); op.add(Builder::beta, JsonpDeserializer.floatDeserializer(), "beta"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.alpha); + result = 31 * result + Objects.hashCode(this.beta); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HoltLinearModelSettings other = (HoltLinearModelSettings) o; + return Objects.equals(this.alpha, other.alpha) && Objects.equals(this.beta, other.beta); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java index a08a176473..3b991497f6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltMovingAverageAggregation.java @@ -30,39 +30,53 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HoltMovingAverageAggregation @JsonpDeserializable -public class HoltMovingAverageAggregation extends MovingAverageAggregationBase implements MovingAverageAggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HoltMovingAverageAggregation extends MovingAverageAggregationBase + implements + MovingAverageAggregationVariant, + ToCopyableBuilder { + + @Nonnull private final HoltLinearModelSettings settings; // --------------------------------------------------------------------------------------------- private HoltMovingAverageAggregation(Builder builder) { super(builder); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static HoltMovingAverageAggregation of(Function> fn) { + public static HoltMovingAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * MovingAverageAggregation variant kind. + * {@link MovingAverageAggregation} variant kind. */ @Override public MovingAverageAggregation.Kind _movingAverageAggregationKind() { @@ -72,33 +86,67 @@ public MovingAverageAggregation.Kind _movingAverageAggregationKind() { /** * Required - API name: {@code settings} */ + @Nonnull public final HoltLinearModelSettings settings() { return this.settings; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("model", "holt"); super.serializeInternal(generator, mapper); generator.writeKey("settings"); this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HoltMovingAverageAggregation}. */ - public static class Builder extends MovingAverageAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { private HoltLinearModelSettings settings; + public Builder() {} + + private Builder(HoltMovingAverageAggregation o) { + super(o); + this.settings = o.settings; + } + + private Builder(Builder o) { + super(o); + this.settings = o.settings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(HoltLinearModelSettings value) { this.settings = value; return this; @@ -107,21 +155,18 @@ public final Builder settings(HoltLinearModelSettings value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new HoltLinearModelSettings.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return settings(fn.apply(new HoltLinearModelSettings.Builder()).build()); } /** * Builds a {@link HoltMovingAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HoltMovingAverageAggregation build() { _checkSingleUse(); @@ -140,10 +185,27 @@ public HoltMovingAverageAggregation build() { ); protected static void setupHoltMovingAverageAggregationDeserializer(ObjectDeserializer op) { - MovingAverageAggregationBase.setupMovingAverageAggregationBaseDeserializer(op); + setupMovingAverageAggregationBaseDeserializer(op); op.add(Builder::settings, HoltLinearModelSettings._DESERIALIZER, "settings"); op.ignore("model"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.settings.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HoltMovingAverageAggregation other = (HoltMovingAverageAggregation) o; + return this.settings.equals(other.settings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java index e784789a5d..5cac34aecc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersModelSettings.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HoltWintersModelSettings @JsonpDeserializable -public class HoltWintersModelSettings implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HoltWintersModelSettings + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Float alpha; @@ -69,17 +83,15 @@ public class HoltWintersModelSettings implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private HoltWintersModelSettings(Builder builder) { - this.alpha = builder.alpha; this.beta = builder.beta; this.gamma = builder.gamma; this.pad = builder.pad; this.period = builder.period; this.type = builder.type; - } - public static HoltWintersModelSettings of(Function> fn) { + public static HoltWintersModelSettings of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -134,6 +146,7 @@ public final HoltWintersType type() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -141,67 +154,97 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.alpha != null) { generator.writeKey("alpha"); generator.write(this.alpha); - } + if (this.beta != null) { generator.writeKey("beta"); generator.write(this.beta); - } + if (this.gamma != null) { generator.writeKey("gamma"); generator.write(this.gamma); - } + if (this.pad != null) { generator.writeKey("pad"); generator.write(this.pad); - } + if (this.period != null) { generator.writeKey("period"); generator.write(this.period); - } + if (this.type != null) { generator.writeKey("type"); this.type.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HoltWintersModelSettings}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Float alpha; - @Nullable private Float beta; - @Nullable private Float gamma; - @Nullable private Boolean pad; - @Nullable private Integer period; - @Nullable private HoltWintersType type; + public Builder() {} + + private Builder(HoltWintersModelSettings o) { + this.alpha = o.alpha; + this.beta = o.beta; + this.gamma = o.gamma; + this.pad = o.pad; + this.period = o.period; + this.type = o.type; + } + + private Builder(Builder o) { + this.alpha = o.alpha; + this.beta = o.beta; + this.gamma = o.gamma; + this.pad = o.pad; + this.period = o.period; + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code alpha} */ + @Nonnull public final Builder alpha(@Nullable Float value) { this.alpha = value; return this; @@ -210,6 +253,7 @@ public final Builder alpha(@Nullable Float value) { /** * API name: {@code beta} */ + @Nonnull public final Builder beta(@Nullable Float value) { this.beta = value; return this; @@ -218,6 +262,7 @@ public final Builder beta(@Nullable Float value) { /** * API name: {@code gamma} */ + @Nonnull public final Builder gamma(@Nullable Float value) { this.gamma = value; return this; @@ -226,6 +271,7 @@ public final Builder gamma(@Nullable Float value) { /** * API name: {@code pad} */ + @Nonnull public final Builder pad(@Nullable Boolean value) { this.pad = value; return this; @@ -234,6 +280,7 @@ public final Builder pad(@Nullable Boolean value) { /** * API name: {@code period} */ + @Nonnull public final Builder period(@Nullable Integer value) { this.period = value; return this; @@ -242,6 +289,7 @@ public final Builder period(@Nullable Integer value) { /** * API name: {@code type} */ + @Nonnull public final Builder type(@Nullable HoltWintersType value) { this.type = value; return this; @@ -250,9 +298,10 @@ public final Builder type(@Nullable HoltWintersType value) { /** * Builds a {@link HoltWintersModelSettings}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HoltWintersModelSettings build() { _checkSingleUse(); @@ -271,14 +320,36 @@ public HoltWintersModelSettings build() { ); protected static void setupHoltWintersModelSettingsDeserializer(ObjectDeserializer op) { - op.add(Builder::alpha, JsonpDeserializer.floatDeserializer(), "alpha"); op.add(Builder::beta, JsonpDeserializer.floatDeserializer(), "beta"); op.add(Builder::gamma, JsonpDeserializer.floatDeserializer(), "gamma"); op.add(Builder::pad, JsonpDeserializer.booleanDeserializer(), "pad"); op.add(Builder::period, JsonpDeserializer.integerDeserializer(), "period"); op.add(Builder::type, HoltWintersType._DESERIALIZER, "type"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.alpha); + result = 31 * result + Objects.hashCode(this.beta); + result = 31 * result + Objects.hashCode(this.gamma); + result = 31 * result + Objects.hashCode(this.pad); + result = 31 * result + Objects.hashCode(this.period); + result = 31 * result + Objects.hashCode(this.type); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HoltWintersModelSettings other = (HoltWintersModelSettings) o; + return Objects.equals(this.alpha, other.alpha) + && Objects.equals(this.beta, other.beta) + && Objects.equals(this.gamma, other.gamma) + && Objects.equals(this.pad, other.pad) + && Objects.equals(this.period, other.period) + && Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java index 2731f6e048..f566355dcd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersMovingAverageAggregation.java @@ -30,39 +30,53 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.HoltWintersMovingAverageAggregation @JsonpDeserializable -public class HoltWintersMovingAverageAggregation extends MovingAverageAggregationBase implements MovingAverageAggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HoltWintersMovingAverageAggregation extends MovingAverageAggregationBase + implements + MovingAverageAggregationVariant, + ToCopyableBuilder { + + @Nonnull private final HoltWintersModelSettings settings; // --------------------------------------------------------------------------------------------- private HoltWintersMovingAverageAggregation(Builder builder) { super(builder); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static HoltWintersMovingAverageAggregation of(Function> fn) { + public static HoltWintersMovingAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * MovingAverageAggregation variant kind. + * {@link MovingAverageAggregation} variant kind. */ @Override public MovingAverageAggregation.Kind _movingAverageAggregationKind() { @@ -72,33 +86,67 @@ public MovingAverageAggregation.Kind _movingAverageAggregationKind() { /** * Required - API name: {@code settings} */ + @Nonnull public final HoltWintersModelSettings settings() { return this.settings; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("model", "holt_winters"); super.serializeInternal(generator, mapper); generator.writeKey("settings"); this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HoltWintersMovingAverageAggregation}. */ - public static class Builder extends MovingAverageAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { private HoltWintersModelSettings settings; + public Builder() {} + + private Builder(HoltWintersMovingAverageAggregation o) { + super(o); + this.settings = o.settings; + } + + private Builder(Builder o) { + super(o); + this.settings = o.settings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(HoltWintersModelSettings value) { this.settings = value; return this; @@ -107,21 +155,18 @@ public final Builder settings(HoltWintersModelSettings value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new HoltWintersModelSettings.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return settings(fn.apply(new HoltWintersModelSettings.Builder()).build()); } /** * Builds a {@link HoltWintersMovingAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HoltWintersMovingAverageAggregation build() { _checkSingleUse(); @@ -142,10 +187,27 @@ public HoltWintersMovingAverageAggregation build() { protected static void setupHoltWintersMovingAverageAggregationDeserializer( ObjectDeserializer op ) { - MovingAverageAggregationBase.setupMovingAverageAggregationBaseDeserializer(op); + setupMovingAverageAggregationBaseDeserializer(op); op.add(Builder::settings, HoltWintersModelSettings._DESERIALIZER, "settings"); op.ignore("model"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.settings.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HoltWintersMovingAverageAggregation other = (HoltWintersMovingAverageAggregation) o; + return this.settings.equals(other.settings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java index 77512c5017..3a44545a7d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/HoltWintersType.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.HoltWintersType + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum HoltWintersType implements JsonEnum { Additive("add"), - Multiplicative("mult"), - - ; + Multiplicative("mult"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java index 089638fb3f..b34e66008f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,46 +48,45 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.InferenceAggregation @JsonpDeserializable -public class InferenceAggregation extends PipelineAggregationBase implements AggregationVariant { - private final String modelId; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class InferenceAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { @Nullable private final InferenceConfig inferenceConfig; + @Nonnull + private final String modelId; + // --------------------------------------------------------------------------------------------- private InferenceAggregation(Builder builder) { super(builder); - - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); this.inferenceConfig = builder.inferenceConfig; - + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); } - public static InferenceAggregation of(Function> fn) { + public static InferenceAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { return Aggregation.Kind.Inference; } - /** - * Required - API name: {@code model_id} - */ - public final String modelId() { - return this.modelId; - } - /** * API name: {@code inference_config} */ @@ -89,43 +95,78 @@ public final InferenceConfig inferenceConfig() { return this.inferenceConfig; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - generator.writeKey("model_id"); - generator.write(this.modelId); - if (this.inferenceConfig != null) { generator.writeKey("inference_config"); this.inferenceConfig.serialize(generator, mapper); - } + generator.writeKey("model_id"); + generator.write(this.modelId); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link InferenceAggregation}. */ - - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { - private String modelId; - + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private InferenceConfig inferenceConfig; + private String modelId; - /** - * Required - API name: {@code model_id} - */ - public final Builder modelId(String value) { - this.modelId = value; + public Builder() {} + + private Builder(InferenceAggregation o) { + super(o); + this.inferenceConfig = o.inferenceConfig; + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.inferenceConfig = o.inferenceConfig; + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { return this; } /** * API name: {@code inference_config} */ + @Nonnull public final Builder inferenceConfig(@Nullable InferenceConfig value) { this.inferenceConfig = value; return this; @@ -134,21 +175,27 @@ public final Builder inferenceConfig(@Nullable InferenceConfig value) { /** * API name: {@code inference_config} */ + @Nonnull public final Builder inferenceConfig(Function> fn) { - return this.inferenceConfig(fn.apply(new InferenceConfig.Builder()).build()); + return inferenceConfig(fn.apply(new InferenceConfig.Builder()).build()); } - @Override - protected Builder self() { + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; return this; } /** * Builds a {@link InferenceAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public InferenceAggregation build() { _checkSingleUse(); @@ -167,10 +214,27 @@ public InferenceAggregation build() { ); protected static void setupInferenceAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); - op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::inferenceConfig, InferenceConfig._DESERIALIZER, "inference_config"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.inferenceConfig); + result = 31 * result + this.modelId.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + InferenceAggregation other = (InferenceAggregation) o; + return Objects.equals(this.inferenceConfig, other.inferenceConfig) && this.modelId.equals(other.modelId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java new file mode 100644 index 0000000000..368e0972d3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java @@ -0,0 +1,229 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonEnum; +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.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: _types.aggregations.InferenceConfigContainer + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class InferenceConfig implements TaggedUnion, PlainJsonSerializable { + /** + * {@link InferenceConfig} variant kinds. + */ + public enum Kind implements JsonEnum { + Classification("classification"), + Regression("regression"); + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + @Override + public String jsonValue() { + return jsonValue; + } + } + + private final Kind _kind; + private final InferenceConfigVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final InferenceConfigVariant _get() { + return _value; + } + + public InferenceConfig(InferenceConfigVariant value) { + this._kind = ApiTypeHelper.requireNonNull(value._inferenceConfigKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + } + + private InferenceConfig(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static InferenceConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code classification}? + */ + public boolean isClassification() { + return _kind == Kind.Classification; + } + + /** + * Get the {@code classification} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code classification} kind. + */ + public ClassificationInferenceOptions classification() { + return TaggedUnionUtils.get(this, Kind.Classification); + } + + /** + * Is this variant instance of kind {@code regression}? + */ + public boolean isRegression() { + return _kind == Kind.Regression; + } + + /** + * Get the {@code regression} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code regression} kind. + */ + public RegressionInferenceOptions regression() { + return TaggedUnionUtils.get(this, Kind.Regression); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + generator.writeEnd(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private InferenceConfigVariant _value; + + public Builder() {} + + private Builder(InferenceConfig o) { + this._kind = o._kind; + this._value = o._value; + } + + public ObjectBuilder classification(ClassificationInferenceOptions v) { + this._kind = Kind.Classification; + this._value = v; + return this; + } + + public ObjectBuilder classification( + Function> fn + ) { + return this.classification(fn.apply(new ClassificationInferenceOptions.Builder()).build()); + } + + public ObjectBuilder regression(RegressionInferenceOptions v) { + this._kind = Kind.Regression; + this._value = v; + return this; + } + + public ObjectBuilder regression( + Function> fn + ) { + return this.regression(fn.apply(new RegressionInferenceOptions.Builder()).build()); + } + + @Override + public InferenceConfig build() { + _checkSingleUse(); + return new InferenceConfig(this); + } + } + + protected static void setupInferenceConfigDeserializer(ObjectDeserializer op) { + op.add(Builder::classification, ClassificationInferenceOptions._DESERIALIZER, "classification"); + op.add(Builder::regression, RegressionInferenceOptions._DESERIALIZER, "regression"); + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + InferenceConfig::setupInferenceConfigDeserializer, + Builder::build + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + InferenceConfig other = (InferenceConfig) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMathBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigBuilders.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMathBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigBuilders.java index 803450d015..a8b8b42e32 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/FieldDateMathBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigBuilders.java @@ -30,16 +30,32 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; + /** - * Builders for {@link FieldDateMath} variants. - *

- * Variants expr, value are not available here as they - * don't have a dedicated class. Use {@link FieldDateMath}'s builder for these. - * + * Builders for {@link InferenceConfig} variants. */ -public class FieldDateMathBuilders { - private FieldDateMathBuilders() {} +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class InferenceConfigBuilders { + private InferenceConfigBuilders() {} + + /** + * Creates a builder for the {@link ClassificationInferenceOptions classification} {@code InferenceConfig} variant. + */ + public static ClassificationInferenceOptions.Builder classification() { + return new ClassificationInferenceOptions.Builder(); + } + /** + * Creates a builder for the {@link RegressionInferenceOptions regression} {@code InferenceConfig} variant. + */ + public static RegressionInferenceOptions.Builder regression() { + return new RegressionInferenceOptions.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsExcludeBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigVariant.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsExcludeBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigVariant.java index 0ff7633d56..a851a57258 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsExcludeBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfigVariant.java @@ -30,17 +30,22 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; + /** - * Builders for {@link TermsExclude} variants. - *

- * Variants terms, regexp are not available here as - * they don't have a dedicated class. Use {@link TermsExclude}'s builder for - * these. - * + * Base interface for {@link InferenceConfig} variants. */ -public class TermsExcludeBuilders { - private TermsExcludeBuilders() {} +@Generated("org.opensearch.client.codegen.CodeGenerator") +public interface InferenceConfigVariant { + InferenceConfig.Kind _inferenceConfigKind(); + default InferenceConfig toInferenceConfig() { + return new InferenceConfig(this); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java index 2a4326fd2e..1f092ac4ff 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,33 +49,39 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.IpRangeAggregation @JsonpDeserializable -public class IpRangeAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IpRangeAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String field; + @Nonnull private final List ranges; // --------------------------------------------------------------------------------------------- private IpRangeAggregation(Builder builder) { super(builder); - this.field = builder.field; this.ranges = ApiTypeHelper.unmodifiable(builder.ranges); - } - public static IpRangeAggregation of(Function> fn) { + public static IpRangeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -84,94 +97,146 @@ public final String field() { } /** + * Array of IP ranges. + *

* API name: {@code ranges} + *

*/ + @Nonnull public final List ranges() { return this.ranges; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (ApiTypeHelper.isDefined(this.ranges)) { generator.writeKey("ranges"); generator.writeStartArray(); for (IpRangeAggregationRange item0 : this.ranges) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IpRangeAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String field; - @Nullable private List ranges; + public Builder() {} + + private Builder(IpRangeAggregation o) { + super(o); + this.field = o.field; + this.ranges = _listCopy(o.ranges); + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.ranges = _listCopy(o.ranges); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * Array of IP ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds all elements of list to ranges. + *

*/ + @Nonnull public final Builder ranges(List list) { this.ranges = _listAddAll(this.ranges, list); return this; } /** + * Array of IP ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds one or more values to ranges. + *

*/ + @Nonnull public final Builder ranges(IpRangeAggregationRange value, IpRangeAggregationRange... values) { this.ranges = _listAdd(this.ranges, value, values); return this; } /** + * Array of IP ranges. + *

* API name: {@code ranges} + *

+ * *

* Adds a value to ranges using a builder lambda. + *

*/ + @Nonnull public final Builder ranges(Function> fn) { return ranges(fn.apply(new IpRangeAggregationRange.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link IpRangeAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IpRangeAggregation build() { _checkSingleUse(); @@ -190,10 +255,27 @@ public IpRangeAggregation build() { ); protected static void setupIpRangeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ranges, JsonpDeserializer.arrayDeserializer(IpRangeAggregationRange._DESERIALIZER), "ranges"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.ranges); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IpRangeAggregation other = (IpRangeAggregation) o; + return Objects.equals(this.field, other.field) && Objects.equals(this.ranges, other.ranges); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java index 024a653d61..45f35d1226 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/IpRangeAggregationRange.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.IpRangeAggregationRange @JsonpDeserializable -public class IpRangeAggregationRange implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IpRangeAggregationRange + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final String from; @@ -60,19 +74,20 @@ public class IpRangeAggregationRange implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private IpRangeAggregationRange(Builder builder) { - this.from = builder.from; this.mask = builder.mask; this.to = builder.to; - } - public static IpRangeAggregationRange of(Function> fn) { + public static IpRangeAggregationRange of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Start of the range. + *

* API name: {@code from} + *

*/ @Nullable public final String from() { @@ -80,7 +95,10 @@ public final String from() { } /** + * IP range defined as a CIDR mask. + *

* API name: {@code mask} + *

*/ @Nullable public final String mask() { @@ -88,7 +106,10 @@ public final String mask() { } /** + * End of the range. + *

* API name: {@code to} + *

*/ @Nullable public final String to() { @@ -98,6 +119,7 @@ public final String to() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -105,60 +127,97 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.from != null) { generator.writeKey("from"); generator.write(this.from); - } + if (this.mask != null) { generator.writeKey("mask"); generator.write(this.mask); - } + if (this.to != null) { generator.writeKey("to"); generator.write(this.to); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IpRangeAggregationRange}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String from; - @Nullable private String mask; - @Nullable private String to; + public Builder() {} + + private Builder(IpRangeAggregationRange o) { + this.from = o.from; + this.mask = o.mask; + this.to = o.to; + } + + private Builder(Builder o) { + this.from = o.from; + this.mask = o.mask; + this.to = o.to; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Start of the range. + *

* API name: {@code from} + *

*/ + @Nonnull public final Builder from(@Nullable String value) { this.from = value; return this; } /** + * IP range defined as a CIDR mask. + *

* API name: {@code mask} + *

*/ + @Nonnull public final Builder mask(@Nullable String value) { this.mask = value; return this; } /** + * End of the range. + *

* API name: {@code to} + *

*/ + @Nonnull public final Builder to(@Nullable String value) { this.to = value; return this; @@ -167,9 +226,10 @@ public final Builder to(@Nullable String value) { /** * Builds a {@link IpRangeAggregationRange}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IpRangeAggregationRange build() { _checkSingleUse(); @@ -188,11 +248,25 @@ public IpRangeAggregationRange build() { ); protected static void setupIpRangeAggregationRangeDeserializer(ObjectDeserializer op) { - op.add(Builder::from, JsonpDeserializer.stringDeserializer(), "from"); op.add(Builder::mask, JsonpDeserializer.stringDeserializer(), "mask"); op.add(Builder::to, JsonpDeserializer.stringDeserializer(), "to"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.from); + result = 31 * result + Objects.hashCode(this.mask); + result = 31 * result + Objects.hashCode(this.to); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IpRangeAggregationRange other = (IpRangeAggregationRange) o; + return Objects.equals(this.from, other.from) && Objects.equals(this.mask, other.mask) && Objects.equals(this.to, other.to); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java index 9c3cda754a..5a81bec820 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/LinearMovingAverageAggregation.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,29 +47,37 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.EmptyObject; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.LinearMovingAverageAggregation @JsonpDeserializable -public class LinearMovingAverageAggregation extends MovingAverageAggregationBase implements MovingAverageAggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class LinearMovingAverageAggregation extends MovingAverageAggregationBase + implements + MovingAverageAggregationVariant, + ToCopyableBuilder { + + @Nonnull private final EmptyObject settings; // --------------------------------------------------------------------------------------------- private LinearMovingAverageAggregation(Builder builder) { super(builder); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static LinearMovingAverageAggregation of(Function> fn) { + public static LinearMovingAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * MovingAverageAggregation variant kind. + * {@link MovingAverageAggregation} variant kind. */ @Override public MovingAverageAggregation.Kind _movingAverageAggregationKind() { @@ -73,33 +87,67 @@ public MovingAverageAggregation.Kind _movingAverageAggregationKind() { /** * Required - API name: {@code settings} */ + @Nonnull public final EmptyObject settings() { return this.settings; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("model", "linear"); super.serializeInternal(generator, mapper); generator.writeKey("settings"); this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link LinearMovingAverageAggregation}. */ - public static class Builder extends MovingAverageAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { private EmptyObject settings; + public Builder() {} + + private Builder(LinearMovingAverageAggregation o) { + super(o); + this.settings = o.settings; + } + + private Builder(Builder o) { + super(o); + this.settings = o.settings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(EmptyObject value) { this.settings = value; return this; @@ -108,21 +156,18 @@ public final Builder settings(EmptyObject value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new EmptyObject.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return settings(fn.apply(new EmptyObject.Builder()).build()); } /** * Builds a {@link LinearMovingAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public LinearMovingAverageAggregation build() { _checkSingleUse(); @@ -141,10 +186,27 @@ public LinearMovingAverageAggregation build() { ); protected static void setupLinearMovingAverageAggregationDeserializer(ObjectDeserializer op) { - MovingAverageAggregationBase.setupMovingAverageAggregationBaseDeserializer(op); + setupMovingAverageAggregationBaseDeserializer(op); op.add(Builder::settings, EmptyObject._DESERIALIZER, "settings"); op.ignore("model"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.settings.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LinearMovingAverageAggregation other = (LinearMovingAverageAggregation) o; + return this.settings.equals(other.settings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java index e64504cb78..8760b89501 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,75 +50,95 @@ // typedef: _types.aggregations.MatrixAggregation +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class MatrixAggregation extends AggregationBase { + + @Nonnull private final List fields; + @Nonnull private final Map missing; // --------------------------------------------------------------------------------------------- protected MatrixAggregation(AbstractBuilder builder) { super(builder); - this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.missing = ApiTypeHelper.unmodifiable(builder.missing); - } /** * API name: {@code fields} */ + @Nonnull public final List fields() { return this.fields; } /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

*/ + @Nonnull public final Map missing() { return this.missing; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartArray(); for (String item0 : this.fields) { generator.write(item0); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.missing)) { generator.writeKey("missing"); generator.writeStartObject(); for (Map.Entry item0 : this.missing.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder< BuilderT> { @Nullable private List fields; - @Nullable private Map missing; + protected AbstractBuilder() {} + + protected AbstractBuilder(MatrixAggregation o) { + super(o); + this.fields = _listCopy(o.fields); + this.missing = _mapCopy(o.missing); + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.fields = _listCopy(o.fields); + this.missing = _mapCopy(o.missing); + } + /** * API name: {@code fields} + * *

* Adds all elements of list to fields. + *

*/ + @Nonnull public final BuilderT fields(List list) { this.fields = _listAddAll(this.fields, list); return self(); @@ -119,42 +146,74 @@ public final BuilderT fields(List list) { /** * API name: {@code fields} + * *

* Adds one or more values to fields. + *

*/ + @Nonnull public final BuilderT fields(String value, String... values) { this.fields = _listAdd(this.fields, value, values); return self(); } /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

+ * *

- * Adds all entries of map to missing. + * Adds all elements of map to missing. + *

*/ + @Nonnull public final BuilderT missing(Map map) { this.missing = _mapPutAll(this.missing, map); return self(); } /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

+ * *

* Adds an entry to missing. + *

*/ + @Nonnull public final BuilderT missing(String key, Double value) { this.missing = _mapPut(this.missing, key, value); return self(); } - } // --------------------------------------------------------------------------------------------- + protected static > void setupMatrixAggregationDeserializer(ObjectDeserializer op) { setupAggregationBaseDeserializer(op); op.add(AbstractBuilder::fields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "fields"); op.add(AbstractBuilder::missing, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.doubleDeserializer()), "missing"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.missing); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MatrixAggregation other = (MatrixAggregation) o; + return Objects.equals(this.fields, other.fields) && Objects.equals(this.missing, other.missing); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java index b66cd02d9a..59ac693c68 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MatrixStatsAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.SortMode; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MatrixStatsAggregation @JsonpDeserializable -public class MatrixStatsAggregation extends MatrixAggregation implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MatrixStatsAggregation extends MatrixAggregation + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final SortMode mode; @@ -54,17 +68,15 @@ public class MatrixStatsAggregation extends MatrixAggregation implements Aggrega private MatrixStatsAggregation(Builder builder) { super(builder); - this.mode = builder.mode; - } - public static MatrixStatsAggregation of(Function> fn) { + public static MatrixStatsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -80,44 +92,75 @@ public final SortMode mode() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.mode != null) { generator.writeKey("mode"); this.mode.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MatrixStatsAggregation}. */ - - public static class Builder extends MatrixAggregation.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MatrixAggregation.AbstractBuilder + implements + CopyableBuilder { @Nullable private SortMode mode; + public Builder() {} + + private Builder(MatrixStatsAggregation o) { + super(o); + this.mode = o.mode; + } + + private Builder(Builder o) { + super(o); + this.mode = o.mode; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code mode} */ + @Nonnull public final Builder mode(@Nullable SortMode value) { this.mode = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link MatrixStatsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MatrixStatsAggregation build() { _checkSingleUse(); @@ -136,9 +179,25 @@ public MatrixStatsAggregation build() { ); protected static void setupMatrixStatsAggregationDeserializer(ObjectDeserializer op) { - MatrixAggregation.setupMatrixAggregationDeserializer(op); + setupMatrixAggregationDeserializer(op); op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.mode); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MatrixStatsAggregation other = (MatrixStatsAggregation) o; + return Objects.equals(this.mode, other.mode); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java index deffa0ce2e..d91eaa1836 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MaxAggregation @JsonpDeserializable -public class MaxAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MaxAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private MaxAggregation(Builder builder) { super(builder); - } - public static MaxAggregation of(Function> fn) { + public static MaxAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MaxAggregation}. */ + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(MaxAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link MaxAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MaxAggregation build() { _checkSingleUse(); @@ -99,7 +142,21 @@ public MaxAggregation build() { protected static void setupMaxAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java index be2a8bc812..28222602d5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MaxBucketAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MaxBucketAggregation @JsonpDeserializable -public class MaxBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MaxBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private MaxBucketAggregation(Builder builder) { super(builder); - } - public static MaxBucketAggregation of(Function> fn) { + public static MaxBucketAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MaxBucketAggregation}. */ + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(MaxBucketAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link MaxBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MaxBucketAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public MaxBucketAggregation build() { ); protected static void setupMaxBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java index 322b5679b8..a4072d80d3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MedianAbsoluteDeviationAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MedianAbsoluteDeviationAggregation @JsonpDeserializable -public class MedianAbsoluteDeviationAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MedianAbsoluteDeviationAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Double compression; @@ -53,17 +67,17 @@ public class MedianAbsoluteDeviationAggregation extends FormatMetricAggregationB private MedianAbsoluteDeviationAggregation(Builder builder) { super(builder); - this.compression = builder.compression; - } - public static MedianAbsoluteDeviationAggregation of(Function> fn) { + public static MedianAbsoluteDeviationAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +85,11 @@ public Aggregation.Kind _aggregationKind() { } /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ @Nullable public final Double compression() { @@ -79,47 +97,79 @@ public final Double compression() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.compression != null) { generator.writeKey("compression"); generator.write(this.compression); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MedianAbsoluteDeviationAggregation}. */ - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Double compression; + public Builder() {} + + private Builder(MedianAbsoluteDeviationAggregation o) { + super(o); + this.compression = o.compression; + } + + private Builder(Builder o) { + super(o); + this.compression = o.compression; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ + @Nonnull public final Builder compression(@Nullable Double value) { this.compression = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link MedianAbsoluteDeviationAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MedianAbsoluteDeviationAggregation build() { _checkSingleUse(); @@ -142,7 +192,23 @@ protected static void setupMedianAbsoluteDeviationAggregationDeserializer( ) { setupFormatMetricAggregationBaseDeserializer(op); op.add(Builder::compression, JsonpDeserializer.doubleDeserializer(), "compression"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.compression); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MedianAbsoluteDeviationAggregation other = (MedianAbsoluteDeviationAggregation) o; + return Objects.equals(this.compression, other.compression); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java index 57a372478a..e56d1f4a84 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MetricAggregationBase.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -46,7 +53,9 @@ // typedef: _types.aggregations.MetricAggregationBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class MetricAggregationBase implements PlainJsonSerializable { + @Nullable private final String field; @@ -59,11 +68,9 @@ public abstract class MetricAggregationBase implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- protected MetricAggregationBase(AbstractBuilder builder) { - this.field = builder.field; this.missing = builder.missing; this.script = builder.script; - } /** @@ -93,6 +100,7 @@ public final Script script() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -100,38 +108,53 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.missing != null) { generator.writeKey("missing"); this.missing.serialize(generator, mapper); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private String field; - @Nullable private FieldValue missing; - @Nullable private Script script; + protected AbstractBuilder() {} + + protected AbstractBuilder(MetricAggregationBase o) { + this.field = o.field; + this.missing = o.missing; + this.script = o.script; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.field = o.field; + this.missing = o.missing; + this.script = o.script; + } + + @Nonnull + protected abstract BuilderT self(); + /** * API name: {@code field} */ + @Nonnull public final BuilderT field(@Nullable String value) { this.field = value; return self(); @@ -140,6 +163,7 @@ public final BuilderT field(@Nullable String value) { /** * API name: {@code missing} */ + @Nonnull public final BuilderT missing(@Nullable FieldValue value) { this.missing = value; return self(); @@ -148,13 +172,15 @@ public final BuilderT missing(@Nullable FieldValue value) { /** * API name: {@code missing} */ + @Nonnull public final BuilderT missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); + return missing(fn.apply(new FieldValue.Builder()).build()); } /** * API name: {@code script} */ + @Nonnull public final BuilderT script(@Nullable Script value) { this.script = value; return self(); @@ -163,23 +189,38 @@ public final BuilderT script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final BuilderT script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } - - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- + protected static > void setupMetricAggregationBaseDeserializer( ObjectDeserializer op ) { - op.add(AbstractBuilder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(AbstractBuilder::missing, FieldValue._DESERIALIZER, "missing"); op.add(AbstractBuilder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.missing); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MetricAggregationBase other = (MetricAggregationBase) o; + return Objects.equals(this.field, other.field) + && Objects.equals(this.missing, other.missing) + && Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java index 9b6e6d6760..9c3200da87 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MinAggregation @JsonpDeserializable -public class MinAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MinAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private MinAggregation(Builder builder) { super(builder); - } - public static MinAggregation of(Function> fn) { + public static MinAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MinAggregation}. */ + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(MinAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link MinAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MinAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public MinAggregation build() { ); protected static void setupMinAggregationDeserializer(ObjectDeserializer op) { - FormatMetricAggregationBase.setupFormatMetricAggregationBaseDeserializer(op); + setupFormatMetricAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java index b46b514810..b83790b440 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinBucketAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MinBucketAggregation @JsonpDeserializable -public class MinBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MinBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private MinBucketAggregation(Builder builder) { super(builder); - } - public static MinBucketAggregation of(Function> fn) { + public static MinBucketAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MinBucketAggregation}. */ + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(MinBucketAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link MinBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MinBucketAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public MinBucketAggregation build() { ); protected static void setupMinBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java index e8db6b0639..af178475e0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MinimumInterval.java @@ -30,26 +30,32 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.MinimumInterval + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum MinimumInterval implements JsonEnum { - Second("second"), - - Minute("minute"), + Day("day"), Hour("hour"), - Day("day"), + Minute("minute"), Month("month"), - Year("year"), + Second("second"), - ; + Year("year"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java index 4773d0840a..420a928420 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MissingAggregation @JsonpDeserializable -public class MissingAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MissingAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String field; @@ -57,18 +71,16 @@ public class MissingAggregation extends BucketAggregationBase implements Aggrega private MissingAggregation(Builder builder) { super(builder); - this.field = builder.field; this.missing = builder.missing; - } - public static MissingAggregation of(Function> fn) { + public static MissingAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -92,37 +104,72 @@ public final FieldValue missing() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.missing != null) { generator.writeKey("missing"); this.missing.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MissingAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String field; - @Nullable private FieldValue missing; + public Builder() {} + + private Builder(MissingAggregation o) { + super(o); + this.field = o.field; + this.missing = o.missing; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.missing = o.missing; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -131,6 +178,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable FieldValue value) { this.missing = value; return this; @@ -139,21 +187,18 @@ public final Builder missing(@Nullable FieldValue value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return missing(fn.apply(new FieldValue.Builder()).build()); } /** * Builds a {@link MissingAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MissingAggregation build() { _checkSingleUse(); @@ -172,10 +217,27 @@ public MissingAggregation build() { ); protected static void setupMissingAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.missing); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MissingAggregation other = (MissingAggregation) o; + return Objects.equals(this.field, other.field) && Objects.equals(this.missing, other.missing); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java index a8451e048d..0624995780 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MissingOrder.java @@ -30,20 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.MissingOrder + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum MissingOrder implements JsonEnum { - First("first"), - - Last("last"), - Default("default"), - ; + First("first"), + + Last("last"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java index 44555c8511..514a973f88 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregation.java @@ -30,17 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonEnum; 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.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -50,30 +57,21 @@ // typedef: _types.aggregations.MovingAverageAggregation @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class MovingAverageAggregation implements TaggedUnion, - JsonpSerializable { - - /** - * {@link MovingAverageAggregation} variant kinds. - */ + AggregationVariant, + PlainJsonSerializable { /** * {@link MovingAverageAggregation} variant kinds. */ - public enum Kind implements JsonEnum { Ewma("ewma"), - Holt("holt"), - HoltWinters("holt_winters"), - Linear("linear"), - - Simple("simple"), - - ; + Simple("simple"); private final String jsonValue; @@ -81,10 +79,18 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } + } + /** + * {@link Aggregation} variant kind. + */ + @Override + public Aggregation.Kind _aggregationKind() { + return Aggregation.Kind.MovingAvg; } private final Kind _kind; @@ -101,20 +107,16 @@ public final MovingAverageAggregationVariant _get() { } public MovingAverageAggregation(MovingAverageAggregationVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._movingAverageAggregationKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private MovingAverageAggregation(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static MovingAverageAggregation of(Function> fn) { + public static MovingAverageAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -128,8 +130,7 @@ public boolean isEwma() { /** * Get the {@code ewma} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code ewma} kind. + * @throws IllegalStateException if the current variant is not the {@code ewma} kind. */ public EwmaMovingAverageAggregation ewma() { return TaggedUnionUtils.get(this, Kind.Ewma); @@ -145,8 +146,7 @@ public boolean isHolt() { /** * Get the {@code holt} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code holt} kind. + * @throws IllegalStateException if the current variant is not the {@code holt} kind. */ public HoltMovingAverageAggregation holt() { return TaggedUnionUtils.get(this, Kind.Holt); @@ -162,8 +162,7 @@ public boolean isHoltWinters() { /** * Get the {@code holt_winters} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code holt_winters} kind. + * @throws IllegalStateException if the current variant is not the {@code holt_winters} kind. */ public HoltWintersMovingAverageAggregation holtWinters() { return TaggedUnionUtils.get(this, Kind.HoltWinters); @@ -179,8 +178,7 @@ public boolean isLinear() { /** * Get the {@code linear} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code linear} kind. + * @throws IllegalStateException if the current variant is not the {@code linear} kind. */ public LinearMovingAverageAggregation linear() { return TaggedUnionUtils.get(this, Kind.Linear); @@ -196,8 +194,7 @@ public boolean isSimple() { /** * Get the {@code simple} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code simple} kind. + * @throws IllegalStateException if the current variant is not the {@code simple} kind. */ public SimpleMovingAverageAggregation simple() { return TaggedUnionUtils.get(this, Kind.Simple); @@ -205,15 +202,30 @@ public SimpleMovingAverageAggregation simple() { @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { - mapper.serialize(_value, generator); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private MovingAverageAggregationVariant _value; + public Builder() {} + + private Builder(MovingAverageAggregation o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder ewma(EwmaMovingAverageAggregation v) { this._kind = Kind.Ewma; this._value = v; @@ -274,23 +286,20 @@ public ObjectBuilder simple( return this.simple(fn.apply(new SimpleMovingAverageAggregation.Builder()).build()); } + @Override public MovingAverageAggregation build() { _checkSingleUse(); return new MovingAverageAggregation(this); } - } protected static void setupMovingAverageAggregationDeserializer(ObjectDeserializer op) { - op.add(Builder::ewma, EwmaMovingAverageAggregation._DESERIALIZER, "ewma"); op.add(Builder::holt, HoltMovingAverageAggregation._DESERIALIZER, "holt"); op.add(Builder::holtWinters, HoltWintersMovingAverageAggregation._DESERIALIZER, "holt_winters"); op.add(Builder::linear, LinearMovingAverageAggregation._DESERIALIZER, "linear"); op.add(Builder::simple, SimpleMovingAverageAggregation._DESERIALIZER, "simple"); - op.setTypeProperty("model", null); - } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -298,4 +307,20 @@ protected static void setupMovingAverageAggregationDeserializer(ObjectDeserializ MovingAverageAggregation::setupMovingAverageAggregationDeserializer, Builder::build ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MovingAverageAggregation other = (MovingAverageAggregation) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java index ae7dfff169..e593594a1c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBase.java @@ -30,9 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,7 +47,9 @@ // typedef: _types.aggregations.MovingAverageAggregationBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class MovingAverageAggregationBase extends PipelineAggregationBase { + @Nullable private final Boolean minimize; @@ -54,11 +63,9 @@ public abstract class MovingAverageAggregationBase extends PipelineAggregationBa protected MovingAverageAggregationBase(AbstractBuilder builder) { super(builder); - this.minimize = builder.minimize; this.predict = builder.predict; this.window = builder.window; - } /** @@ -86,40 +93,54 @@ public final Integer window() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.minimize != null) { generator.writeKey("minimize"); generator.write(this.minimize); - } + if (this.predict != null) { generator.writeKey("predict"); generator.write(this.predict); - } + if (this.window != null) { generator.writeKey("window"); generator.write(this.window); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends PipelineAggregationBase.AbstractBuilder { @Nullable private Boolean minimize; - @Nullable private Integer predict; - @Nullable private Integer window; + protected AbstractBuilder() {} + + protected AbstractBuilder(MovingAverageAggregationBase o) { + super(o); + this.minimize = o.minimize; + this.predict = o.predict; + this.window = o.window; + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.minimize = o.minimize; + this.predict = o.predict; + this.window = o.window; + } + /** * API name: {@code minimize} */ + @Nonnull public final BuilderT minimize(@Nullable Boolean value) { this.minimize = value; return self(); @@ -128,6 +149,7 @@ public final BuilderT minimize(@Nullable Boolean value) { /** * API name: {@code predict} */ + @Nonnull public final BuilderT predict(@Nullable Integer value) { this.predict = value; return self(); @@ -136,22 +158,43 @@ public final BuilderT predict(@Nullable Integer value) { /** * API name: {@code window} */ + @Nonnull public final BuilderT window(@Nullable Integer value) { this.window = value; return self(); } - } // --------------------------------------------------------------------------------------------- + protected static > void setupMovingAverageAggregationBaseDeserializer( ObjectDeserializer op ) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(AbstractBuilder::minimize, JsonpDeserializer.booleanDeserializer(), "minimize"); op.add(AbstractBuilder::predict, JsonpDeserializer.integerDeserializer(), "predict"); op.add(AbstractBuilder::window, JsonpDeserializer.integerDeserializer(), "window"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.minimize); + result = 31 * result + Objects.hashCode(this.predict); + result = 31 * result + Objects.hashCode(this.window); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MovingAverageAggregationBase other = (MovingAverageAggregationBase) o; + return Objects.equals(this.minimize, other.minimize) + && Objects.equals(this.predict, other.predict) + && Objects.equals(this.window, other.window); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java index ef80469d4a..7ca48fc493 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationBuilders.java @@ -30,52 +30,53 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; + /** * Builders for {@link MovingAverageAggregation} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class MovingAverageAggregationBuilders { private MovingAverageAggregationBuilders() {} /** - * Creates a builder for the {@link EwmaMovingAverageAggregation ewma} - * {@code MovingAverageAggregation} variant. + * Creates a builder for the {@link EwmaMovingAverageAggregation ewma} {@code MovingAverageAggregation} variant. */ public static EwmaMovingAverageAggregation.Builder ewma() { return new EwmaMovingAverageAggregation.Builder(); } /** - * Creates a builder for the {@link HoltMovingAverageAggregation holt} - * {@code MovingAverageAggregation} variant. + * Creates a builder for the {@link HoltMovingAverageAggregation holt} {@code MovingAverageAggregation} variant. */ public static HoltMovingAverageAggregation.Builder holt() { return new HoltMovingAverageAggregation.Builder(); } /** - * Creates a builder for the {@link HoltWintersMovingAverageAggregation - * holt_winters} {@code MovingAverageAggregation} variant. + * Creates a builder for the {@link HoltWintersMovingAverageAggregation holt_winters} {@code MovingAverageAggregation} variant. */ public static HoltWintersMovingAverageAggregation.Builder holtWinters() { return new HoltWintersMovingAverageAggregation.Builder(); } /** - * Creates a builder for the {@link LinearMovingAverageAggregation linear} - * {@code MovingAverageAggregation} variant. + * Creates a builder for the {@link LinearMovingAverageAggregation linear} {@code MovingAverageAggregation} variant. */ public static LinearMovingAverageAggregation.Builder linear() { return new LinearMovingAverageAggregation.Builder(); } /** - * Creates a builder for the {@link SimpleMovingAverageAggregation simple} - * {@code MovingAverageAggregation} variant. + * Creates a builder for the {@link SimpleMovingAverageAggregation simple} {@code MovingAverageAggregation} variant. */ public static SimpleMovingAverageAggregation.Builder simple() { return new SimpleMovingAverageAggregation.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java index 36995c7d5c..60bd0334c7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingAverageAggregationVariant.java @@ -30,19 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpSerializable; /** * Base interface for {@link MovingAverageAggregation} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public interface MovingAverageAggregationVariant extends JsonpSerializable { - MovingAverageAggregation.Kind _movingAverageAggregationKind(); - default MovingAverageAggregation _toMovingAverageAggregation() { + default MovingAverageAggregation toMovingAverageAggregation() { return new MovingAverageAggregation(this); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java index 57ea720bc9..94de3d738f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingFunctionAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MovingFunctionAggregation @JsonpDeserializable -public class MovingFunctionAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MovingFunctionAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String script; @@ -59,19 +73,17 @@ public class MovingFunctionAggregation extends PipelineAggregationBase implement private MovingFunctionAggregation(Builder builder) { super(builder); - this.script = builder.script; this.shift = builder.shift; this.window = builder.window; - } - public static MovingFunctionAggregation of(Function> fn) { + public static MovingFunctionAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,7 +91,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * The script that should be executed on each window of data. + *

* API name: {@code script} + *

*/ @Nullable public final String script() { @@ -87,7 +102,11 @@ public final String script() { } /** + * By default, the window consists of the last n values excluding the current bucket. Increasing shift by 1, moves the + * starting window position by 1 to the right. + *

* API name: {@code shift} + *

*/ @Nullable public final Integer shift() { @@ -95,7 +114,10 @@ public final Integer shift() { } /** + * The size of window to "slide" across the histogram. + *

* API name: {@code window} + *

*/ @Nullable public final Integer window() { @@ -103,79 +125,121 @@ public final Integer window() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.script != null) { generator.writeKey("script"); generator.write(this.script); - } + if (this.shift != null) { generator.writeKey("shift"); generator.write(this.shift); - } + if (this.window != null) { generator.writeKey("window"); generator.write(this.window); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MovingFunctionAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private String script; - @Nullable private Integer shift; - @Nullable private Integer window; + public Builder() {} + + private Builder(MovingFunctionAggregation o) { + super(o); + this.script = o.script; + this.shift = o.shift; + this.window = o.window; + } + + private Builder(Builder o) { + super(o); + this.script = o.script; + this.shift = o.shift; + this.window = o.window; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The script that should be executed on each window of data. + *

* API name: {@code script} + *

*/ + @Nonnull public final Builder script(@Nullable String value) { this.script = value; return this; } /** + * By default, the window consists of the last n values excluding the current bucket. Increasing shift by 1, moves the + * starting window position by 1 to the right. + *

* API name: {@code shift} + *

*/ + @Nonnull public final Builder shift(@Nullable Integer value) { this.shift = value; return this; } /** + * The size of window to "slide" across the histogram. + *

* API name: {@code window} + *

*/ + @Nonnull public final Builder window(@Nullable Integer value) { this.window = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link MovingFunctionAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MovingFunctionAggregation build() { _checkSingleUse(); @@ -194,11 +258,31 @@ public MovingFunctionAggregation build() { ); protected static void setupMovingFunctionAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::script, JsonpDeserializer.stringDeserializer(), "script"); op.add(Builder::shift, JsonpDeserializer.integerDeserializer(), "shift"); op.add(Builder::window, JsonpDeserializer.integerDeserializer(), "window"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.script); + result = 31 * result + Objects.hashCode(this.shift); + result = 31 * result + Objects.hashCode(this.window); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MovingFunctionAggregation other = (MovingFunctionAggregation) o; + return Objects.equals(this.script, other.script) + && Objects.equals(this.shift, other.shift) + && Objects.equals(this.window, other.window); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java index e00de44a51..2601c8fefd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MovingPercentilesAggregation.java @@ -30,48 +30,62 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MovingPercentilesAggregation @JsonpDeserializable -public class MovingPercentilesAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MovingPercentilesAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable - private final Integer window; + private final Boolean keyed; @Nullable private final Integer shift; @Nullable - private final Boolean keyed; + private final Integer window; // --------------------------------------------------------------------------------------------- private MovingPercentilesAggregation(Builder builder) { super(builder); - - this.window = builder.window; - this.shift = builder.shift; this.keyed = builder.keyed; - + this.shift = builder.shift; + this.window = builder.window; } - public static MovingPercentilesAggregation of(Function> fn) { + public static MovingPercentilesAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,15 +93,19 @@ public Aggregation.Kind _aggregationKind() { } /** - * API name: {@code window} + * API name: {@code keyed} */ @Nullable - public final Integer window() { - return this.window; + public final Boolean keyed() { + return this.keyed; } /** + * By default, the window consists of the last n values excluding the current bucket. Increasing shift by 1, moves the + * starting window position by 1 to the right. + *

* API name: {@code shift} + *

*/ @Nullable public final Integer shift() { @@ -95,87 +113,129 @@ public final Integer shift() { } /** - * API name: {@code keyed} + * The size of window to "slide" across the histogram. + *

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

*/ @Nullable - public final Boolean keyed() { - return this.keyed; + public final Integer window() { + return this.window; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.window != null) { - generator.writeKey("window"); - generator.write(this.window); - + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); } + if (this.shift != null) { generator.writeKey("shift"); generator.write(this.shift); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + if (this.window != null) { + generator.writeKey("window"); + generator.write(this.window); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MovingPercentilesAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable - private Integer window; - + private Boolean keyed; @Nullable private Integer shift; - @Nullable - private Boolean keyed; + private Integer window; + + public Builder() {} + + private Builder(MovingPercentilesAggregation o) { + super(o); + this.keyed = o.keyed; + this.shift = o.shift; + this.window = o.window; + } + + private Builder(Builder o) { + super(o); + this.keyed = o.keyed; + this.shift = o.shift; + this.window = o.window; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** - * API name: {@code window} + * API name: {@code keyed} */ - public final Builder window(@Nullable Integer value) { - this.window = value; + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; return this; } /** + * By default, the window consists of the last n values excluding the current bucket. Increasing shift by 1, moves the + * starting window position by 1 to the right. + *

* API name: {@code shift} + *

*/ + @Nonnull public final Builder shift(@Nullable Integer value) { this.shift = value; return this; } /** - * API name: {@code keyed} + * The size of window to "slide" across the histogram. + *

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

*/ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; - } - - @Override - protected Builder self() { + @Nonnull + public final Builder window(@Nullable Integer value) { + this.window = value; return this; } /** * Builds a {@link MovingPercentilesAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MovingPercentilesAggregation build() { _checkSingleUse(); @@ -194,11 +254,31 @@ public MovingPercentilesAggregation build() { ); protected static void setupMovingPercentilesAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); - op.add(Builder::window, JsonpDeserializer.integerDeserializer(), "window"); - op.add(Builder::shift, JsonpDeserializer.integerDeserializer(), "shift"); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); + op.add(Builder::shift, JsonpDeserializer.integerDeserializer(), "shift"); + op.add(Builder::window, JsonpDeserializer.integerDeserializer(), "window"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.shift); + result = 31 * result + Objects.hashCode(this.window); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MovingPercentilesAggregation other = (MovingPercentilesAggregation) o; + return Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.shift, other.shift) + && Objects.equals(this.window, other.window); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java index 32e130cc2c..53e90b9e46 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermLookup.java @@ -30,48 +30,74 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.FieldValue; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MultiTermLookup @JsonpDeserializable -public class MultiTermLookup implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MultiTermLookup implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String field; + @Nullable + private final FieldValue missing; + // --------------------------------------------------------------------------------------------- private MultiTermLookup(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - + this.missing = builder.missing; } - public static MultiTermLookup of(Function> fn) { + public static MultiTermLookup of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } + /** + * API name: {@code missing} + */ + @Nullable + public final FieldValue missing() { + return this.missing; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,35 +105,87 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("field"); generator.write(this.field); + if (this.missing != null) { + generator.writeKey("missing"); + this.missing.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MultiTermLookup}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String field; + @Nullable + private FieldValue missing; + + public Builder() {} + + private Builder(MultiTermLookup o) { + this.field = o.field; + this.missing = o.missing; + } + + private Builder(Builder o) { + this.field = o.field; + this.missing = o.missing; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } + /** + * API name: {@code missing} + */ + @Nonnull + public final Builder missing(@Nullable FieldValue value) { + this.missing = value; + return this; + } + + /** + * API name: {@code missing} + */ + @Nonnull + public final Builder missing(Function> fn) { + return missing(fn.apply(new FieldValue.Builder()).build()); + } + /** * Builds a {@link MultiTermLookup}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MultiTermLookup build() { _checkSingleUse(); @@ -126,9 +204,23 @@ public MultiTermLookup build() { ); protected static void setupMultiTermLookupDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.missing); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MultiTermLookup other = (MultiTermLookup) o; + return this.field.equals(other.field) && Objects.equals(this.missing, other.missing); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java new file mode 100644 index 0000000000..0bce6e7867 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java @@ -0,0 +1,517 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: _types.aggregations.MultiTermsAggregation + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MultiTermsAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nullable + private final TermsAggregationCollectMode collectMode; + + @Nullable + private final Integer minDocCount; + + @Nullable + private final HistogramOrder order; + + @Nullable + private final Integer shardMinDocCount; + + @Nullable + private final Integer shardSize; + + @Nullable + private final Boolean showTermDocCountError; + + @Nullable + private final Integer size; + + @Nonnull + private final List terms; + + // --------------------------------------------------------------------------------------------- + + private MultiTermsAggregation(Builder builder) { + super(builder); + this.collectMode = builder.collectMode; + this.minDocCount = builder.minDocCount; + this.order = builder.order; + this.shardMinDocCount = builder.shardMinDocCount; + this.shardSize = builder.shardSize; + this.showTermDocCountError = builder.showTermDocCountError; + this.size = builder.size; + this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms"); + } + + public static MultiTermsAggregation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link Aggregation} variant kind. + */ + @Override + public Aggregation.Kind _aggregationKind() { + return Aggregation.Kind.MultiTerms; + } + + /** + * API name: {@code collect_mode} + */ + @Nullable + public final TermsAggregationCollectMode collectMode() { + return this.collectMode; + } + + /** + * The minimum number of documents in a bucket for it to be returned. + *

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

+ */ + @Nullable + public final Integer minDocCount() { + return this.minDocCount; + } + + /** + * API name: {@code order} + */ + @Nullable + public final HistogramOrder order() { + return this.order; + } + + /** + * The minimum number of documents in a bucket on each shard for it to be returned. + *

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

+ */ + @Nullable + public final Integer shardMinDocCount() { + return this.shardMinDocCount; + } + + /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based on + * the number of shards and the size parameter. + *

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

+ */ + @Nullable + public final Integer shardSize() { + return this.shardSize; + } + + /** + * Calculates the doc count error on per term basis. + *

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

+ */ + @Nullable + public final Boolean showTermDocCountError() { + return this.showTermDocCountError; + } + + /** + * The number of term buckets should be returned out of the overall terms list. + *

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

+ */ + @Nullable + public final Integer size() { + return this.size; + } + + /** + * Required - The field from which to generate sets of terms. + *

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

+ */ + @Nonnull + public final List terms() { + return this.terms; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.collectMode != null) { + generator.writeKey("collect_mode"); + this.collectMode.serialize(generator, mapper); + } + + if (this.minDocCount != null) { + generator.writeKey("min_doc_count"); + generator.write(this.minDocCount); + } + + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + + if (this.shardMinDocCount != null) { + generator.writeKey("shard_min_doc_count"); + generator.write(this.shardMinDocCount); + } + + if (this.shardSize != null) { + generator.writeKey("shard_size"); + generator.write(this.shardSize); + } + + if (this.showTermDocCountError != null) { + generator.writeKey("show_term_doc_count_error"); + generator.write(this.showTermDocCountError); + } + + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + } + + generator.writeKey("terms"); + generator.writeStartArray(); + for (MultiTermLookup item0 : this.terms) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link MultiTermsAggregation}. + */ + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private TermsAggregationCollectMode collectMode; + @Nullable + private Integer minDocCount; + @Nullable + private HistogramOrder order; + @Nullable + private Integer shardMinDocCount; + @Nullable + private Integer shardSize; + @Nullable + private Boolean showTermDocCountError; + @Nullable + private Integer size; + private List terms; + + public Builder() {} + + private Builder(MultiTermsAggregation o) { + super(o); + this.collectMode = o.collectMode; + this.minDocCount = o.minDocCount; + this.order = o.order; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.showTermDocCountError = o.showTermDocCountError; + this.size = o.size; + this.terms = _listCopy(o.terms); + } + + private Builder(Builder o) { + super(o); + this.collectMode = o.collectMode; + this.minDocCount = o.minDocCount; + this.order = o.order; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.showTermDocCountError = o.showTermDocCountError; + this.size = o.size; + this.terms = _listCopy(o.terms); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code collect_mode} + */ + @Nonnull + public final Builder collectMode(@Nullable TermsAggregationCollectMode value) { + this.collectMode = value; + return this; + } + + /** + * The minimum number of documents in a bucket for it to be returned. + *

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

+ */ + @Nonnull + public final Builder minDocCount(@Nullable Integer value) { + this.minDocCount = value; + return this; + } + + /** + * API name: {@code order} + */ + @Nonnull + public final Builder order(@Nullable HistogramOrder value) { + this.order = value; + return this; + } + + /** + * API name: {@code order} + */ + @Nonnull + public final Builder order(Function> fn) { + return order(fn.apply(new HistogramOrder.Builder()).build()); + } + + /** + * The minimum number of documents in a bucket on each shard for it to be returned. + *

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

+ */ + @Nonnull + public final Builder shardMinDocCount(@Nullable Integer value) { + this.shardMinDocCount = value; + return this; + } + + /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based + * on the number of shards and the size parameter. + *

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

+ */ + @Nonnull + public final Builder shardSize(@Nullable Integer value) { + this.shardSize = value; + return this; + } + + /** + * Calculates the doc count error on per term basis. + *

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

+ */ + @Nonnull + public final Builder showTermDocCountError(@Nullable Boolean value) { + this.showTermDocCountError = value; + return this; + } + + /** + * The number of term buckets should be returned out of the overall terms list. + *

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

+ */ + @Nonnull + public final Builder size(@Nullable Integer value) { + this.size = value; + return this; + } + + /** + * Required - The field from which to generate sets of terms. + *

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

+ * + *

+ * Adds all elements of list to terms. + *

+ */ + @Nonnull + public final Builder terms(List list) { + this.terms = _listAddAll(this.terms, list); + return this; + } + + /** + * Required - The field from which to generate sets of terms. + *

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

+ * + *

+ * Adds one or more values to terms. + *

+ */ + @Nonnull + public final Builder terms(MultiTermLookup value, MultiTermLookup... values) { + this.terms = _listAdd(this.terms, value, values); + return this; + } + + /** + * Required - The field from which to generate sets of terms. + *

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

+ * + *

+ * Adds a value to terms using a builder lambda. + *

+ */ + @Nonnull + public final Builder terms(Function> fn) { + return terms(fn.apply(new MultiTermLookup.Builder()).build()); + } + + /** + * Builds a {@link MultiTermsAggregation}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public MultiTermsAggregation build() { + _checkSingleUse(); + + return new MultiTermsAggregation(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MultiTermsAggregation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + MultiTermsAggregation::setupMultiTermsAggregationDeserializer + ); + + protected static void setupMultiTermsAggregationDeserializer(ObjectDeserializer op) { + setupBucketAggregationBaseDeserializer(op); + op.add(Builder::collectMode, TermsAggregationCollectMode._DESERIALIZER, "collect_mode"); + op.add(Builder::minDocCount, JsonpDeserializer.integerDeserializer(), "min_doc_count"); + op.add(Builder::order, HistogramOrder._DESERIALIZER, "order"); + op.add(Builder::shardMinDocCount, JsonpDeserializer.integerDeserializer(), "shard_min_doc_count"); + op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); + op.add(Builder::showTermDocCountError, JsonpDeserializer.booleanDeserializer(), "show_term_doc_count_error"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(MultiTermLookup._DESERIALIZER), "terms"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.collectMode); + result = 31 * result + Objects.hashCode(this.minDocCount); + result = 31 * result + Objects.hashCode(this.order); + result = 31 * result + Objects.hashCode(this.shardMinDocCount); + result = 31 * result + Objects.hashCode(this.shardSize); + result = 31 * result + Objects.hashCode(this.showTermDocCountError); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + this.terms.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MultiTermsAggregation other = (MultiTermsAggregation) o; + return Objects.equals(this.collectMode, other.collectMode) + && Objects.equals(this.minDocCount, other.minDocCount) + && Objects.equals(this.order, other.order) + && Objects.equals(this.shardMinDocCount, other.shardMinDocCount) + && Objects.equals(this.shardSize, other.shardSize) + && Objects.equals(this.showTermDocCountError, other.showTermDocCountError) + && Objects.equals(this.size, other.size) + && this.terms.equals(other.terms); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java index 5cff33b37d..2f84dc5c13 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/MutualInformationHeuristic.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,13 +48,20 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.MutualInformationHeuristic @JsonpDeserializable -public class MutualInformationHeuristic implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MutualInformationHeuristic + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Boolean backgroundIsSuperset; @@ -57,18 +71,22 @@ public class MutualInformationHeuristic implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private MutualInformationHeuristic(Builder builder) { - this.backgroundIsSuperset = builder.backgroundIsSuperset; this.includeNegatives = builder.includeNegatives; - } - public static MutualInformationHeuristic of(Function> fn) { + public static MutualInformationHeuristic of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** + * Set to false if you defined a custom background filter that represents a different set of documents that you want to + * compare to. + *

* API name: {@code background_is_superset} + *

*/ @Nullable public final Boolean backgroundIsSuperset() { @@ -76,7 +94,10 @@ public final Boolean backgroundIsSuperset() { } /** + * Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. + *

* API name: {@code include_negatives} + *

*/ @Nullable public final Boolean includeNegatives() { @@ -86,6 +107,7 @@ public final Boolean includeNegatives() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -93,44 +115,77 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.backgroundIsSuperset != null) { generator.writeKey("background_is_superset"); generator.write(this.backgroundIsSuperset); - } + if (this.includeNegatives != null) { generator.writeKey("include_negatives"); generator.write(this.includeNegatives); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link MutualInformationHeuristic}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean backgroundIsSuperset; - @Nullable private Boolean includeNegatives; + public Builder() {} + + private Builder(MutualInformationHeuristic o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + this.includeNegatives = o.includeNegatives; + } + + private Builder(Builder o) { + this.backgroundIsSuperset = o.backgroundIsSuperset; + this.includeNegatives = o.includeNegatives; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Set to false if you defined a custom background filter that represents a different set of documents that you want to + * compare to. + *

* API name: {@code background_is_superset} + *

*/ + @Nonnull public final Builder backgroundIsSuperset(@Nullable Boolean value) { this.backgroundIsSuperset = value; return this; } /** + * Set to false to filter out the terms that appear less often in the subset than in documents outside the subset. + *

* API name: {@code include_negatives} + *

*/ + @Nonnull public final Builder includeNegatives(@Nullable Boolean value) { this.includeNegatives = value; return this; @@ -139,9 +194,10 @@ public final Builder includeNegatives(@Nullable Boolean value) { /** * Builds a {@link MutualInformationHeuristic}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public MutualInformationHeuristic build() { _checkSingleUse(); @@ -160,10 +216,24 @@ public MutualInformationHeuristic build() { ); protected static void setupMutualInformationHeuristicDeserializer(ObjectDeserializer op) { - op.add(Builder::backgroundIsSuperset, JsonpDeserializer.booleanDeserializer(), "background_is_superset"); op.add(Builder::includeNegatives, JsonpDeserializer.booleanDeserializer(), "include_negatives"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.backgroundIsSuperset); + result = 31 * result + Objects.hashCode(this.includeNegatives); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MutualInformationHeuristic other = (MutualInformationHeuristic) o; + return Objects.equals(this.backgroundIsSuperset, other.backgroundIsSuperset) + && Objects.equals(this.includeNegatives, other.includeNegatives); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java index c72cd9cd2f..fb8e1b2ed0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NestedAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.NestedAggregation @JsonpDeserializable -public class NestedAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NestedAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String path; @@ -53,17 +67,15 @@ public class NestedAggregation extends BucketAggregationBase implements Aggregat private NestedAggregation(Builder builder) { super(builder); - this.path = builder.path; - } - public static NestedAggregation of(Function> fn) { + public static NestedAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,45 +91,75 @@ public final String path() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NestedAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String path; + public Builder() {} + + private Builder(NestedAggregation o) { + super(o); + this.path = o.path; + } + + private Builder(Builder o) { + super(o); + this.path = o.path; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code path} */ + @Nonnull public final Builder path(@Nullable String value) { this.path = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link NestedAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NestedAggregation build() { _checkSingleUse(); @@ -138,7 +180,23 @@ public NestedAggregation build() { protected static void setupNestedAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.path); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NestedAggregation other = (NestedAggregation) o; + return Objects.equals(this.path, other.path); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java index 1fa646c8dd..09c682f963 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.NormalizeAggregation @JsonpDeserializable -public class NormalizeAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NormalizeAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final NormalizeMethod method; @@ -53,17 +67,15 @@ public class NormalizeAggregation extends PipelineAggregationBase implements Agg private NormalizeAggregation(Builder builder) { super(builder); - this.method = builder.method; - } - public static NormalizeAggregation of(Function> fn) { + public static NormalizeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,44 +91,75 @@ public final NormalizeMethod method() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.method != null) { generator.writeKey("method"); this.method.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NormalizeAggregation}. */ - - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private NormalizeMethod method; + public Builder() {} + + private Builder(NormalizeAggregation o) { + super(o); + this.method = o.method; + } + + private Builder(Builder o) { + super(o); + this.method = o.method; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code method} */ + @Nonnull public final Builder method(@Nullable NormalizeMethod value) { this.method = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link NormalizeAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NormalizeAggregation build() { _checkSingleUse(); @@ -135,9 +178,25 @@ public NormalizeAggregation build() { ); protected static void setupNormalizeAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::method, NormalizeMethod._DESERIALIZER, "method"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.method); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NormalizeAggregation other = (NormalizeAggregation) o; + return Objects.equals(this.method, other.method); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java index f417015d9d..0041b9b6df 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/NormalizeMethod.java @@ -30,26 +30,32 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.NormalizeMethod + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum NormalizeMethod implements JsonEnum { - Rescale_0_1("rescale_0_1"), - - Rescale_0_100("rescale_0_100"), + Mean("mean"), PercentOfSum("percent_of_sum"), - Mean("mean"), + Rescale_0_1("rescale_0_1"), - ZScore("z-score"), + Rescale_0_100("rescale_0_100"), Softmax("softmax"), - ; + ZScore("z-score"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java index 317804fcd9..aa628423ca 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ParentAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ParentAggregation @JsonpDeserializable -public class ParentAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ParentAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String type; @@ -53,17 +67,15 @@ public class ParentAggregation extends BucketAggregationBase implements Aggregat private ParentAggregation(Builder builder) { super(builder); - this.type = builder.type; - } - public static ParentAggregation of(Function> fn) { + public static ParentAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,45 +91,75 @@ public final String type() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.type != null) { generator.writeKey("type"); generator.write(this.type); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ParentAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String type; + public Builder() {} + + private Builder(ParentAggregation o) { + super(o); + this.type = o.type; + } + + private Builder(Builder o) { + super(o); + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code type} */ + @Nonnull public final Builder type(@Nullable String value) { this.type = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ParentAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ParentAggregation build() { _checkSingleUse(); @@ -138,7 +180,23 @@ public ParentAggregation build() { protected static void setupParentAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.type); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ParentAggregation other = (ParentAggregation) o; + return Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java index 672411e95d..a232ff5c75 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentileRanksAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,41 +49,49 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.PercentileRanksAggregation @JsonpDeserializable -public class PercentileRanksAggregation extends FormatMetricAggregationBase implements AggregationVariant { - @Nullable - private final Boolean keyed; - - private final List values; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PercentileRanksAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { @Nullable private final HdrMethod hdr; + @Nullable + private final Boolean keyed; + @Nullable private final TDigest tdigest; + @Nonnull + private final List values; + // --------------------------------------------------------------------------------------------- private PercentileRanksAggregation(Builder builder) { super(builder); - - this.keyed = builder.keyed; - this.values = ApiTypeHelper.unmodifiable(builder.values); this.hdr = builder.hdr; + this.keyed = builder.keyed; this.tdigest = builder.tdigest; - + this.values = ApiTypeHelper.unmodifiable(builder.values); } - public static PercentileRanksAggregation of(Function> fn) { + public static PercentileRanksAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -84,26 +99,23 @@ public Aggregation.Kind _aggregationKind() { } /** - * API name: {@code keyed} + * API name: {@code hdr} */ @Nullable - public final Boolean keyed() { - return this.keyed; - } - - /** - * API name: {@code values} - */ - public final List values() { - return this.values; + public final HdrMethod hdr() { + return this.hdr; } /** - * API name: {@code hdr} + * By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an array. + * Set to false to disable this behavior. + *

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

*/ @Nullable - public final HdrMethod hdr() { - return this.hdr; + public final Boolean keyed() { + return this.keyed; } /** @@ -114,89 +126,106 @@ public final TDigest tdigest() { return this.tdigest; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * An array of values for which to calculate the percentile ranks. + *

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

+ */ + @Nonnull + public final List values() { + return this.values; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); + if (this.hdr != null) { + generator.writeKey("hdr"); + this.hdr.serialize(generator, mapper); + } + if (this.keyed != null) { generator.writeKey("keyed"); generator.write(this.keyed); + } + if (this.tdigest != null) { + generator.writeKey("tdigest"); + this.tdigest.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.values)) { generator.writeKey("values"); generator.writeStartArray(); for (Double item0 : this.values) { generator.write(item0); - } generator.writeEnd(); - } - if (this.hdr != null) { - generator.writeKey("hdr"); - this.hdr.serialize(generator, mapper); - - } - if (this.tdigest != null) { - generator.writeKey("tdigest"); - this.tdigest.serialize(generator, mapper); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PercentileRanksAggregation}. */ - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + @Nullable + private HdrMethod hdr; @Nullable private Boolean keyed; - + @Nullable + private TDigest tdigest; @Nullable private List values; - @Nullable - private HdrMethod hdr; + public Builder() {} - @Nullable - private TDigest tdigest; + private Builder(PercentileRanksAggregation o) { + super(o); + this.hdr = o.hdr; + this.keyed = o.keyed; + this.tdigest = o.tdigest; + this.values = _listCopy(o.values); + } - /** - * API name: {@code keyed} - */ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; + private Builder(Builder o) { + super(o); + this.hdr = o.hdr; + this.keyed = o.keyed; + this.tdigest = o.tdigest; + this.values = _listCopy(o.values); } - /** - * API name: {@code values} - *

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

- * Adds one or more values to values. - */ - public final Builder values(Double value, Double... values) { - this.values = _listAdd(this.values, value, values); + @Override + @Nonnull + protected Builder self() { return this; } /** * API name: {@code hdr} */ + @Nonnull public final Builder hdr(@Nullable HdrMethod value) { this.hdr = value; return this; @@ -205,13 +234,28 @@ public final Builder hdr(@Nullable HdrMethod value) { /** * API name: {@code hdr} */ + @Nonnull public final Builder hdr(Function> fn) { - return this.hdr(fn.apply(new HdrMethod.Builder()).build()); + return hdr(fn.apply(new HdrMethod.Builder()).build()); + } + + /** + * By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an + * array. Set to false to disable this behavior. + *

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

+ */ + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; + return this; } /** * API name: {@code tdigest} */ + @Nonnull public final Builder tdigest(@Nullable TDigest value) { this.tdigest = value; return this; @@ -220,21 +264,50 @@ public final Builder tdigest(@Nullable TDigest value) { /** * API name: {@code tdigest} */ + @Nonnull public final Builder tdigest(Function> fn) { - return this.tdigest(fn.apply(new TDigest.Builder()).build()); + return tdigest(fn.apply(new TDigest.Builder()).build()); } - @Override - protected Builder self() { + /** + * An array of values for which to calculate the percentile ranks. + *

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

+ * + *

+ * Adds all elements of list to values. + *

+ */ + @Nonnull + public final Builder values(List list) { + this.values = _listAddAll(this.values, list); + return this; + } + + /** + * An array of values for which to calculate the percentile ranks. + *

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

+ * + *

+ * Adds one or more values to values. + *

+ */ + @Nonnull + public final Builder values(Double value, Double... values) { + this.values = _listAdd(this.values, value, values); return this; } /** * Builds a {@link PercentileRanksAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PercentileRanksAggregation build() { _checkSingleUse(); @@ -254,11 +327,33 @@ public PercentileRanksAggregation build() { protected static void setupPercentileRanksAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); - op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); - op.add(Builder::values, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "values"); op.add(Builder::hdr, HdrMethod._DESERIALIZER, "hdr"); + op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); op.add(Builder::tdigest, TDigest._DESERIALIZER, "tdigest"); + op.add(Builder::values, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "values"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.hdr); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.tdigest); + result = 31 * result + Objects.hashCode(this.values); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PercentileRanksAggregation other = (PercentileRanksAggregation) o; + return Objects.equals(this.hdr, other.hdr) + && Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.tdigest, other.tdigest) + && Objects.equals(this.values, other.values); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java index 3e8d053aac..9ae33bbc3a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,20 +49,28 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.PercentilesAggregation @JsonpDeserializable -public class PercentilesAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PercentilesAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nullable + private final HdrMethod hdr; + @Nullable private final Boolean keyed; + @Nonnull private final List percents; - @Nullable - private final HdrMethod hdr; - @Nullable private final TDigest tdigest; @@ -63,20 +78,18 @@ public class PercentilesAggregation extends FormatMetricAggregationBase implemen private PercentilesAggregation(Builder builder) { super(builder); - + this.hdr = builder.hdr; this.keyed = builder.keyed; this.percents = ApiTypeHelper.unmodifiable(builder.percents); - this.hdr = builder.hdr; this.tdigest = builder.tdigest; - } - public static PercentilesAggregation of(Function> fn) { + public static PercentilesAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -84,7 +97,19 @@ public Aggregation.Kind _aggregationKind() { } /** + * API name: {@code hdr} + */ + @Nullable + public final HdrMethod hdr() { + return this.hdr; + } + + /** + * By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an array. + * Set to false to disable this behavior. + *

* API name: {@code keyed} + *

*/ @Nullable public final Boolean keyed() { @@ -92,20 +117,16 @@ public final Boolean keyed() { } /** + * The percentiles to calculate. + *

* API name: {@code percents} + *

*/ + @Nonnull public final List percents() { return this.percents; } - /** - * API name: {@code hdr} - */ - @Nullable - public final HdrMethod hdr() { - return this.hdr; - } - /** * API name: {@code tdigest} */ @@ -115,103 +136,156 @@ public final TDigest tdigest() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); + if (this.hdr != null) { + generator.writeKey("hdr"); + this.hdr.serialize(generator, mapper); + } + if (this.keyed != null) { generator.writeKey("keyed"); generator.write(this.keyed); - } + if (ApiTypeHelper.isDefined(this.percents)) { generator.writeKey("percents"); generator.writeStartArray(); for (Double item0 : this.percents) { generator.write(item0); - } generator.writeEnd(); - } - if (this.hdr != null) { - generator.writeKey("hdr"); - this.hdr.serialize(generator, mapper); - } if (this.tdigest != null) { generator.writeKey("tdigest"); this.tdigest.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PercentilesAggregation}. */ - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + @Nullable + private HdrMethod hdr; @Nullable private Boolean keyed; - @Nullable private List percents; - - @Nullable - private HdrMethod hdr; - @Nullable private TDigest tdigest; + public Builder() {} + + private Builder(PercentilesAggregation o) { + super(o); + this.hdr = o.hdr; + this.keyed = o.keyed; + this.percents = _listCopy(o.percents); + this.tdigest = o.tdigest; + } + + private Builder(Builder o) { + super(o); + this.hdr = o.hdr; + this.keyed = o.keyed; + this.percents = _listCopy(o.percents); + this.tdigest = o.tdigest; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * API name: {@code hdr} + */ + @Nonnull + public final Builder hdr(@Nullable HdrMethod value) { + this.hdr = value; + return this; + } + + /** + * API name: {@code hdr} + */ + @Nonnull + public final Builder hdr(Function> fn) { + return hdr(fn.apply(new HdrMethod.Builder()).build()); + } + + /** + * By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an + * array. Set to false to disable this behavior. + *

* API name: {@code keyed} + *

*/ + @Nonnull public final Builder keyed(@Nullable Boolean value) { this.keyed = value; return this; } /** + * The percentiles to calculate. + *

* API name: {@code percents} + *

+ * *

* Adds all elements of list to percents. + *

*/ + @Nonnull public final Builder percents(List list) { this.percents = _listAddAll(this.percents, list); return this; } /** + * The percentiles to calculate. + *

* API name: {@code percents} + *

+ * *

* Adds one or more values to percents. + *

*/ + @Nonnull public final Builder percents(Double value, Double... values) { this.percents = _listAdd(this.percents, value, values); return this; } - /** - * API name: {@code hdr} - */ - public final Builder hdr(@Nullable HdrMethod value) { - this.hdr = value; - return this; - } - - /** - * API name: {@code hdr} - */ - public final Builder hdr(Function> fn) { - return this.hdr(fn.apply(new HdrMethod.Builder()).build()); - } - /** * API name: {@code tdigest} */ + @Nonnull public final Builder tdigest(@Nullable TDigest value) { this.tdigest = value; return this; @@ -220,21 +294,18 @@ public final Builder tdigest(@Nullable TDigest value) { /** * API name: {@code tdigest} */ + @Nonnull public final Builder tdigest(Function> fn) { - return this.tdigest(fn.apply(new TDigest.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return tdigest(fn.apply(new TDigest.Builder()).build()); } /** * Builds a {@link PercentilesAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PercentilesAggregation build() { _checkSingleUse(); @@ -254,11 +325,33 @@ public PercentilesAggregation build() { protected static void setupPercentilesAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); + op.add(Builder::hdr, HdrMethod._DESERIALIZER, "hdr"); op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); op.add(Builder::percents, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "percents"); - op.add(Builder::hdr, HdrMethod._DESERIALIZER, "hdr"); op.add(Builder::tdigest, TDigest._DESERIALIZER, "tdigest"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.hdr); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.percents); + result = 31 * result + Objects.hashCode(this.tdigest); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PercentilesAggregation other = (PercentilesAggregation) o; + return Objects.equals(this.hdr, other.hdr) + && Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.percents, other.percents) + && Objects.equals(this.tdigest, other.tdigest); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java index 1bcb629719..40342e194c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PercentilesBucketAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,29 +49,37 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.PercentilesBucketAggregation @JsonpDeserializable -public class PercentilesBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PercentilesBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nonnull private final List percents; // --------------------------------------------------------------------------------------------- private PercentilesBucketAggregation(Builder builder) { super(builder); - this.percents = ApiTypeHelper.unmodifiable(builder.percents); - } - public static PercentilesBucketAggregation of(Function> fn) { + public static PercentilesBucketAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -72,71 +87,113 @@ public Aggregation.Kind _aggregationKind() { } /** + * The list of percentiles to calculate. + *

* API name: {@code percents} + *

*/ + @Nonnull public final List percents() { return this.percents; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.percents)) { generator.writeKey("percents"); generator.writeStartArray(); for (Double item0 : this.percents) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PercentilesBucketAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private List percents; + public Builder() {} + + private Builder(PercentilesBucketAggregation o) { + super(o); + this.percents = _listCopy(o.percents); + } + + private Builder(Builder o) { + super(o); + this.percents = _listCopy(o.percents); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The list of percentiles to calculate. + *

* API name: {@code percents} + *

+ * *

* Adds all elements of list to percents. + *

*/ + @Nonnull public final Builder percents(List list) { this.percents = _listAddAll(this.percents, list); return this; } /** + * The list of percentiles to calculate. + *

* API name: {@code percents} + *

+ * *

* Adds one or more values to percents. + *

*/ + @Nonnull public final Builder percents(Double value, Double... values) { this.percents = _listAdd(this.percents, value, values); return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link PercentilesBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PercentilesBucketAggregation build() { _checkSingleUse(); @@ -155,9 +212,25 @@ public PercentilesBucketAggregation build() { ); protected static void setupPercentilesBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); op.add(Builder::percents, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "percents"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.percents); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PercentilesBucketAggregation other = (PercentilesBucketAggregation) o; + return Objects.equals(this.percents, other.percents); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java new file mode 100644 index 0000000000..f3de12493a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/PipelineAggregationBase.java @@ -0,0 +1,174 @@ +/* + * 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. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types.aggregations; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectDeserializer; + +// typedef: _types.aggregations.PipelineAggregationBase + +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class PipelineAggregationBase extends BucketPathAggregation { + + @Nullable + private final String format; + + @Nullable + private final GapPolicy gapPolicy; + + // --------------------------------------------------------------------------------------------- + + protected PipelineAggregationBase(AbstractBuilder builder) { + super(builder); + this.format = builder.format; + this.gapPolicy = builder.gapPolicy; + } + + /** + * DecimalFormat pattern for the output value. If specified, the formatted value is returned in the aggregation's + * value_as_string property. + *

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

+ */ + @Nullable + public final String format() { + return this.format; + } + + /** + * API name: {@code gap_policy} + */ + @Nullable + public final GapPolicy gapPolicy() { + return this.gapPolicy; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + } + + if (this.gapPolicy != null) { + generator.writeKey("gap_policy"); + this.gapPolicy.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + protected abstract static class AbstractBuilder> extends + BucketPathAggregation.AbstractBuilder { + @Nullable + private String format; + @Nullable + private GapPolicy gapPolicy; + + protected AbstractBuilder() {} + + protected AbstractBuilder(PipelineAggregationBase o) { + super(o); + this.format = o.format; + this.gapPolicy = o.gapPolicy; + } + + protected AbstractBuilder(AbstractBuilder o) { + super(o); + this.format = o.format; + this.gapPolicy = o.gapPolicy; + } + + /** + * DecimalFormat pattern for the output value. If specified, the formatted value is returned in the aggregation's + * value_as_string property. + *

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

+ */ + @Nonnull + public final BuilderT format(@Nullable String value) { + this.format = value; + return self(); + } + + /** + * API name: {@code gap_policy} + */ + @Nonnull + public final BuilderT gapPolicy(@Nullable GapPolicy value) { + this.gapPolicy = value; + return self(); + } + } + + // --------------------------------------------------------------------------------------------- + + protected static > void setupPipelineAggregationBaseDeserializer( + ObjectDeserializer op + ) { + setupBucketPathAggregationDeserializer(op); + op.add(AbstractBuilder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(AbstractBuilder::gapPolicy, GapPolicy._DESERIALIZER, "gap_policy"); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.gapPolicy); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PipelineAggregationBase other = (PipelineAggregationBase) o; + return Objects.equals(this.format, other.format) && Objects.equals(this.gapPolicy, other.gapPolicy); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java index 0d58ddb6da..f211e80fb4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RangeAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,45 +50,55 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.RangeAggregation @JsonpDeserializable -public class RangeAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RangeAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String field; + @Nullable + private final String format; + + @Nullable + private final Boolean keyed; + @Nullable private final Integer missing; + @Nonnull private final List ranges; @Nullable private final Script script; - @Nullable - private final Boolean keyed; - // --------------------------------------------------------------------------------------------- private RangeAggregation(Builder builder) { super(builder); - this.field = builder.field; + this.format = builder.format; + this.keyed = builder.keyed; this.missing = builder.missing; this.ranges = ApiTypeHelper.unmodifiable(builder.ranges); this.script = builder.script; - this.keyed = builder.keyed; - } - public static RangeAggregation of(Function> fn) { + public static RangeAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -97,7 +114,29 @@ public final String field() { } /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * Set to true to associate a unique string key with each bucket and return the ranges as a hash rather than an array. + *

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

+ */ + @Nullable + public final Boolean keyed() { + return this.keyed; + } + + /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

*/ @Nullable public final Integer missing() { @@ -105,8 +144,12 @@ public final Integer missing() { } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

*/ + @Nonnull public final List ranges() { return this.ranges; } @@ -119,113 +162,194 @@ public final Script script() { return this.script; } - /** - * API name: {@code keyed} - */ - @Nullable - public final Boolean keyed() { - return this.keyed; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); } + + if (this.keyed != null) { + generator.writeKey("keyed"); + generator.write(this.keyed); + } + if (this.missing != null) { generator.writeKey("missing"); generator.write(this.missing); - } + if (ApiTypeHelper.isDefined(this.ranges)) { generator.writeKey("ranges"); generator.writeStartArray(); for (AggregationRange item0 : this.ranges) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } - if (this.keyed != null) { - generator.writeKey("keyed"); - generator.write(this.keyed); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link RangeAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String field; - + @Nullable + private String format; + @Nullable + private Boolean keyed; @Nullable private Integer missing; - @Nullable private List ranges; - @Nullable private Script script; - @Nullable - private Boolean keyed; + public Builder() {} + + private Builder(RangeAggregation o) { + super(o); + this.field = o.field; + this.format = o.format; + this.keyed = o.keyed; + this.missing = o.missing; + this.ranges = _listCopy(o.ranges); + this.script = o.script; + } + + private Builder(Builder o) { + super(o); + this.field = o.field; + this.format = o.format; + this.keyed = o.keyed; + this.missing = o.missing; + this.ranges = _listCopy(o.ranges); + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * API name: {@code format} + */ + @Nonnull + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Set to true to associate a unique string key with each bucket and return the ranges as a hash rather than an array. + *

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

+ */ + @Nonnull + public final Builder keyed(@Nullable Boolean value) { + this.keyed = value; + return this; + } + + /** + * The value to apply to documents that do not have a value. By default, documents without a value are ignored. + *

* API name: {@code missing} + *

*/ + @Nonnull public final Builder missing(@Nullable Integer value) { this.missing = value; return this; } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds all elements of list to ranges. + *

*/ + @Nonnull public final Builder ranges(List list) { this.ranges = _listAddAll(this.ranges, list); return this; } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds one or more values to ranges. + *

*/ + @Nonnull public final Builder ranges(AggregationRange value, AggregationRange... values) { this.ranges = _listAdd(this.ranges, value, values); return this; } /** + * An array of ranges used to bucket documents. + *

* API name: {@code ranges} + *

+ * *

* Adds a value to ranges using a builder lambda. + *

*/ + @Nonnull public final Builder ranges(Function> fn) { return ranges(fn.apply(new AggregationRange.Builder()).build()); } @@ -233,6 +357,7 @@ public final Builder ranges(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - /** - * API name: {@code keyed} - */ - public final Builder keyed(@Nullable Boolean value) { - this.keyed = value; - return this; - } - - @Override - protected Builder self() { - return this; + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link RangeAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RangeAggregation build() { _checkSingleUse(); @@ -284,11 +398,38 @@ public RangeAggregation build() { protected static void setupRangeAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); op.add(Builder::missing, JsonpDeserializer.integerDeserializer(), "missing"); op.add(Builder::ranges, JsonpDeserializer.arrayDeserializer(AggregationRange._DESERIALIZER), "ranges"); op.add(Builder::script, Script._DESERIALIZER, "script"); - op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.keyed); + result = 31 * result + Objects.hashCode(this.missing); + result = 31 * result + Objects.hashCode(this.ranges); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RangeAggregation other = (RangeAggregation) o; + return Objects.equals(this.field, other.field) + && Objects.equals(this.format, other.format) + && Objects.equals(this.keyed, other.keyed) + && Objects.equals(this.missing, other.missing) + && Objects.equals(this.ranges, other.ranges) + && Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java index 3aa4de2486..7d9542a2af 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RareTermsAggregation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,12 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.RareTermsAggregation @JsonpDeserializable -public class RareTermsAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RareTermsAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final TermsExclude exclude; @@ -72,7 +86,6 @@ public class RareTermsAggregation extends BucketAggregationBase implements Aggre private RareTermsAggregation(Builder builder) { super(builder); - this.exclude = builder.exclude; this.field = builder.field; this.include = builder.include; @@ -80,15 +93,14 @@ private RareTermsAggregation(Builder builder) { this.missing = builder.missing; this.precision = builder.precision; this.valueType = builder.valueType; - } - public static RareTermsAggregation of(Function> fn) { + public static RareTermsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -120,7 +132,10 @@ public final TermsInclude include() { } /** + * The maximum number of documents a term should appear in. + *

* API name: {@code max_doc_count} + *

*/ @Nullable public final Long maxDocCount() { @@ -136,7 +151,10 @@ public final FieldValue missing() { } /** + * The precision of the internal CuckooFilters. Smaller precision leads to better approximation, but higher memory usage. + *

* API name: {@code precision} + *

*/ @Nullable public final Double precision() { @@ -152,77 +170,117 @@ public final String valueType() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.exclude != null) { generator.writeKey("exclude"); this.exclude.serialize(generator, mapper); - } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.include != null) { generator.writeKey("include"); this.include.serialize(generator, mapper); - } + if (this.maxDocCount != null) { generator.writeKey("max_doc_count"); generator.write(this.maxDocCount); - } + if (this.missing != null) { generator.writeKey("missing"); this.missing.serialize(generator, mapper); - } + if (this.precision != null) { generator.writeKey("precision"); generator.write(this.precision); - } + if (this.valueType != null) { generator.writeKey("value_type"); generator.write(this.valueType); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RareTermsAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private TermsExclude exclude; - @Nullable private String field; - @Nullable private TermsInclude include; - @Nullable private Long maxDocCount; - @Nullable private FieldValue missing; - @Nullable private Double precision; - @Nullable private String valueType; + public Builder() {} + + private Builder(RareTermsAggregation o) { + super(o); + this.exclude = o.exclude; + this.field = o.field; + this.include = o.include; + this.maxDocCount = o.maxDocCount; + this.missing = o.missing; + this.precision = o.precision; + this.valueType = o.valueType; + } + + private Builder(Builder o) { + super(o); + this.exclude = o.exclude; + this.field = o.field; + this.include = o.include; + this.maxDocCount = o.maxDocCount; + this.missing = o.missing; + this.precision = o.precision; + this.valueType = o.valueType; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(@Nullable TermsExclude value) { this.exclude = value; return this; @@ -231,13 +289,15 @@ public final Builder exclude(@Nullable TermsExclude value) { /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(Function> fn) { - return this.exclude(fn.apply(new TermsExclude.Builder()).build()); + return exclude(fn.apply(new TermsExclude.Builder()).build()); } /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -246,6 +306,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code include} */ + @Nonnull public final Builder include(@Nullable TermsInclude value) { this.include = value; return this; @@ -254,13 +315,18 @@ public final Builder include(@Nullable TermsInclude value) { /** * API name: {@code include} */ + @Nonnull public final Builder include(Function> fn) { - return this.include(fn.apply(new TermsInclude.Builder()).build()); + return include(fn.apply(new TermsInclude.Builder()).build()); } /** + * The maximum number of documents a term should appear in. + *

* API name: {@code max_doc_count} + *

*/ + @Nonnull public final Builder maxDocCount(@Nullable Long value) { this.maxDocCount = value; return this; @@ -269,6 +335,7 @@ public final Builder maxDocCount(@Nullable Long value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable FieldValue value) { this.missing = value; return this; @@ -277,13 +344,18 @@ public final Builder missing(@Nullable FieldValue value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); + return missing(fn.apply(new FieldValue.Builder()).build()); } /** + * The precision of the internal CuckooFilters. Smaller precision leads to better approximation, but higher memory usage. + *

* API name: {@code precision} + *

*/ + @Nonnull public final Builder precision(@Nullable Double value) { this.precision = value; return this; @@ -292,22 +364,19 @@ public final Builder precision(@Nullable Double value) { /** * API name: {@code value_type} */ + @Nonnull public final Builder valueType(@Nullable String value) { this.valueType = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link RareTermsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RareTermsAggregation build() { _checkSingleUse(); @@ -326,7 +395,7 @@ public RareTermsAggregation build() { ); protected static void setupRareTermsAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); @@ -334,7 +403,35 @@ protected static void setupRareTermsAggregationDeserializer(ObjectDeserializer { @Nullable private final RateMode mode; + @Nullable + private final CalendarInterval unit; + // --------------------------------------------------------------------------------------------- private RateAggregation(Builder builder) { super(builder); - - this.unit = builder.unit; this.mode = builder.mode; - + this.unit = builder.unit; } - public static RateAggregation of(Function> fn) { + public static RateAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -75,75 +87,109 @@ public Aggregation.Kind _aggregationKind() { } /** - * API name: {@code unit} + * API name: {@code mode} */ @Nullable - public final CalendarInterval unit() { - return this.unit; + public final RateMode mode() { + return this.mode; } /** - * API name: {@code mode} + * API name: {@code unit} */ @Nullable - public final RateMode mode() { - return this.mode; + public final CalendarInterval unit() { + return this.unit; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.unit != null) { - generator.writeKey("unit"); - this.unit.serialize(generator, mapper); - } if (this.mode != null) { generator.writeKey("mode"); this.mode.serialize(generator, mapper); } + if (this.unit != null) { + generator.writeKey("unit"); + this.unit.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RateAggregation}. */ - - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private RateMode mode; @Nullable private CalendarInterval unit; - @Nullable - private RateMode mode; + public Builder() {} - /** - * API name: {@code unit} - */ - public final Builder unit(@Nullable CalendarInterval value) { - this.unit = value; + private Builder(RateAggregation o) { + super(o); + this.mode = o.mode; + this.unit = o.unit; + } + + private Builder(Builder o) { + super(o); + this.mode = o.mode; + this.unit = o.unit; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { return this; } /** * API name: {@code mode} */ + @Nonnull public final Builder mode(@Nullable RateMode value) { this.mode = value; return this; } - @Override - protected Builder self() { + /** + * API name: {@code unit} + */ + @Nonnull + public final Builder unit(@Nullable CalendarInterval value) { + this.unit = value; return this; } /** * Builds a {@link RateAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RateAggregation build() { _checkSingleUse(); @@ -163,9 +209,26 @@ public RateAggregation build() { protected static void setupRateAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); - op.add(Builder::unit, CalendarInterval._DESERIALIZER, "unit"); op.add(Builder::mode, RateMode._DESERIALIZER, "mode"); + op.add(Builder::unit, CalendarInterval._DESERIALIZER, "unit"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.mode); + result = 31 * result + Objects.hashCode(this.unit); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RateAggregation other = (RateAggregation) o; + return Objects.equals(this.mode, other.mode) && Objects.equals(this.unit, other.unit); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java index 5bf0394cf7..278908ba2e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RateMode.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.RateMode + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum RateMode implements JsonEnum { Sum("sum"), - ValueCount("value_count"), - - ; + ValueCount("value_count"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java index d7910332b8..4a8373adf9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/RegressionInferenceOptions.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,57 +48,71 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.RegressionInferenceOptions @JsonpDeserializable -public class RegressionInferenceOptions implements PlainJsonSerializable { - @Nullable - private final String resultsField; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegressionInferenceOptions + implements + InferenceConfigVariant, + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Integer numTopFeatureImportanceValues; + @Nullable + private final String resultsField; + // --------------------------------------------------------------------------------------------- private RegressionInferenceOptions(Builder builder) { - - this.resultsField = builder.resultsField; this.numTopFeatureImportanceValues = builder.numTopFeatureImportanceValues; - + this.resultsField = builder.resultsField; } - public static RegressionInferenceOptions of(Function> fn) { + public static RegressionInferenceOptions of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * The field that is added to incoming documents to contain the inference - * prediction. Defaults to predicted_value. - *

- * API name: {@code results_field} + * {@link InferenceConfig} variant kind. */ - @Nullable - public final String resultsField() { - return this.resultsField; + @Override + public InferenceConfig.Kind _inferenceConfigKind() { + return InferenceConfig.Kind.Regression; } /** - * Specifies the maximum number of feature importance values per document. By - * default, it is zero and no feature importance calculation occurs. + * Specifies the maximum number of feature importance values per document. *

* API name: {@code num_top_feature_importance_values} + *

*/ @Nullable public final Integer numTopFeatureImportanceValues() { return this.numTopFeatureImportanceValues; } + /** + * API name: {@code results_field} + */ + @Nullable + public final String resultsField() { + return this.resultsField; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,61 +120,85 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.numTopFeatureImportanceValues != null) { + generator.writeKey("num_top_feature_importance_values"); + generator.write(this.numTopFeatureImportanceValues); + } if (this.resultsField != null) { generator.writeKey("results_field"); generator.write(this.resultsField); - } - if (this.numTopFeatureImportanceValues != null) { - generator.writeKey("num_top_feature_importance_values"); - generator.write(this.numTopFeatureImportanceValues); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link RegressionInferenceOptions}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer numTopFeatureImportanceValues; @Nullable private String resultsField; - @Nullable - private Integer numTopFeatureImportanceValues; + public Builder() {} - /** - * The field that is added to incoming documents to contain the inference - * prediction. Defaults to predicted_value. - *

- * API name: {@code results_field} - */ - public final Builder resultsField(@Nullable String value) { - this.resultsField = value; - return this; + private Builder(RegressionInferenceOptions o) { + this.numTopFeatureImportanceValues = o.numTopFeatureImportanceValues; + this.resultsField = o.resultsField; + } + + private Builder(Builder o) { + this.numTopFeatureImportanceValues = o.numTopFeatureImportanceValues; + this.resultsField = o.resultsField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Specifies the maximum number of feature importance values per document. By - * default, it is zero and no feature importance calculation occurs. + * Specifies the maximum number of feature importance values per document. *

* API name: {@code num_top_feature_importance_values} + *

*/ + @Nonnull public final Builder numTopFeatureImportanceValues(@Nullable Integer value) { this.numTopFeatureImportanceValues = value; return this; } + /** + * API name: {@code results_field} + */ + @Nonnull + public final Builder resultsField(@Nullable String value) { + this.resultsField = value; + return this; + } + /** * Builds a {@link RegressionInferenceOptions}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RegressionInferenceOptions build() { _checkSingleUse(); @@ -172,10 +217,24 @@ public RegressionInferenceOptions build() { ); protected static void setupRegressionInferenceOptionsDeserializer(ObjectDeserializer op) { - - op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); op.add(Builder::numTopFeatureImportanceValues, JsonpDeserializer.integerDeserializer(), "num_top_feature_importance_values"); + op.add(Builder::resultsField, JsonpDeserializer.stringDeserializer(), "results_field"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.numTopFeatureImportanceValues); + result = 31 * result + Objects.hashCode(this.resultsField); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RegressionInferenceOptions other = (RegressionInferenceOptions) o; + return Objects.equals(this.numTopFeatureImportanceValues, other.numTopFeatureImportanceValues) + && Objects.equals(this.resultsField, other.resultsField); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java index a567b9e1e8..012617fe7b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ReverseNestedAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ReverseNestedAggregation @JsonpDeserializable -public class ReverseNestedAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ReverseNestedAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String path; @@ -53,17 +67,15 @@ public class ReverseNestedAggregation extends BucketAggregationBase implements A private ReverseNestedAggregation(Builder builder) { super(builder); - this.path = builder.path; - } - public static ReverseNestedAggregation of(Function> fn) { + public static ReverseNestedAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -79,45 +91,75 @@ public final String path() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ReverseNestedAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String path; + public Builder() {} + + private Builder(ReverseNestedAggregation o) { + super(o); + this.path = o.path; + } + + private Builder(Builder o) { + super(o); + this.path = o.path; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code path} */ + @Nonnull public final Builder path(@Nullable String value) { this.path = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ReverseNestedAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ReverseNestedAggregation build() { _checkSingleUse(); @@ -138,7 +180,23 @@ public ReverseNestedAggregation build() { protected static void setupReverseNestedAggregationDeserializer(ObjectDeserializer op) { setupBucketAggregationBaseDeserializer(op); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.path); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ReverseNestedAggregation other = (ReverseNestedAggregation) o; + return Objects.equals(this.path, other.path); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java index 3cdb3a762d..2bb3e5a944 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SamplerAggregation @JsonpDeserializable -public class SamplerAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SamplerAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Integer shardSize; @@ -53,17 +67,15 @@ public class SamplerAggregation extends BucketAggregationBase implements Aggrega private SamplerAggregation(Builder builder) { super(builder); - this.shardSize = builder.shardSize; - } - public static SamplerAggregation of(Function> fn) { + public static SamplerAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +83,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * Limits how many top-scoring documents are collected in the sample processed on each shard. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -79,45 +94,78 @@ public final Integer shardSize() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SamplerAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Integer shardSize; + public Builder() {} + + private Builder(SamplerAggregation o) { + super(o); + this.shardSize = o.shardSize; + } + + private Builder(Builder o) { + super(o); + this.shardSize = o.shardSize; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Limits how many top-scoring documents are collected in the sample processed on each shard. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SamplerAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SamplerAggregation build() { _checkSingleUse(); @@ -136,9 +184,25 @@ public SamplerAggregation build() { ); protected static void setupSamplerAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.shardSize); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SamplerAggregation other = (SamplerAggregation) o; + return Objects.equals(this.shardSize, other.shardSize); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java index 198dc72554..7f57ec04b9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SamplerAggregationExecutionHint.java @@ -30,20 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.SamplerAggregationExecutionHint + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum SamplerAggregationExecutionHint implements JsonEnum { - Map("map"), + BytesHash("bytes_hash"), GlobalOrdinals("global_ordinals"), - BytesHash("bytes_hash"), - - ; + Map("map"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java index d8bc2f76c8..a3182a3468 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedHeuristic.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,34 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ScriptedHeuristic @JsonpDeserializable -public class ScriptedHeuristic implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ScriptedHeuristic implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Script script; // --------------------------------------------------------------------------------------------- private ScriptedHeuristic(Builder builder) { - this.script = ApiTypeHelper.requireNonNull(builder.script, this, "script"); - } - public static ScriptedHeuristic of(Function> fn) { + public static ScriptedHeuristic of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code script} */ + @Nonnull public final Script script() { return this.script; } @@ -73,6 +83,7 @@ public final Script script() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,24 +91,49 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("script"); this.script.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ScriptedHeuristic}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Script script; + public Builder() {} + + private Builder(ScriptedHeuristic o) { + this.script = o.script; + } + + private Builder(Builder o) { + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code script} */ + @Nonnull public final Builder script(Script value) { this.script = value; return this; @@ -106,16 +142,18 @@ public final Builder script(Script value) { /** * Required - API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link ScriptedHeuristic}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ScriptedHeuristic build() { _checkSingleUse(); @@ -134,9 +172,21 @@ public ScriptedHeuristic build() { ); protected static void setupScriptedHeuristicDeserializer(ObjectDeserializer op) { - op.add(Builder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.script.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ScriptedHeuristic other = (ScriptedHeuristic) o; + return this.script.equals(other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java index 0e4adc192d..d34b433fce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ScriptedMetricAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -44,12 +51,19 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ScriptedMetricAggregation @JsonpDeserializable -public class ScriptedMetricAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ScriptedMetricAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Script combineScript; @@ -59,6 +73,7 @@ public class ScriptedMetricAggregation extends MetricAggregationBase implements @Nullable private final Script mapScript; + @Nonnull private final Map params; @Nullable @@ -68,21 +83,19 @@ public class ScriptedMetricAggregation extends MetricAggregationBase implements private ScriptedMetricAggregation(Builder builder) { super(builder); - this.combineScript = builder.combineScript; this.initScript = builder.initScript; this.mapScript = builder.mapScript; this.params = ApiTypeHelper.unmodifiable(builder.params); this.reduceScript = builder.reduceScript; - } - public static ScriptedMetricAggregation of(Function> fn) { + public static ScriptedMetricAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -114,8 +127,13 @@ public final Script mapScript() { } /** + * A global object with script parameters for init, map and combine scripts. It is shared between + * the scripts. + *

* API name: {@code params} + *

*/ + @Nonnull public final Map params() { return this.params; } @@ -129,67 +147,104 @@ public final Script reduceScript() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.combineScript != null) { generator.writeKey("combine_script"); this.combineScript.serialize(generator, mapper); - } + if (this.initScript != null) { generator.writeKey("init_script"); this.initScript.serialize(generator, mapper); - } + if (this.mapScript != null) { generator.writeKey("map_script"); this.mapScript.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); generator.writeStartObject(); for (Map.Entry item0 : this.params.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.reduceScript != null) { generator.writeKey("reduce_script"); this.reduceScript.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ScriptedMetricAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Script combineScript; - @Nullable private Script initScript; - @Nullable private Script mapScript; - @Nullable private Map params; - @Nullable private Script reduceScript; + public Builder() {} + + private Builder(ScriptedMetricAggregation o) { + super(o); + this.combineScript = o.combineScript; + this.initScript = o.initScript; + this.mapScript = o.mapScript; + this.params = _mapCopy(o.params); + this.reduceScript = o.reduceScript; + } + + private Builder(Builder o) { + super(o); + this.combineScript = o.combineScript; + this.initScript = o.initScript; + this.mapScript = o.mapScript; + this.params = _mapCopy(o.params); + this.reduceScript = o.reduceScript; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code combine_script} */ + @Nonnull public final Builder combineScript(@Nullable Script value) { this.combineScript = value; return this; @@ -198,13 +253,15 @@ public final Builder combineScript(@Nullable Script value) { /** * API name: {@code combine_script} */ + @Nonnull public final Builder combineScript(Function> fn) { - return this.combineScript(fn.apply(new Script.Builder()).build()); + return combineScript(fn.apply(new Script.Builder()).build()); } /** * API name: {@code init_script} */ + @Nonnull public final Builder initScript(@Nullable Script value) { this.initScript = value; return this; @@ -213,13 +270,15 @@ public final Builder initScript(@Nullable Script value) { /** * API name: {@code init_script} */ + @Nonnull public final Builder initScript(Function> fn) { - return this.initScript(fn.apply(new Script.Builder()).build()); + return initScript(fn.apply(new Script.Builder()).build()); } /** * API name: {@code map_script} */ + @Nonnull public final Builder mapScript(@Nullable Script value) { this.mapScript = value; return this; @@ -228,25 +287,40 @@ public final Builder mapScript(@Nullable Script value) { /** * API name: {@code map_script} */ + @Nonnull public final Builder mapScript(Function> fn) { - return this.mapScript(fn.apply(new Script.Builder()).build()); + return mapScript(fn.apply(new Script.Builder()).build()); } /** + * A global object with script parameters for init, map and combine scripts. It is shared + * between the scripts. + *

* API name: {@code params} + *

+ * *

- * Adds all entries of map to params. + * Adds all elements of map to params. + *

*/ + @Nonnull public final Builder params(Map map) { this.params = _mapPutAll(this.params, map); return this; } /** + * A global object with script parameters for init, map and combine scripts. It is shared + * between the scripts. + *

* API name: {@code params} + *

+ * *

* Adds an entry to params. + *

*/ + @Nonnull public final Builder params(String key, JsonData value) { this.params = _mapPut(this.params, key, value); return this; @@ -255,6 +329,7 @@ public final Builder params(String key, JsonData value) { /** * API name: {@code reduce_script} */ + @Nonnull public final Builder reduceScript(@Nullable Script value) { this.reduceScript = value; return this; @@ -263,21 +338,18 @@ public final Builder reduceScript(@Nullable Script value) { /** * API name: {@code reduce_script} */ + @Nonnull public final Builder reduceScript(Function> fn) { - return this.reduceScript(fn.apply(new Script.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return reduceScript(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link ScriptedMetricAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ScriptedMetricAggregation build() { _checkSingleUse(); @@ -296,13 +368,37 @@ public ScriptedMetricAggregation build() { ); protected static void setupScriptedMetricAggregationDeserializer(ObjectDeserializer op) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(Builder::combineScript, Script._DESERIALIZER, "combine_script"); op.add(Builder::initScript, Script._DESERIALIZER, "init_script"); op.add(Builder::mapScript, Script._DESERIALIZER, "map_script"); op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); op.add(Builder::reduceScript, Script._DESERIALIZER, "reduce_script"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.combineScript); + result = 31 * result + Objects.hashCode(this.initScript); + result = 31 * result + Objects.hashCode(this.mapScript); + result = 31 * result + Objects.hashCode(this.params); + result = 31 * result + Objects.hashCode(this.reduceScript); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ScriptedMetricAggregation other = (ScriptedMetricAggregation) o; + return Objects.equals(this.combineScript, other.combineScript) + && Objects.equals(this.initScript, other.initScript) + && Objects.equals(this.mapScript, other.mapScript) + && Objects.equals(this.params, other.params) + && Objects.equals(this.reduceScript, other.reduceScript); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java index 2e68643910..68fec1d8ca 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SerialDifferencingAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SerialDifferencingAggregation @JsonpDeserializable -public class SerialDifferencingAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SerialDifferencingAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Integer lag; @@ -53,17 +67,17 @@ public class SerialDifferencingAggregation extends PipelineAggregationBase imple private SerialDifferencingAggregation(Builder builder) { super(builder); - this.lag = builder.lag; - } - public static SerialDifferencingAggregation of(Function> fn) { + public static SerialDifferencingAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +85,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * The historical bucket to subtract from the current value. Must be a positive, non-zero integer. + *

* API name: {@code lag} + *

*/ @Nullable public final Integer lag() { @@ -79,47 +96,78 @@ public final Integer lag() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.lag != null) { generator.writeKey("lag"); generator.write(this.lag); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SerialDifferencingAggregation}. */ - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Integer lag; + public Builder() {} + + private Builder(SerialDifferencingAggregation o) { + super(o); + this.lag = o.lag; + } + + private Builder(Builder o) { + super(o); + this.lag = o.lag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The historical bucket to subtract from the current value. Must be a positive, non-zero integer. + *

* API name: {@code lag} + *

*/ + @Nonnull public final Builder lag(@Nullable Integer value) { this.lag = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SerialDifferencingAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SerialDifferencingAggregation build() { _checkSingleUse(); @@ -140,7 +188,23 @@ public SerialDifferencingAggregation build() { protected static void setupSerialDifferencingAggregationDeserializer(ObjectDeserializer op) { setupPipelineAggregationBaseDeserializer(op); op.add(Builder::lag, JsonpDeserializer.integerDeserializer(), "lag"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.lag); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SerialDifferencingAggregation other = (SerialDifferencingAggregation) o; + return Objects.equals(this.lag, other.lag); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java index c12ae7aa05..d3441f10ac 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTermsAggregation.java @@ -30,25 +30,38 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; -import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.EmptyObject; import org.opensearch.client.opensearch._types.query_dsl.Query; -import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SignificantTermsAggregation @JsonpDeserializable -public class SignificantTermsAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SignificantTermsAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Query backgroundFilter; @@ -67,7 +80,11 @@ public class SignificantTermsAggregation extends BucketAggregationBase implement @Nullable private final GoogleNormalizedDistanceHeuristic gnd; - private final List include; + @Nullable + private final TermsInclude include; + + @Nullable + private final EmptyObject jlh; @Nullable private final Long minDocCount; @@ -94,14 +111,14 @@ public class SignificantTermsAggregation extends BucketAggregationBase implement private SignificantTermsAggregation(Builder builder) { super(builder); - this.backgroundFilter = builder.backgroundFilter; this.chiSquare = builder.chiSquare; this.exclude = builder.exclude; this.executionHint = builder.executionHint; this.field = builder.field; this.gnd = builder.gnd; - this.include = ApiTypeHelper.unmodifiable(builder.include); + this.include = builder.include; + this.jlh = builder.jlh; this.minDocCount = builder.minDocCount; this.mutualInformation = builder.mutualInformation; this.percentage = builder.percentage; @@ -109,15 +126,16 @@ private SignificantTermsAggregation(Builder builder) { this.shardMinDocCount = builder.shardMinDocCount; this.shardSize = builder.shardSize; this.size = builder.size; - } - public static SignificantTermsAggregation of(Function> fn) { + public static SignificantTermsAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -175,12 +193,24 @@ public final GoogleNormalizedDistanceHeuristic gnd() { /** * API name: {@code include} */ - public final List include() { + @Nullable + public final TermsInclude include() { return this.include; } /** + * API name: {@code jlh} + */ + @Nullable + public final EmptyObject jlh() { + return this.jlh; + } + + /** + * Only return terms that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ @Nullable public final Long minDocCount() { @@ -212,7 +242,12 @@ public final ScriptedHeuristic scriptHeuristic() { } /** + * Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the + * min_doc_count. Terms will only be considered if their local shard frequency within the set is higher than the + * shard_min_doc_count. + *

* API name: {@code shard_min_doc_count} + *

*/ @Nullable public final Long shardMinDocCount() { @@ -220,7 +255,11 @@ public final Long shardMinDocCount() { } /** + * Can be used to control the volumes of candidate terms produced by each shard. By default, shard_size will be + * automatically estimated based on the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -228,7 +267,10 @@ public final Integer shardSize() { } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -236,139 +278,189 @@ public final Integer size() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.backgroundFilter != null) { generator.writeKey("background_filter"); this.backgroundFilter.serialize(generator, mapper); - } + if (this.chiSquare != null) { generator.writeKey("chi_square"); this.chiSquare.serialize(generator, mapper); - } + if (this.exclude != null) { generator.writeKey("exclude"); this.exclude.serialize(generator, mapper); - } + if (this.executionHint != null) { generator.writeKey("execution_hint"); this.executionHint.serialize(generator, mapper); } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.gnd != null) { generator.writeKey("gnd"); this.gnd.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.include)) { - generator.writeKey("include"); - generator.writeStartArray(); - for (String item0 : this.include) { - generator.write(item0); - } - generator.writeEnd(); + if (this.include != null) { + generator.writeKey("include"); + this.include.serialize(generator, mapper); + } + if (this.jlh != null) { + generator.writeKey("jlh"); + this.jlh.serialize(generator, mapper); } + if (this.minDocCount != null) { generator.writeKey("min_doc_count"); generator.write(this.minDocCount); - } + if (this.mutualInformation != null) { generator.writeKey("mutual_information"); this.mutualInformation.serialize(generator, mapper); - } + if (this.percentage != null) { generator.writeKey("percentage"); this.percentage.serialize(generator, mapper); - } + if (this.scriptHeuristic != null) { generator.writeKey("script_heuristic"); this.scriptHeuristic.serialize(generator, mapper); - } + if (this.shardMinDocCount != null) { generator.writeKey("shard_min_doc_count"); generator.write(this.shardMinDocCount); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SignificantTermsAggregation}. */ - public static class Builder extends BucketAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Query backgroundFilter; - @Nullable private ChiSquareHeuristic chiSquare; - @Nullable private TermsExclude exclude; - @Nullable private TermsAggregationExecutionHint executionHint; - @Nullable private String field; - @Nullable private GoogleNormalizedDistanceHeuristic gnd; - @Nullable - private List include; - + private TermsInclude include; + @Nullable + private EmptyObject jlh; @Nullable private Long minDocCount; - @Nullable private MutualInformationHeuristic mutualInformation; - @Nullable private PercentageScoreHeuristic percentage; - @Nullable private ScriptedHeuristic scriptHeuristic; - @Nullable private Long shardMinDocCount; - @Nullable private Integer shardSize; - @Nullable private Integer size; + public Builder() {} + + private Builder(SignificantTermsAggregation o) { + super(o); + this.backgroundFilter = o.backgroundFilter; + this.chiSquare = o.chiSquare; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.gnd = o.gnd; + this.include = o.include; + this.jlh = o.jlh; + this.minDocCount = o.minDocCount; + this.mutualInformation = o.mutualInformation; + this.percentage = o.percentage; + this.scriptHeuristic = o.scriptHeuristic; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.size = o.size; + } + + private Builder(Builder o) { + super(o); + this.backgroundFilter = o.backgroundFilter; + this.chiSquare = o.chiSquare; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.gnd = o.gnd; + this.include = o.include; + this.jlh = o.jlh; + this.minDocCount = o.minDocCount; + this.mutualInformation = o.mutualInformation; + this.percentage = o.percentage; + this.scriptHeuristic = o.scriptHeuristic; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.size = o.size; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code background_filter} */ + @Nonnull public final Builder backgroundFilter(@Nullable Query value) { this.backgroundFilter = value; return this; @@ -377,13 +469,15 @@ public final Builder backgroundFilter(@Nullable Query value) { /** * API name: {@code background_filter} */ + @Nonnull public final Builder backgroundFilter(Function> fn) { - return this.backgroundFilter(fn.apply(new Query.Builder()).build()); + return backgroundFilter(fn.apply(new Query.Builder()).build()); } /** * API name: {@code chi_square} */ + @Nonnull public final Builder chiSquare(@Nullable ChiSquareHeuristic value) { this.chiSquare = value; return this; @@ -392,13 +486,15 @@ public final Builder chiSquare(@Nullable ChiSquareHeuristic value) { /** * API name: {@code chi_square} */ + @Nonnull public final Builder chiSquare(Function> fn) { - return this.chiSquare(fn.apply(new ChiSquareHeuristic.Builder()).build()); + return chiSquare(fn.apply(new ChiSquareHeuristic.Builder()).build()); } /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(@Nullable TermsExclude value) { this.exclude = value; return this; @@ -407,13 +503,15 @@ public final Builder exclude(@Nullable TermsExclude value) { /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(Function> fn) { - return this.exclude(fn.apply(new TermsExclude.Builder()).build()); + return exclude(fn.apply(new TermsExclude.Builder()).build()); } /** * API name: {@code execution_hint} */ + @Nonnull public final Builder executionHint(@Nullable TermsAggregationExecutionHint value) { this.executionHint = value; return this; @@ -422,6 +520,7 @@ public final Builder executionHint(@Nullable TermsAggregationExecutionHint value /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; @@ -430,6 +529,7 @@ public final Builder field(@Nullable String value) { /** * API name: {@code gnd} */ + @Nonnull public final Builder gnd(@Nullable GoogleNormalizedDistanceHeuristic value) { this.gnd = value; return this; @@ -438,33 +538,52 @@ public final Builder gnd(@Nullable GoogleNormalizedDistanceHeuristic value) { /** * API name: {@code gnd} */ + @Nonnull public final Builder gnd(Function> fn) { - return this.gnd(fn.apply(new GoogleNormalizedDistanceHeuristic.Builder()).build()); + return gnd(fn.apply(new GoogleNormalizedDistanceHeuristic.Builder()).build()); } /** * API name: {@code include} - *

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

- * Adds one or more values to include. */ - public final Builder include(String value, String... values) { - this.include = _listAdd(this.include, value, values); + @Nonnull + public final Builder include(Function> fn) { + return include(fn.apply(new TermsInclude.Builder()).build()); + } + + /** + * API name: {@code jlh} + */ + @Nonnull + public final Builder jlh(@Nullable EmptyObject value) { + this.jlh = value; return this; } /** + * API name: {@code jlh} + */ + @Nonnull + public final Builder jlh(Function> fn) { + return jlh(fn.apply(new EmptyObject.Builder()).build()); + } + + /** + * Only return terms that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ + @Nonnull public final Builder minDocCount(@Nullable Long value) { this.minDocCount = value; return this; @@ -473,6 +592,7 @@ public final Builder minDocCount(@Nullable Long value) { /** * API name: {@code mutual_information} */ + @Nonnull public final Builder mutualInformation(@Nullable MutualInformationHeuristic value) { this.mutualInformation = value; return this; @@ -481,13 +601,15 @@ public final Builder mutualInformation(@Nullable MutualInformationHeuristic valu /** * API name: {@code mutual_information} */ + @Nonnull public final Builder mutualInformation(Function> fn) { - return this.mutualInformation(fn.apply(new MutualInformationHeuristic.Builder()).build()); + return mutualInformation(fn.apply(new MutualInformationHeuristic.Builder()).build()); } /** * API name: {@code percentage} */ + @Nonnull public final Builder percentage(@Nullable PercentageScoreHeuristic value) { this.percentage = value; return this; @@ -496,13 +618,15 @@ public final Builder percentage(@Nullable PercentageScoreHeuristic value) { /** * API name: {@code percentage} */ + @Nonnull public final Builder percentage(Function> fn) { - return this.percentage(fn.apply(new PercentageScoreHeuristic.Builder()).build()); + return percentage(fn.apply(new PercentageScoreHeuristic.Builder()).build()); } /** * API name: {@code script_heuristic} */ + @Nonnull public final Builder scriptHeuristic(@Nullable ScriptedHeuristic value) { this.scriptHeuristic = value; return this; @@ -511,45 +635,57 @@ public final Builder scriptHeuristic(@Nullable ScriptedHeuristic value) { /** * API name: {@code script_heuristic} */ + @Nonnull public final Builder scriptHeuristic(Function> fn) { - return this.scriptHeuristic(fn.apply(new ScriptedHeuristic.Builder()).build()); + return scriptHeuristic(fn.apply(new ScriptedHeuristic.Builder()).build()); } /** + * Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the + * min_doc_count. Terms will only be considered if their local shard frequency within the set is higher than the + * shard_min_doc_count. + *

* API name: {@code shard_min_doc_count} + *

*/ + @Nonnull public final Builder shardMinDocCount(@Nullable Long value) { this.shardMinDocCount = value; return this; } /** + * Can be used to control the volumes of candidate terms produced by each shard. By default, shard_size will be + * automatically estimated based on the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SignificantTermsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SignificantTermsAggregation build() { _checkSingleUse(); @@ -568,14 +704,15 @@ public SignificantTermsAggregation build() { ); protected static void setupSignificantTermsAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::backgroundFilter, Query._DESERIALIZER, "background_filter"); op.add(Builder::chiSquare, ChiSquareHeuristic._DESERIALIZER, "chi_square"); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); op.add(Builder::executionHint, TermsAggregationExecutionHint._DESERIALIZER, "execution_hint"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::gnd, GoogleNormalizedDistanceHeuristic._DESERIALIZER, "gnd"); - op.add(Builder::include, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "include"); + op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); + op.add(Builder::jlh, EmptyObject._DESERIALIZER, "jlh"); op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count"); op.add(Builder::mutualInformation, MutualInformationHeuristic._DESERIALIZER, "mutual_information"); op.add(Builder::percentage, PercentageScoreHeuristic._DESERIALIZER, "percentage"); @@ -583,7 +720,51 @@ protected static void setupSignificantTermsAggregationDeserializer(ObjectDeseria op.add(Builder::shardMinDocCount, JsonpDeserializer.longDeserializer(), "shard_min_doc_count"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.backgroundFilter); + result = 31 * result + Objects.hashCode(this.chiSquare); + result = 31 * result + Objects.hashCode(this.exclude); + result = 31 * result + Objects.hashCode(this.executionHint); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.gnd); + result = 31 * result + Objects.hashCode(this.include); + result = 31 * result + Objects.hashCode(this.jlh); + result = 31 * result + Objects.hashCode(this.minDocCount); + result = 31 * result + Objects.hashCode(this.mutualInformation); + result = 31 * result + Objects.hashCode(this.percentage); + result = 31 * result + Objects.hashCode(this.scriptHeuristic); + result = 31 * result + Objects.hashCode(this.shardMinDocCount); + result = 31 * result + Objects.hashCode(this.shardSize); + result = 31 * result + Objects.hashCode(this.size); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SignificantTermsAggregation other = (SignificantTermsAggregation) o; + return Objects.equals(this.backgroundFilter, other.backgroundFilter) + && Objects.equals(this.chiSquare, other.chiSquare) + && Objects.equals(this.exclude, other.exclude) + && Objects.equals(this.executionHint, other.executionHint) + && Objects.equals(this.field, other.field) + && Objects.equals(this.gnd, other.gnd) + && Objects.equals(this.include, other.include) + && Objects.equals(this.jlh, other.jlh) + && Objects.equals(this.minDocCount, other.minDocCount) + && Objects.equals(this.mutualInformation, other.mutualInformation) + && Objects.equals(this.percentage, other.percentage) + && Objects.equals(this.scriptHeuristic, other.scriptHeuristic) + && Objects.equals(this.shardMinDocCount, other.shardMinDocCount) + && Objects.equals(this.shardSize, other.shardSize) + && Objects.equals(this.size, other.size); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java index 656c9f5f73..53e22f9abc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SignificantTextAggregation.java @@ -30,25 +30,40 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.EmptyObject; import org.opensearch.client.opensearch._types.query_dsl.Query; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SignificantTextAggregation @JsonpDeserializable -public class SignificantTextAggregation extends BucketAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SignificantTextAggregation extends BucketAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Query backgroundFilter; @@ -70,7 +85,11 @@ public class SignificantTextAggregation extends BucketAggregationBase implements @Nullable private final GoogleNormalizedDistanceHeuristic gnd; - private final List include; + @Nullable + private final TermsInclude include; + + @Nullable + private final EmptyObject jlh; @Nullable private final Long minDocCount; @@ -93,13 +112,13 @@ public class SignificantTextAggregation extends BucketAggregationBase implements @Nullable private final Integer size; + @Nonnull private final List sourceFields; // --------------------------------------------------------------------------------------------- private SignificantTextAggregation(Builder builder) { super(builder); - this.backgroundFilter = builder.backgroundFilter; this.chiSquare = builder.chiSquare; this.exclude = builder.exclude; @@ -107,7 +126,8 @@ private SignificantTextAggregation(Builder builder) { this.field = builder.field; this.filterDuplicateText = builder.filterDuplicateText; this.gnd = builder.gnd; - this.include = ApiTypeHelper.unmodifiable(builder.include); + this.include = builder.include; + this.jlh = builder.jlh; this.minDocCount = builder.minDocCount; this.mutualInformation = builder.mutualInformation; this.percentage = builder.percentage; @@ -116,15 +136,16 @@ private SignificantTextAggregation(Builder builder) { this.shardSize = builder.shardSize; this.size = builder.size; this.sourceFields = ApiTypeHelper.unmodifiable(builder.sourceFields); - } - public static SignificantTextAggregation of(Function> fn) { + public static SignificantTextAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -172,7 +193,10 @@ public final String field() { } /** + * Whether to out duplicate text to deal with noisy data. + *

* API name: {@code filter_duplicate_text} + *

*/ @Nullable public final Boolean filterDuplicateText() { @@ -190,12 +214,24 @@ public final GoogleNormalizedDistanceHeuristic gnd() { /** * API name: {@code include} */ - public final List include() { + @Nullable + public final TermsInclude include() { return this.include; } /** + * API name: {@code jlh} + */ + @Nullable + public final EmptyObject jlh() { + return this.jlh; + } + + /** + * Only return values that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ @Nullable public final Long minDocCount() { @@ -227,7 +263,12 @@ public final ScriptedHeuristic scriptHeuristic() { } /** + * Regulates the certainty a shard has if the values should actually be added to the candidate list or not with respect to the + * min_doc_count. Values will only be considered if their local shard frequency within the set is higher than the + * shard_min_doc_count. + *

* API name: {@code shard_min_doc_count} + *

*/ @Nullable public final Long shardMinDocCount() { @@ -235,7 +276,11 @@ public final Long shardMinDocCount() { } /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based on + * the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -243,7 +288,10 @@ public final Integer shardSize() { } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -253,165 +301,217 @@ public final Integer size() { /** * API name: {@code source_fields} */ + @Nonnull public final List sourceFields() { return this.sourceFields; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.backgroundFilter != null) { generator.writeKey("background_filter"); this.backgroundFilter.serialize(generator, mapper); - } + if (this.chiSquare != null) { generator.writeKey("chi_square"); this.chiSquare.serialize(generator, mapper); - } + if (this.exclude != null) { generator.writeKey("exclude"); this.exclude.serialize(generator, mapper); - } + if (this.executionHint != null) { generator.writeKey("execution_hint"); this.executionHint.serialize(generator, mapper); } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.filterDuplicateText != null) { generator.writeKey("filter_duplicate_text"); generator.write(this.filterDuplicateText); - } + if (this.gnd != null) { generator.writeKey("gnd"); this.gnd.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.include)) { - generator.writeKey("include"); - generator.writeStartArray(); - for (String item0 : this.include) { - generator.write(item0); - } - generator.writeEnd(); + if (this.include != null) { + generator.writeKey("include"); + this.include.serialize(generator, mapper); + } + if (this.jlh != null) { + generator.writeKey("jlh"); + this.jlh.serialize(generator, mapper); } + if (this.minDocCount != null) { generator.writeKey("min_doc_count"); generator.write(this.minDocCount); - } + if (this.mutualInformation != null) { generator.writeKey("mutual_information"); this.mutualInformation.serialize(generator, mapper); - } + if (this.percentage != null) { generator.writeKey("percentage"); this.percentage.serialize(generator, mapper); - } + if (this.scriptHeuristic != null) { generator.writeKey("script_heuristic"); this.scriptHeuristic.serialize(generator, mapper); - } + if (this.shardMinDocCount != null) { generator.writeKey("shard_min_doc_count"); generator.write(this.shardMinDocCount); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (ApiTypeHelper.isDefined(this.sourceFields)) { generator.writeKey("source_fields"); generator.writeStartArray(); for (String item0 : this.sourceFields) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SignificantTextAggregation}. */ - public static class Builder extends BucketAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { @Nullable private Query backgroundFilter; - @Nullable private ChiSquareHeuristic chiSquare; - @Nullable private TermsExclude exclude; - @Nullable private TermsAggregationExecutionHint executionHint; - @Nullable private String field; - @Nullable private Boolean filterDuplicateText; - @Nullable private GoogleNormalizedDistanceHeuristic gnd; - @Nullable - private List include; - + private TermsInclude include; + @Nullable + private EmptyObject jlh; @Nullable private Long minDocCount; - @Nullable private MutualInformationHeuristic mutualInformation; - @Nullable private PercentageScoreHeuristic percentage; - @Nullable private ScriptedHeuristic scriptHeuristic; - @Nullable private Long shardMinDocCount; - @Nullable private Integer shardSize; - @Nullable private Integer size; - @Nullable private List sourceFields; + public Builder() {} + + private Builder(SignificantTextAggregation o) { + super(o); + this.backgroundFilter = o.backgroundFilter; + this.chiSquare = o.chiSquare; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.filterDuplicateText = o.filterDuplicateText; + this.gnd = o.gnd; + this.include = o.include; + this.jlh = o.jlh; + this.minDocCount = o.minDocCount; + this.mutualInformation = o.mutualInformation; + this.percentage = o.percentage; + this.scriptHeuristic = o.scriptHeuristic; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.size = o.size; + this.sourceFields = _listCopy(o.sourceFields); + } + + private Builder(Builder o) { + super(o); + this.backgroundFilter = o.backgroundFilter; + this.chiSquare = o.chiSquare; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.filterDuplicateText = o.filterDuplicateText; + this.gnd = o.gnd; + this.include = o.include; + this.jlh = o.jlh; + this.minDocCount = o.minDocCount; + this.mutualInformation = o.mutualInformation; + this.percentage = o.percentage; + this.scriptHeuristic = o.scriptHeuristic; + this.shardMinDocCount = o.shardMinDocCount; + this.shardSize = o.shardSize; + this.size = o.size; + this.sourceFields = _listCopy(o.sourceFields); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code background_filter} */ + @Nonnull public final Builder backgroundFilter(@Nullable Query value) { this.backgroundFilter = value; return this; @@ -420,13 +520,15 @@ public final Builder backgroundFilter(@Nullable Query value) { /** * API name: {@code background_filter} */ + @Nonnull public final Builder backgroundFilter(Function> fn) { - return this.backgroundFilter(fn.apply(new Query.Builder()).build()); + return backgroundFilter(fn.apply(new Query.Builder()).build()); } /** * API name: {@code chi_square} */ + @Nonnull public final Builder chiSquare(@Nullable ChiSquareHeuristic value) { this.chiSquare = value; return this; @@ -435,13 +537,15 @@ public final Builder chiSquare(@Nullable ChiSquareHeuristic value) { /** * API name: {@code chi_square} */ + @Nonnull public final Builder chiSquare(Function> fn) { - return this.chiSquare(fn.apply(new ChiSquareHeuristic.Builder()).build()); + return chiSquare(fn.apply(new ChiSquareHeuristic.Builder()).build()); } /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(@Nullable TermsExclude value) { this.exclude = value; return this; @@ -450,13 +554,15 @@ public final Builder exclude(@Nullable TermsExclude value) { /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(Function> fn) { - return this.exclude(fn.apply(new TermsExclude.Builder()).build()); + return exclude(fn.apply(new TermsExclude.Builder()).build()); } /** * API name: {@code execution_hint} */ + @Nonnull public final Builder executionHint(@Nullable TermsAggregationExecutionHint value) { this.executionHint = value; return this; @@ -465,14 +571,19 @@ public final Builder executionHint(@Nullable TermsAggregationExecutionHint value /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * Whether to out duplicate text to deal with noisy data. + *

* API name: {@code filter_duplicate_text} + *

*/ + @Nonnull public final Builder filterDuplicateText(@Nullable Boolean value) { this.filterDuplicateText = value; return this; @@ -481,6 +592,7 @@ public final Builder filterDuplicateText(@Nullable Boolean value) { /** * API name: {@code gnd} */ + @Nonnull public final Builder gnd(@Nullable GoogleNormalizedDistanceHeuristic value) { this.gnd = value; return this; @@ -489,33 +601,52 @@ public final Builder gnd(@Nullable GoogleNormalizedDistanceHeuristic value) { /** * API name: {@code gnd} */ + @Nonnull public final Builder gnd(Function> fn) { - return this.gnd(fn.apply(new GoogleNormalizedDistanceHeuristic.Builder()).build()); + return gnd(fn.apply(new GoogleNormalizedDistanceHeuristic.Builder()).build()); } /** * API name: {@code include} - *

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

- * Adds one or more values to include. */ - public final Builder include(String value, String... values) { - this.include = _listAdd(this.include, value, values); + @Nonnull + public final Builder include(Function> fn) { + return include(fn.apply(new TermsInclude.Builder()).build()); + } + + /** + * API name: {@code jlh} + */ + @Nonnull + public final Builder jlh(@Nullable EmptyObject value) { + this.jlh = value; return this; } /** + * API name: {@code jlh} + */ + @Nonnull + public final Builder jlh(Function> fn) { + return jlh(fn.apply(new EmptyObject.Builder()).build()); + } + + /** + * Only return values that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ + @Nonnull public final Builder minDocCount(@Nullable Long value) { this.minDocCount = value; return this; @@ -524,6 +655,7 @@ public final Builder minDocCount(@Nullable Long value) { /** * API name: {@code mutual_information} */ + @Nonnull public final Builder mutualInformation(@Nullable MutualInformationHeuristic value) { this.mutualInformation = value; return this; @@ -532,13 +664,15 @@ public final Builder mutualInformation(@Nullable MutualInformationHeuristic valu /** * API name: {@code mutual_information} */ + @Nonnull public final Builder mutualInformation(Function> fn) { - return this.mutualInformation(fn.apply(new MutualInformationHeuristic.Builder()).build()); + return mutualInformation(fn.apply(new MutualInformationHeuristic.Builder()).build()); } /** * API name: {@code percentage} */ + @Nonnull public final Builder percentage(@Nullable PercentageScoreHeuristic value) { this.percentage = value; return this; @@ -547,13 +681,15 @@ public final Builder percentage(@Nullable PercentageScoreHeuristic value) { /** * API name: {@code percentage} */ + @Nonnull public final Builder percentage(Function> fn) { - return this.percentage(fn.apply(new PercentageScoreHeuristic.Builder()).build()); + return percentage(fn.apply(new PercentageScoreHeuristic.Builder()).build()); } /** * API name: {@code script_heuristic} */ + @Nonnull public final Builder scriptHeuristic(@Nullable ScriptedHeuristic value) { this.scriptHeuristic = value; return this; @@ -562,29 +698,45 @@ public final Builder scriptHeuristic(@Nullable ScriptedHeuristic value) { /** * API name: {@code script_heuristic} */ + @Nonnull public final Builder scriptHeuristic(Function> fn) { - return this.scriptHeuristic(fn.apply(new ScriptedHeuristic.Builder()).build()); + return scriptHeuristic(fn.apply(new ScriptedHeuristic.Builder()).build()); } /** + * Regulates the certainty a shard has if the values should actually be added to the candidate list or not with respect to the + * min_doc_count. Values will only be considered if their local shard frequency within the set is higher than the + * shard_min_doc_count. + *

* API name: {@code shard_min_doc_count} + *

*/ + @Nonnull public final Builder shardMinDocCount(@Nullable Long value) { this.shardMinDocCount = value; return this; } /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based + * on the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; @@ -592,9 +744,12 @@ public final Builder size(@Nullable Integer value) { /** * API name: {@code source_fields} + * *

* Adds all elements of list to sourceFields. + *

*/ + @Nonnull public final Builder sourceFields(List list) { this.sourceFields = _listAddAll(this.sourceFields, list); return this; @@ -602,25 +757,24 @@ public final Builder sourceFields(List list) { /** * API name: {@code source_fields} + * *

* Adds one or more values to sourceFields. + *

*/ + @Nonnull public final Builder sourceFields(String value, String... values) { this.sourceFields = _listAdd(this.sourceFields, value, values); return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link SignificantTextAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SignificantTextAggregation build() { _checkSingleUse(); @@ -639,7 +793,7 @@ public SignificantTextAggregation build() { ); protected static void setupSignificantTextAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + setupBucketAggregationBaseDeserializer(op); op.add(Builder::backgroundFilter, Query._DESERIALIZER, "background_filter"); op.add(Builder::chiSquare, ChiSquareHeuristic._DESERIALIZER, "chi_square"); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); @@ -647,7 +801,8 @@ protected static void setupSignificantTextAggregationDeserializer(ObjectDeserial op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::filterDuplicateText, JsonpDeserializer.booleanDeserializer(), "filter_duplicate_text"); op.add(Builder::gnd, GoogleNormalizedDistanceHeuristic._DESERIALIZER, "gnd"); - op.add(Builder::include, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "include"); + op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); + op.add(Builder::jlh, EmptyObject._DESERIALIZER, "jlh"); op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count"); op.add(Builder::mutualInformation, MutualInformationHeuristic._DESERIALIZER, "mutual_information"); op.add(Builder::percentage, PercentageScoreHeuristic._DESERIALIZER, "percentage"); @@ -656,7 +811,55 @@ protected static void setupSignificantTextAggregationDeserializer(ObjectDeserial op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sourceFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "source_fields"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.backgroundFilter); + result = 31 * result + Objects.hashCode(this.chiSquare); + result = 31 * result + Objects.hashCode(this.exclude); + result = 31 * result + Objects.hashCode(this.executionHint); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.filterDuplicateText); + result = 31 * result + Objects.hashCode(this.gnd); + result = 31 * result + Objects.hashCode(this.include); + result = 31 * result + Objects.hashCode(this.jlh); + result = 31 * result + Objects.hashCode(this.minDocCount); + result = 31 * result + Objects.hashCode(this.mutualInformation); + result = 31 * result + Objects.hashCode(this.percentage); + result = 31 * result + Objects.hashCode(this.scriptHeuristic); + result = 31 * result + Objects.hashCode(this.shardMinDocCount); + result = 31 * result + Objects.hashCode(this.shardSize); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Objects.hashCode(this.sourceFields); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SignificantTextAggregation other = (SignificantTextAggregation) o; + return Objects.equals(this.backgroundFilter, other.backgroundFilter) + && Objects.equals(this.chiSquare, other.chiSquare) + && Objects.equals(this.exclude, other.exclude) + && Objects.equals(this.executionHint, other.executionHint) + && Objects.equals(this.field, other.field) + && Objects.equals(this.filterDuplicateText, other.filterDuplicateText) + && Objects.equals(this.gnd, other.gnd) + && Objects.equals(this.include, other.include) + && Objects.equals(this.jlh, other.jlh) + && Objects.equals(this.minDocCount, other.minDocCount) + && Objects.equals(this.mutualInformation, other.mutualInformation) + && Objects.equals(this.percentage, other.percentage) + && Objects.equals(this.scriptHeuristic, other.scriptHeuristic) + && Objects.equals(this.shardMinDocCount, other.shardMinDocCount) + && Objects.equals(this.shardSize, other.shardSize) + && Objects.equals(this.size, other.size) + && Objects.equals(this.sourceFields, other.sourceFields); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java index ce868f20c1..f8e4dfad01 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SimpleMovingAverageAggregation.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,29 +47,37 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.EmptyObject; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SimpleMovingAverageAggregation @JsonpDeserializable -public class SimpleMovingAverageAggregation extends MovingAverageAggregationBase implements MovingAverageAggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SimpleMovingAverageAggregation extends MovingAverageAggregationBase + implements + MovingAverageAggregationVariant, + ToCopyableBuilder { + + @Nonnull private final EmptyObject settings; // --------------------------------------------------------------------------------------------- private SimpleMovingAverageAggregation(Builder builder) { super(builder); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static SimpleMovingAverageAggregation of(Function> fn) { + public static SimpleMovingAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * MovingAverageAggregation variant kind. + * {@link MovingAverageAggregation} variant kind. */ @Override public MovingAverageAggregation.Kind _movingAverageAggregationKind() { @@ -73,33 +87,67 @@ public MovingAverageAggregation.Kind _movingAverageAggregationKind() { /** * Required - API name: {@code settings} */ + @Nonnull public final EmptyObject settings() { return this.settings; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("model", "simple"); super.serializeInternal(generator, mapper); generator.writeKey("settings"); this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SimpleMovingAverageAggregation}. */ - public static class Builder extends MovingAverageAggregationBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { private EmptyObject settings; + public Builder() {} + + private Builder(SimpleMovingAverageAggregation o) { + super(o); + this.settings = o.settings; + } + + private Builder(Builder o) { + super(o); + this.settings = o.settings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(EmptyObject value) { this.settings = value; return this; @@ -108,21 +156,18 @@ public final Builder settings(EmptyObject value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new EmptyObject.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return settings(fn.apply(new EmptyObject.Builder()).build()); } /** * Builds a {@link SimpleMovingAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SimpleMovingAverageAggregation build() { _checkSingleUse(); @@ -141,10 +186,27 @@ public SimpleMovingAverageAggregation build() { ); protected static void setupSimpleMovingAverageAggregationDeserializer(ObjectDeserializer op) { - MovingAverageAggregationBase.setupMovingAverageAggregationBaseDeserializer(op); + setupMovingAverageAggregationBaseDeserializer(op); op.add(Builder::settings, EmptyObject._DESERIALIZER, "settings"); op.ignore("model"); } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.settings.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SimpleMovingAverageAggregation other = (SimpleMovingAverageAggregation) o; + return this.settings.equals(other.settings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java index db04ddfc4c..1f0351ce62 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.StatsAggregation @JsonpDeserializable -public class StatsAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StatsAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private StatsAggregation(Builder builder) { super(builder); - } - public static StatsAggregation of(Function> fn) { + public static StatsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StatsAggregation}. */ + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(StatsAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link StatsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StatsAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public StatsAggregation build() { ); protected static void setupStatsAggregationDeserializer(ObjectDeserializer op) { - FormatMetricAggregationBase.setupFormatMetricAggregationBaseDeserializer(op); + setupFormatMetricAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java index a189ecdf51..ec1fd16b05 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StatsBucketAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.StatsBucketAggregation @JsonpDeserializable -public class StatsBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StatsBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private StatsBucketAggregation(Builder builder) { super(builder); - } - public static StatsBucketAggregation of(Function> fn) { + public static StatsBucketAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StatsBucketAggregation}. */ + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(StatsBucketAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link StatsBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StatsBucketAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public StatsBucketAggregation build() { ); protected static void setupStatsBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java index 3c4d0255c2..a6368d48b9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/StringStatsAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.StringStatsAggregation @JsonpDeserializable -public class StringStatsAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StringStatsAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final Boolean showDistribution; @@ -53,17 +67,15 @@ public class StringStatsAggregation extends MetricAggregationBase implements Agg private StringStatsAggregation(Builder builder) { super(builder); - this.showDistribution = builder.showDistribution; - } - public static StringStatsAggregation of(Function> fn) { + public static StringStatsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -71,7 +83,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * Shows the probability distribution for all characters. + *

* API name: {@code show_distribution} + *

*/ @Nullable public final Boolean showDistribution() { @@ -79,45 +94,78 @@ public final Boolean showDistribution() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.showDistribution != null) { generator.writeKey("show_distribution"); generator.write(this.showDistribution); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StringStatsAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private Boolean showDistribution; + public Builder() {} + + private Builder(StringStatsAggregation o) { + super(o); + this.showDistribution = o.showDistribution; + } + + private Builder(Builder o) { + super(o); + this.showDistribution = o.showDistribution; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * Shows the probability distribution for all characters. + *

* API name: {@code show_distribution} + *

*/ + @Nonnull public final Builder showDistribution(@Nullable Boolean value) { this.showDistribution = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link StringStatsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StringStatsAggregation build() { _checkSingleUse(); @@ -138,7 +186,23 @@ public StringStatsAggregation build() { protected static void setupStringStatsAggregationDeserializer(ObjectDeserializer op) { setupMetricAggregationBaseDeserializer(op); op.add(Builder::showDistribution, JsonpDeserializer.booleanDeserializer(), "show_distribution"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.showDistribution); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + StringStatsAggregation other = (StringStatsAggregation) o; + return Objects.equals(this.showDistribution, other.showDistribution); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java index b982937929..8949ee1f1a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SumAggregation @JsonpDeserializable -public class SumAggregation extends FormatMetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SumAggregation extends FormatMetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private SumAggregation(Builder builder) { super(builder); - } - public static SumAggregation of(Function> fn) { + public static SumAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SumAggregation}. */ + public static class Builder extends FormatMetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(SumAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends FormatMetricAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link SumAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SumAggregation build() { _checkSingleUse(); @@ -99,7 +142,21 @@ public SumAggregation build() { protected static void setupSumAggregationDeserializer(ObjectDeserializer op) { setupFormatMetricAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java index 422508d74e..67021d14f2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/SumBucketAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.SumBucketAggregation @JsonpDeserializable -public class SumBucketAggregation extends PipelineAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SumBucketAggregation extends PipelineAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private SumBucketAggregation(Builder builder) { super(builder); - } - public static SumBucketAggregation of(Function> fn) { + public static SumBucketAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,12 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SumBucketAggregation}. */ + public static class Builder extends PipelineAggregationBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(SumBucketAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends PipelineAggregationBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -77,9 +119,10 @@ protected Builder self() { /** * Builds a {@link SumBucketAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SumBucketAggregation build() { _checkSingleUse(); @@ -98,8 +141,22 @@ public SumBucketAggregation build() { ); protected static void setupSumBucketAggregationDeserializer(ObjectDeserializer op) { - PipelineAggregationBase.setupPipelineAggregationBaseDeserializer(op); + setupPipelineAggregationBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java index 02a50e9387..8034d15549 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TDigest.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -41,30 +48,36 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TDigest @JsonpDeserializable -public class TDigest implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TDigest implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Integer compression; // --------------------------------------------------------------------------------------------- private TDigest(Builder builder) { - this.compression = builder.compression; - } - public static TDigest of(Function> fn) { + public static TDigest of(Function> fn) { return fn.apply(new Builder()).build(); } /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ @Nullable public final Integer compression() { @@ -74,6 +87,7 @@ public final Integer compression() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,28 +95,56 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.compression != null) { generator.writeKey("compression"); generator.write(this.compression); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TDigest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Integer compression; + public Builder() {} + + private Builder(TDigest o) { + this.compression = o.compression; + } + + private Builder(Builder o) { + this.compression = o.compression; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** + * Limits the maximum number of nodes used by the underlying TDigest algorithm to 20 * compression, enabling control of + * memory usage and approximation error. + *

* API name: {@code compression} + *

*/ + @Nonnull public final Builder compression(@Nullable Integer value) { this.compression = value; return this; @@ -111,9 +153,10 @@ public final Builder compression(@Nullable Integer value) { /** * Builds a {@link TDigest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TDigest build() { _checkSingleUse(); @@ -132,9 +175,21 @@ public TDigest build() { ); protected static void setupTDigestDeserializer(ObjectDeserializer op) { - op.add(Builder::compression, JsonpDeserializer.integerDeserializer(), "compression"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.compression); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TDigest other = (TDigest) o; + return Objects.equals(this.compression, other.compression); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java index 418b5ecf26..6ce5dbd368 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TTestAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TTestAggregation @JsonpDeserializable -public class TTestAggregation extends AggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TTestAggregation extends AggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final TestPopulation a; @@ -59,19 +73,17 @@ public class TTestAggregation extends AggregationBase implements AggregationVari private TTestAggregation(Builder builder) { super(builder); - this.a = builder.a; this.b = builder.b; this.type = builder.type; - } - public static TTestAggregation of(Function> fn) { + public static TTestAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -103,44 +115,79 @@ public final TTestType type() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.a != null) { generator.writeKey("a"); this.a.serialize(generator, mapper); - } + if (this.b != null) { generator.writeKey("b"); this.b.serialize(generator, mapper); - } + if (this.type != null) { generator.writeKey("type"); this.type.serialize(generator, mapper); } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TTestAggregation}. */ - - public static class Builder extends AggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AggregationBase.AbstractBuilder implements CopyableBuilder { @Nullable private TestPopulation a; - @Nullable private TestPopulation b; - @Nullable private TTestType type; + public Builder() {} + + private Builder(TTestAggregation o) { + super(o); + this.a = o.a; + this.b = o.b; + this.type = o.type; + } + + private Builder(Builder o) { + super(o); + this.a = o.a; + this.b = o.b; + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code a} */ + @Nonnull public final Builder a(@Nullable TestPopulation value) { this.a = value; return this; @@ -149,13 +196,15 @@ public final Builder a(@Nullable TestPopulation value) { /** * API name: {@code a} */ + @Nonnull public final Builder a(Function> fn) { - return this.a(fn.apply(new TestPopulation.Builder()).build()); + return a(fn.apply(new TestPopulation.Builder()).build()); } /** * API name: {@code b} */ + @Nonnull public final Builder b(@Nullable TestPopulation value) { this.b = value; return this; @@ -164,29 +213,27 @@ public final Builder b(@Nullable TestPopulation value) { /** * API name: {@code b} */ + @Nonnull public final Builder b(Function> fn) { - return this.b(fn.apply(new TestPopulation.Builder()).build()); + return b(fn.apply(new TestPopulation.Builder()).build()); } /** * API name: {@code type} */ + @Nonnull public final Builder type(@Nullable TTestType value) { this.type = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link TTestAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TTestAggregation build() { _checkSingleUse(); @@ -209,7 +256,25 @@ protected static void setupTTestAggregationDeserializer(ObjectDeserializer { + @Nullable private final TermsAggregationCollectMode collectMode; @@ -64,6 +78,9 @@ public class TermsAggregation extends BucketAggregationBase implements Aggregati @Nullable private final String field; + @Nullable + private final String format; + @Nullable private final TermsInclude include; @@ -73,15 +90,13 @@ public class TermsAggregation extends BucketAggregationBase implements Aggregati @Nullable private final FieldValue missing; - @Nullable - private final MissingOrder missingOrder; - @Nullable private final Boolean missingBucket; @Nullable - private final String valueType; + private final MissingOrder missingOrder; + @Nonnull private final List> order; @Nullable @@ -96,35 +111,37 @@ public class TermsAggregation extends BucketAggregationBase implements Aggregati @Nullable private final Integer size; + @Nullable + private final String valueType; + // --------------------------------------------------------------------------------------------- private TermsAggregation(Builder builder) { super(builder); - this.collectMode = builder.collectMode; this.exclude = builder.exclude; this.executionHint = builder.executionHint; this.field = builder.field; + this.format = builder.format; this.include = builder.include; this.minDocCount = builder.minDocCount; this.missing = builder.missing; - this.missingOrder = builder.missingOrder; this.missingBucket = builder.missingBucket; - this.valueType = builder.valueType; + this.missingOrder = builder.missingOrder; this.order = ApiTypeHelper.unmodifiable(builder.order); this.script = builder.script; this.shardSize = builder.shardSize; this.showTermDocCountError = builder.showTermDocCountError; this.size = builder.size; - + this.valueType = builder.valueType; } - public static TermsAggregation of(Function> fn) { + public static TermsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -163,6 +180,14 @@ public final String field() { return this.field; } + /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + /** * API name: {@code include} */ @@ -172,7 +197,10 @@ public final TermsInclude include() { } /** + * Only return values that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ @Nullable public final Integer minDocCount() { @@ -187,14 +215,6 @@ public final FieldValue missing() { return this.missing; } - /** - * API name: {@code missing_order} - */ - @Nullable - public final MissingOrder missingOrder() { - return this.missingOrder; - } - /** * API name: {@code missing_bucket} */ @@ -204,16 +224,17 @@ public final Boolean missingBucket() { } /** - * API name: {@code value_type} + * API name: {@code missing_order} */ @Nullable - public final String valueType() { - return this.valueType; + public final MissingOrder missingOrder() { + return this.missingOrder; } /** * API name: {@code order} */ + @Nonnull public final List> order() { return this.order; } @@ -227,7 +248,11 @@ public final Script script() { } /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based on + * the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ @Nullable public final Integer shardSize() { @@ -235,7 +260,11 @@ public final Integer shardSize() { } /** + * Set to true to return the doc_count_error_upper_bound, which is an upper bound to the error on the + * doc_count returned by each shard. + *

* API name: {@code show_term_doc_count_error} + *

*/ @Nullable public final Boolean showTermDocCountError() { @@ -243,63 +272,79 @@ public final Boolean showTermDocCountError() { } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { return this.size; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Coerced unmapped fields into the specified type. + *

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

+ */ + @Nullable + public final String valueType() { + return this.valueType; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); if (this.collectMode != null) { generator.writeKey("collect_mode"); this.collectMode.serialize(generator, mapper); } + if (this.exclude != null) { generator.writeKey("exclude"); this.exclude.serialize(generator, mapper); - } + if (this.executionHint != null) { generator.writeKey("execution_hint"); this.executionHint.serialize(generator, mapper); } + if (this.field != null) { generator.writeKey("field"); generator.write(this.field); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); } + if (this.include != null) { generator.writeKey("include"); this.include.serialize(generator, mapper); - } + if (this.minDocCount != null) { generator.writeKey("min_doc_count"); generator.write(this.minDocCount); - } + if (this.missing != null) { generator.writeKey("missing"); this.missing.serialize(generator, mapper); - - } - if (this.missingOrder != null) { - generator.writeKey("missing_order"); - this.missingOrder.serialize(generator, mapper); } + if (this.missingBucket != null) { generator.writeKey("missing_bucket"); generator.write(this.missingBucket); - } - if (this.valueType != null) { - generator.writeKey("value_type"); - generator.write(this.valueType); + if (this.missingOrder != null) { + generator.writeKey("missing_order"); + this.missingOrder.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.order)) { generator.writeKey("order"); generator.writeStartArray(); @@ -312,89 +357,146 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } } generator.writeEnd(); - } generator.writeEnd(); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } + if (this.showTermDocCountError != null) { generator.writeKey("show_term_doc_count_error"); generator.write(this.showTermDocCountError); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (this.valueType != null) { + generator.writeKey("value_type"); + generator.write(this.valueType); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TermsAggregation}. */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends BucketAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private TermsAggregationCollectMode collectMode; - @Nullable private TermsExclude exclude; - @Nullable private TermsAggregationExecutionHint executionHint; - @Nullable private String field; - + @Nullable + private String format; @Nullable private TermsInclude include; - @Nullable private Integer minDocCount; - @Nullable private FieldValue missing; - - @Nullable - private MissingOrder missingOrder; - @Nullable private Boolean missingBucket; - @Nullable - private String valueType; - + private MissingOrder missingOrder; @Nullable private List> order; - @Nullable private Script script; - @Nullable private Integer shardSize; - @Nullable private Boolean showTermDocCountError; - @Nullable private Integer size; + @Nullable + private String valueType; + + public Builder() {} + + private Builder(TermsAggregation o) { + super(o); + this.collectMode = o.collectMode; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.format = o.format; + this.include = o.include; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.missingBucket = o.missingBucket; + this.missingOrder = o.missingOrder; + this.order = _listCopy(o.order); + this.script = o.script; + this.shardSize = o.shardSize; + this.showTermDocCountError = o.showTermDocCountError; + this.size = o.size; + this.valueType = o.valueType; + } + + private Builder(Builder o) { + super(o); + this.collectMode = o.collectMode; + this.exclude = o.exclude; + this.executionHint = o.executionHint; + this.field = o.field; + this.format = o.format; + this.include = o.include; + this.minDocCount = o.minDocCount; + this.missing = o.missing; + this.missingBucket = o.missingBucket; + this.missingOrder = o.missingOrder; + this.order = _listCopy(o.order); + this.script = o.script; + this.shardSize = o.shardSize; + this.showTermDocCountError = o.showTermDocCountError; + this.size = o.size; + this.valueType = o.valueType; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code collect_mode} */ + @Nonnull public final Builder collectMode(@Nullable TermsAggregationCollectMode value) { this.collectMode = value; return this; @@ -403,6 +505,7 @@ public final Builder collectMode(@Nullable TermsAggregationCollectMode value) { /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(@Nullable TermsExclude value) { this.exclude = value; return this; @@ -411,13 +514,15 @@ public final Builder exclude(@Nullable TermsExclude value) { /** * API name: {@code exclude} */ + @Nonnull public final Builder exclude(Function> fn) { - return this.exclude(fn.apply(new TermsExclude.Builder()).build()); + return exclude(fn.apply(new TermsExclude.Builder()).build()); } /** * API name: {@code execution_hint} */ + @Nonnull public final Builder executionHint(@Nullable TermsAggregationExecutionHint value) { this.executionHint = value; return this; @@ -426,14 +531,25 @@ public final Builder executionHint(@Nullable TermsAggregationExecutionHint value /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } + /** + * API name: {@code format} + */ + @Nonnull + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + /** * API name: {@code include} */ + @Nonnull public final Builder include(@Nullable TermsInclude value) { this.include = value; return this; @@ -442,13 +558,18 @@ public final Builder include(@Nullable TermsInclude value) { /** * API name: {@code include} */ + @Nonnull public final Builder include(Function> fn) { - return this.include(fn.apply(new TermsInclude.Builder()).build()); + return include(fn.apply(new TermsInclude.Builder()).build()); } /** + * Only return values that are found in more than min_doc_count hits. + *

* API name: {@code min_doc_count} + *

*/ + @Nonnull public final Builder minDocCount(@Nullable Integer value) { this.minDocCount = value; return this; @@ -457,6 +578,7 @@ public final Builder minDocCount(@Nullable Integer value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(@Nullable FieldValue value) { this.missing = value; return this; @@ -465,39 +587,37 @@ public final Builder missing(@Nullable FieldValue value) { /** * API name: {@code missing} */ + @Nonnull public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); - } - - /** - * API name: {@code missing_order} - */ - public final Builder missingOrder(@Nullable MissingOrder value) { - this.missingOrder = value; - return this; + return missing(fn.apply(new FieldValue.Builder()).build()); } /** * API name: {@code missing_bucket} */ + @Nonnull public final Builder missingBucket(@Nullable Boolean value) { this.missingBucket = value; return this; } /** - * API name: {@code value_type} + * API name: {@code missing_order} */ - public final Builder valueType(@Nullable String value) { - this.valueType = value; + @Nonnull + public final Builder missingOrder(@Nullable MissingOrder value) { + this.missingOrder = value; return this; } /** * API name: {@code order} + * *

* Adds all elements of list to order. + *

*/ + @Nonnull public final Builder order(List> list) { this.order = _listAddAll(this.order, list); return this; @@ -505,9 +625,12 @@ public final Builder order(List> list) { /** * API name: {@code order} + * *

* Adds one or more values to order. + *

*/ + @Nonnull public final Builder order(Map value, Map... values) { this.order = _listAdd(this.order, value, values); return this; @@ -516,6 +639,7 @@ public final Builder order(Map value, Map. /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -524,45 +648,68 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** + * The number of candidate terms produced by each shard. By default, shard_size will be automatically estimated based + * on the number of shards and the size parameter. + *

* API name: {@code shard_size} + *

*/ + @Nonnull public final Builder shardSize(@Nullable Integer value) { this.shardSize = value; return this; } /** + * Set to true to return the doc_count_error_upper_bound, which is an upper bound to the error on the + * doc_count returned by each shard. + *

* API name: {@code show_term_doc_count_error} + *

*/ + @Nonnull public final Builder showTermDocCountError(@Nullable Boolean value) { this.showTermDocCountError = value; return this; } /** + * The number of buckets returned out of the overall terms list. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; } - @Override - protected Builder self() { + /** + * Coerced unmapped fields into the specified type. + *

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

+ */ + @Nonnull + public final Builder valueType(@Nullable String value) { + this.valueType = value; return this; } /** * Builds a {@link TermsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TermsAggregation build() { _checkSingleUse(); @@ -586,12 +733,12 @@ protected static void setupTermsAggregationDeserializer(ObjectDeserializer, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TermsExclude implements TaggedUnion, PlainJsonSerializable { + /** + * {@link TermsExclude} variant kinds. + */ public enum Kind { - Terms, - Regexp - + Regexp, + Terms } private final Kind _kind; @@ -76,27 +85,40 @@ private TermsExclude(Kind kind, Object value) { this._value = value; } + private TermsExclude(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static TermsExclude of(Function> fn) { + return fn.apply(new Builder()).build(); + } + public String _toJsonString() { switch (_kind) { - case Terms: - return this.terms().stream().map(v -> v).collect(Collectors.joining(",")); case Regexp: return this.regexp(); - + case Terms: + return String.join(",", this.terms()); default: throw new IllegalStateException("Unknown kind " + _kind); } } - private TermsExclude(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - + /** + * Is this variant instance of kind {@code regexp}? + */ + public boolean isRegexp() { + return _kind == Kind.Regexp; } - public static TermsExclude of(Function> fn) { - return fn.apply(new Builder()).build(); + /** + * Get the {@code regexp} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code regexp} kind. + */ + public String regexp() { + return TaggedUnionUtils.get(this, Kind.Regexp); } /** @@ -109,62 +131,51 @@ public boolean isTerms() { /** * Get the {@code terms} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code terms} kind. + * @throws IllegalStateException if the current variant is not the {@code terms} kind. */ public List terms() { return TaggedUnionUtils.get(this, Kind.Terms); } - /** - * Is this variant instance of kind {@code regexp}? - */ - public boolean isRegexp() { - return _kind == Kind.Regexp; - } - - /** - * Get the {@code regexp} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code regexp} kind. - */ - public String regexp() { - return TaggedUnionUtils.get(this, Kind.Regexp); - } - @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } else { switch (_kind) { + case Regexp: + generator.write(((String) this._value)); + break; case Terms: generator.writeStartArray(); for (String item0 : ((List) this._value)) { generator.write(item0); - } generator.writeEnd(); - - break; - case Regexp: - generator.write(((String) this._value)); - break; } } + } + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; - public ObjectBuilder terms(List v) { - this._kind = Kind.Terms; - this._value = v; - return this; + public Builder() {} + + private Builder(TermsExclude o) { + this._kind = o._kind; + this._value = o._value; } public ObjectBuilder regexp(String v) { @@ -173,19 +184,41 @@ public ObjectBuilder regexp(String v) { return this; } + public ObjectBuilder terms(List v) { + this._kind = Kind.Terms; + this._value = v; + return this; + } + + @Override public TermsExclude build() { _checkSingleUse(); return new TermsExclude(this); } - } private static JsonpDeserializer buildTermsExcludeDeserializer() { return new UnionDeserializer.Builder(TermsExclude::new, false).addMember( - Kind.Terms, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()) - ).addMember(Kind.Regexp, JsonpDeserializer.stringDeserializer()).build(); + Kind.Regexp, + JsonpDeserializer.stringDeserializer() + ).addMember(Kind.Terms, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())).build(); } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(TermsExclude::buildTermsExcludeDeserializer); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TermsExclude other = (TermsExclude) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java index 376b748cba..0a8a2c0274 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsInclude.java @@ -30,15 +30,23 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.PlainJsonSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -49,13 +57,15 @@ // typedef: _types.aggregations.TermsInclude @JsonpDeserializable -public class TermsInclude implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TermsInclude implements TaggedUnion, PlainJsonSerializable { + /** + * {@link TermsInclude} variant kinds. + */ public enum Kind { - Terms, Partition, - Regexp - + Regexp, + Terms } private final Kind _kind; @@ -77,33 +87,14 @@ private TermsInclude(Kind kind, Object value) { } private TermsInclude(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static TermsInclude of(Function> fn) { + public static TermsInclude of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Is this variant instance of kind {@code terms}? - */ - public boolean isTerms() { - return _kind == Kind.Terms; - } - - /** - * Get the {@code terms} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code terms} kind. - */ - public List terms() { - return TaggedUnionUtils.get(this, Kind.Terms); - } - /** * Is this variant instance of kind {@code partition}? */ @@ -114,8 +105,7 @@ public boolean isPartition() { /** * Get the {@code partition} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code partition} kind. + * @throws IllegalStateException if the current variant is not the {@code partition} kind. */ public TermsPartition partition() { return TaggedUnionUtils.get(this, Kind.Partition); @@ -131,45 +121,67 @@ public boolean isRegexp() { /** * Get the {@code regexp} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code regexp} kind. + * @throws IllegalStateException if the current variant is not the {@code regexp} kind. */ public String regexp() { return TaggedUnionUtils.get(this, Kind.Regexp); } + /** + * Is this variant instance of kind {@code terms}? + */ + public boolean isTerms() { + return _kind == Kind.Terms; + } + + /** + * Get the {@code terms} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code terms} kind. + */ + public List terms() { + return TaggedUnionUtils.get(this, Kind.Terms); + } + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } else { switch (_kind) { + case Regexp: + generator.write(((String) this._value)); + break; case Terms: generator.writeStartArray(); for (String item0 : ((List) this._value)) { generator.write(item0); - } generator.writeEnd(); - - break; - case Regexp: - generator.write(((String) this._value)); - break; } } + } + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; - public ObjectBuilder terms(List v) { - this._kind = Kind.Terms; - this._value = v; - return this; + public Builder() {} + + private Builder(TermsInclude o) { + this._kind = o._kind; + this._value = o._value; } public ObjectBuilder partition(TermsPartition v) { @@ -188,19 +200,44 @@ public ObjectBuilder regexp(String v) { return this; } + public ObjectBuilder terms(List v) { + this._kind = Kind.Terms; + this._value = v; + return this; + } + + @Override public TermsInclude build() { _checkSingleUse(); return new TermsInclude(this); } - } private static JsonpDeserializer buildTermsIncludeDeserializer() { return new UnionDeserializer.Builder(TermsInclude::new, false).addMember( - Kind.Terms, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()) - ).addMember(Kind.Partition, TermsPartition._DESERIALIZER).addMember(Kind.Regexp, JsonpDeserializer.stringDeserializer()).build(); + Kind.Partition, + TermsPartition._DESERIALIZER + ) + .addMember(Kind.Regexp, JsonpDeserializer.stringDeserializer()) + .addMember(Kind.Terms, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())) + .build(); } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(TermsInclude::buildTermsIncludeDeserializer); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TermsInclude other = (TermsInclude) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java index e456f8fd9f..7da33ac701 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsIncludeBuilders.java @@ -30,25 +30,31 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; + /** + *

* Builders for {@link TermsInclude} variants. + *

*

- * Variants terms, regexp are not available here as - * they don't have a dedicated class. Use {@link TermsInclude}'s builder for - * these. - * + * Variants regexp, terms are not available here as they don't have a dedicated class. Use {@link TermsInclude}'s + * builder for these. + *

*/ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class TermsIncludeBuilders { private TermsIncludeBuilders() {} /** - * Creates a builder for the {@link TermsPartition partition} - * {@code TermsInclude} variant. + * Creates a builder for the {@link TermsPartition partition} {@code TermsInclude} variant. */ public static TermsPartition.Builder partition() { return new TermsPartition.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java index 99b6b1b29e..d38a724446 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsPartition.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TermsPartition @JsonpDeserializable -public class TermsPartition implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TermsPartition implements PlainJsonSerializable, ToCopyableBuilder { + private final long numPartitions; private final long partition; @@ -55,25 +65,29 @@ public class TermsPartition implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private TermsPartition(Builder builder) { - this.numPartitions = ApiTypeHelper.requireNonNull(builder.numPartitions, this, "numPartitions"); this.partition = ApiTypeHelper.requireNonNull(builder.partition, this, "partition"); - } - public static TermsPartition of(Function> fn) { + public static TermsPartition of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code num_partitions} + * Required - The number of partitions. + *

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

*/ public final long numPartitions() { return this.numPartitions; } /** - * Required - API name: {@code partition} + * Required - The partition number for this request. + *

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

*/ public final long partition() { return this.partition; @@ -82,6 +96,7 @@ public final long partition() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,37 +104,70 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("num_partitions"); generator.write(this.numPartitions); generator.writeKey("partition"); generator.write(this.partition); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TermsPartition}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long numPartitions; - private Long partition; + public Builder() {} + + private Builder(TermsPartition o) { + this.numPartitions = o.numPartitions; + this.partition = o.partition; + } + + private Builder(Builder o) { + this.numPartitions = o.numPartitions; + this.partition = o.partition; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code num_partitions} + * Required - The number of partitions. + *

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

*/ + @Nonnull public final Builder numPartitions(long value) { this.numPartitions = value; return this; } /** - * Required - API name: {@code partition} + * Required - The partition number for this request. + *

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

*/ + @Nonnull public final Builder partition(long value) { this.partition = value; return this; @@ -128,9 +176,10 @@ public final Builder partition(long value) { /** * Builds a {@link TermsPartition}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TermsPartition build() { _checkSingleUse(); @@ -149,10 +198,23 @@ public TermsPartition build() { ); protected static void setupTermsPartitionDeserializer(ObjectDeserializer op) { - op.add(Builder::numPartitions, JsonpDeserializer.longDeserializer(), "num_partitions"); op.add(Builder::partition, JsonpDeserializer.longDeserializer(), "partition"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.numPartitions); + result = 31 * result + Long.hashCode(this.partition); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TermsPartition other = (TermsPartition) o; + return this.numPartitions == other.numPartitions && this.partition == other.partition; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java index a8e85cd16c..928884d8ab 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TestPopulation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -44,61 +51,66 @@ import org.opensearch.client.opensearch._types.Script; import org.opensearch.client.opensearch._types.query_dsl.Query; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TestPopulation @JsonpDeserializable -public class TestPopulation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TestPopulation implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String field; @Nullable - private final Script script; + private final Query filter; @Nullable - private final Query filter; + private final Script script; // --------------------------------------------------------------------------------------------- private TestPopulation(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.script = builder.script; this.filter = builder.filter; - + this.script = builder.script; } - public static TestPopulation of(Function> fn) { + public static TestPopulation of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } /** - * API name: {@code script} + * API name: {@code filter} */ @Nullable - public final Script script() { - return this.script; + public final Query filter() { + return this.filter; } /** - * API name: {@code filter} + * API name: {@code script} */ @Nullable - public final Query filter() { - return this.filter; + public final Script script() { + return this.script; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -106,82 +118,113 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("field"); generator.write(this.field); - if (this.script != null) { - generator.writeKey("script"); - this.script.serialize(generator, mapper); - - } if (this.filter != null) { generator.writeKey("filter"); this.filter.serialize(generator, mapper); - } + if (this.script != null) { + generator.writeKey("script"); + this.script.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TestPopulation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String field; - + @Nullable + private Query filter; @Nullable private Script script; - @Nullable - private Query filter; + public Builder() {} + + private Builder(TestPopulation o) { + this.field = o.field; + this.filter = o.filter; + this.script = o.script; + } + + private Builder(Builder o) { + this.field = o.field; + this.filter = o.filter; + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; } /** - * API name: {@code script} + * API name: {@code filter} */ - public final Builder script(@Nullable Script value) { - this.script = value; + @Nonnull + public final Builder filter(@Nullable Query value) { + this.filter = value; return this; } /** - * API name: {@code script} + * API name: {@code filter} */ - public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + @Nonnull + public final Builder filter(Function> fn) { + return filter(fn.apply(new Query.Builder()).build()); } /** - * API name: {@code filter} + * API name: {@code script} */ - public final Builder filter(@Nullable Query value) { - this.filter = value; + @Nonnull + public final Builder script(@Nullable Script value) { + this.script = value; return this; } /** - * API name: {@code filter} + * API name: {@code script} */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); + @Nonnull + public final Builder script(Function> fn) { + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link TestPopulation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TestPopulation build() { _checkSingleUse(); @@ -200,11 +243,25 @@ public TestPopulation build() { ); protected static void setupTestPopulationDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::filter, Query._DESERIALIZER, "filter"); + op.add(Builder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.filter); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TestPopulation other = (TestPopulation) o; + return this.field.equals(other.field) && Objects.equals(this.filter, other.filter) && Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java index b914ebf161..cb7e57282a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopHitsAggregation.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -47,12 +54,20 @@ import org.opensearch.client.opensearch.core.search.Highlight; import org.opensearch.client.opensearch.core.search.SourceConfig; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TopHitsAggregation @JsonpDeserializable -public class TopHitsAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TopHitsAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nonnull private final List docvalueFields; @Nullable @@ -64,16 +79,22 @@ public class TopHitsAggregation extends MetricAggregationBase implements Aggrega @Nullable private final Highlight highlight; + @Nonnull private final Map scriptFields; + @Nullable + private final Boolean seqNoPrimaryTerm; + @Nullable private final Integer size; + @Nonnull private final List sort; @Nullable private final SourceConfig source; + @Nonnull private final List storedFields; @Nullable @@ -82,35 +103,30 @@ public class TopHitsAggregation extends MetricAggregationBase implements Aggrega @Nullable private final Boolean version; - @Nullable - private final Boolean seqNoPrimaryTerm; - // --------------------------------------------------------------------------------------------- private TopHitsAggregation(Builder builder) { super(builder); - this.docvalueFields = ApiTypeHelper.unmodifiable(builder.docvalueFields); this.explain = builder.explain; this.from = builder.from; this.highlight = builder.highlight; this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields); + this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm; this.size = builder.size; this.sort = ApiTypeHelper.unmodifiable(builder.sort); this.source = builder.source; this.storedFields = ApiTypeHelper.unmodifiable(builder.storedFields); this.trackScores = builder.trackScores; this.version = builder.version; - this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm; - } - public static TopHitsAggregation of(Function> fn) { + public static TopHitsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -120,12 +136,16 @@ public Aggregation.Kind _aggregationKind() { /** * API name: {@code docvalue_fields} */ + @Nonnull public final List docvalueFields() { return this.docvalueFields; } /** + * If true, returns detailed information about score computation as part of a hit. + *

* API name: {@code explain} + *

*/ @Nullable public final Boolean explain() { @@ -133,7 +153,10 @@ public final Boolean explain() { } /** + * Starting document offset. + *

* API name: {@code from} + *

*/ @Nullable public final Integer from() { @@ -149,14 +172,32 @@ public final Highlight highlight() { } /** + * Returns the result of one or more script evaluations for each hit. + *

* API name: {@code script_fields} + *

*/ + @Nonnull public final Map scriptFields() { return this.scriptFields; } /** + * If true, returns sequence number and primary term of the last modification of each hit. + *

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

+ */ + @Nullable + public final Boolean seqNoPrimaryTerm() { + return this.seqNoPrimaryTerm; + } + + /** + * The maximum number of top matching hits to return per bucket. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -166,6 +207,7 @@ public final Integer size() { /** * API name: {@code sort} */ + @Nonnull public final List sort() { return this.sort; } @@ -181,12 +223,16 @@ public final SourceConfig source() { /** * API name: {@code stored_fields} */ + @Nonnull public final List storedFields() { return this.storedFields; } /** + * If true, calculates and returns document scores, even if the scores are not used for sorting. + *

* API name: {@code track_scores} + *

*/ @Nullable public final Boolean trackScores() { @@ -194,156 +240,194 @@ public final Boolean trackScores() { } /** + * If true, returns document version as part of a hit. + *

* API name: {@code version} + *

*/ @Nullable public final Boolean version() { return this.version; } - /** - * API name: {@code seq_no_primary_term} - */ - @Nullable - public final Boolean seqNoPrimaryTerm() { - return this.seqNoPrimaryTerm; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.docvalueFields)) { generator.writeKey("docvalue_fields"); generator.writeStartArray(); for (String item0 : this.docvalueFields) { generator.write(item0); - } generator.writeEnd(); - } + if (this.explain != null) { generator.writeKey("explain"); generator.write(this.explain); - } + if (this.from != null) { generator.writeKey("from"); generator.write(this.from); - } + if (this.highlight != null) { generator.writeKey("highlight"); this.highlight.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.scriptFields)) { generator.writeKey("script_fields"); generator.writeStartObject(); for (Map.Entry item0 : this.scriptFields.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.seqNoPrimaryTerm != null) { + generator.writeKey("seq_no_primary_term"); + generator.write(this.seqNoPrimaryTerm); } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (ApiTypeHelper.isDefined(this.sort)) { generator.writeKey("sort"); generator.writeStartArray(); for (SortOptions item0 : this.sort) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.source != null) { generator.writeKey("_source"); this.source.serialize(generator, mapper); - } + if (ApiTypeHelper.isDefined(this.storedFields)) { generator.writeKey("stored_fields"); generator.writeStartArray(); for (String item0 : this.storedFields) { generator.write(item0); - } generator.writeEnd(); - } + if (this.trackScores != null) { generator.writeKey("track_scores"); generator.write(this.trackScores); - } + if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - if (this.seqNoPrimaryTerm != null) { - generator.writeKey("seq_no_primary_term"); - generator.write(this.seqNoPrimaryTerm); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link TopHitsAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private List docvalueFields; - @Nullable private Boolean explain; - @Nullable private Integer from; - @Nullable private Highlight highlight; - @Nullable private Map scriptFields; - + @Nullable + private Boolean seqNoPrimaryTerm; @Nullable private Integer size; - @Nullable private List sort; - @Nullable private SourceConfig source; - @Nullable private List storedFields; - @Nullable private Boolean trackScores; - @Nullable private Boolean version; - @Nullable - private Boolean seqNoPrimaryTerm; + public Builder() {} + + private Builder(TopHitsAggregation o) { + super(o); + this.docvalueFields = _listCopy(o.docvalueFields); + this.explain = o.explain; + this.from = o.from; + this.highlight = o.highlight; + this.scriptFields = _mapCopy(o.scriptFields); + this.seqNoPrimaryTerm = o.seqNoPrimaryTerm; + this.size = o.size; + this.sort = _listCopy(o.sort); + this.source = o.source; + this.storedFields = _listCopy(o.storedFields); + this.trackScores = o.trackScores; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.docvalueFields = _listCopy(o.docvalueFields); + this.explain = o.explain; + this.from = o.from; + this.highlight = o.highlight; + this.scriptFields = _mapCopy(o.scriptFields); + this.seqNoPrimaryTerm = o.seqNoPrimaryTerm; + this.size = o.size; + this.sort = _listCopy(o.sort); + this.source = o.source; + this.storedFields = _listCopy(o.storedFields); + this.trackScores = o.trackScores; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } /** * API name: {@code docvalue_fields} + * *

* Adds all elements of list to docvalueFields. + *

*/ + @Nonnull public final Builder docvalueFields(List list) { this.docvalueFields = _listAddAll(this.docvalueFields, list); return this; @@ -351,25 +435,36 @@ public final Builder docvalueFields(List list) { /** * API name: {@code docvalue_fields} + * *

* Adds one or more values to docvalueFields. + *

*/ + @Nonnull public final Builder docvalueFields(String value, String... values) { this.docvalueFields = _listAdd(this.docvalueFields, value, values); return this; } /** + * If true, returns detailed information about score computation as part of a hit. + *

* API name: {@code explain} + *

*/ + @Nonnull public final Builder explain(@Nullable Boolean value) { this.explain = value; return this; } /** + * Starting document offset. + *

* API name: {@code from} + *

*/ + @Nonnull public final Builder from(@Nullable Integer value) { this.from = value; return this; @@ -378,6 +473,7 @@ public final Builder from(@Nullable Integer value) { /** * API name: {@code highlight} */ + @Nonnull public final Builder highlight(@Nullable Highlight value) { this.highlight = value; return this; @@ -386,42 +482,77 @@ public final Builder highlight(@Nullable Highlight value) { /** * API name: {@code highlight} */ + @Nonnull public final Builder highlight(Function> fn) { - return this.highlight(fn.apply(new Highlight.Builder()).build()); + return highlight(fn.apply(new Highlight.Builder()).build()); } /** + * Returns the result of one or more script evaluations for each hit. + *

* API name: {@code script_fields} + *

+ * *

- * Adds all entries of map to scriptFields. + * Adds all elements of map to scriptFields. + *

*/ + @Nonnull public final Builder scriptFields(Map map) { this.scriptFields = _mapPutAll(this.scriptFields, map); return this; } /** + * Returns the result of one or more script evaluations for each hit. + *

* API name: {@code script_fields} + *

+ * *

* Adds an entry to scriptFields. + *

*/ + @Nonnull public final Builder scriptFields(String key, ScriptField value) { this.scriptFields = _mapPut(this.scriptFields, key, value); return this; } /** + * Returns the result of one or more script evaluations for each hit. + *

* API name: {@code script_fields} + *

+ * *

- * Adds an entry to scriptFields using a builder lambda. + * Adds a value to scriptFields using a builder lambda. + *

*/ + @Nonnull public final Builder scriptFields(String key, Function> fn) { return scriptFields(key, fn.apply(new ScriptField.Builder()).build()); } /** + * If true, returns sequence number and primary term of the last modification of each hit. + *

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

+ */ + @Nonnull + public final Builder seqNoPrimaryTerm(@Nullable Boolean value) { + this.seqNoPrimaryTerm = value; + return this; + } + + /** + * The maximum number of top matching hits to return per bucket. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; @@ -429,9 +560,12 @@ public final Builder size(@Nullable Integer value) { /** * API name: {@code sort} + * *

* Adds all elements of list to sort. + *

*/ + @Nonnull public final Builder sort(List list) { this.sort = _listAddAll(this.sort, list); return this; @@ -439,9 +573,12 @@ public final Builder sort(List list) { /** * API name: {@code sort} + * *

* Adds one or more values to sort. + *

*/ + @Nonnull public final Builder sort(SortOptions value, SortOptions... values) { this.sort = _listAdd(this.sort, value, values); return this; @@ -449,9 +586,12 @@ public final Builder sort(SortOptions value, SortOptions... values) { /** * API name: {@code sort} + * *

* Adds a value to sort using a builder lambda. + *

*/ + @Nonnull public final Builder sort(Function> fn) { return sort(fn.apply(new SortOptions.Builder()).build()); } @@ -459,6 +599,7 @@ public final Builder sort(Function> fn) { - return this.source(fn.apply(new SourceConfig.Builder()).build()); + return source(fn.apply(new SourceConfig.Builder()).build()); } /** * API name: {@code stored_fields} + * *

* Adds all elements of list to storedFields. + *

*/ + @Nonnull public final Builder storedFields(List list) { this.storedFields = _listAddAll(this.storedFields, list); return this; @@ -483,49 +628,48 @@ public final Builder storedFields(List list) { /** * API name: {@code stored_fields} + * *

* Adds one or more values to storedFields. + *

*/ + @Nonnull public final Builder storedFields(String value, String... values) { this.storedFields = _listAdd(this.storedFields, value, values); return this; } /** + * If true, calculates and returns document scores, even if the scores are not used for sorting. + *

* API name: {@code track_scores} + *

*/ + @Nonnull public final Builder trackScores(@Nullable Boolean value) { this.trackScores = value; return this; } /** + * If true, returns document version as part of a hit. + *

* API name: {@code version} + *

*/ + @Nonnull public final Builder version(@Nullable Boolean value) { this.version = value; return this; } - /** - * API name: {@code seq_no_primary_term} - */ - public final Builder seqNoPrimaryTerm(@Nullable Boolean value) { - this.seqNoPrimaryTerm = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link TopHitsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TopHitsAggregation build() { _checkSingleUse(); @@ -544,20 +688,58 @@ public TopHitsAggregation build() { ); protected static void setupTopHitsAggregationDeserializer(ObjectDeserializer op) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(Builder::docvalueFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "docvalue_fields"); op.add(Builder::explain, JsonpDeserializer.booleanDeserializer(), "explain"); op.add(Builder::from, JsonpDeserializer.integerDeserializer(), "from"); op.add(Builder::highlight, Highlight._DESERIALIZER, "highlight"); op.add(Builder::scriptFields, JsonpDeserializer.stringMapDeserializer(ScriptField._DESERIALIZER), "script_fields"); + op.add(Builder::seqNoPrimaryTerm, JsonpDeserializer.booleanDeserializer(), "seq_no_primary_term"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); op.add(Builder::source, SourceConfig._DESERIALIZER, "_source"); op.add(Builder::storedFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stored_fields"); op.add(Builder::trackScores, JsonpDeserializer.booleanDeserializer(), "track_scores"); op.add(Builder::version, JsonpDeserializer.booleanDeserializer(), "version"); - op.add(Builder::seqNoPrimaryTerm, JsonpDeserializer.booleanDeserializer(), "seq_no_primary_term"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.docvalueFields); + result = 31 * result + Objects.hashCode(this.explain); + result = 31 * result + Objects.hashCode(this.from); + result = 31 * result + Objects.hashCode(this.highlight); + result = 31 * result + Objects.hashCode(this.scriptFields); + result = 31 * result + Objects.hashCode(this.seqNoPrimaryTerm); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Objects.hashCode(this.sort); + result = 31 * result + Objects.hashCode(this.source); + result = 31 * result + Objects.hashCode(this.storedFields); + result = 31 * result + Objects.hashCode(this.trackScores); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TopHitsAggregation other = (TopHitsAggregation) o; + return Objects.equals(this.docvalueFields, other.docvalueFields) + && Objects.equals(this.explain, other.explain) + && Objects.equals(this.from, other.from) + && Objects.equals(this.highlight, other.highlight) + && Objects.equals(this.scriptFields, other.scriptFields) + && Objects.equals(this.seqNoPrimaryTerm, other.seqNoPrimaryTerm) + && Objects.equals(this.size, other.size) + && Objects.equals(this.sort, other.sort) + && Objects.equals(this.source, other.source) + && Objects.equals(this.storedFields, other.storedFields) + && Objects.equals(this.trackScores, other.trackScores) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java index 06181dc039..3f93cf8ab1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsAggregation.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,36 +50,43 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.SortOptions; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TopMetricsAggregation @JsonpDeserializable -public class TopMetricsAggregation extends MetricAggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TopMetricsAggregation extends MetricAggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + + @Nonnull private final List metrics; @Nullable private final Integer size; + @Nonnull private final List sort; // --------------------------------------------------------------------------------------------- private TopMetricsAggregation(Builder builder) { super(builder); - this.metrics = ApiTypeHelper.unmodifiable(builder.metrics); this.size = builder.size; this.sort = ApiTypeHelper.unmodifiable(builder.sort); - } - public static TopMetricsAggregation of(Function> fn) { + public static TopMetricsAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -80,14 +94,21 @@ public Aggregation.Kind _aggregationKind() { } /** + * The fields of the top document to return. + *

* API name: {@code metrics} + *

*/ + @Nonnull public final List metrics() { return this.metrics; } /** + * The number of top documents from which to return metrics. + *

* API name: {@code size} + *

*/ @Nullable public final Integer size() { @@ -97,89 +118,145 @@ public final Integer size() { /** * API name: {@code sort} */ + @Nonnull public final List sort() { return this.sort; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.metrics)) { generator.writeKey("metrics"); generator.writeStartArray(); for (TopMetricsValue item0 : this.metrics) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.size != null) { generator.writeKey("size"); generator.write(this.size); - } + if (ApiTypeHelper.isDefined(this.sort)) { generator.writeKey("sort"); generator.writeStartArray(); for (SortOptions item0 : this.sort) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TopMetricsAggregation}. */ - - public static class Builder extends MetricAggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends MetricAggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private List metrics; - @Nullable private Integer size; - @Nullable private List sort; + public Builder() {} + + private Builder(TopMetricsAggregation o) { + super(o); + this.metrics = _listCopy(o.metrics); + this.size = o.size; + this.sort = _listCopy(o.sort); + } + + private Builder(Builder o) { + super(o); + this.metrics = _listCopy(o.metrics); + this.size = o.size; + this.sort = _listCopy(o.sort); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * The fields of the top document to return. + *

* API name: {@code metrics} + *

+ * *

* Adds all elements of list to metrics. + *

*/ + @Nonnull public final Builder metrics(List list) { this.metrics = _listAddAll(this.metrics, list); return this; } /** + * The fields of the top document to return. + *

* API name: {@code metrics} + *

+ * *

* Adds one or more values to metrics. + *

*/ + @Nonnull public final Builder metrics(TopMetricsValue value, TopMetricsValue... values) { this.metrics = _listAdd(this.metrics, value, values); return this; } /** + * The fields of the top document to return. + *

* API name: {@code metrics} + *

+ * *

* Adds a value to metrics using a builder lambda. + *

*/ + @Nonnull public final Builder metrics(Function> fn) { return metrics(fn.apply(new TopMetricsValue.Builder()).build()); } /** + * The number of top documents from which to return metrics. + *

* API name: {@code size} + *

*/ + @Nonnull public final Builder size(@Nullable Integer value) { this.size = value; return this; @@ -187,9 +264,12 @@ public final Builder size(@Nullable Integer value) { /** * API name: {@code sort} + * *

* Adds all elements of list to sort. + *

*/ + @Nonnull public final Builder sort(List list) { this.sort = _listAddAll(this.sort, list); return this; @@ -197,9 +277,12 @@ public final Builder sort(List list) { /** * API name: {@code sort} + * *

* Adds one or more values to sort. + *

*/ + @Nonnull public final Builder sort(SortOptions value, SortOptions... values) { this.sort = _listAdd(this.sort, value, values); return this; @@ -207,24 +290,23 @@ public final Builder sort(SortOptions value, SortOptions... values) { /** * API name: {@code sort} + * *

* Adds a value to sort using a builder lambda. + *

*/ + @Nonnull public final Builder sort(Function> fn) { return sort(fn.apply(new SortOptions.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link TopMetricsAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TopMetricsAggregation build() { _checkSingleUse(); @@ -243,11 +325,31 @@ public TopMetricsAggregation build() { ); protected static void setupTopMetricsAggregationDeserializer(ObjectDeserializer op) { - MetricAggregationBase.setupMetricAggregationBaseDeserializer(op); + setupMetricAggregationBaseDeserializer(op); op.add(Builder::metrics, JsonpDeserializer.arrayDeserializer(TopMetricsValue._DESERIALIZER), "metrics"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.metrics); + result = 31 * result + Objects.hashCode(this.size); + result = 31 * result + Objects.hashCode(this.sort); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TopMetricsAggregation other = (TopMetricsAggregation) o; + return Objects.equals(this.metrics, other.metrics) + && Objects.equals(this.size, other.size) + && Objects.equals(this.sort, other.sort); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java index dbc459c19d..16673b19f3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TopMetricsValue.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,30 +47,34 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.TopMetricsValue @JsonpDeserializable -public class TopMetricsValue implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TopMetricsValue implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String field; // --------------------------------------------------------------------------------------------- private TopMetricsValue(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - } - public static TopMetricsValue of(Function> fn) { + public static TopMetricsValue of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code field} */ + @Nonnull public final String field() { return this.field; } @@ -72,6 +82,7 @@ public final String field() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,24 +90,49 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("field"); generator.write(this.field); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TopMetricsValue}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String field; + public Builder() {} + + private Builder(TopMetricsValue o) { + this.field = o.field; + } + + private Builder(Builder o) { + this.field = o.field; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code field} */ + @Nonnull public final Builder field(String value) { this.field = value; return this; @@ -105,9 +141,10 @@ public final Builder field(String value) { /** * Builds a {@link TopMetricsValue}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TopMetricsValue build() { _checkSingleUse(); @@ -126,9 +163,21 @@ public TopMetricsValue build() { ); protected static void setupTopMetricsValueDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.field.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TopMetricsValue other = (TopMetricsValue) o; + return this.field.equals(other.field); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java index 3c56538b0c..28435722e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueCountAggregation.java @@ -30,32 +30,44 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.ValueCountAggregation @JsonpDeserializable -public class ValueCountAggregation extends FormattableMetricAggregation implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ValueCountAggregation extends FormattableMetricAggregation + implements + AggregationVariant, + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private ValueCountAggregation(Builder builder) { super(builder); - } - public static ValueCountAggregation of(Function> fn) { + public static ValueCountAggregation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -64,14 +76,42 @@ public Aggregation.Kind _aggregationKind() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ValueCountAggregation}. */ - public static class Builder extends FormattableMetricAggregation.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(ValueCountAggregation o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -79,9 +119,10 @@ protected Builder self() { /** * Builds a {@link ValueCountAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ValueCountAggregation build() { _checkSingleUse(); @@ -100,8 +141,22 @@ public ValueCountAggregation build() { ); protected static void setupValueCountAggregationDeserializer(ObjectDeserializer op) { - FormattableMetricAggregation.setupFormattableMetricAggregationDeserializer(op); + setupFormattableMetricAggregationDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java index a056bb9c03..0098be9227 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/ValueType.java @@ -30,34 +30,40 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.aggregations.ValueType + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ValueType implements JsonEnum { - String("string"), - - Long("long"), - - Double("double"), - - Number("number"), + Boolean("boolean"), Date("date"), DateNanos("date_nanos"), + Double("double"), + + GeoPoint("geo_point"), + Ip("ip"), - Numeric("numeric"), + Long("long"), - GeoPoint("geo_point"), + Number("number"), - Boolean("boolean"), + Numeric("numeric"), - ; + String("string"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java index 6f7bf6e7e9..8e8406ea5f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/VariableWidthHistogramAggregation.java @@ -30,53 +30,68 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.VariableWidthHistogramAggregation @JsonpDeserializable -public class VariableWidthHistogramAggregation implements AggregationVariant, JsonpSerializable { - @Nullable - private final String field; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class VariableWidthHistogramAggregation + implements + AggregationVariant, + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Integer buckets; @Nullable - private final Integer shardSize; + private final String field; @Nullable private final Integer initialBuffer; + @Nullable + private final Integer shardSize; + // --------------------------------------------------------------------------------------------- private VariableWidthHistogramAggregation(Builder builder) { - - this.field = builder.field; this.buckets = builder.buckets; - this.shardSize = builder.shardSize; + this.field = builder.field; this.initialBuffer = builder.initialBuffer; - + this.shardSize = builder.shardSize; } - public static VariableWidthHistogramAggregation of(Function> fn) { + public static VariableWidthHistogramAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -84,15 +99,10 @@ public Aggregation.Kind _aggregationKind() { } /** - * API name: {@code field} - */ - @Nullable - public final String field() { - return this.field; - } - - /** + * The target number of buckets. + *

* API name: {@code buckets} + *

*/ @Nullable public final Integer buckets() { @@ -100,24 +110,40 @@ public final Integer buckets() { } /** - * API name: {@code shard_size} + * API name: {@code field} */ @Nullable - public final Integer shardSize() { - return this.shardSize; + public final String field() { + return this.field; } /** + * Specifies the number of individual documents that will be stored in memory on a shard before the initial bucketing algorithm is run. + * Defaults to min(10 * shard_size, 50000). + *

* API name: {@code initial_buffer} + *

*/ @Nullable public final Integer initialBuffer() { return this.initialBuffer; } + /** + * The number of buckets that the coordinating node will request from each shard. Defaults to buckets * 50. + *

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

+ */ + @Nullable + public final Integer shardSize() { + return this.shardSize; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -125,87 +151,128 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.buckets != null) { + generator.writeKey("buckets"); + generator.write(this.buckets); + } if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } - if (this.buckets != null) { - generator.writeKey("buckets"); - generator.write(this.buckets); + if (this.initialBuffer != null) { + generator.writeKey("initial_buffer"); + generator.write(this.initialBuffer); } + if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); - } - if (this.initialBuffer != null) { - generator.writeKey("initial_buffer"); - generator.write(this.initialBuffer); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link VariableWidthHistogramAggregation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer buckets; @Nullable private String field; - @Nullable - private Integer buckets; - + private Integer initialBuffer; @Nullable private Integer shardSize; - @Nullable - private Integer initialBuffer; + public Builder() {} - /** - * API name: {@code field} - */ - public final Builder field(@Nullable String value) { - this.field = value; - return this; + private Builder(VariableWidthHistogramAggregation o) { + this.buckets = o.buckets; + this.field = o.field; + this.initialBuffer = o.initialBuffer; + this.shardSize = o.shardSize; + } + + private Builder(Builder o) { + this.buckets = o.buckets; + this.field = o.field; + this.initialBuffer = o.initialBuffer; + this.shardSize = o.shardSize; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** + * The target number of buckets. + *

* API name: {@code buckets} + *

*/ + @Nonnull public final Builder buckets(@Nullable Integer value) { this.buckets = value; return this; } /** - * API name: {@code shard_size} + * API name: {@code field} */ - public final Builder shardSize(@Nullable Integer value) { - this.shardSize = value; + @Nonnull + public final Builder field(@Nullable String value) { + this.field = value; return this; } /** + * Specifies the number of individual documents that will be stored in memory on a shard before the initial bucketing algorithm is + * run. Defaults to min(10 * shard_size, 50000). + *

* API name: {@code initial_buffer} + *

*/ + @Nonnull public final Builder initialBuffer(@Nullable Integer value) { this.initialBuffer = value; return this; } + /** + * The number of buckets that the coordinating node will request from each shard. Defaults to buckets * 50. + *

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

+ */ + @Nonnull + public final Builder shardSize(@Nullable Integer value) { + this.shardSize = value; + return this; + } + /** * Builds a {@link VariableWidthHistogramAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public VariableWidthHistogramAggregation build() { _checkSingleUse(); @@ -226,12 +293,30 @@ public VariableWidthHistogramAggregation build() { protected static void setupVariableWidthHistogramAggregationDeserializer( ObjectDeserializer op ) { - - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::buckets, JsonpDeserializer.integerDeserializer(), "buckets"); - op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::initialBuffer, JsonpDeserializer.integerDeserializer(), "initial_buffer"); + op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.buckets); + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.initialBuffer); + result = 31 * result + Objects.hashCode(this.shardSize); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + VariableWidthHistogramAggregation other = (VariableWidthHistogramAggregation) o; + return Objects.equals(this.buckets, other.buckets) + && Objects.equals(this.field, other.field) + && Objects.equals(this.initialBuffer, other.initialBuffer) + && Objects.equals(this.shardSize, other.shardSize); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java index 3459a723bb..d5a65518d2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageAggregation.java @@ -30,22 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; 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.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.WeightedAverageAggregation @JsonpDeserializable -public class WeightedAverageAggregation extends AggregationBase implements AggregationVariant { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class WeightedAverageAggregation extends AggregationBase + implements + AggregationVariant, + ToCopyableBuilder { + @Nullable private final String format; @@ -62,20 +76,20 @@ public class WeightedAverageAggregation extends AggregationBase implements Aggre private WeightedAverageAggregation(Builder builder) { super(builder); - this.format = builder.format; this.value = builder.value; this.valueType = builder.valueType; this.weight = builder.weight; - } - public static WeightedAverageAggregation of(Function> fn) { + public static WeightedAverageAggregation of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Aggregation variant kind. + * {@link Aggregation} variant kind. */ @Override public Aggregation.Kind _aggregationKind() { @@ -83,7 +97,10 @@ public Aggregation.Kind _aggregationKind() { } /** + * A numeric response formatter. + *

* API name: {@code format} + *

*/ @Nullable public final String format() { @@ -115,52 +132,93 @@ public final WeightedAverageValue weight() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.format != null) { generator.writeKey("format"); generator.write(this.format); - } + if (this.value != null) { generator.writeKey("value"); this.value.serialize(generator, mapper); - } + if (this.valueType != null) { generator.writeKey("value_type"); this.valueType.serialize(generator, mapper); } + if (this.weight != null) { generator.writeKey("weight"); this.weight.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link WeightedAverageAggregation}. */ - - public static class Builder extends AggregationBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends AggregationBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private String format; - @Nullable private WeightedAverageValue value; - @Nullable private ValueType valueType; - @Nullable private WeightedAverageValue weight; + public Builder() {} + + private Builder(WeightedAverageAggregation o) { + super(o); + this.format = o.format; + this.value = o.value; + this.valueType = o.valueType; + this.weight = o.weight; + } + + private Builder(Builder o) { + super(o); + this.format = o.format; + this.value = o.value; + this.valueType = o.valueType; + this.weight = o.weight; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** + * A numeric response formatter. + *

* API name: {@code format} + *

*/ + @Nonnull public final Builder format(@Nullable String value) { this.format = value; return this; @@ -169,6 +227,7 @@ public final Builder format(@Nullable String value) { /** * API name: {@code value} */ + @Nonnull public final Builder value(@Nullable WeightedAverageValue value) { this.value = value; return this; @@ -177,13 +236,15 @@ public final Builder value(@Nullable WeightedAverageValue value) { /** * API name: {@code value} */ + @Nonnull public final Builder value(Function> fn) { - return this.value(fn.apply(new WeightedAverageValue.Builder()).build()); + return value(fn.apply(new WeightedAverageValue.Builder()).build()); } /** * API name: {@code value_type} */ + @Nonnull public final Builder valueType(@Nullable ValueType value) { this.valueType = value; return this; @@ -192,6 +253,7 @@ public final Builder valueType(@Nullable ValueType value) { /** * API name: {@code weight} */ + @Nonnull public final Builder weight(@Nullable WeightedAverageValue value) { this.weight = value; return this; @@ -200,21 +262,18 @@ public final Builder weight(@Nullable WeightedAverageValue value) { /** * API name: {@code weight} */ + @Nonnull public final Builder weight(Function> fn) { - return this.weight(fn.apply(new WeightedAverageValue.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + return weight(fn.apply(new WeightedAverageValue.Builder()).build()); } /** * Builds a {@link WeightedAverageAggregation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public WeightedAverageAggregation build() { _checkSingleUse(); @@ -238,7 +297,29 @@ protected static void setupWeightedAverageAggregationDeserializer(ObjectDeserial op.add(Builder::value, WeightedAverageValue._DESERIALIZER, "value"); op.add(Builder::valueType, ValueType._DESERIALIZER, "value_type"); op.add(Builder::weight, WeightedAverageValue._DESERIALIZER, "weight"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.format); + result = 31 * result + Objects.hashCode(this.value); + result = 31 * result + Objects.hashCode(this.valueType); + result = 31 * result + Objects.hashCode(this.weight); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + WeightedAverageAggregation other = (WeightedAverageAggregation) o; + return Objects.equals(this.format, other.format) + && Objects.equals(this.value, other.value) + && Objects.equals(this.valueType, other.valueType) + && Objects.equals(this.weight, other.weight); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java index c7fbfb179b..0e9ac3917a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/WeightedAverageValue.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types.aggregations; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,13 +49,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.aggregations.WeightedAverageValue @JsonpDeserializable -public class WeightedAverageValue implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class WeightedAverageValue implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final String field; @@ -61,14 +72,12 @@ public class WeightedAverageValue implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private WeightedAverageValue(Builder builder) { - this.field = builder.field; this.missing = builder.missing; this.script = builder.script; - } - public static WeightedAverageValue of(Function> fn) { + public static WeightedAverageValue of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -81,7 +90,10 @@ public final String field() { } /** + * A value or weight to use if the field is missing. + *

* API name: {@code missing} + *

*/ @Nullable public final Double missing() { @@ -99,6 +111,7 @@ public final Script script() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -106,52 +119,82 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.field != null) { generator.writeKey("field"); generator.write(this.field); - } + if (this.missing != null) { generator.writeKey("missing"); generator.write(this.missing); - } + if (this.script != null) { generator.writeKey("script"); this.script.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link WeightedAverageValue}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String field; - @Nullable private Double missing; - @Nullable private Script script; + public Builder() {} + + private Builder(WeightedAverageValue o) { + this.field = o.field; + this.missing = o.missing; + this.script = o.script; + } + + private Builder(Builder o) { + this.field = o.field; + this.missing = o.missing; + this.script = o.script; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code field} */ + @Nonnull public final Builder field(@Nullable String value) { this.field = value; return this; } /** + * A value or weight to use if the field is missing. + *

* API name: {@code missing} + *

*/ + @Nonnull public final Builder missing(@Nullable Double value) { this.missing = value; return this; @@ -160,6 +203,7 @@ public final Builder missing(@Nullable Double value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(@Nullable Script value) { this.script = value; return this; @@ -168,16 +212,18 @@ public final Builder script(@Nullable Script value) { /** * API name: {@code script} */ + @Nonnull public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); + return script(fn.apply(new Script.Builder()).build()); } /** * Builds a {@link WeightedAverageValue}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public WeightedAverageValue build() { _checkSingleUse(); @@ -196,11 +242,27 @@ public WeightedAverageValue build() { ); protected static void setupWeightedAverageValueDeserializer(ObjectDeserializer op) { - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::missing, JsonpDeserializer.doubleDeserializer(), "missing"); op.add(Builder::script, Script._DESERIALIZER, "script"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.field); + result = 31 * result + Objects.hashCode(this.missing); + result = 31 * result + Objects.hashCode(this.script); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + WeightedAverageValue other = (WeightedAverageValue) o; + return Objects.equals(this.field, other.field) + && Objects.equals(this.missing, other.missing) + && Objects.equals(this.script, other.script); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/CountRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/CountRequest.java index 8417c59c2c..73e4612079 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/CountRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/CountRequest.java @@ -210,8 +210,7 @@ public final String df() { } /** - * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard - * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + * Specifies the type of index that wildcard expressions can match. Supports comma-separated values. *

* API name: {@code expand_wildcards} *

@@ -516,8 +515,7 @@ public final Builder df(@Nullable String value) { } /** - * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard - * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + * Specifies the type of index that wildcard expressions can match. Supports comma-separated values. *

* API name: {@code expand_wildcards} *

@@ -533,8 +531,7 @@ public final Builder expandWildcards(List list) { } /** - * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard - * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. + * Specifies the type of index that wildcard expressions can match. Supports comma-separated values. *

* API name: {@code expand_wildcards} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/AlgorithmOperations.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/AlgorithmOperations.java new file mode 100644 index 0000000000..93d3c59985 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/AlgorithmOperations.java @@ -0,0 +1,335 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.AlgorithmOperations + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AlgorithmOperations implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Deploy deploy; + + @Nullable + private final Predict predict; + + @Nullable + private final Register register; + + @Nullable + private final Train train; + + @Nullable + private final Undeploy undeploy; + + // --------------------------------------------------------------------------------------------- + + private AlgorithmOperations(Builder builder) { + this.deploy = builder.deploy; + this.predict = builder.predict; + this.register = builder.register; + this.train = builder.train; + this.undeploy = builder.undeploy; + } + + public static AlgorithmOperations of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code deploy} + */ + @Nullable + public final Deploy deploy() { + return this.deploy; + } + + /** + * API name: {@code predict} + */ + @Nullable + public final Predict predict() { + return this.predict; + } + + /** + * API name: {@code register} + */ + @Nullable + public final Register register() { + return this.register; + } + + /** + * API name: {@code train} + */ + @Nullable + public final Train train() { + return this.train; + } + + /** + * API name: {@code undeploy} + */ + @Nullable + public final Undeploy undeploy() { + return this.undeploy; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.deploy != null) { + generator.writeKey("deploy"); + this.deploy.serialize(generator, mapper); + } + + if (this.predict != null) { + generator.writeKey("predict"); + this.predict.serialize(generator, mapper); + } + + if (this.register != null) { + generator.writeKey("register"); + this.register.serialize(generator, mapper); + } + + if (this.train != null) { + generator.writeKey("train"); + this.train.serialize(generator, mapper); + } + + if (this.undeploy != null) { + generator.writeKey("undeploy"); + this.undeploy.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link AlgorithmOperations}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Deploy deploy; + @Nullable + private Predict predict; + @Nullable + private Register register; + @Nullable + private Train train; + @Nullable + private Undeploy undeploy; + + public Builder() {} + + private Builder(AlgorithmOperations o) { + this.deploy = o.deploy; + this.predict = o.predict; + this.register = o.register; + this.train = o.train; + this.undeploy = o.undeploy; + } + + private Builder(Builder o) { + this.deploy = o.deploy; + this.predict = o.predict; + this.register = o.register; + this.train = o.train; + this.undeploy = o.undeploy; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code deploy} + */ + @Nonnull + public final Builder deploy(@Nullable Deploy value) { + this.deploy = value; + return this; + } + + /** + * API name: {@code deploy} + */ + @Nonnull + public final Builder deploy(Function> fn) { + return deploy(fn.apply(new Deploy.Builder()).build()); + } + + /** + * API name: {@code predict} + */ + @Nonnull + public final Builder predict(@Nullable Predict value) { + this.predict = value; + return this; + } + + /** + * API name: {@code predict} + */ + @Nonnull + public final Builder predict(Function> fn) { + return predict(fn.apply(new Predict.Builder()).build()); + } + + /** + * API name: {@code register} + */ + @Nonnull + public final Builder register(@Nullable Register value) { + this.register = value; + return this; + } + + /** + * API name: {@code register} + */ + @Nonnull + public final Builder register(Function> fn) { + return register(fn.apply(new Register.Builder()).build()); + } + + /** + * API name: {@code train} + */ + @Nonnull + public final Builder train(@Nullable Train value) { + this.train = value; + return this; + } + + /** + * API name: {@code train} + */ + @Nonnull + public final Builder train(Function> fn) { + return train(fn.apply(new Train.Builder()).build()); + } + + /** + * API name: {@code undeploy} + */ + @Nonnull + public final Builder undeploy(@Nullable Undeploy value) { + this.undeploy = value; + return this; + } + + /** + * API name: {@code undeploy} + */ + @Nonnull + public final Builder undeploy(Function> fn) { + return undeploy(fn.apply(new Undeploy.Builder()).build()); + } + + /** + * Builds a {@link AlgorithmOperations}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public AlgorithmOperations build() { + _checkSingleUse(); + + return new AlgorithmOperations(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AlgorithmOperations} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + AlgorithmOperations::setupAlgorithmOperationsDeserializer + ); + + protected static void setupAlgorithmOperationsDeserializer(ObjectDeserializer op) { + op.add(Builder::deploy, Deploy._DESERIALIZER, "deploy"); + op.add(Builder::predict, Predict._DESERIALIZER, "predict"); + op.add(Builder::register, Register._DESERIALIZER, "register"); + op.add(Builder::train, Train._DESERIALIZER, "train"); + op.add(Builder::undeploy, Undeploy._DESERIALIZER, "undeploy"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.deploy); + result = 31 * result + Objects.hashCode(this.predict); + result = 31 * result + Objects.hashCode(this.register); + result = 31 * result + Objects.hashCode(this.train); + result = 31 * result + Objects.hashCode(this.undeploy); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AlgorithmOperations other = (AlgorithmOperations) o; + return Objects.equals(this.deploy, other.deploy) + && Objects.equals(this.predict, other.predict) + && Objects.equals(this.register, other.register) + && Objects.equals(this.train, other.train) + && Objects.equals(this.undeploy, other.undeploy); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Deploy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Deploy.java new file mode 100644 index 0000000000..5b88341e1e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Deploy.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.Deploy + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Deploy implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long mlActionFailureCount; + + @Nullable + private final Long mlActionRequestCount; + + @Nullable + private final Long mlExecutingTaskCount; + + // --------------------------------------------------------------------------------------------- + + private Deploy(Builder builder) { + this.mlActionFailureCount = builder.mlActionFailureCount; + this.mlActionRequestCount = builder.mlActionRequestCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + } + + public static Deploy of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlActionFailureCount() { + return this.mlActionFailureCount; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlActionRequestCount() { + return this.mlActionRequestCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlActionFailureCount != null) { + generator.writeKey("ml_action_failure_count"); + generator.write(this.mlActionFailureCount); + } + + if (this.mlActionRequestCount != null) { + generator.writeKey("ml_action_request_count"); + generator.write(this.mlActionRequestCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Deploy}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long mlActionFailureCount; + @Nullable + private Long mlActionRequestCount; + @Nullable + private Long mlExecutingTaskCount; + + public Builder() {} + + private Builder(Deploy o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + private Builder(Builder o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlActionFailureCount(@Nullable Long value) { + this.mlActionFailureCount = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlActionRequestCount(@Nullable Long value) { + this.mlActionRequestCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * Builds a {@link Deploy}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Deploy build() { + _checkSingleUse(); + + return new Deploy(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Deploy} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Deploy::setupDeployDeserializer + ); + + protected static void setupDeployDeserializer(ObjectDeserializer op) { + op.add(Builder::mlActionFailureCount, JsonpDeserializer.longDeserializer(), "ml_action_failure_count"); + op.add(Builder::mlActionRequestCount, JsonpDeserializer.longDeserializer(), "ml_action_request_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlActionFailureCount); + result = 31 * result + Objects.hashCode(this.mlActionRequestCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Deploy other = (Deploy) o; + return Objects.equals(this.mlActionFailureCount, other.mlActionFailureCount) + && Objects.equals(this.mlActionRequestCount, other.mlActionRequestCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java index 4c702d8790..38bf9ad304 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java @@ -56,7 +56,11 @@ public static GetAllMemoriesRequest of(Functionmax_results, the response + * returns only the number of memories that exist. Default is 10. + *

* API name: {@code max_results} + *

*/ @Nullable public final Integer maxResults() { @@ -64,7 +68,12 @@ public final Integer maxResults() { } /** + * The index of the first memory in the sorted list of memories to return. Memories are ordered by create_time. For + * example, if memories A, B, and C exist, next_token=1 returns memories + * B and C. Default is 0 (return all memories). + *

* API name: {@code next_token} + *

*/ @Nullable public final Integer nextToken() { @@ -120,7 +129,11 @@ protected Builder self() { } /** + * The maximum number of results to return. If there are fewer memories than the number set in max_results, the + * response returns only the number of memories that exist. Default is 10. + *

* API name: {@code max_results} + *

*/ @Nonnull public final Builder maxResults(@Nullable Integer value) { @@ -129,7 +142,12 @@ public final Builder maxResults(@Nullable Integer value) { } /** + * The index of the first memory in the sorted list of memories to return. Memories are ordered by create_time. For + * example, if memories A, B, and C exist, next_token=1 returns memories + * B and C. Default is 0 (return all memories). + *

* API name: {@code next_token} + *

*/ @Nonnull public final Builder nextToken(@Nullable Integer value) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsRequest.java new file mode 100644 index 0000000000..ecf1129b3b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsRequest.java @@ -0,0 +1,223 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_stats.Request + +/** + * Get stats. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetStatsRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final String nodeId; + + @Nullable + private final String stat; + + // --------------------------------------------------------------------------------------------- + + private GetStatsRequest(Builder builder) { + super(builder); + this.nodeId = builder.nodeId; + this.stat = builder.stat; + } + + public static GetStatsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code node_id} + */ + @Nullable + public final String nodeId() { + return this.nodeId; + } + + /** + * API name: {@code stat} + */ + @Nullable + public final String stat() { + return this.stat; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetStatsRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String nodeId; + @Nullable + private String stat; + + public Builder() {} + + private Builder(GetStatsRequest o) { + super(o); + this.nodeId = o.nodeId; + this.stat = o.stat; + } + + private Builder(Builder o) { + super(o); + this.nodeId = o.nodeId; + this.stat = o.stat; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code node_id} + */ + @Nonnull + public final Builder nodeId(@Nullable String value) { + this.nodeId = value; + return this; + } + + /** + * API name: {@code stat} + */ + @Nonnull + public final Builder stat(@Nullable String value) { + this.stat = value; + return this; + } + + /** + * Builds a {@link GetStatsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetStatsRequest build() { + _checkSingleUse(); + + return new GetStatsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_stats}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _nodeId = 1 << 0; + final int _stat = 1 << 1; + + int propsSet = 0; + + if (request.nodeId() != null) propsSet |= _nodeId; + if (request.stat() != null) propsSet |= _stat; + + if (propsSet == 0) { + return "/_plugins/_ml/stats"; + } + if (propsSet == (_nodeId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/"); + SimpleEndpoint.pathEncode(request.nodeId, buf); + buf.append("/stats/"); + return buf.toString(); + } + if (propsSet == (_nodeId | _stat)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/"); + SimpleEndpoint.pathEncode(request.nodeId, buf); + buf.append("/stats/"); + SimpleEndpoint.pathEncode(request.stat, buf); + return buf.toString(); + } + if (propsSet == (_stat)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/stats/"); + SimpleEndpoint.pathEncode(request.stat, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetStatsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodeId); + result = 31 * result + Objects.hashCode(this.stat); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetStatsRequest other = (GetStatsRequest) o; + return Objects.equals(this.nodeId, other.nodeId) && Objects.equals(this.stat, other.stat); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsResponse.java new file mode 100644 index 0000000000..4c2120703d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetStatsResponse.java @@ -0,0 +1,472 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_stats.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetStatsResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String mlConfigIndexStatus; + + @Nullable + private final Long mlConnectorCount; + + @Nullable + private final String mlConnectorIndexStatus; + + @Nullable + private final String mlControllerIndexStatus; + + @Nullable + private final Long mlModelCount; + + @Nullable + private final String mlModelIndexStatus; + + @Nullable + private final String mlTaskIndexStatus; + + @Nonnull + private final Map nodes; + + // --------------------------------------------------------------------------------------------- + + private GetStatsResponse(Builder builder) { + this.mlConfigIndexStatus = builder.mlConfigIndexStatus; + this.mlConnectorCount = builder.mlConnectorCount; + this.mlConnectorIndexStatus = builder.mlConnectorIndexStatus; + this.mlControllerIndexStatus = builder.mlControllerIndexStatus; + this.mlModelCount = builder.mlModelCount; + this.mlModelIndexStatus = builder.mlModelIndexStatus; + this.mlTaskIndexStatus = builder.mlTaskIndexStatus; + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + } + + public static GetStatsResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The config index status. + *

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

+ */ + @Nullable + public final String mlConfigIndexStatus() { + return this.mlConfigIndexStatus; + } + + /** + * The connector count. + *

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

+ */ + @Nullable + public final Long mlConnectorCount() { + return this.mlConnectorCount; + } + + /** + * The connector index status. + *

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

+ */ + @Nullable + public final String mlConnectorIndexStatus() { + return this.mlConnectorIndexStatus; + } + + /** + * The controller index status. + *

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

+ */ + @Nullable + public final String mlControllerIndexStatus() { + return this.mlControllerIndexStatus; + } + + /** + * The model count. + *

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

+ */ + @Nullable + public final Long mlModelCount() { + return this.mlModelCount; + } + + /** + * The model index status. + *

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

+ */ + @Nullable + public final String mlModelIndexStatus() { + return this.mlModelIndexStatus; + } + + /** + * The task index status. + *

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

+ */ + @Nullable + public final String mlTaskIndexStatus() { + return this.mlTaskIndexStatus; + } + + /** + * API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlConfigIndexStatus != null) { + generator.writeKey("ml_config_index_status"); + generator.write(this.mlConfigIndexStatus); + } + + if (this.mlConnectorCount != null) { + generator.writeKey("ml_connector_count"); + generator.write(this.mlConnectorCount); + } + + if (this.mlConnectorIndexStatus != null) { + generator.writeKey("ml_connector_index_status"); + generator.write(this.mlConnectorIndexStatus); + } + + if (this.mlControllerIndexStatus != null) { + generator.writeKey("ml_controller_index_status"); + generator.write(this.mlControllerIndexStatus); + } + + if (this.mlModelCount != null) { + generator.writeKey("ml_model_count"); + generator.write(this.mlModelCount); + } + + if (this.mlModelIndexStatus != null) { + generator.writeKey("ml_model_index_status"); + generator.write(this.mlModelIndexStatus); + } + + if (this.mlTaskIndexStatus != null) { + generator.writeKey("ml_task_index_status"); + generator.write(this.mlTaskIndexStatus); + } + + if (ApiTypeHelper.isDefined(this.nodes)) { + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetStatsResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String mlConfigIndexStatus; + @Nullable + private Long mlConnectorCount; + @Nullable + private String mlConnectorIndexStatus; + @Nullable + private String mlControllerIndexStatus; + @Nullable + private Long mlModelCount; + @Nullable + private String mlModelIndexStatus; + @Nullable + private String mlTaskIndexStatus; + @Nullable + private Map nodes; + + public Builder() {} + + private Builder(GetStatsResponse o) { + this.mlConfigIndexStatus = o.mlConfigIndexStatus; + this.mlConnectorCount = o.mlConnectorCount; + this.mlConnectorIndexStatus = o.mlConnectorIndexStatus; + this.mlControllerIndexStatus = o.mlControllerIndexStatus; + this.mlModelCount = o.mlModelCount; + this.mlModelIndexStatus = o.mlModelIndexStatus; + this.mlTaskIndexStatus = o.mlTaskIndexStatus; + this.nodes = _mapCopy(o.nodes); + } + + private Builder(Builder o) { + this.mlConfigIndexStatus = o.mlConfigIndexStatus; + this.mlConnectorCount = o.mlConnectorCount; + this.mlConnectorIndexStatus = o.mlConnectorIndexStatus; + this.mlControllerIndexStatus = o.mlControllerIndexStatus; + this.mlModelCount = o.mlModelCount; + this.mlModelIndexStatus = o.mlModelIndexStatus; + this.mlTaskIndexStatus = o.mlTaskIndexStatus; + this.nodes = _mapCopy(o.nodes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The config index status. + *

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

+ */ + @Nonnull + public final Builder mlConfigIndexStatus(@Nullable String value) { + this.mlConfigIndexStatus = value; + return this; + } + + /** + * The connector count. + *

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

+ */ + @Nonnull + public final Builder mlConnectorCount(@Nullable Long value) { + this.mlConnectorCount = value; + return this; + } + + /** + * The connector index status. + *

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

+ */ + @Nonnull + public final Builder mlConnectorIndexStatus(@Nullable String value) { + this.mlConnectorIndexStatus = value; + return this; + } + + /** + * The controller index status. + *

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

+ */ + @Nonnull + public final Builder mlControllerIndexStatus(@Nullable String value) { + this.mlControllerIndexStatus = value; + return this; + } + + /** + * The model count. + *

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

+ */ + @Nonnull + public final Builder mlModelCount(@Nullable Long value) { + this.mlModelCount = value; + return this; + } + + /** + * The model index status. + *

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

+ */ + @Nonnull + public final Builder mlModelIndexStatus(@Nullable String value) { + this.mlModelIndexStatus = value; + return this; + } + + /** + * The task index status. + *

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

+ */ + @Nonnull + public final Builder mlTaskIndexStatus(@Nullable String value) { + this.mlTaskIndexStatus = value; + return this; + } + + /** + * API name: {@code nodes} + * + *

+ * Adds all elements of map to nodes. + *

+ */ + @Nonnull + public final Builder nodes(Map map) { + this.nodes = _mapPutAll(this.nodes, map); + return this; + } + + /** + * API name: {@code nodes} + * + *

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, NodeStatsDetails value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + + /** + * API name: {@code nodes} + * + *

+ * Adds a value to nodes using a builder lambda. + *

+ */ + @Nonnull + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new NodeStatsDetails.Builder()).build()); + } + + /** + * Builds a {@link GetStatsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetStatsResponse build() { + _checkSingleUse(); + + return new GetStatsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetStatsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetStatsResponse::setupGetStatsResponseDeserializer + ); + + protected static void setupGetStatsResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::mlConfigIndexStatus, JsonpDeserializer.stringDeserializer(), "ml_config_index_status"); + op.add(Builder::mlConnectorCount, JsonpDeserializer.longDeserializer(), "ml_connector_count"); + op.add(Builder::mlConnectorIndexStatus, JsonpDeserializer.stringDeserializer(), "ml_connector_index_status"); + op.add(Builder::mlControllerIndexStatus, JsonpDeserializer.stringDeserializer(), "ml_controller_index_status"); + op.add(Builder::mlModelCount, JsonpDeserializer.longDeserializer(), "ml_model_count"); + op.add(Builder::mlModelIndexStatus, JsonpDeserializer.stringDeserializer(), "ml_model_index_status"); + op.add(Builder::mlTaskIndexStatus, JsonpDeserializer.stringDeserializer(), "ml_task_index_status"); + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(NodeStatsDetails._DESERIALIZER), "nodes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlConfigIndexStatus); + result = 31 * result + Objects.hashCode(this.mlConnectorCount); + result = 31 * result + Objects.hashCode(this.mlConnectorIndexStatus); + result = 31 * result + Objects.hashCode(this.mlControllerIndexStatus); + result = 31 * result + Objects.hashCode(this.mlModelCount); + result = 31 * result + Objects.hashCode(this.mlModelIndexStatus); + result = 31 * result + Objects.hashCode(this.mlTaskIndexStatus); + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetStatsResponse other = (GetStatsResponse) o; + return Objects.equals(this.mlConfigIndexStatus, other.mlConfigIndexStatus) + && Objects.equals(this.mlConnectorCount, other.mlConnectorCount) + && Objects.equals(this.mlConnectorIndexStatus, other.mlConnectorIndexStatus) + && Objects.equals(this.mlControllerIndexStatus, other.mlControllerIndexStatus) + && Objects.equals(this.mlModelCount, other.mlModelCount) + && Objects.equals(this.mlModelIndexStatus, other.mlModelIndexStatus) + && Objects.equals(this.mlTaskIndexStatus, other.mlTaskIndexStatus) + && Objects.equals(this.nodes, other.nodes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java index 737bd47fe5..5d383a8b4f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java @@ -37,6 +37,9 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class ModelProfile implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable + private final Deploy deploy; + @Nullable private final Long memorySizeEstimationCpu; @@ -46,27 +49,44 @@ public class ModelProfile implements PlainJsonSerializable, ToCopyableBuilder> targetWorkerNodes; + @Nullable + private final Train train; + + @Nullable + private final Undeploy undeploy; + @Nonnull private final List> workerNodes; // --------------------------------------------------------------------------------------------- private ModelProfile(Builder builder) { + this.deploy = builder.deploy; this.memorySizeEstimationCpu = builder.memorySizeEstimationCpu; this.memorySizeEstimationGpu = builder.memorySizeEstimationGpu; this.modelState = builder.modelState; + this.predict = builder.predict; this.predictRequestStats = builder.predictRequestStats; this.predictor = builder.predictor; + this.register = builder.register; this.targetWorkerNodes = ApiTypeHelper.unmodifiable(builder.targetWorkerNodes); + this.train = builder.train; + this.undeploy = builder.undeploy; this.workerNodes = ApiTypeHelper.unmodifiable(builder.workerNodes); } @@ -74,6 +94,14 @@ public static ModelProfile of(Function @@ -107,6 +135,14 @@ public final String modelState() { return this.modelState; } + /** + * API name: {@code predict} + */ + @Nullable + public final Predict predict() { + return this.predict; + } + /** * API name: {@code predict_request_stats} */ @@ -126,6 +162,14 @@ public final String predictor() { return this.predictor; } + /** + * API name: {@code register} + */ + @Nullable + public final Register register() { + return this.register; + } + /** * API name: {@code target_worker_nodes} */ @@ -134,6 +178,22 @@ public final List> targetWorkerNodes() { return this.targetWorkerNodes; } + /** + * API name: {@code train} + */ + @Nullable + public final Train train() { + return this.train; + } + + /** + * API name: {@code undeploy} + */ + @Nullable + public final Undeploy undeploy() { + return this.undeploy; + } + /** * API name: {@code worker_nodes} */ @@ -153,6 +213,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.deploy != null) { + generator.writeKey("deploy"); + this.deploy.serialize(generator, mapper); + } + if (this.memorySizeEstimationCpu != null) { generator.writeKey("memory_size_estimation_cpu"); generator.write(this.memorySizeEstimationCpu); @@ -168,6 +233,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.modelState); } + if (this.predict != null) { + generator.writeKey("predict"); + this.predict.serialize(generator, mapper); + } + if (this.predictRequestStats != null) { generator.writeKey("predict_request_stats"); this.predictRequestStats.serialize(generator, mapper); @@ -178,6 +248,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.predictor); } + if (this.register != null) { + generator.writeKey("register"); + this.register.serialize(generator, mapper); + } + if (ApiTypeHelper.isDefined(this.targetWorkerNodes)) { generator.writeKey("target_worker_nodes"); generator.writeStartArray(); @@ -191,6 +266,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.train != null) { + generator.writeKey("train"); + this.train.serialize(generator, mapper); + } + + if (this.undeploy != null) { + generator.writeKey("undeploy"); + this.undeploy.serialize(generator, mapper); + } + if (ApiTypeHelper.isDefined(this.workerNodes)) { generator.writeKey("worker_nodes"); generator.writeStartArray(); @@ -222,6 +307,8 @@ public static Builder builder() { * Builder for {@link ModelProfile}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Deploy deploy; @Nullable private Long memorySizeEstimationCpu; @Nullable @@ -229,33 +316,51 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder @Nullable private String modelState; @Nullable + private Predict predict; + @Nullable private PredictRequestStats predictRequestStats; @Nullable private String predictor; @Nullable + private Register register; + @Nullable private List> targetWorkerNodes; @Nullable + private Train train; + @Nullable + private Undeploy undeploy; + @Nullable private List> workerNodes; public Builder() {} private Builder(ModelProfile o) { + this.deploy = o.deploy; this.memorySizeEstimationCpu = o.memorySizeEstimationCpu; this.memorySizeEstimationGpu = o.memorySizeEstimationGpu; this.modelState = o.modelState; + this.predict = o.predict; this.predictRequestStats = o.predictRequestStats; this.predictor = o.predictor; + this.register = o.register; this.targetWorkerNodes = _listCopy(o.targetWorkerNodes); + this.train = o.train; + this.undeploy = o.undeploy; this.workerNodes = _listCopy(o.workerNodes); } private Builder(Builder o) { + this.deploy = o.deploy; this.memorySizeEstimationCpu = o.memorySizeEstimationCpu; this.memorySizeEstimationGpu = o.memorySizeEstimationGpu; this.modelState = o.modelState; + this.predict = o.predict; this.predictRequestStats = o.predictRequestStats; this.predictor = o.predictor; + this.register = o.register; this.targetWorkerNodes = _listCopy(o.targetWorkerNodes); + this.train = o.train; + this.undeploy = o.undeploy; this.workerNodes = _listCopy(o.workerNodes); } @@ -265,6 +370,23 @@ public Builder copy() { return new Builder(this); } + /** + * API name: {@code deploy} + */ + @Nonnull + public final Builder deploy(@Nullable Deploy value) { + this.deploy = value; + return this; + } + + /** + * API name: {@code deploy} + */ + @Nonnull + public final Builder deploy(Function> fn) { + return deploy(fn.apply(new Deploy.Builder()).build()); + } + /** * The estimated memory size in CPU. *

@@ -301,6 +423,23 @@ public final Builder modelState(@Nullable String value) { return this; } + /** + * API name: {@code predict} + */ + @Nonnull + public final Builder predict(@Nullable Predict value) { + this.predict = value; + return this; + } + + /** + * API name: {@code predict} + */ + @Nonnull + public final Builder predict(Function> fn) { + return predict(fn.apply(new Predict.Builder()).build()); + } + /** * API name: {@code predict_request_stats} */ @@ -330,6 +469,23 @@ public final Builder predictor(@Nullable String value) { return this; } + /** + * API name: {@code register} + */ + @Nonnull + public final Builder register(@Nullable Register value) { + this.register = value; + return this; + } + + /** + * API name: {@code register} + */ + @Nonnull + public final Builder register(Function> fn) { + return register(fn.apply(new Register.Builder()).build()); + } + /** * API name: {@code target_worker_nodes} * @@ -356,6 +512,40 @@ public final Builder targetWorkerNodes(List value, List... value return this; } + /** + * API name: {@code train} + */ + @Nonnull + public final Builder train(@Nullable Train value) { + this.train = value; + return this; + } + + /** + * API name: {@code train} + */ + @Nonnull + public final Builder train(Function> fn) { + return train(fn.apply(new Train.Builder()).build()); + } + + /** + * API name: {@code undeploy} + */ + @Nonnull + public final Builder undeploy(@Nullable Undeploy value) { + this.undeploy = value; + return this; + } + + /** + * API name: {@code undeploy} + */ + @Nonnull + public final Builder undeploy(Function> fn) { + return undeploy(fn.apply(new Undeploy.Builder()).build()); + } + /** * API name: {@code worker_nodes} * @@ -407,16 +597,21 @@ public ModelProfile build() { ); protected static void setupModelProfileDeserializer(ObjectDeserializer op) { + op.add(Builder::deploy, Deploy._DESERIALIZER, "deploy"); op.add(Builder::memorySizeEstimationCpu, JsonpDeserializer.longDeserializer(), "memory_size_estimation_cpu"); op.add(Builder::memorySizeEstimationGpu, JsonpDeserializer.longDeserializer(), "memory_size_estimation_gpu"); op.add(Builder::modelState, JsonpDeserializer.stringDeserializer(), "model_state"); + op.add(Builder::predict, Predict._DESERIALIZER, "predict"); op.add(Builder::predictRequestStats, PredictRequestStats._DESERIALIZER, "predict_request_stats"); op.add(Builder::predictor, JsonpDeserializer.stringDeserializer(), "predictor"); + op.add(Builder::register, Register._DESERIALIZER, "register"); op.add( Builder::targetWorkerNodes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "target_worker_nodes" ); + op.add(Builder::train, Train._DESERIALIZER, "train"); + op.add(Builder::undeploy, Undeploy._DESERIALIZER, "undeploy"); op.add( Builder::workerNodes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), @@ -427,12 +622,17 @@ protected static void setupModelProfileDeserializer(ObjectDeserializer { + + @Nonnull + private final Map algorithms; + + @Nullable + private final Long mlCircuitBreakerTriggerCount; + + @Nullable + private final Long mlDeployedModelCount; + + @Nullable + private final Long mlExecutingTaskCount; + + @Nullable + private final Long mlFailureCount; + + @Nullable + private final Long mlJvmHeapUsage; + + @Nullable + private final Long mlRequestCount; + + @Nonnull + private final Map models; + + // --------------------------------------------------------------------------------------------- + + private NodeStatsDetails(Builder builder) { + this.algorithms = ApiTypeHelper.unmodifiable(builder.algorithms); + this.mlCircuitBreakerTriggerCount = builder.mlCircuitBreakerTriggerCount; + this.mlDeployedModelCount = builder.mlDeployedModelCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + this.mlFailureCount = builder.mlFailureCount; + this.mlJvmHeapUsage = builder.mlJvmHeapUsage; + this.mlRequestCount = builder.mlRequestCount; + this.models = ApiTypeHelper.unmodifiable(builder.models); + } + + public static NodeStatsDetails of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code algorithms} + */ + @Nonnull + public final Map algorithms() { + return this.algorithms; + } + + /** + * The circuit breaker trigger count. + *

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

+ */ + @Nullable + public final Long mlCircuitBreakerTriggerCount() { + return this.mlCircuitBreakerTriggerCount; + } + + /** + * The deployed model count. + *

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

+ */ + @Nullable + public final Long mlDeployedModelCount() { + return this.mlDeployedModelCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlFailureCount() { + return this.mlFailureCount; + } + + /** + * The JVM heap usage. + *

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

+ */ + @Nullable + public final Long mlJvmHeapUsage() { + return this.mlJvmHeapUsage; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlRequestCount() { + return this.mlRequestCount; + } + + /** + * API name: {@code models} + */ + @Nonnull + public final Map models() { + return this.models; + } + + /** + * Serialize this object to JSON. + */ + @Override + 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.algorithms)) { + generator.writeKey("algorithms"); + generator.writeStartObject(); + for (Map.Entry item0 : this.algorithms.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.mlCircuitBreakerTriggerCount != null) { + generator.writeKey("ml_circuit_breaker_trigger_count"); + generator.write(this.mlCircuitBreakerTriggerCount); + } + + if (this.mlDeployedModelCount != null) { + generator.writeKey("ml_deployed_model_count"); + generator.write(this.mlDeployedModelCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + + if (this.mlFailureCount != null) { + generator.writeKey("ml_failure_count"); + generator.write(this.mlFailureCount); + } + + if (this.mlJvmHeapUsage != null) { + generator.writeKey("ml_jvm_heap_usage"); + generator.write(this.mlJvmHeapUsage); + } + + if (this.mlRequestCount != null) { + generator.writeKey("ml_request_count"); + generator.write(this.mlRequestCount); + } + + if (ApiTypeHelper.isDefined(this.models)) { + generator.writeKey("models"); + generator.writeStartObject(); + for (Map.Entry item0 : this.models.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link NodeStatsDetails}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map algorithms; + @Nullable + private Long mlCircuitBreakerTriggerCount; + @Nullable + private Long mlDeployedModelCount; + @Nullable + private Long mlExecutingTaskCount; + @Nullable + private Long mlFailureCount; + @Nullable + private Long mlJvmHeapUsage; + @Nullable + private Long mlRequestCount; + @Nullable + private Map models; + + public Builder() {} + + private Builder(NodeStatsDetails o) { + this.algorithms = _mapCopy(o.algorithms); + this.mlCircuitBreakerTriggerCount = o.mlCircuitBreakerTriggerCount; + this.mlDeployedModelCount = o.mlDeployedModelCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + this.mlFailureCount = o.mlFailureCount; + this.mlJvmHeapUsage = o.mlJvmHeapUsage; + this.mlRequestCount = o.mlRequestCount; + this.models = _mapCopy(o.models); + } + + private Builder(Builder o) { + this.algorithms = _mapCopy(o.algorithms); + this.mlCircuitBreakerTriggerCount = o.mlCircuitBreakerTriggerCount; + this.mlDeployedModelCount = o.mlDeployedModelCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + this.mlFailureCount = o.mlFailureCount; + this.mlJvmHeapUsage = o.mlJvmHeapUsage; + this.mlRequestCount = o.mlRequestCount; + this.models = _mapCopy(o.models); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code algorithms} + * + *

+ * Adds all elements of map to algorithms. + *

+ */ + @Nonnull + public final Builder algorithms(Map map) { + this.algorithms = _mapPutAll(this.algorithms, map); + return this; + } + + /** + * API name: {@code algorithms} + * + *

+ * Adds an entry to algorithms. + *

+ */ + @Nonnull + public final Builder algorithms(String key, AlgorithmOperations value) { + this.algorithms = _mapPut(this.algorithms, key, value); + return this; + } + + /** + * API name: {@code algorithms} + * + *

+ * Adds a value to algorithms using a builder lambda. + *

+ */ + @Nonnull + public final Builder algorithms(String key, Function> fn) { + return algorithms(key, fn.apply(new AlgorithmOperations.Builder()).build()); + } + + /** + * The circuit breaker trigger count. + *

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

+ */ + @Nonnull + public final Builder mlCircuitBreakerTriggerCount(@Nullable Long value) { + this.mlCircuitBreakerTriggerCount = value; + return this; + } + + /** + * The deployed model count. + *

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

+ */ + @Nonnull + public final Builder mlDeployedModelCount(@Nullable Long value) { + this.mlDeployedModelCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlFailureCount(@Nullable Long value) { + this.mlFailureCount = value; + return this; + } + + /** + * The JVM heap usage. + *

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

+ */ + @Nonnull + public final Builder mlJvmHeapUsage(@Nullable Long value) { + this.mlJvmHeapUsage = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlRequestCount(@Nullable Long value) { + this.mlRequestCount = value; + return this; + } + + /** + * API name: {@code models} + * + *

+ * Adds all elements of map to models. + *

+ */ + @Nonnull + public final Builder models(Map map) { + this.models = _mapPutAll(this.models, map); + return this; + } + + /** + * API name: {@code models} + * + *

+ * Adds an entry to models. + *

+ */ + @Nonnull + public final Builder models(String key, ModelProfile value) { + this.models = _mapPut(this.models, key, value); + return this; + } + + /** + * API name: {@code models} + * + *

+ * Adds a value to models using a builder lambda. + *

+ */ + @Nonnull + public final Builder models(String key, Function> fn) { + return models(key, fn.apply(new ModelProfile.Builder()).build()); + } + + /** + * Builds a {@link NodeStatsDetails}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public NodeStatsDetails build() { + _checkSingleUse(); + + return new NodeStatsDetails(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeStatsDetails} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeStatsDetails::setupNodeStatsDetailsDeserializer + ); + + protected static void setupNodeStatsDetailsDeserializer(ObjectDeserializer op) { + op.add(Builder::algorithms, JsonpDeserializer.stringMapDeserializer(AlgorithmOperations._DESERIALIZER), "algorithms"); + op.add(Builder::mlCircuitBreakerTriggerCount, JsonpDeserializer.longDeserializer(), "ml_circuit_breaker_trigger_count"); + op.add(Builder::mlDeployedModelCount, JsonpDeserializer.longDeserializer(), "ml_deployed_model_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + op.add(Builder::mlFailureCount, JsonpDeserializer.longDeserializer(), "ml_failure_count"); + op.add(Builder::mlJvmHeapUsage, JsonpDeserializer.longDeserializer(), "ml_jvm_heap_usage"); + op.add(Builder::mlRequestCount, JsonpDeserializer.longDeserializer(), "ml_request_count"); + op.add(Builder::models, JsonpDeserializer.stringMapDeserializer(ModelProfile._DESERIALIZER), "models"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.algorithms); + result = 31 * result + Objects.hashCode(this.mlCircuitBreakerTriggerCount); + result = 31 * result + Objects.hashCode(this.mlDeployedModelCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + result = 31 * result + Objects.hashCode(this.mlFailureCount); + result = 31 * result + Objects.hashCode(this.mlJvmHeapUsage); + result = 31 * result + Objects.hashCode(this.mlRequestCount); + result = 31 * result + Objects.hashCode(this.models); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodeStatsDetails other = (NodeStatsDetails) o; + return Objects.equals(this.algorithms, other.algorithms) + && Objects.equals(this.mlCircuitBreakerTriggerCount, other.mlCircuitBreakerTriggerCount) + && Objects.equals(this.mlDeployedModelCount, other.mlDeployedModelCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount) + && Objects.equals(this.mlFailureCount, other.mlFailureCount) + && Objects.equals(this.mlJvmHeapUsage, other.mlJvmHeapUsage) + && Objects.equals(this.mlRequestCount, other.mlRequestCount) + && Objects.equals(this.models, other.models); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java index 279546ef45..e3a5169837 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java @@ -582,6 +582,32 @@ public final CompletableFuture getProfileTasks() throws return getProfileTasks(new GetProfileTasksRequest.Builder().build()); } + // ----- Endpoint: ml.get_stats + + /** + * Get stats. + */ + public CompletableFuture getStats(GetStatsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get stats. + * + * @param fn a function that initializes a builder to create the {@link GetStatsRequest} + */ + public final CompletableFuture getStats(Function> fn) + throws IOException, OpenSearchException { + return getStats(fn.apply(new GetStatsRequest.Builder()).build()); + } + + /** + * Get stats. + */ + public final CompletableFuture getStats() throws IOException, OpenSearchException { + return getStats(new GetStatsRequest.Builder().build()); + } + // ----- Endpoint: ml.get_task /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java index 877895595f..17d954ed97 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java @@ -557,6 +557,32 @@ public final GetProfileTasksResponse getProfileTasks() throws IOException, OpenS return getProfileTasks(new GetProfileTasksRequest.Builder().build()); } + // ----- Endpoint: ml.get_stats + + /** + * Get stats. + */ + public GetStatsResponse getStats(GetStatsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get stats. + * + * @param fn a function that initializes a builder to create the {@link GetStatsRequest} + */ + public final GetStatsResponse getStats(Function> fn) throws IOException, + OpenSearchException { + return getStats(fn.apply(new GetStatsRequest.Builder()).build()); + } + + /** + * Get stats. + */ + public final GetStatsResponse getStats() throws IOException, OpenSearchException { + return getStats(new GetStatsRequest.Builder().build()); + } + // ----- Endpoint: ml.get_task /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Predict.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Predict.java new file mode 100644 index 0000000000..40dc183c3a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Predict.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.Predict + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Predict implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long mlActionFailureCount; + + @Nullable + private final Long mlActionRequestCount; + + @Nullable + private final Long mlExecutingTaskCount; + + // --------------------------------------------------------------------------------------------- + + private Predict(Builder builder) { + this.mlActionFailureCount = builder.mlActionFailureCount; + this.mlActionRequestCount = builder.mlActionRequestCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + } + + public static Predict of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlActionFailureCount() { + return this.mlActionFailureCount; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlActionRequestCount() { + return this.mlActionRequestCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlActionFailureCount != null) { + generator.writeKey("ml_action_failure_count"); + generator.write(this.mlActionFailureCount); + } + + if (this.mlActionRequestCount != null) { + generator.writeKey("ml_action_request_count"); + generator.write(this.mlActionRequestCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Predict}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long mlActionFailureCount; + @Nullable + private Long mlActionRequestCount; + @Nullable + private Long mlExecutingTaskCount; + + public Builder() {} + + private Builder(Predict o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + private Builder(Builder o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlActionFailureCount(@Nullable Long value) { + this.mlActionFailureCount = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlActionRequestCount(@Nullable Long value) { + this.mlActionRequestCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * Builds a {@link Predict}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Predict build() { + _checkSingleUse(); + + return new Predict(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Predict} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Predict::setupPredictDeserializer + ); + + protected static void setupPredictDeserializer(ObjectDeserializer op) { + op.add(Builder::mlActionFailureCount, JsonpDeserializer.longDeserializer(), "ml_action_failure_count"); + op.add(Builder::mlActionRequestCount, JsonpDeserializer.longDeserializer(), "ml_action_request_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlActionFailureCount); + result = 31 * result + Objects.hashCode(this.mlActionRequestCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Predict other = (Predict) o; + return Objects.equals(this.mlActionFailureCount, other.mlActionFailureCount) + && Objects.equals(this.mlActionRequestCount, other.mlActionRequestCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Register.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Register.java new file mode 100644 index 0000000000..dc27cebaa7 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Register.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.Register + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Register implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long mlActionFailureCount; + + @Nullable + private final Long mlActionRequestCount; + + @Nullable + private final Long mlExecutingTaskCount; + + // --------------------------------------------------------------------------------------------- + + private Register(Builder builder) { + this.mlActionFailureCount = builder.mlActionFailureCount; + this.mlActionRequestCount = builder.mlActionRequestCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + } + + public static Register of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlActionFailureCount() { + return this.mlActionFailureCount; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlActionRequestCount() { + return this.mlActionRequestCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlActionFailureCount != null) { + generator.writeKey("ml_action_failure_count"); + generator.write(this.mlActionFailureCount); + } + + if (this.mlActionRequestCount != null) { + generator.writeKey("ml_action_request_count"); + generator.write(this.mlActionRequestCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Register}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long mlActionFailureCount; + @Nullable + private Long mlActionRequestCount; + @Nullable + private Long mlExecutingTaskCount; + + public Builder() {} + + private Builder(Register o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + private Builder(Builder o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlActionFailureCount(@Nullable Long value) { + this.mlActionFailureCount = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlActionRequestCount(@Nullable Long value) { + this.mlActionRequestCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * Builds a {@link Register}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Register build() { + _checkSingleUse(); + + return new Register(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Register} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Register::setupRegisterDeserializer + ); + + protected static void setupRegisterDeserializer(ObjectDeserializer op) { + op.add(Builder::mlActionFailureCount, JsonpDeserializer.longDeserializer(), "ml_action_failure_count"); + op.add(Builder::mlActionRequestCount, JsonpDeserializer.longDeserializer(), "ml_action_request_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlActionFailureCount); + result = 31 * result + Objects.hashCode(this.mlActionRequestCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Register other = (Register) o; + return Objects.equals(this.mlActionFailureCount, other.mlActionFailureCount) + && Objects.equals(this.mlActionRequestCount, other.mlActionRequestCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Train.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Train.java new file mode 100644 index 0000000000..321406e434 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Train.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.Train + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Train implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long mlActionFailureCount; + + @Nullable + private final Long mlActionRequestCount; + + @Nullable + private final Long mlExecutingTaskCount; + + // --------------------------------------------------------------------------------------------- + + private Train(Builder builder) { + this.mlActionFailureCount = builder.mlActionFailureCount; + this.mlActionRequestCount = builder.mlActionRequestCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + } + + public static Train of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlActionFailureCount() { + return this.mlActionFailureCount; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlActionRequestCount() { + return this.mlActionRequestCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlActionFailureCount != null) { + generator.writeKey("ml_action_failure_count"); + generator.write(this.mlActionFailureCount); + } + + if (this.mlActionRequestCount != null) { + generator.writeKey("ml_action_request_count"); + generator.write(this.mlActionRequestCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Train}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long mlActionFailureCount; + @Nullable + private Long mlActionRequestCount; + @Nullable + private Long mlExecutingTaskCount; + + public Builder() {} + + private Builder(Train o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + private Builder(Builder o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlActionFailureCount(@Nullable Long value) { + this.mlActionFailureCount = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlActionRequestCount(@Nullable Long value) { + this.mlActionRequestCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * Builds a {@link Train}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Train build() { + _checkSingleUse(); + + return new Train(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Train} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Train::setupTrainDeserializer + ); + + protected static void setupTrainDeserializer(ObjectDeserializer op) { + op.add(Builder::mlActionFailureCount, JsonpDeserializer.longDeserializer(), "ml_action_failure_count"); + op.add(Builder::mlActionRequestCount, JsonpDeserializer.longDeserializer(), "ml_action_request_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlActionFailureCount); + result = 31 * result + Objects.hashCode(this.mlActionRequestCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Train other = (Train) o; + return Objects.equals(this.mlActionFailureCount, other.mlActionFailureCount) + && Objects.equals(this.mlActionRequestCount, other.mlActionRequestCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Undeploy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Undeploy.java new file mode 100644 index 0000000000..928ad4fc7f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Undeploy.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.Undeploy + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Undeploy implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long mlActionFailureCount; + + @Nullable + private final Long mlActionRequestCount; + + @Nullable + private final Long mlExecutingTaskCount; + + // --------------------------------------------------------------------------------------------- + + private Undeploy(Builder builder) { + this.mlActionFailureCount = builder.mlActionFailureCount; + this.mlActionRequestCount = builder.mlActionRequestCount; + this.mlExecutingTaskCount = builder.mlExecutingTaskCount; + } + + public static Undeploy of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The failure count. + *

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

+ */ + @Nullable + public final Long mlActionFailureCount() { + return this.mlActionFailureCount; + } + + /** + * The request count. + *

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

+ */ + @Nullable + public final Long mlActionRequestCount() { + return this.mlActionRequestCount; + } + + /** + * The executing task count. + *

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

+ */ + @Nullable + public final Long mlExecutingTaskCount() { + return this.mlExecutingTaskCount; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.mlActionFailureCount != null) { + generator.writeKey("ml_action_failure_count"); + generator.write(this.mlActionFailureCount); + } + + if (this.mlActionRequestCount != null) { + generator.writeKey("ml_action_request_count"); + generator.write(this.mlActionRequestCount); + } + + if (this.mlExecutingTaskCount != null) { + generator.writeKey("ml_executing_task_count"); + generator.write(this.mlExecutingTaskCount); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Undeploy}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long mlActionFailureCount; + @Nullable + private Long mlActionRequestCount; + @Nullable + private Long mlExecutingTaskCount; + + public Builder() {} + + private Builder(Undeploy o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + private Builder(Builder o) { + this.mlActionFailureCount = o.mlActionFailureCount; + this.mlActionRequestCount = o.mlActionRequestCount; + this.mlExecutingTaskCount = o.mlExecutingTaskCount; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The failure count. + *

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

+ */ + @Nonnull + public final Builder mlActionFailureCount(@Nullable Long value) { + this.mlActionFailureCount = value; + return this; + } + + /** + * The request count. + *

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

+ */ + @Nonnull + public final Builder mlActionRequestCount(@Nullable Long value) { + this.mlActionRequestCount = value; + return this; + } + + /** + * The executing task count. + *

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

+ */ + @Nonnull + public final Builder mlExecutingTaskCount(@Nullable Long value) { + this.mlExecutingTaskCount = value; + return this; + } + + /** + * Builds a {@link Undeploy}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Undeploy build() { + _checkSingleUse(); + + return new Undeploy(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Undeploy} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Undeploy::setupUndeployDeserializer + ); + + protected static void setupUndeployDeserializer(ObjectDeserializer op) { + op.add(Builder::mlActionFailureCount, JsonpDeserializer.longDeserializer(), "ml_action_failure_count"); + op.add(Builder::mlActionRequestCount, JsonpDeserializer.longDeserializer(), "ml_action_request_count"); + op.add(Builder::mlExecutingTaskCount, JsonpDeserializer.longDeserializer(), "ml_executing_task_count"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.mlActionFailureCount); + result = 31 * result + Objects.hashCode(this.mlActionRequestCount); + result = 31 * result + Objects.hashCode(this.mlExecutingTaskCount); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Undeploy other = (Undeploy) o; + return Objects.equals(this.mlActionFailureCount, other.mlActionFailureCount) + && Objects.equals(this.mlActionRequestCount, other.mlActionRequestCount) + && Objects.equals(this.mlExecutingTaskCount, other.mlExecutingTaskCount); + } +} 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 deleted file mode 100644 index be883f856f..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java +++ /dev/null @@ -1,46 +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. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types; - -/** - * Builders for {@link GeoHashPrecision} variants. - *

- * 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() {} - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java deleted file mode 100644 index 9e67d4f493..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java +++ /dev/null @@ -1,218 +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. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.util.ObjectBuilder; - -public class CompositeDateHistogramAggregationSource extends CompositeValuesSource { - - @Nullable - private final Time calendarInterval; - - @Nullable - private final Time fixedInterval; - - @Nullable - private final Long offset; - - @Nullable - private final String timeZone; - - private CompositeDateHistogramAggregationSource(Builder builder) { - super(builder); - this.calendarInterval = builder.calendarInterval; - this.fixedInterval = builder.fixedInterval; - this.offset = builder.offset; - this.timeZone = builder.timeZone; - } - - public static CompositeDateHistogramAggregationSource of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code calendar_interval} - */ - @Nullable - public final Time calendarInterval() { - return this.calendarInterval; - } - - /** - * API name: {@code fixed_interval} - */ - @Nullable - public final Time fixedInterval() { - return this.fixedInterval; - } - - /** - * API name: {@code offset} - */ - @Nullable - public final Long offset() { - return this.offset; - } - - /** - * API name: {@code time_zone} - */ - public final String timeZone() { - return this.timeZone; - } - - /** - * API name: {@code time_zone} - * @deprecated Use {@link #timeZone()} instead. - */ - @Deprecated - public final String zoneId() { - return timeZone(); - } - - /** - * Serialize this object to JSON. - */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.calendarInterval != null) { - generator.writeKey("calendar_interval"); - this.calendarInterval.serialize(generator, mapper); - - } - if (this.fixedInterval != null) { - generator.writeKey("fixed_interval"); - this.fixedInterval.serialize(generator, mapper); - - } - if (this.offset != null) { - generator.writeKey("offset"); - generator.write(this.offset); - - } - - if (this.timeZone != null) { - generator.writeKey("time_zone"); - generator.write(this.timeZone); - } - } - - /** - * Builder for {@link CompositeDateHistogramAggregationSource}. - */ - - public static class Builder extends CompositeValuesSource.AbstractBuilder - implements - ObjectBuilder { - - @Nullable - private Time calendarInterval; - - @Nullable - private Time fixedInterval; - - @Nullable - private Long offset; - - @Nullable - private String timeZone; - - /** - * API name: {@code calendar_interval} - */ - public final Builder calendarInterval(@Nullable Time value) { - this.calendarInterval = value; - return this; - } - - /** - * API name: {@code fixed_interval} - */ - public final Builder fixedInterval(@Nullable Time value) { - this.fixedInterval = value; - return this; - } - - /** - * API name: {@code offset} - */ - public final Builder offset(Long value) { - this.offset = value; - return this; - } - - /** - * API name: {@code time_zone} - */ - public final Builder timeZone(String value) { - this.timeZone = value; - return this; - } - - /** - * API name: {@code time_zone} - * @deprecated Use {@link #timeZone(String)} instead. - */ - @Deprecated - public final Builder zoneId(String value) { - return timeZone(value); - } - - /** - * Builds a {@link CompositeDateHistogramAggregationSource}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompositeDateHistogramAggregationSource build() { - _checkSingleUse(); - - return new CompositeDateHistogramAggregationSource(this); - } - - @Override - protected Builder self() { - return this; - } - } - - /** - * Json deserializer for {@link CompositeDateHistogramAggregationSource} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CompositeDateHistogramAggregationSource::setupCompositeDateHistogramAggregationSourceDeserializer - ); - - protected static void setupCompositeDateHistogramAggregationSourceDeserializer( - ObjectDeserializer op - ) { - CompositeValuesSource.setupCompositeValuesSourceDeserializer(op); - op.add(Builder::calendarInterval, Time._DESERIALIZER, "calendar_interval"); - op.add(Builder::fixedInterval, Time._DESERIALIZER, "fixed_interval"); - op.add(Builder::offset, JsonpDeserializer.longDeserializer(), "offset"); - op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java deleted file mode 100644 index fa035e9d80..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeGeoTileGridAggregationSource.java +++ /dev/null @@ -1,150 +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. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -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.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.GeoBounds; -import org.opensearch.client.util.ObjectBuilder; - -@JsonpDeserializable -public class CompositeGeoTileGridAggregationSource extends CompositeValuesSource { - - @Nullable - private final Integer precision; - - @Nullable - private final GeoBounds geoBounds; - - private CompositeGeoTileGridAggregationSource(Builder builder) { - super(builder); - this.precision = builder.precision; - this.geoBounds = builder.geoBounds; - } - - public static CompositeGeoTileGridAggregationSource of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code precision} - */ - @Nullable - public final Integer precision() { - return this.precision; - } - - /** - * API name: {@code geoBounds} - */ - @Nullable - public final GeoBounds geoBounds() { - return this.geoBounds; - } - - /** - * Serialize this object to JSON. - */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.precision != null) { - generator.writeKey("precision"); - generator.write(this.precision); - } - if (this.geoBounds != null) { - generator.writeKey("bounds"); - this.geoBounds.serialize(generator, mapper); - - } - } - - /** - * Builder for {@link CompositeGeoTileGridAggregationSource}. - */ - - public static class Builder extends CompositeValuesSource.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Integer precision; - - @Nullable - private GeoBounds geoBounds; - - /** - * API name: {@code precision} - */ - public final Builder precision(@Nullable Integer precision) { - this.precision = precision; - return this; - } - - /** - * API name: {@code geoBounds} - */ - public final Builder geoBounds(@Nullable GeoBounds geoBounds) { - this.geoBounds = geoBounds; - return this; - } - - /** - * API name: {@code geoBounds} - */ - public final Builder geoBounds(Function> fn) { - return this.geoBounds(fn.apply(new GeoBounds.Builder()).build()); - } - - /** - * Builds a {@link CompositeGeoTileGridAggregationSource}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompositeGeoTileGridAggregationSource build() { - _checkSingleUse(); - - return new CompositeGeoTileGridAggregationSource(this); - } - - @Override - protected Builder self() { - return this; - } - } - - /** - * Json deserializer for {@link CompositeGeoTileGridAggregationSource} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CompositeGeoTileGridAggregationSource::setupCompositeGeoTileGridAggregationSourceDeserializer - ); - - protected static void setupCompositeGeoTileGridAggregationSourceDeserializer( - ObjectDeserializer op - ) { - CompositeValuesSource.setupCompositeValuesSourceDeserializer(op); - op.add(Builder::precision, JsonpDeserializer.integerDeserializer(), "precision"); - op.add(Builder::geoBounds, GeoBounds._DESERIALIZER, "bounds"); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java deleted file mode 100644 index acd2cb80e1..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeHistogramAggregationSource.java +++ /dev/null @@ -1,107 +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. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -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; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ObjectBuilder; - -@JsonpDeserializable -public class CompositeHistogramAggregationSource extends CompositeValuesSource { - - private final double interval; - - private CompositeHistogramAggregationSource(Builder builder) { - super(builder); - this.interval = builder.interval; - } - - public static CompositeHistogramAggregationSource of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code interval} - */ - public final double interval() { - return this.interval; - } - - /** - * Serialize this object to JSON. - */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - generator.writeKey("interval"); - generator.write(this.interval); - } - - /** - * Builder for {@link CompositeHistogramAggregationSource}. - */ - - public static class Builder extends CompositeValuesSource.AbstractBuilder - implements - ObjectBuilder { - private double interval; - - /** - * Required - API name: {@code interval} - */ - public final Builder interval(double interval) { - this.interval = interval; - return this; - } - - /** - * Builds a {@link CompositeHistogramAggregationSource}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompositeHistogramAggregationSource build() { - _checkSingleUse(); - - return new CompositeHistogramAggregationSource(this); - } - - @Override - protected Builder self() { - return this; - } - } - - /** - * Json deserializer for {@link CompositeHistogramAggregationSource} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CompositeHistogramAggregationSource::setupCompositeHistogramAggregationSourceDeserializer - ); - - protected static void setupCompositeHistogramAggregationSourceDeserializer( - ObjectDeserializer op - ) { - CompositeValuesSource.setupCompositeValuesSourceDeserializer(op); - op.add(Builder::interval, JsonpDeserializer.doubleDeserializer(), "interval"); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java deleted file mode 100644 index 891f6618d7..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeTermsAggregationSource.java +++ /dev/null @@ -1,84 +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. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -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; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ObjectBuilder; - -@JsonpDeserializable -public class CompositeTermsAggregationSource extends CompositeValuesSource { - - private CompositeTermsAggregationSource(Builder builder) { - super(builder); - } - - public static CompositeTermsAggregationSource of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Serialize this object to JSON. - */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - } - - /** - * Builder for {@link CompositeTermsAggregationSource}. - */ - public static class Builder extends CompositeValuesSource.AbstractBuilder - implements - ObjectBuilder { - - /** - * Builds a {@link CompositeTermsAggregationSource}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompositeTermsAggregationSource build() { - _checkSingleUse(); - - return new CompositeTermsAggregationSource(this); - } - - @Override - protected Builder self() { - return this; - } - } - - /** - * Json deserializer for {@link CompositeTermsAggregationSource} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CompositeTermsAggregationSource::setupCompositeGeoTileGridAggregationSourceDeserializer - ); - - protected static void setupCompositeGeoTileGridAggregationSourceDeserializer( - ObjectDeserializer op - ) { - CompositeValuesSource.setupCompositeValuesSourceDeserializer(op); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java deleted file mode 100644 index a4a0d25f95..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/InferenceConfig.java +++ /dev/null @@ -1,197 +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. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -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.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: _types.aggregations.InferenceConfigContainer - -@JsonpDeserializable -public class InferenceConfig implements PlainJsonSerializable { - @Nullable - private final RegressionInferenceOptions regression; - - @Nullable - private final ClassificationInferenceOptions classification; - - // --------------------------------------------------------------------------------------------- - - private InferenceConfig(Builder builder) { - - this.regression = builder.regression; - this.classification = builder.classification; - - } - - public static InferenceConfig of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Regression configuration for inference. - *

- * API name: {@code regression} - */ - @Nullable - public final RegressionInferenceOptions regression() { - return this.regression; - } - - /** - * Classification configuration for inference. - *

- * API name: {@code classification} - */ - @Nullable - public final ClassificationInferenceOptions classification() { - return this.classification; - } - - /** - * 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.regression != null) { - generator.writeKey("regression"); - this.regression.serialize(generator, mapper); - - } - if (this.classification != null) { - generator.writeKey("classification"); - this.classification.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InferenceConfig}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private RegressionInferenceOptions regression; - - @Nullable - private ClassificationInferenceOptions classification; - - /** - * Regression configuration for inference. - *

- * API name: {@code regression} - */ - public final Builder regression(@Nullable RegressionInferenceOptions value) { - this.regression = value; - return this; - } - - /** - * Regression configuration for inference. - *

- * API name: {@code regression} - */ - public final Builder regression(Function> fn) { - return this.regression(fn.apply(new RegressionInferenceOptions.Builder()).build()); - } - - /** - * Classification configuration for inference. - *

- * API name: {@code classification} - */ - public final Builder classification(@Nullable ClassificationInferenceOptions value) { - this.classification = value; - return this; - } - - /** - * Classification configuration for inference. - *

- * API name: {@code classification} - */ - public final Builder classification( - Function> fn - ) { - return this.classification(fn.apply(new ClassificationInferenceOptions.Builder()).build()); - } - - /** - * Builds a {@link InferenceConfig}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InferenceConfig build() { - _checkSingleUse(); - - return new InferenceConfig(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InferenceConfig} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - InferenceConfig::setupInferenceConfigDeserializer - ); - - protected static void setupInferenceConfigDeserializer(ObjectDeserializer op) { - - op.add(Builder::regression, RegressionInferenceOptions._DESERIALIZER, "regression"); - op.add(Builder::classification, ClassificationInferenceOptions._DESERIALIZER, "classification"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java deleted file mode 100644 index e8079b0272..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java +++ /dev/null @@ -1,196 +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. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch._types.aggregations; - -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; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: _types.aggregations.MultiTermsAggregation - -@JsonpDeserializable -public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant { - private final List terms; - - @Nullable - private final Integer size; - - // --------------------------------------------------------------------------------------------- - - private MultiTermsAggregation(Builder builder) { - super(builder); - - this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms"); - this.size = builder.size; - } - - public static MultiTermsAggregation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Aggregation variant kind. - */ - @Override - public Aggregation.Kind _aggregationKind() { - return Aggregation.Kind.MultiTerms; - } - - /** - * Required - API name: {@code terms} - */ - public final List terms() { - return this.terms; - } - - /** - * API name: {@code size} - */ - @Nullable - public final Integer size() { - return this.size; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - if (ApiTypeHelper.isDefined(this.terms)) { - generator.writeKey("terms"); - generator.writeStartArray(); - for (MultiTermLookup item0 : this.terms) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MultiTermsAggregation}. - */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { - private List terms; - - @Nullable - private Integer size; - - /** - * Required - API name: {@code terms} - *

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

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

- * Adds a value to terms using a builder lambda. - */ - public final Builder terms(Function> fn) { - return terms(fn.apply(new MultiTermLookup.Builder()).build()); - } - - /** - * API name: {@code size} - */ - public final Builder size(@Nullable Integer value) { - this.size = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MultiTermsAggregation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MultiTermsAggregation build() { - _checkSingleUse(); - - return new MultiTermsAggregation(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MultiTermsAggregation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - MultiTermsAggregation::setupMultiTermsAggregationDeserializer - ); - - protected static void setupMultiTermsAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); - op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); - op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(MultiTermLookup._DESERIALIZER), "terms"); - } - -} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/ClassStructureTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/ClassStructureTest.java index db0842ce40..06f25be997 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/ClassStructureTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/ClassStructureTest.java @@ -236,14 +236,14 @@ public void testMapSetters() { ValueCountAggregation countC = ValueCountAggregation.of(v -> v.field("c")); Map aggs = new HashMap<>(); - aggs.put("aggA", countA._toAggregation()); - aggs.put("aggB", countB._toAggregation()); + aggs.put("aggA", countA.toAggregation()); + aggs.put("aggB", countB.toAggregation()); { // Appending doesn't modify the original collection SearchRequest search = SearchRequest.of( b -> b.aggregations(aggs) - .aggregations("aggC", countC._toAggregation()) + .aggregations("aggC", countC.toAggregation()) .aggregations("aggD", a -> a.valueCount(c -> c.field("d"))) ); diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java index 0d5dfdfac4..3cf5a426e1 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java @@ -489,7 +489,7 @@ public void testSubAggregation() throws IOException { .size(0) .aggregations( "price", - _3 -> _3.aggregations(Map.of("price", TermsAggregation.of(_4 -> _4.field("price"))._toAggregation())) + _3 -> _3.aggregations(Map.of("price", TermsAggregation.of(_4 -> _4.field("price")).toAggregation())) .filter( BoolQuery.of( _5 -> _5.filter( diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 10c8907567..54e84b9388 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -4687,6 +4687,39 @@ paths: responses: '200': $ref: '#/components/responses/ml.train___200' + /_plugins/_ml/{node_id}/stats/: + get: + operationId: ml.get_stats.2 + x-operation-group: ml.get_stats + x-version-added: '1.3' + description: Get stats. + parameters: + - $ref: '#/components/parameters/ml.get_stats___path.node_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_stats___200' + /_plugins/_ml/{node_id}/stats/{stat}: + get: + operationId: ml.get_stats.3 + x-operation-group: ml.get_stats + x-version-added: '1.3' + description: Get stats. + parameters: + - $ref: '#/components/parameters/ml.get_stats___path.node_id' + - $ref: '#/components/parameters/ml.get_stats___path.stat' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_stats___200' /_plugins/_ml/agents/_register: post: operationId: ml.register_agents.0 @@ -5615,6 +5648,37 @@ paths: responses: '200': $ref: '#/components/responses/ml.get_profile_tasks___200' + /_plugins/_ml/stats: + get: + operationId: ml.get_stats.0 + x-operation-group: ml.get_stats + x-version-added: '1.3' + description: Get stats. + responses: + '200': + $ref: '#/components/responses/ml.get_stats___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/stats/{stat}: + get: + operationId: ml.get_stats.1 + x-operation-group: ml.get_stats + x-version-added: '1.3' + description: Get stats. + parameters: + - $ref: '#/components/parameters/ml.get_stats___path.stat' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_stats___200' /_plugins/_ml/tasks/{task_id}: delete: operationId: ml.delete_task.0 @@ -18584,10 +18648,6 @@ components: count___query.expand_wildcards: in: query name: expand_wildcards - description: |- - Type of index that wildcard patterns can match. - If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. - Supports comma-separated values, such as `open,hidden`. schema: $ref: '#/components/schemas/_common___ExpandWildcards' style: form @@ -23800,6 +23860,26 @@ components: required: true schema: type: string + ml.get_stats___path.node_id: + name: node_id + in: path + required: true + schema: + type: string + ml.get_stats___path.stat: + name: stat + in: path + required: true + schema: + type: string + enum: + - ml_config_index_status + - ml_connector_count + - ml_connector_index_status + - ml_controller_index_status + - ml_model_count + - ml_model_index_status + - ml_task_index_status ml.get_task___path.task_id: name: task_id in: path @@ -31876,6 +31956,12 @@ components: schema: $ref: '#/components/schemas/ml._common___GetProfileResponse' description: '' + ml.get_stats___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___GetStatsResponse' + description: '' ml.get_task___200: content: application/json: @@ -34454,6 +34540,7 @@ components: const: open description: Match open, non-hidden indexes. _common___ExpandWildcards: + description: Specifies the type of index that wildcard expressions can match. Supports comma-separated values. oneOf: - $ref: '#/components/schemas/_common___ExpandWildcard' - type: array @@ -34604,12 +34691,11 @@ components: _common___GeoHashPrecision: description: The level of geohash precision, which can be expressed as a geohash length between 1 and 12 or as a distance measure, such as "1km" or "10m". oneOf: - - type: integer + - title: geohash_length + type: integer format: int32 - - type: string - _common___GeoHexCell: - description: A map hex cell (H3) reference. - type: string + - title: distance + type: string _common___GeoLine: type: object properties: @@ -36513,19 +36599,16 @@ components: - $ref: '#/components/schemas/_common.aggregations___UnmappedSamplerAggregate' - $ref: '#/components/schemas/_common.aggregations___GeoHashGridAggregate' - $ref: '#/components/schemas/_common.aggregations___GeoTileGridAggregate' - - $ref: '#/components/schemas/_common.aggregations___GeoHexGridAggregate' - $ref: '#/components/schemas/_common.aggregations___RangeAggregate' - $ref: '#/components/schemas/_common.aggregations___DateRangeAggregate' - $ref: '#/components/schemas/_common.aggregations___GeoDistanceAggregate' - $ref: '#/components/schemas/_common.aggregations___IpRangeAggregate' - - $ref: '#/components/schemas/_common.aggregations___IpPrefixAggregate' - $ref: '#/components/schemas/_common.aggregations___FiltersAggregate' - $ref: '#/components/schemas/_common.aggregations___AdjacencyMatrixAggregate' - $ref: '#/components/schemas/_common.aggregations___SignificantLongTermsAggregate' - $ref: '#/components/schemas/_common.aggregations___SignificantStringTermsAggregate' - $ref: '#/components/schemas/_common.aggregations___UnmappedSignificantTermsAggregate' - $ref: '#/components/schemas/_common.aggregations___CompositeAggregate' - - $ref: '#/components/schemas/_common.aggregations___FrequentItemSetsAggregate' - $ref: '#/components/schemas/_common.aggregations___ScriptedMetricAggregate' - $ref: '#/components/schemas/_common.aggregations___TopHitsAggregate' - $ref: '#/components/schemas/_common.aggregations___InferenceAggregate' @@ -36594,14 +36677,8 @@ components: $ref: '#/components/schemas/_common.aggregations___BucketSelectorAggregation' bucket_sort: $ref: '#/components/schemas/_common.aggregations___BucketSortAggregation' - bucket_count_ks_test: - $ref: '#/components/schemas/_common.aggregations___BucketKsAggregation' - bucket_correlation: - $ref: '#/components/schemas/_common.aggregations___BucketCorrelationAggregation' cardinality: $ref: '#/components/schemas/_common.aggregations___CardinalityAggregation' - categorize_text: - $ref: '#/components/schemas/_common.aggregations___CategorizeTextAggregation' children: $ref: '#/components/schemas/_common.aggregations___ChildrenAggregation' composite: @@ -36622,8 +36699,6 @@ components: $ref: '#/components/schemas/_common.aggregations___ExtendedStatsAggregation' extended_stats_bucket: $ref: '#/components/schemas/_common.aggregations___ExtendedStatsBucketAggregation' - frequent_item_sets: - $ref: '#/components/schemas/_common.aggregations___FrequentItemSetsAggregation' filter: $ref: '#/components/schemas/_common.query_dsl___QueryContainer' filters: @@ -36640,16 +36715,12 @@ components: $ref: '#/components/schemas/_common.aggregations___GeoLineAggregation' geotile_grid: $ref: '#/components/schemas/_common.aggregations___GeoTileGridAggregation' - geohex_grid: - $ref: '#/components/schemas/_common.aggregations___GeohexGridAggregation' global: $ref: '#/components/schemas/_common.aggregations___GlobalAggregation' histogram: $ref: '#/components/schemas/_common.aggregations___HistogramAggregation' ip_range: $ref: '#/components/schemas/_common.aggregations___IpRangeAggregation' - ip_prefix: - $ref: '#/components/schemas/_common.aggregations___IpPrefixAggregation' inference: $ref: '#/components/schemas/_common.aggregations___InferenceAggregation' line: @@ -36781,7 +36852,8 @@ components: properties: buckets: description: The target number of buckets. - type: number + type: integer + format: int32 field: $ref: '#/components/schemas/_common___Field' format: @@ -36798,8 +36870,7 @@ components: type: string params: type: object - additionalProperties: - type: object + additionalProperties: true script: $ref: '#/components/schemas/_common___Script' time_zone: @@ -36865,90 +36936,11 @@ components: compression: description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. type: number + format: double _common.aggregations___BucketAggregationBase: allOf: - $ref: '#/components/schemas/_common.aggregations___Aggregation' - type: object - _common.aggregations___BucketCorrelationAggregation: - allOf: - - $ref: '#/components/schemas/_common.aggregations___BucketPathAggregation' - - type: object - properties: - function: - $ref: '#/components/schemas/_common.aggregations___BucketCorrelationFunction' - required: - - function - _common.aggregations___BucketCorrelationFunction: - type: object - properties: - count_correlation: - $ref: '#/components/schemas/_common.aggregations___BucketCorrelationFunctionCountCorrelation' - required: - - count_correlation - _common.aggregations___BucketCorrelationFunctionCountCorrelation: - type: object - properties: - indicator: - $ref: '#/components/schemas/_common.aggregations___BucketCorrelationFunctionCountCorrelationIndicator' - required: - - indicator - _common.aggregations___BucketCorrelationFunctionCountCorrelationIndicator: - type: object - properties: - doc_count: - description: |- - The total number of documents that initially created the expectations. It's required to be greater - than or equal to the sum of all values in the `buckets_path` as this is the originating superset of data - to which the term values are correlated. - type: number - expectations: - description: |- - An array of numbers with which to correlate the configured `bucket_path` values. - The length of this value must always equal the number of buckets returned by the `bucket_path`. - type: array - items: - type: number - fractions: - description: |- - An array of fractions to use when averaging and calculating variance. This should be used if - the pre-calculated data and the `buckets_path` have known gaps. The length of fractions, if provided, - must equal expectations. - type: array - items: - type: number - required: - - doc_count - - expectations - _common.aggregations___BucketKsAggregation: - allOf: - - $ref: '#/components/schemas/_common.aggregations___BucketPathAggregation' - - type: object - properties: - alternative: - description: |- - A list of string values indicating which K-S test alternative to calculate. The valid values - are: "greater", "less", "two_sided". This parameter is key for determining the K-S statistic used - when calculating the K-S test. Default value is all possible alternative hypotheses. - type: array - items: - type: string - fractions: - description: |- - A list of doubles indicating the distribution of the samples with which to compare to the `buckets_path` results. - In typical usage this is the overall proportion of documents in each bucket, which is compared with the actual - document proportions in each bucket from the sibling aggregation counts. The default is to assume that overall - documents are uniformly distributed on these buckets, which they would be if one used equal percentiles of a - metric to define the bucket end points. - type: array - items: - type: number - sampling_method: - description: |- - Indicates the sampling methodology when calculating the K-S test. Note, this is sampling of the returned values. - This determines the cumulative distribution function (CDF) points used comparing the two samples. Default is - `upper_tail`, which emphasizes the upper end of the CDF points. Valid options are: `upper_tail`, `uniform`, - and `lower_tail`. - type: string _common.aggregations___BucketMetricValueAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SingleMetricAggregateBase' @@ -37036,17 +37028,6 @@ components: - type: array items: $ref: '#/components/schemas/_common.aggregations___FiltersBucket' - _common.aggregations___BucketsFrequentItemSetsBucket: - description: |- - Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for - the different buckets, the result is a dictionary. - oneOf: - - type: object - additionalProperties: - $ref: '#/components/schemas/_common.aggregations___FrequentItemSetsBucket' - - type: array - items: - $ref: '#/components/schemas/_common.aggregations___FrequentItemSetsBucket' _common.aggregations___BucketsGeoHashGridBucket: description: |- Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for @@ -37058,17 +37039,6 @@ components: - type: array items: $ref: '#/components/schemas/_common.aggregations___GeoHashGridBucket' - _common.aggregations___BucketsGeoHexGridBucket: - description: |- - Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for - the different buckets, the result is a dictionary. - oneOf: - - type: object - additionalProperties: - $ref: '#/components/schemas/_common.aggregations___GeoHexGridBucket' - - type: array - items: - $ref: '#/components/schemas/_common.aggregations___GeoHexGridBucket' _common.aggregations___BucketsGeoTileGridBucket: description: |- Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for @@ -37091,17 +37061,6 @@ components: - type: array items: $ref: '#/components/schemas/_common.aggregations___HistogramBucket' - _common.aggregations___BucketsIpPrefixBucket: - description: |- - Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for - the different buckets, the result is a dictionary. - oneOf: - - type: object - additionalProperties: - $ref: '#/components/schemas/_common.aggregations___IpPrefixBucket' - - type: array - items: - $ref: '#/components/schemas/_common.aggregations___IpPrefixBucket' _common.aggregations___BucketsIpRangeBucket: description: |- Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for @@ -37153,14 +37112,16 @@ components: properties: from: description: Buckets in positions prior to `from` will be truncated. - type: number + type: integer + format: int32 gap_policy: $ref: '#/components/schemas/_common.aggregations___GapPolicy' size: description: |- The number of buckets to return. Defaults to all buckets of the parent aggregation. - type: number + type: integer + format: int32 sort: $ref: '#/components/schemas/_common___Sort' _common.aggregations___BucketsPath: @@ -37169,11 +37130,14 @@ components: forms depending on its type. Refer to each aggregation's documentation to know what buckets path forms they accept. oneOf: - - type: string - - type: array + - title: single + type: string + - title: array + type: array items: type: string - - type: object + - title: dict + type: object additionalProperties: type: string _common.aggregations___BucketsQueryContainer: @@ -37181,10 +37145,12 @@ components: Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for the different buckets, the result is a dictionary. oneOf: - - type: object + - title: keyed + type: object additionalProperties: $ref: '#/components/schemas/_common.query_dsl___QueryContainer' - - type: array + - title: array + type: array items: $ref: '#/components/schemas/_common.query_dsl___QueryContainer' _common.aggregations___BucketsRangeBucket: @@ -37265,16 +37231,47 @@ components: items: $ref: '#/components/schemas/_common___Void' _common.aggregations___CalendarInterval: - type: string - enum: - - day - - hour - - minute - - month - - quarter - - second - - week - - year + oneOf: + - title: second + type: string + enum: + - second + - 1s + - title: minute + type: string + enum: + - minute + - 1m + - title: hour + type: string + enum: + - hour + - 1h + - title: day + type: string + enum: + - day + - 1d + - title: week + type: string + enum: + - week + - 1w + - title: month + type: string + enum: + - month + - 1M + - title: quarter + type: string + enum: + - quarter + - 1q + - title: year + type: string + enum: + - year + - 1Y _common.aggregations___CardinalityAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -37293,7 +37290,8 @@ components: description: |- A unique count below which counts are expected to be close to accurate. This allows to trade memory for accuracy. - type: number + type: integer + format: int32 rehash: type: boolean execution_hint: @@ -37306,62 +37304,6 @@ components: - save_memory_heuristic - save_time_heuristic - segment_ordinals - _common.aggregations___CategorizeTextAggregation: - allOf: - - $ref: '#/components/schemas/_common.aggregations___Aggregation' - - type: object - properties: - field: - $ref: '#/components/schemas/_common___Field' - max_unique_tokens: - description: |- - The maximum number of unique tokens at any position up to `max_matched_tokensg`. Must be larger than 1. - Smaller values use less memory and create fewer categories. Larger values will use more memory and - create narrower categories. Max allowed value is 100. - type: number - max_matched_tokens: - description: |- - The maximum number of token positions to match on before attempting to merge categories. Larger - values will use more memory and create narrower categories. Max allowed value is 100. - type: number - similarity_threshold: - description: |- - The minimum percentage of tokens that must match for text to be added to the category bucket. Must - be between 1 and 100. The larger the value the narrower the categories. Larger values will increase memory - usage and create narrower categories. - type: number - categorization_filters: - description: |- - This property expects an array of regular expressions. The expressions are used to filter out matching - sequences from the categorization field values. You can use this functionality to fine tune the categorization - by excluding sequences from consideration when categories are defined. For example, you can exclude SQL - statements that appear in your log files. This property cannot be used at the same time as `categorization_analyzer`. - If you only want to define simple regular expression filters that are applied prior to tokenization, setting - this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering, - use the `categorization_analyzer` property instead and include the filters as `pattern_replace` character filters. - type: array - items: - type: string - categorization_analyzer: - $ref: '#/components/schemas/_common.aggregations___CategorizeTextAnalyzer' - shard_size: - description: The number of categorization buckets to return from each shard before merging all the results. - type: number - size: - description: The number of buckets to return. - type: number - min_doc_count: - description: The minimum number of documents in a bucket to be returned to the results. - type: number - shard_min_doc_count: - description: The minimum number of documents in a bucket to be returned from the shard before merging. - type: number - required: - - field - _common.aggregations___CategorizeTextAnalyzer: - oneOf: - - type: string - - $ref: '#/components/schemas/_common.aggregations___CustomCategorizeTextAnalyzer' _common.aggregations___ChildrenAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SingleBucketAggregateBase' @@ -37390,10 +37332,12 @@ components: properties: num_top_classes: description: Specifies the number of top class predictions to return. Defaults to 0. - type: number + type: integer + format: int32 num_top_feature_importance_values: description: Specifies the maximum number of feature importance values per document. - type: number + type: integer + format: int32 prediction_field_type: description: 'Specifies the type of the predicted field to write. Acceptable values are: string, number, Boolean. When Boolean is provided 1.0 is transformed to true and 0.0 to false.' type: string @@ -37423,7 +37367,8 @@ components: $ref: '#/components/schemas/_common.aggregations___CompositeAggregateKey' size: description: The number of composite buckets that should be returned. - type: number + type: integer + format: int32 sources: description: |- The value sources used to build composite buckets. @@ -37433,32 +37378,17 @@ components: type: object additionalProperties: $ref: '#/components/schemas/_common.aggregations___CompositeAggregationSource' - _common.aggregations___CompositeAggregationBase: - type: object - properties: - field: - $ref: '#/components/schemas/_common___Field' - missing_bucket: - type: boolean - missing_order: - $ref: '#/components/schemas/_common.aggregations___MissingOrder' - script: - $ref: '#/components/schemas/_common___Script' - value_type: - $ref: '#/components/schemas/_common.aggregations___ValueType' - order: - $ref: '#/components/schemas/_common___SortOrder' _common.aggregations___CompositeAggregationSource: type: object properties: terms: - $ref: '#/components/schemas/_common.aggregations___CompositeTermsAggregation' + $ref: '#/components/schemas/_common.aggregations___CompositeTermsAggregationSource' histogram: - $ref: '#/components/schemas/_common.aggregations___CompositeHistogramAggregation' + $ref: '#/components/schemas/_common.aggregations___CompositeHistogramAggregationSource' date_histogram: - $ref: '#/components/schemas/_common.aggregations___CompositeDateHistogramAggregation' + $ref: '#/components/schemas/_common.aggregations___CompositeDateHistogramAggregationSource' geotile_grid: - $ref: '#/components/schemas/_common.aggregations___CompositeGeoTileGridAggregation' + $ref: '#/components/schemas/_common.aggregations___CompositeGeoTileGridAggregationSource' _common.aggregations___CompositeBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' @@ -37468,9 +37398,9 @@ components: $ref: '#/components/schemas/_common.aggregations___CompositeAggregateKey' required: - key - _common.aggregations___CompositeDateHistogramAggregation: + _common.aggregations___CompositeDateHistogramAggregationSource: allOf: - - $ref: '#/components/schemas/_common.aggregations___CompositeAggregationBase' + - $ref: '#/components/schemas/_common.aggregations___CompositeValuesSource' - type: object properties: format: @@ -37483,28 +37413,45 @@ components: $ref: '#/components/schemas/_common___Duration' time_zone: $ref: '#/components/schemas/_common___TimeZone' - _common.aggregations___CompositeGeoTileGridAggregation: + _common.aggregations___CompositeGeoTileGridAggregationSource: allOf: - - $ref: '#/components/schemas/_common.aggregations___CompositeAggregationBase' + - $ref: '#/components/schemas/_common.aggregations___CompositeValuesSource' - type: object properties: precision: - type: number + type: integer + format: int32 bounds: $ref: '#/components/schemas/_common___GeoBounds' - _common.aggregations___CompositeHistogramAggregation: + _common.aggregations___CompositeHistogramAggregationSource: allOf: - - $ref: '#/components/schemas/_common.aggregations___CompositeAggregationBase' + - $ref: '#/components/schemas/_common.aggregations___CompositeValuesSource' - type: object properties: interval: type: number + format: double required: - interval - _common.aggregations___CompositeTermsAggregation: + _common.aggregations___CompositeTermsAggregationSource: allOf: - - $ref: '#/components/schemas/_common.aggregations___CompositeAggregationBase' + - $ref: '#/components/schemas/_common.aggregations___CompositeValuesSource' - type: object + _common.aggregations___CompositeValuesSource: + type: object + properties: + field: + $ref: '#/components/schemas/_common___Field' + missing_bucket: + type: boolean + missing_order: + $ref: '#/components/schemas/_common.aggregations___MissingOrder' + script: + $ref: '#/components/schemas/_common___Script' + value_type: + $ref: '#/components/schemas/_common.aggregations___ValueType' + order: + $ref: '#/components/schemas/_common___SortOrder' _common.aggregations___CumulativeCardinalityAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -37524,19 +37471,6 @@ components: allOf: - $ref: '#/components/schemas/_common.aggregations___PipelineAggregationBase' - type: object - _common.aggregations___CustomCategorizeTextAnalyzer: - type: object - properties: - char_filter: - type: array - items: - type: string - tokenizer: - type: string - filter: - type: array - items: - type: string _common.aggregations___DateHistogramAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketAggregateBaseDateHistogramBucket' @@ -37567,17 +37501,17 @@ components: description: |- Only returns buckets that have `min_doc_count` number of documents. By default, all buckets between the first bucket that matches documents and the last one are returned. - type: number + type: integer + format: int32 missing: $ref: '#/components/schemas/_common___DateTime' offset: $ref: '#/components/schemas/_common___Duration' order: - $ref: '#/components/schemas/_common.aggregations___AggregateOrder' + $ref: '#/components/schemas/_common.aggregations___HistogramOrder' params: type: object - additionalProperties: - type: object + additionalProperties: true script: $ref: '#/components/schemas/_common___Script' time_zone: @@ -37611,7 +37545,7 @@ components: description: The date format used to format `from` and `to` in the response. type: string missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' ranges: description: Array of date ranges. type: array @@ -37654,12 +37588,14 @@ components: $ref: '#/components/schemas/_common.aggregations___SamplerAggregationExecutionHint' max_docs_per_value: description: Limits how many documents are permitted per choice of de-duplicating value. - type: number + type: integer + format: int32 script: $ref: '#/components/schemas/_common___Script' shard_size: description: Limits how many top-scoring documents are collected in the sample processed on each shard. - type: number + type: integer + format: int32 field: $ref: '#/components/schemas/_common___Field' _common.aggregations___DoubleTermsAggregate: @@ -37682,6 +37618,7 @@ components: properties: alpha: type: number + format: float _common.aggregations___EwmaMovingAverageAggregation: allOf: - $ref: '#/components/schemas/_common.aggregations___MovingAverageAggregationBase' @@ -37788,6 +37725,7 @@ components: sigma: description: The number of standard deviations above/below the mean to display. type: number + format: double _common.aggregations___ExtendedStatsBucketAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___ExtendedStatsAggregate' @@ -37800,13 +37738,17 @@ components: sigma: description: The number of standard deviations above/below the mean to display. type: number + format: double _common.aggregations___FieldDateMath: description: |- A date range limit, represented either as a DateMath expression or a number expressed according to the target field's precision. oneOf: - - $ref: '#/components/schemas/_common___DateMath' - - type: number + - title: expr + $ref: '#/components/schemas/_common___DateMath' + - title: value + type: number + format: double _common.aggregations___FilterAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SingleBucketAggregateBase' @@ -37851,58 +37793,6 @@ components: properties: format: type: string - _common.aggregations___FrequentItemSetsAggregate: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketAggregateBaseFrequentItemSetsBucket' - - type: object - _common.aggregations___FrequentItemSetsAggregation: - type: object - properties: - fields: - description: Fields to analyze. - type: array - items: - $ref: '#/components/schemas/_common.aggregations___FrequentItemSetsField' - minimum_set_size: - description: The minimum size of one item set. - type: number - minimum_support: - description: The minimum support of one item set. - type: number - size: - description: The number of top item sets to return. - type: number - filter: - $ref: '#/components/schemas/_common.query_dsl___QueryContainer' - required: - - fields - _common.aggregations___FrequentItemSetsBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' - - type: object - properties: - key: - type: object - additionalProperties: - type: array - items: - type: string - support: - type: number - required: - - key - - support - _common.aggregations___FrequentItemSetsField: - type: object - properties: - field: - $ref: '#/components/schemas/_common___Field' - exclude: - $ref: '#/components/schemas/_common.aggregations___TermsExclude' - include: - $ref: '#/components/schemas/_common.aggregations___TermsInclude' - required: - - field _common.aggregations___GapPolicy: type: string enum: @@ -37941,7 +37831,8 @@ components: - type: object properties: count: - type: number + type: integer + format: int64 location: $ref: '#/components/schemas/_common___GeoLocation' _common.aggregations___GeoDistanceAggregate: @@ -37985,10 +37876,12 @@ components: description: |- Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning `max(10,(size x number-of-shards))` buckets from each shard. - type: number + type: integer + format: int32 size: description: The maximum number of geohash buckets to return. - type: number + type: integer + format: int32 _common.aggregations___GeoHashGridBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' @@ -37998,41 +37891,6 @@ components: $ref: '#/components/schemas/_common___GeoHash' required: - key - _common.aggregations___GeoHexGridAggregate: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketAggregateBaseGeoHexGridBucket' - - type: object - _common.aggregations___GeohexGridAggregation: - allOf: - - $ref: '#/components/schemas/_common.aggregations___BucketAggregationBase' - - type: object - properties: - field: - $ref: '#/components/schemas/_common___Field' - precision: - description: |- - Integer zoom of the key used to defined cells or buckets - in the results. Value should be between 0 and 15. - type: number - bounds: - $ref: '#/components/schemas/_common___GeoBounds' - size: - description: Maximum number of buckets to return. - type: number - shard_size: - description: Number of buckets returned from each shard. - type: number - required: - - field - _common.aggregations___GeoHexGridBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' - - type: object - properties: - key: - $ref: '#/components/schemas/_common___GeoHexCell' - required: - - key _common.aggregations___GeoLineAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38064,7 +37922,8 @@ components: description: |- The maximum length of the line represented in the aggregation. Valid sizes are between 1 and 10000. - type: number + type: integer + format: int32 required: - point - sort @@ -38099,10 +37958,12 @@ components: description: |- Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning `max(10,(size x number-of-shards))` buckets from each shard. - type: number + type: integer + format: int32 size: description: The maximum number of buckets to return. - type: number + type: integer + format: int32 bounds: $ref: '#/components/schemas/_common___GeoBounds' _common.aggregations___GeoTileGridBucket: @@ -38133,7 +37994,8 @@ components: properties: number_of_significant_value_digits: description: Specifies the resolution of values for the histogram in number of significant digits. - type: number + type: integer + format: int32 _common.aggregations___HdrPercentileRanksAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___PercentilesAggregateBase' @@ -38162,23 +38024,27 @@ components: The interval for the buckets. Must be a positive decimal. type: number + format: double min_doc_count: description: |- Only returns buckets that have `min_doc_count` number of documents. By default, the response will fill gaps in the histogram with empty buckets. - type: number + type: integer + format: int32 missing: description: |- The value to apply to documents that do not have a value. By default, documents without a value are ignored. type: number + format: double offset: description: |- By default, the bucket keys start with 0 and then continue in even spaced steps of `interval`. The bucket boundaries can be shifted by using the `offset` option. type: number + format: double order: - $ref: '#/components/schemas/_common.aggregations___AggregateOrder' + $ref: '#/components/schemas/_common.aggregations___HistogramOrder' script: $ref: '#/components/schemas/_common___Script' format: @@ -38197,13 +38063,22 @@ components: type: number required: - key + _common.aggregations___HistogramOrder: + type: object + properties: + _count: + $ref: '#/components/schemas/_common___SortOrder' + _key: + $ref: '#/components/schemas/_common___SortOrder' _common.aggregations___HoltLinearModelSettings: type: object properties: alpha: type: number + format: float beta: type: number + format: float _common.aggregations___HoltMovingAverageAggregation: allOf: - $ref: '#/components/schemas/_common.aggregations___MovingAverageAggregationBase' @@ -38223,14 +38098,18 @@ components: properties: alpha: type: number + format: float beta: type: number + format: float gamma: type: number + format: float pad: type: boolean period: - type: number + type: integer + format: int32 type: $ref: '#/components/schemas/_common.aggregations___HoltWintersType' _common.aggregations___HoltWintersMovingAverageAggregation: @@ -38248,10 +38127,13 @@ components: - model - settings _common.aggregations___HoltWintersType: - type: string - enum: - - add - - mult + oneOf: + - title: additive + type: string + const: add + - title: multiplicative + type: string + const: mult _common.aggregations___InferenceAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38325,54 +38207,6 @@ components: - class_name - class_probability - class_score - _common.aggregations___IpPrefixAggregate: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketAggregateBaseIpPrefixBucket' - - type: object - _common.aggregations___IpPrefixAggregation: - allOf: - - $ref: '#/components/schemas/_common.aggregations___BucketAggregationBase' - - type: object - properties: - field: - $ref: '#/components/schemas/_common___Field' - prefix_length: - description: |- - Length of the network prefix. For IPv4 addresses the accepted range is [0, 32]. - For IPv6 addresses the accepted range is [0, 128]. - type: number - is_ipv6: - description: Defines whether the prefix applies to IPv6 addresses. - type: boolean - append_prefix_length: - description: Defines whether the prefix length is appended to IP address keys in the response. - type: boolean - keyed: - description: Defines whether buckets are returned as a hash rather than an array in the response. - type: boolean - min_doc_count: - description: Minimum number of documents in a bucket for it to be included in the response. - type: number - required: - - field - - prefix_length - _common.aggregations___IpPrefixBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' - - type: object - properties: - is_ipv6: - type: boolean - key: - type: string - prefix_length: - type: number - netmask: - type: string - required: - - is_ipv6 - - key - - prefix_length _common.aggregations___IpRangeAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketAggregateBaseIpRangeBucket' @@ -38481,6 +38315,7 @@ components: type: object additionalProperties: type: number + format: double _common.aggregations___MatrixStatsAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38557,13 +38392,14 @@ components: compression: description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. type: number + format: double _common.aggregations___MetricAggregationBase: type: object properties: field: $ref: '#/components/schemas/_common___Field' missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' script: $ref: '#/components/schemas/_common___Script' _common.aggregations___MinAggregate: @@ -38587,12 +38423,6 @@ components: - month - second - year - _common.aggregations___Missing: - oneOf: - - type: string - - type: number - - type: number - - type: boolean _common.aggregations___MissingAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SingleBucketAggregateBase' @@ -38605,7 +38435,7 @@ components: field: $ref: '#/components/schemas/_common___Field' missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' _common.aggregations___MissingOrder: type: string enum: @@ -38630,9 +38460,11 @@ components: minimize: type: boolean predict: - type: number + type: integer + format: int32 window: - type: number + type: integer + format: int32 _common.aggregations___MovingFunctionAggregation: allOf: - $ref: '#/components/schemas/_common.aggregations___PipelineAggregationBase' @@ -38645,10 +38477,12 @@ components: description: |- By default, the window consists of the last n values excluding the current bucket. Increasing `shift` by 1, moves the starting window position by 1 to the right. - type: number + type: integer + format: int32 window: description: The size of window to "slide" across the histogram. - type: number + type: integer + format: int32 _common.aggregations___MovingPercentilesAggregation: allOf: - $ref: '#/components/schemas/_common.aggregations___PipelineAggregationBase' @@ -38656,12 +38490,14 @@ components: properties: window: description: The size of window to "slide" across the histogram. - type: number + type: integer + format: int32 shift: description: |- By default, the window consists of the last n values excluding the current bucket. Increasing `shift` by 1, moves the starting window position by 1 to the right. - type: number + type: integer + format: int32 keyed: type: boolean _common.aggregations___MultiBucketAggregateBaseAdjacencyMatrixBucket: @@ -38709,15 +38545,6 @@ components: $ref: '#/components/schemas/_common.aggregations___BucketsFiltersBucket' required: - buckets - _common.aggregations___MultiBucketAggregateBaseFrequentItemSetsBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___AggregateBase' - - type: object - properties: - buckets: - $ref: '#/components/schemas/_common.aggregations___BucketsFrequentItemSetsBucket' - required: - - buckets _common.aggregations___MultiBucketAggregateBaseGeoHashGridBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38727,15 +38554,6 @@ components: $ref: '#/components/schemas/_common.aggregations___BucketsGeoHashGridBucket' required: - buckets - _common.aggregations___MultiBucketAggregateBaseGeoHexGridBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___AggregateBase' - - type: object - properties: - buckets: - $ref: '#/components/schemas/_common.aggregations___BucketsGeoHexGridBucket' - required: - - buckets _common.aggregations___MultiBucketAggregateBaseGeoTileGridBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38754,15 +38572,6 @@ components: $ref: '#/components/schemas/_common.aggregations___BucketsHistogramBucket' required: - buckets - _common.aggregations___MultiBucketAggregateBaseIpPrefixBucket: - allOf: - - $ref: '#/components/schemas/_common.aggregations___AggregateBase' - - type: object - properties: - buckets: - $ref: '#/components/schemas/_common.aggregations___BucketsIpPrefixBucket' - required: - - buckets _common.aggregations___MultiBucketAggregateBaseIpRangeBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___AggregateBase' @@ -38875,7 +38684,7 @@ components: field: $ref: '#/components/schemas/_common___Field' missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' required: - field _common.aggregations___MultiTermsAggregate: @@ -38890,24 +38699,28 @@ components: collect_mode: $ref: '#/components/schemas/_common.aggregations___TermsAggregationCollectMode' order: - $ref: '#/components/schemas/_common.aggregations___AggregateOrder' + $ref: '#/components/schemas/_common.aggregations___HistogramOrder' min_doc_count: description: The minimum number of documents in a bucket for it to be returned. - type: number + type: integer + format: int32 shard_min_doc_count: description: The minimum number of documents in a bucket on each shard for it to be returned. - type: number + type: integer + format: int32 shard_size: description: |- The number of candidate terms produced by each shard. By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter. - type: number + type: integer + format: int32 show_term_doc_count_error: description: Calculates the doc count error on per term basis. type: boolean size: description: The number of term buckets should be returned out of the overall terms list. - type: number + type: integer + format: int32 terms: description: The field from which to generate sets of terms. type: array @@ -38994,12 +38807,10 @@ components: type: boolean values: description: An array of values for which to calculate the percentile ranks. - oneOf: - - type: array - items: - type: number - - type: 'null' - - type: string + type: array + items: + type: number + format: double hdr: $ref: '#/components/schemas/_common.aggregations___HdrMethod' tdigest: @@ -39034,6 +38845,7 @@ components: type: array items: type: number + format: double hdr: $ref: '#/components/schemas/_common.aggregations___HdrMethod' tdigest: @@ -39052,6 +38864,7 @@ components: type: array items: type: number + format: double _common.aggregations___PipelineAggregationBase: allOf: - $ref: '#/components/schemas/_common.aggregations___BucketPathAggregation' @@ -39079,7 +38892,8 @@ components: description: |- The value to apply to documents that do not have a value. By default, documents without a value are ignored. - type: number + type: integer + format: int32 ranges: description: An array of ranges used to bucket documents. type: array @@ -39121,14 +38935,16 @@ components: $ref: '#/components/schemas/_common.aggregations___TermsInclude' max_doc_count: description: The maximum number of documents a term should appear in. - type: number + type: integer + format: int64 missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' precision: description: |- The precision of the internal CuckooFilters. Smaller precision leads to better approximation, but higher memory usage. type: number + format: double value_type: type: string _common.aggregations___RateAggregate: @@ -39163,7 +38979,8 @@ components: $ref: '#/components/schemas/_common___Field' num_top_feature_importance_values: description: Specifies the maximum number of feature importance values per document. - type: number + type: integer + format: int32 _common.aggregations___ReverseNestedAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SingleBucketAggregateBase' @@ -39186,7 +39003,8 @@ components: properties: shard_size: description: Limits how many top-scoring documents are collected in the sample processed on each shard. - type: number + type: integer + format: int32 _common.aggregations___SamplerAggregationExecutionHint: type: string enum: @@ -39225,8 +39043,7 @@ components: A global object with script parameters for `init`, `map` and `combine` scripts. It is shared between the scripts. type: object - additionalProperties: - type: object + additionalProperties: true reduce_script: $ref: '#/components/schemas/_common___Script' _common.aggregations___SerialDifferencingAggregation: @@ -39238,7 +39055,8 @@ components: description: |- The historical bucket to subtract from the current value. Must be a positive, non-zero integer. - type: number + type: integer + format: int32 _common.aggregations___SignificantLongTermsAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___SignificantTermsAggregateBaseSignificantLongTermsBucket' @@ -39317,7 +39135,8 @@ components: $ref: '#/components/schemas/_common___EmptyObject' min_doc_count: description: Only return terms that are found in more than `min_doc_count` hits. - type: number + type: integer + format: int64 mutual_information: $ref: '#/components/schemas/_common.aggregations___MutualInformationHeuristic' percentage: @@ -39328,15 +39147,18 @@ components: description: |- Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the `min_doc_count`. Terms will only be considered if their local shard frequency within the set is higher than the `shard_min_doc_count`. - type: number + type: integer + format: int64 shard_size: description: |- Can be used to control the volumes of candidate terms produced by each shard. By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter. - type: number + type: integer + format: int32 size: description: The number of buckets returned out of the overall terms list. - type: number + type: integer + format: int32 _common.aggregations___SignificantTermsBucketBase: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' @@ -39375,7 +39197,8 @@ components: $ref: '#/components/schemas/_common___EmptyObject' min_doc_count: description: Only return values that are found in more than `min_doc_count` hits. - type: number + type: integer + format: int64 mutual_information: $ref: '#/components/schemas/_common.aggregations___MutualInformationHeuristic' percentage: @@ -39386,15 +39209,18 @@ components: description: |- Regulates the certainty a shard has if the values should actually be added to the candidate list or not with respect to the `min_doc_count`. Values will only be considered if their local shard frequency within the set is higher than the `shard_min_doc_count`. - type: number + type: integer + format: int64 shard_size: description: |- The number of candidate terms produced by each shard. By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter. - type: number + type: integer + format: int32 size: description: The number of buckets returned out of the overall terms list. - type: number + type: integer + format: int32 source_fields: $ref: '#/components/schemas/_common___Fields' _common.aggregations___SimpleMovingAverageAggregation: @@ -39650,7 +39476,8 @@ components: properties: compression: description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error. - type: number + type: integer + format: int32 _common.aggregations___TDigestPercentileRanksAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations___PercentilesAggregateBase' @@ -39721,9 +39548,10 @@ components: $ref: '#/components/schemas/_common.aggregations___TermsInclude' min_doc_count: description: Only return values that are found in more than `min_doc_count` hits. - type: number + type: integer + format: int32 missing: - $ref: '#/components/schemas/_common.aggregations___Missing' + $ref: '#/components/schemas/_common___FieldValue' missing_order: $ref: '#/components/schemas/_common.aggregations___MissingOrder' missing_bucket: @@ -39739,13 +39567,15 @@ components: description: |- The number of candidate terms produced by each shard. By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter. - type: number + type: integer + format: int32 show_term_doc_count_error: description: Set to `true` to return the `doc_count_error_upper_bound`, which is an upper bound to the error on the `doc_count` returned by each shard. type: boolean size: description: The number of buckets returned out of the overall terms list. - type: number + type: integer + format: int32 format: type: string _common.aggregations___TermsAggregationCollectMode: @@ -39769,26 +39599,33 @@ components: type: number _common.aggregations___TermsExclude: oneOf: - - type: string - - type: array + - title: regexp + type: string + - title: terms + type: array items: type: string _common.aggregations___TermsInclude: oneOf: - - type: string - - type: array + - title: regexp + type: string + - title: terms + type: array items: type: string - - $ref: '#/components/schemas/_common.aggregations___TermsPartition' + - title: partition + $ref: '#/components/schemas/_common.aggregations___TermsPartition' _common.aggregations___TermsPartition: type: object properties: num_partitions: description: The number of partitions. - type: number + type: integer + format: int64 partition: description: The partition number for this request. - type: number + type: integer + format: int64 required: - num_partitions - partition @@ -39824,7 +39661,8 @@ components: type: boolean from: description: Starting document offset. - type: number + type: integer + format: int32 highlight: $ref: '#/components/schemas/_core.search___Highlight' script_fields: @@ -39834,7 +39672,8 @@ components: $ref: '#/components/schemas/_common___ScriptField' size: description: The maximum number of top matching hits to return per bucket. - type: number + type: integer + format: int32 sort: $ref: '#/components/schemas/_common___Sort' _source: @@ -39889,7 +39728,8 @@ components: $ref: '#/components/schemas/_common.aggregations___TopMetricsValue' size: description: The number of top documents from which to return metrics. - type: number + type: integer + format: int32 sort: $ref: '#/components/schemas/_common___Sort' _common.aggregations___TopMetricsValue: @@ -39978,17 +39818,20 @@ components: $ref: '#/components/schemas/_common___Field' buckets: description: The target number of buckets. - type: number + type: integer + format: int32 shard_size: description: |- The number of buckets that the coordinating node will request from each shard. Defaults to `buckets * 50`. - type: number + type: integer + format: int32 initial_buffer: description: |- Specifies the number of individual documents that will be stored in memory on a shard before the initial bucketing algorithm is run. Defaults to `min(10 * shard_size, 50000)`. - type: number + type: integer + format: int32 _common.aggregations___VariableWidthHistogramBucket: allOf: - $ref: '#/components/schemas/_common.aggregations___MultiBucketBase' @@ -40032,6 +39875,7 @@ components: missing: description: A value or weight to use if the field is missing. type: number + format: double script: $ref: '#/components/schemas/_common___Script' _common.aggregations___WeightedAvgAggregate: @@ -55533,6 +55377,23 @@ components: - SPARSE_TOKENIZE - TEXT_EMBEDDING - TEXT_SIMILARITY + ml._common___AlgorithmOperations: + type: object + properties: + deploy: + $ref: '#/components/schemas/ml._common___Deploy' + register: + $ref: '#/components/schemas/ml._common___Register' + undeploy: + $ref: '#/components/schemas/ml._common___Undeploy' + predict: + $ref: '#/components/schemas/ml._common___Predict' + train: + $ref: '#/components/schemas/ml._common___Train' + ml._common___Algorithms: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___AlgorithmOperations' ml._common___BoolQuery: type: object description: The Boolean query. @@ -55607,6 +55468,8 @@ components: session_token: type: string additionalProperties: true + ml._common___Deploy: + $ref: '#/components/schemas/ml._common___ModelStats' ml._common___Exists: type: object description: The exists filter. @@ -55664,6 +55527,59 @@ components: properties: nodes: $ref: '#/components/schemas/ml._common___Nodes' + ml._common___GetStatsResponse: + type: object + properties: + ml_model_count: + type: integer + format: int64 + description: The model count. + ml_connector_index_status: + type: string + description: The connector index status. + enum: + - green + - non-existent + - red + - yellow + ml_config_index_status: + type: string + description: The config index status. + enum: + - green + - non-existent + - red + - yellow + ml_task_index_status: + type: string + description: The task index status. + enum: + - green + - non-existent + - red + - yellow + ml_connector_count: + type: integer + format: int64 + description: The connector count. + ml_model_index_status: + type: string + description: The model index status. + enum: + - green + - non-existent + - red + - yellow + ml_controller_index_status: + type: string + description: The controller index status. + enum: + - green + - non-existent + - red + - yellow + nodes: + $ref: '#/components/schemas/ml._common___NodeStats' ml._common___Guardrails: type: object properties: @@ -56001,10 +55917,35 @@ components: type: integer format: int64 description: The estimated memory size in GPU. + deploy: + $ref: '#/components/schemas/ml._common___Deploy' + register: + $ref: '#/components/schemas/ml._common___Register' + undeploy: + $ref: '#/components/schemas/ml._common___Undeploy' + predict: + $ref: '#/components/schemas/ml._common___Predict' + train: + $ref: '#/components/schemas/ml._common___Train' ml._common___Models: type: object additionalProperties: $ref: '#/components/schemas/ml._common___ModelProfile' + ml._common___ModelStats: + type: object + properties: + ml_action_request_count: + type: integer + format: int64 + description: The request count. + ml_action_failure_count: + type: integer + format: int64 + description: The failure count. + ml_executing_task_count: + type: integer + format: int64 + description: The executing task count. ml._common___Nested: type: object description: The nested filter. @@ -56039,6 +55980,41 @@ components: type: object additionalProperties: $ref: '#/components/schemas/ml._common___Node' + ml._common___NodeStats: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___NodeStatsDetails' + ml._common___NodeStatsDetails: + type: object + properties: + ml_deployed_model_count: + type: integer + format: int64 + description: The deployed model count. + ml_jvm_heap_usage: + type: integer + format: int64 + description: The JVM heap usage. + ml_failure_count: + type: integer + format: int64 + description: The failure count. + ml_executing_task_count: + type: integer + format: int64 + description: The executing task count. + ml_circuit_breaker_trigger_count: + type: integer + format: int64 + description: The circuit breaker trigger count. + ml_request_count: + type: integer + format: int64 + description: The request count. + algorithms: + $ref: '#/components/schemas/ml._common___Algorithms' + models: + $ref: '#/components/schemas/ml._common___Models' ml._common___Output: type: object properties: @@ -56114,6 +56090,8 @@ components: ml._common___Parameters: type: object additionalProperties: true + ml._common___Predict: + $ref: '#/components/schemas/ml._common___ModelStats' ml._common___PredictionResult: type: object properties: @@ -56280,6 +56258,8 @@ components: required: - limit - unit + ml._common___Register: + $ref: '#/components/schemas/ml._common___ModelStats' ml._common___Rows: type: object properties: @@ -56720,6 +56700,8 @@ components: parameters: $ref: '#/components/schemas/ml._common___Parameters' additionalProperties: true + ml._common___Train: + $ref: '#/components/schemas/ml._common___ModelStats' ml._common___TrainParameters: type: object properties: @@ -56756,6 +56738,8 @@ components: $ref: '#/components/schemas/ml._common___Status' required: - status + ml._common___Undeploy: + $ref: '#/components/schemas/ml._common___ModelStats' ml._common___UndeployModelNode: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java index c7f774e993..3db970ae23 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java @@ -102,7 +102,7 @@ public void addAlias(String alias) { } public String getName() { - return Strings.toPascalCase(name); + return toEnumConstant(name); } public boolean isDeprecated() { @@ -112,5 +112,16 @@ public boolean isDeprecated() { public void setDeprecated(boolean deprecated) { this.deprecated = deprecated; } + + private static String toEnumConstant(String name) { + switch (name) { + case "rescale_0_1": + return "Rescale_0_1"; + case "rescale_0_100": + return "Rescale_0_100"; + default: + return Strings.toPascalCase(name); + } + } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShapeBase.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShapeBase.java index 554f3008c0..4e9bafc89f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShapeBase.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShapeBase.java @@ -90,6 +90,10 @@ public boolean hasFields(boolean includeSingleKeyMap) { || (includeSingleKeyMap && singleyKeyMapField != null); } + public boolean hasAnyRequiredFields() { + return bodyFields.values().stream().anyMatch(Field::isRequired); + } + public void setAdditionalPropertiesField(Field field) { additionalPropertiesField = field; if (field != null) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index df49c93b5f..a9a3c66b11 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -204,6 +204,7 @@ public boolean hasFields() { return !fields.isEmpty(); } + @Override public boolean hasAnyRequiredFields() { return fields.values().stream().anyMatch(Field::isRequired); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index fe5556c9e0..fa78fcf726 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -323,14 +323,14 @@ private static class PathParam { public PathParam(String name, OpenApiSchema schema, OpenApiParameter original) { this.name = name; this.schema = schema; - this.description = original.getDescription().orElse(null); + this.description = original.getResolvedDescription().orElse(null); this.deprecation = original.getDeprecation().orElse(null); } public PathParam(OpenApiParameter parameter) { this.name = parameter.getName().orElseThrow(); this.schema = parameter.getSchema().orElseThrow(); - this.description = parameter.getDescription().orElse(null); + this.description = parameter.getResolvedDescription().orElse(null); this.deprecation = parameter.getDeprecation().orElse(null); } @@ -356,7 +356,7 @@ private Field visit(OpenApiParameter parameter) { .withWireName(parameter.getName().orElseThrow()) .withType(mapType(parameter.getSchema().orElseThrow())) .withRequired(parameter.getRequired()) - .withDescription(parameter.getDescription().orElse(null)) + .withDescription(parameter.getResolvedDescription().orElse(null)) .withDeprecation(parameter.getDeprecation().orElse(null)) .build(); } @@ -396,7 +396,7 @@ private Shape visit( LOGGER.info("Visiting Schema: {}", schema); - var description = schema.getDescription().orElse(null); + var description = schema.getResolvedDescription().orElse(null); var isTaggedUnion = isTaggedUnion(schema); var isShortcutPropertyObject = isShortcutPropertyObject(schema); @@ -555,7 +555,7 @@ private void visitInto(OpenApiSchema schema, ObjectShapeBase shape) { Field.builder() .withName(valueSchema.getTitle().orElse("metadata")) .withType(Types.Java.Util.Map(Types.Java.Lang.String, mapType(valueSchema))) - .withDescription(valueSchema.getDescription().orElse(null)) + .withDescription(valueSchema.getResolvedDescription().orElse(null)) .build() ); } @@ -628,15 +628,16 @@ private void visitInto(OpenApiSchema schema, EnumShape shape) { } else if (schema.hasEnums()) { var enums = schema.getEnums().orElseThrow(); var description = title.isPresent() || enums.stream().map(String::toLowerCase).distinct().count() == 1 - ? schema.getDescription().orElse(null) + ? schema.getResolvedDescription().orElse(null) : null; enums.forEach(v -> shape.addVariant(title.orElse(v), v, description, isDeprecated)); } else if (schema.hasConst()) { var value = (String) schema.getConst().orElseThrow(); - shape.addVariant(title.orElse(value), value, schema.getDescription().orElse(null), isDeprecated); + shape.addVariant(title.orElse(value), value, schema.getResolvedDescription().orElse(null), isDeprecated); } else if (schema.isBoolean()) { - shape.addVariant(title.orElse("true"), "true", schema.getDescription().orElse(null), isDeprecated); - shape.addVariant(title.orElse("false"), "false", schema.getDescription().orElse(null), isDeprecated); + var description = schema.getResolvedDescription().orElse(null); + shape.addVariant(title.orElse("true"), "true", description, isDeprecated); + shape.addVariant(title.orElse("false"), "false", description, isDeprecated); } } @@ -706,7 +707,15 @@ private Type mapTypeInner(OpenApiSchema schema) { .map(ts -> ts.stream().filter(t -> t != OpenApiSchemaType.Null).collect(Collectors.toSet())) .orElse(null); - if (types == null || types.size() != 1) { + if (types == null || types.isEmpty()) { + return Types.Client.Json.JsonData; + } + + if (types.size() == 2 && types.contains(OpenApiSchemaType.String) && types.contains(OpenApiSchemaType.Number)) { + return Types.Java.Lang.String; + } + + if (types.size() > 1) { return Types.Client.Json.JsonData; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java index b4a7e6eb39..e9f1c565f3 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java @@ -209,7 +209,7 @@ public String toString() { public static class VariantInterface extends Shape { private final String unionClassName; - private boolean includeToUnionMethod; + private final boolean includeToUnionMethod; private VariantInterface(TaggedUnionShape union, ShouldGenerate shouldGenerate) { super( @@ -223,7 +223,7 @@ private VariantInterface(TaggedUnionShape union, ShouldGenerate shouldGenerate) if (union.isInternallyDiscriminated()) { setExtendsType(Types.Client.Json.JsonpSerializable); } - includeToUnionMethod = !union.hasFields(); + includeToUnionMethod = !union.hasAnyRequiredFields() && !union.extendsOtherShape(); } @Override diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index eb642d953c..439e4b4f69 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -102,6 +102,10 @@ public Type[] getTypeParams() { return typeParams; } + public boolean hasTypeParams() { + return typeParams != null && typeParams.length > 0; + } + public boolean isInsidePackage(String pkg) { return packageName != null && packageName.startsWith(pkg); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index a071306dd7..654290f8db 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -170,11 +170,36 @@ public static final class OpenSearch { public static final class _Types { public static final String PACKAGE = OpenSearch.PACKAGE + "._types"; + public static final Type ErrorResponse = type(PACKAGE, "ErrorResponse"); public static final Type FieldValue = type(PACKAGE, "FieldValue"); public static final Type OpenSearchException = type(PACKAGE, "OpenSearchException"); public static final Type RequestBase = type(PACKAGE, "RequestBase"); public static final Type Time = type(PACKAGE, "Time"); + + public static final class Aggregations { + public static final String PACKAGE = _Types.PACKAGE + ".aggregations"; + + public static final Type Buckets = type(PACKAGE, "Buckets"); + + public static Type Buckets(Type bucketType) { + return Buckets.withTypeParameters(bucketType); + } + + public static final Type ExtendedBounds = type(PACKAGE, "ExtendedBounds"); + + public static Type ExtendedBounds(Type valueType) { + return ExtendedBounds.withTypeParameters(valueType); + } + + public static final Type FieldDateMath = type(PACKAGE, "FieldDateMath"); + } + + public static final class QueryDsl { + public static final String PACKAGE = _Types.PACKAGE + ".query_dsl"; + + public static final Type Query = type(PACKAGE, "Query"); + } } public static final class Cat { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 135cda1392..0da926de71 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -45,6 +45,7 @@ private static JsonPointer schema(String namespace, String name) { .withSchemas( s -> s.with(schema("_common", "ByteUnit"), so -> so.withClassName("Bytes")) .with(schema("_common", "Duration"), so -> so.withMappedType(Types.Client.OpenSearch._Types.Time)) + .with(schema("_common", "DurationLarge"), so -> so.withMappedType(Types.Client.OpenSearch._Types.Time)) .with(schema("_common", "FieldValue"), so -> so.withMappedType(Types.Client.OpenSearch._Types.FieldValue)) .with(schema("_common", "StringifiedBoolean"), so -> so.withMappedType(Types.Primitive.Boolean)) .with(schema("_common", "StringifiedDouble"), so -> so.withMappedType(Types.Primitive.Double)) @@ -65,10 +66,37 @@ private static JsonPointer schema(String namespace, String name) { .with(schema("_common", "GetStats"), so -> so.withProperties(p -> p.with("getTime", po -> po.withName("time")))) + .with(schema("_common", "EmptyObject"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + + .with(schema("_common.aggregations", "Aggregation"), so -> so.withClassName("AggregationBase")) .with( schema("_common.aggregations", "AggregationContainer"), - so -> so.withClassName("Aggregation").withShouldGenerate(ShouldGenerate.Never) + so -> so.withClassName("Aggregation").withShouldGenerate(ShouldGenerate.Always) + ) + .with( + schema("_common.aggregations", "AggregationContainer").append("allOf", "0"), + so -> so.withProperties(p -> p.with("aggregations", po -> po.withAliases(Set.of("aggs")))) + ) + .with( + schema("_common.aggregations", "BucketsQueryContainer"), + so -> so.withMappedType( + Types.Client.OpenSearch._Types.Aggregations.Buckets(Types.Client.OpenSearch._Types.QueryDsl.Query) + ) + ) + .with( + schema("_common.aggregations", "ExtendedBoundsdouble"), + so -> so.withMappedType(Types.Client.OpenSearch._Types.Aggregations.ExtendedBounds(Types.Java.Lang.Double)) + ) + .with( + schema("_common.aggregations", "ExtendedBoundsFieldDateMath"), + so -> so.withMappedType( + Types.Client.OpenSearch._Types.Aggregations.ExtendedBounds( + Types.Client.OpenSearch._Types.Aggregations.FieldDateMath + ) + ) ) + .with(schema("_common.aggregations", "InferenceConfigContainer"), so -> so.withClassName("InferenceConfig")) + .with(schema("_common.aggregations", "PercentageScoreHeuristic"), so -> so.withShouldGenerate(ShouldGenerate.Never)) // TODO: Remove this once figuring out how best to handle these schemas .with(schema("_common.query_dsl", "DecayFunction"), so -> so.withShouldGenerate(ShouldGenerate.Never)) diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java index df8f8bcb6b..452fc0a541 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java @@ -64,6 +64,20 @@ public Optional getDescription() { return Optional.ofNullable(description); } + @Nonnull + public Optional getResolvedDescription() { + if (description != null) { + return Optional.of(description); + } + if (has$ref()) { + return resolve().getResolvedDescription(); + } + if (schema != null) { + return schema.getResolvedDescription(); + } + return Optional.empty(); + } + @Nonnull public Optional getIn() { return Optional.ofNullable(in); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index c4546a31aa..6c47901e19 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -190,6 +190,17 @@ public Optional getDescription() { return Optional.ofNullable(description); } + @Nonnull + public Optional getResolvedDescription() { + if (description != null) { + return Optional.of(description); + } + if (has$ref()) { + return resolve().getResolvedDescription(); + } + return Optional.empty(); + } + @Nonnull public Optional> getTypes() { return Sets.unmodifiableOpt(types); diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index 83c772196d..289dd8e4b3 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -39,11 +39,15 @@ {{>ObjectShape/Fields}} {{/hasFields}} -{{^hasFields}} +{{^hasAnyRequiredFields}} +{{^extendsOtherShape}} {{#discriminated}} public {{className}}({{variantInterfaceType}} value) { this._kind = {{TYPES.Client.Util.ApiTypeHelper}}.requireNonNull(value._{{#camelCase}}{{className}}{{/camelCase}}Kind(), this, ""); this._value = {{TYPES.Client.Util.ApiTypeHelper}}.requireNonNull(value, this, ""); + {{#fields}} + this.{{name}} = null; + {{/fields}} } {{/discriminated}} {{^discriminated}} @@ -53,7 +57,8 @@ } {{/discriminated}} -{{/hasFields}} +{{/extendsOtherShape}} +{{/hasAnyRequiredFields}} private {{className}}(Builder builder) { {{>ObjectShape/ConstructorImpl}} this._kind = {{TYPES.Client.Util.ApiTypeHelper}}.requireNonNull(builder._kind, builder, ""); diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache index 25d0754571..3f71fac9c5 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache @@ -17,7 +17,12 @@ {{TYPES.Client.Json.JsonpDeserializer}}.stringDeserializer() {{/isString}} {{^isString}} - {{name}}._DESERIALIZER + {{#hasTypeParams}} + {{name}}.create{{name}}Deserializer({{#typeParams}}{{>Type/deserializer}}{{^-last}}, {{/-last}}{{/typeParams}}) + {{/hasTypeParams}} + {{^hasTypeParams}} + {{name}}._DESERIALIZER + {{/hasTypeParams}} {{/isString}} {{/isNumber}} {{/isListOrMap}}