From 75ff633fce33f555105ff73af3f8b7fa58b0d7bb Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 6 Dec 2024 10:49:12 +1300 Subject: [PATCH] Generate query DSL types (#1337) Signed-off-by: Thomas Farr --- UPGRADING.md | 33 +- .../_types/AcknowledgedResponseBase.java | 1 - .../client/opensearch/_types/BaseNode.java | 1 - .../BulkByScrollTaskStatusOrException.java | 18 + .../opensearch/_types/CoordsGeoBounds.java | 120 +- .../opensearch/_types/DistanceUnit.java | 22 +- .../client/opensearch/_types/ErrorCause.java | 90 +- .../client/opensearch/_types/GeoBounds.java | 79 +- .../opensearch/_types/GeoBoundsBuilders.java | 17 +- .../opensearch/_types/GeoDistanceType.java | 12 +- .../client/opensearch/_types/GeoLocation.java | 18 + .../opensearch/_types/GeoShapeRelation.java | 16 +- .../_types/IndicesResponseBase.java | 1 - .../opensearch/_types/NestedSortValue.java | 102 +- .../opensearch/_types/ResourceStat.java | 208 +++ .../opensearch/_types/ResourceStats.java | 343 +++++ .../client/opensearch/_types/Script.java | 30 +- .../client/opensearch/_types/ScriptBase.java | 1 - .../client/opensearch/_types/ScriptField.java | 123 +- .../opensearch/_types/ScriptLanguage.java | 18 + .../client/opensearch/_types/ScriptSort.java | 218 ++-- .../opensearch/_types/ScriptSortType.java | 14 +- .../client/opensearch/_types/SortMode.java | 18 +- .../client/opensearch/_types/SortOrder.java | 12 +- .../client/opensearch/_types/ThreadInfo.java | 212 +++ .../_types/TopLeftBottomRightGeoBounds.java | 129 +- .../_types/TopRightBottomLeftGeoBounds.java | 129 +- .../client/opensearch/_types/VersionType.java | 12 +- .../_types/WaitForActiveShards.java | 18 + .../opensearch/_types/WktGeoBounds.java | 71 +- .../opensearch/_types/WriteResponseBase.java | 1 - .../client/opensearch/_types/XyLocation.java | 18 + .../opensearch/_types/analysis/Analyzer.java | 19 +- .../_types/analysis/AnalyzerVariant.java | 2 +- .../_types/analysis/CharFilter.java | 18 + .../_types/analysis/CharFilterBase.java | 1 - .../_types/analysis/CharFilterDefinition.java | 19 +- .../analysis/CharFilterDefinitionVariant.java | 2 +- .../analysis/CompoundWordTokenFilterBase.java | 1 - .../_types/analysis/Normalizer.java | 19 +- .../_types/analysis/NormalizerVariant.java | 2 +- .../_types/analysis/TokenFilter.java | 18 + .../_types/analysis/TokenFilterBase.java | 1 - .../analysis/TokenFilterDefinition.java | 19 +- .../TokenFilterDefinitionVariant.java | 2 +- .../opensearch/_types/analysis/Tokenizer.java | 18 + .../_types/analysis/TokenizerBase.java | 1 - .../_types/analysis/TokenizerDefinition.java | 19 +- .../analysis/TokenizerDefinitionVariant.java | 2 +- .../_types/mapping/CorePropertyBase.java | 1 - .../_types/mapping/DocValuesPropertyBase.java | 1 - .../_types/mapping/NumberPropertyBase.java | 1 - .../opensearch/_types/mapping/Property.java | 19 +- .../_types/mapping/PropertyBase.java | 1 - .../_types/mapping/PropertyVariant.java | 2 +- .../_types/mapping/RangePropertyBase.java | 1 - .../_types/query_dsl/BoolQuery.java | 258 +++- .../_types/query_dsl/BoostingQuery.java | 147 ++- .../_types/query_dsl/ChildScoreMode.java | 16 +- .../query_dsl/CombinedFieldsOperator.java | 12 +- .../_types/query_dsl/CombinedFieldsQuery.java | 279 ++-- .../query_dsl/CombinedFieldsZeroTerms.java | 12 +- .../_types/query_dsl/CommonTermsQuery.java | 190 ++- .../_types/query_dsl/ConstantScoreQuery.java | 95 +- .../_types/query_dsl/DisMaxQuery.java | 283 ++++ .../_types/query_dsl/ExistsQuery.java | 89 +- .../_types/query_dsl/FieldAndFormat.java | 104 +- .../query_dsl/FieldValueFactorModifier.java | 26 +- .../_types/query_dsl/FunctionBoostMode.java | 20 +- .../_types/query_dsl/FunctionScoreMode.java | 16 +- .../_types/query_dsl/FunctionScoreQuery.java | 191 ++- .../_types/query_dsl/FuzzyQuery.java | 249 ++-- .../_types/query_dsl/HasChildQuery.java | 171 ++- .../_types/query_dsl/HasParentQuery.java | 143 ++- .../_types/query_dsl/HybridQuery.java} | 160 ++- .../opensearch/_types/query_dsl/IdsQuery.java | 95 +- .../_types/query_dsl/Intervals.java | 105 +- .../_types/query_dsl/IntervalsAllOf.java | 234 +++- .../_types/query_dsl/IntervalsAnyOf.java | 189 ++- .../_types/query_dsl/IntervalsBuilders.java | 26 +- .../_types/query_dsl/IntervalsFilter.java | 117 +- .../query_dsl/IntervalsFilterBuilders.java | 34 +- .../query_dsl/IntervalsFilterVariant.java | 11 +- .../_types/query_dsl/IntervalsFuzzy.java | 163 ++- .../_types/query_dsl/IntervalsMatch.java | 223 +++- .../_types/query_dsl/IntervalsPrefix.java | 122 +- .../_types/query_dsl/IntervalsQuery.java | 135 +- .../query_dsl/IntervalsQueryBuilders.java | 26 +- .../query_dsl/IntervalsQueryVariant.java | 9 +- .../_types/query_dsl/IntervalsVariant.java | 11 +- .../_types/query_dsl/IntervalsWildcard.java | 122 +- .../opensearch/_types/query_dsl/KnnQuery.java | 556 ++++++++ .../opensearch/_types/query_dsl/Like.java | 69 +- .../_types/query_dsl/LikeBuilders.java | 15 +- .../_types/query_dsl/LikeDocument.java | 185 ++- .../_types/query_dsl/MatchAllQuery.java | 68 +- .../query_dsl/MatchBoolPrefixQuery.java | 253 +++- .../_types/query_dsl/MatchNoneQuery.java | 66 +- .../query_dsl/MatchPhrasePrefixQuery.java | 204 ++- .../_types/query_dsl/MatchPhraseQuery.java | 180 ++- .../_types/query_dsl/MatchQuery.java | 316 +++-- .../_types/query_dsl/MoreLikeThisQuery.java | 483 +++++-- .../_types/query_dsl/MultiMatchQuery.java | 324 +++-- .../_types/query_dsl/NestedQuery.java | 132 +- .../_types/query_dsl/NeuralQuery.java | 433 +++++++ .../opensearch/_types/query_dsl/Operator.java | 12 +- .../_types/query_dsl/ParentIdQuery.java | 109 +- .../_types/query_dsl/PercolateQuery.java | 196 ++- .../_types/query_dsl/PinnedDoc.java | 78 +- .../_types/query_dsl/PinnedQuery.java | 168 +-- .../_types/query_dsl/PinnedQueryVariant.java | 9 +- .../_types/query_dsl/PrefixQuery.java | 195 ++- .../opensearch/_types/query_dsl/Query.java | 541 ++++---- .../_types/query_dsl/QueryBase.java | 67 +- .../_types/query_dsl/QueryBuilders.java | 175 ++- .../_types/query_dsl/QueryStringQuery.java | 480 +++++-- .../_types/query_dsl/QueryVariant.java | 13 +- .../_types/query_dsl/RankFeatureQuery.java | 191 ++- .../_types/query_dsl/RegexpQuery.java | 206 ++- .../_types/query_dsl/ScriptQuery.java | 90 +- .../_types/query_dsl/ScriptScoreQuery.java | 116 +- .../query_dsl/SimpleQueryStringFlag.java | 32 +- .../query_dsl/SimpleQueryStringFlags.java | 125 +- .../query_dsl/SimpleQueryStringQuery.java | 325 +++-- .../_types/query_dsl/SpanContainingQuery.java | 116 +- .../query_dsl/SpanFieldMaskingQuery.java | 113 +- .../_types/query_dsl/SpanFirstQuery.java | 121 +- .../_types/query_dsl/SpanMultiTermQuery.java | 121 +- .../_types/query_dsl/SpanNearQuery.java | 172 ++- .../_types/query_dsl/SpanNotQuery.java | 161 ++- .../_types/query_dsl/SpanOrQuery.java | 141 +- .../_types/query_dsl/SpanQuery.java | 157 ++- .../_types/query_dsl/SpanQueryBuilders.java | 46 +- .../_types/query_dsl/SpanQueryVariant.java | 11 +- .../_types/query_dsl/SpanTermQuery.java | 116 +- .../_types/query_dsl/SpanWithinQuery.java | 116 +- .../_types/query_dsl/TermQuery.java | 172 ++- .../_types/query_dsl/TermsLookup.java | 159 ++- .../_types/query_dsl/TermsQueryField.java | 114 +- .../query_dsl/TermsQueryFieldBuilders.java | 18 +- .../_types/query_dsl/TermsSetQuery.java | 150 ++- .../_types/query_dsl/TextQueryType.java | 18 +- .../_types/query_dsl/TypeQuery.java | 89 +- .../_types/query_dsl/WildcardQuery.java | 198 ++- .../_types/query_dsl/WrapperQuery.java | 97 +- .../_types/query_dsl/ZeroTermsQuery.java | 12 +- .../core/search/BoundaryScanner.java | 12 +- .../core/search/BuiltinHighlighterType.java | 14 +- .../opensearch/core/search/FieldCollapse.java | 118 +- .../opensearch/core/search/Highlight.java | 254 ++++ .../opensearch/core/search/HighlightBase.java | 1025 +++++++++++++++ .../core/search/HighlightField.java | 253 ++++ .../core/search/HighlighterEncoder.java | 12 +- .../core/search/HighlighterFragmenter.java | 12 +- .../core/search/HighlighterOrder.java | 12 +- .../core/search/HighlighterTagsSchema.java | 12 +- .../core/search/HighlighterType.java | 80 +- .../opensearch/core/search/InnerHits.java | 473 ++++--- .../opensearch/core/search/SourceConfig.java | 113 +- .../core/search/SourceConfigBuilders.java | 18 +- .../opensearch/core/search/SourceFilter.java | 96 +- .../opensearch/indices/IndexSettings.java | 82 +- .../indices/IndexSettingsMergePolicy.java | 18 + .../indices/SimulateIndexTemplateRequest.java | 76 -- .../client/opensearch/ml/Credential.java | 70 +- .../client/opensearch/ml/Headers.java | 2 - .../client/opensearch/ml/ToolItems.java | 84 +- .../snapshot/CreateSnapshotRequest.java | 4 +- .../client/opensearch/tasks/Status.java | 82 +- .../client/opensearch/tasks/TaskInfoBase.java | 43 +- .../client/opensearch/tasks/TaskInfos.java | 18 + .../tasks/TaskListResponseBase.java | 1 - .../query_dsl/DistanceFeatureQuery.java | 11 +- .../_types/query_dsl/GeoBoundingBoxQuery.java | 17 +- .../_types/query_dsl/GeoDistanceQuery.java | 13 +- .../_types/query_dsl/GeoShapeQuery.java | 11 +- .../_types/query_dsl/HybridQuery.java | 115 -- .../opensearch/_types/query_dsl/KnnQuery.java | 270 ---- .../_types/query_dsl/NeuralQuery.java | 344 ----- .../_types/query_dsl/PinnedQueryBuilders.java | 45 - .../_types/query_dsl/RangeQuery.java | 17 +- .../_types/query_dsl/RangeQueryBase.java | 7 + .../SimpleQueryStringFlagsBuilders.java | 46 - .../_types/query_dsl/TermsQuery.java | 10 +- .../_types/query_dsl/XyShapeQuery.java | 11 +- .../opensearch/core/search/Highlight.java | 758 ----------- .../core/search/HighlightField.java | 778 ----------- .../core/search/HighlighterTypeBuilders.java | 46 - .../MissingRequiredPropertiesException.java | 53 - .../client/util/ObjectBuilderBase.java | 12 +- .../query_dsl/FunctionScoreQueryTest.java | 4 +- .../_types/query_dsl/HybridQueryTest.java | 2 +- .../_types/query_dsl/KnnQueryTest.java | 2 +- .../_types/query_dsl/NeuralQueryTest.java | 9 - .../client/opensearch/model/VariantsTest.java | 6 +- .../integTest/AbstractHighlightIT.java | 2 +- .../opensearch/integTest/AbstractKnnIT.java | 2 +- java-codegen/opensearch-openapi.yaml | 1144 +++++++++-------- .../client/codegen/model/ArrayShape.java | 7 +- .../client/codegen/model/EnumShape.java | 8 +- .../client/codegen/model/Field.java | 152 ++- .../client/codegen/model/ObjectShape.java | 124 +- .../client/codegen/model/ObjectShapeBase.java | 149 +++ .../client/codegen/model/RequestShape.java | 5 + .../client/codegen/model/Shape.java | 52 +- .../client/codegen/model/SpecTransformer.java | 207 ++- .../codegen/model/TaggedUnionShape.java | 82 +- .../client/codegen/model/Types.java | 1 + .../codegen/model/overrides/Overrides.java | 50 +- .../model/overrides/PropertyOverride.java | 24 + .../model/overrides/SchemaOverride.java | 28 +- .../client/codegen/openapi/OpenApiSchema.java | 41 +- .../codegen/openapi/OpenApiSchemaType.java | 2 + .../renderer/TemplateGlobalContext.java | 2 +- .../client/codegen/utils/NameSanitizer.java | 4 +- .../utils/builder/ObjectBuilderBase.java | 8 + .../codegen/templates/ObjectShape.mustache | 13 +- .../templates/ObjectShape/Builder.mustache | 17 +- .../ObjectShape/Builder/HelperCtor.mustache | 4 + .../ObjectShape/Builder/Setter.mustache | 72 ++ .../ObjectShape/Builder/Setters.mustache | 73 -- .../ObjectShape/Constructor.mustache | 22 +- .../ObjectShape/ConstructorImpl.mustache | 21 + .../ObjectShape/Deserialize.mustache | 7 +- .../ObjectShape/Deserialize/Fields.mustache | 3 + .../DiscriminatedUnionInterfaceImpl.mustache | 7 + .../templates/ObjectShape/Equals.mustache | 39 +- .../ObjectShape/Equals/Fields.mustache | 16 + .../ObjectShape/FieldDoc/Basic.mustache | 4 +- .../ObjectShape/FieldDoc/BasicInner.mustache | 11 +- .../templates/ObjectShape/HashCode.mustache | 15 +- .../ObjectShape/HashCode/Fields.mustache | 14 + .../templates/ObjectShape/Serialize.mustache | 20 +- .../ObjectShape/Serialize/Fields.mustache | 13 + .../templates/TaggedUnionShape.mustache | 111 +- .../TaggedUnionShape/Deserialize.mustache | 28 + .../TaggedUnionShape/Equals.mustache | 9 +- .../TaggedUnionShape/HashCode.mustache | 6 + .../TaggedUnionShape/Serialize.mustache | 40 + .../VariantInterface.mustache | 4 +- .../client/samples/knn/KnnBasics.java | 2 +- .../client/samples/knn/KnnBooleanFilter.java | 4 +- .../samples/knn/KnnEfficientFilter.java | 10 +- .../client/samples/util/RandUtil.java | 17 +- 244 files changed, 15567 insertions(+), 7907 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/DistanceUnit.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GeoBounds.java (76%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/NestedSortValue.java (70%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStat.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStats.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ScriptField.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ScriptSort.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ScriptSortType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/SortMode.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/SortOrder.java (84%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/ThreadInfo.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/TopLeftBottomRightGeoBounds.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/TopRightBottomLeftGeoBounds.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/VersionType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/WktGeoBounds.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java (57%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ChildScoreMode.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsOperator.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsZeroTerms.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormat.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorModifier.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionBoostMode.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreMode.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java (65%) rename java-client/src/{main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java => generated/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java} (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/Intervals.java (79%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOf.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOf.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsBuilders.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilter.java (82%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterBuilders.java (79%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterVariant.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzy.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatch.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefix.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java (78%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryBuilders.java (77%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryVariant.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsVariant.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcard.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/Like.java (75%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/LikeBuilders.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocument.java (73%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchAllQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchNoneQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java (68%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/Operator.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDoc.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java (76%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQueryVariant.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java (86%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBuilders.java (89%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/QueryVariant.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringFlag.java (85%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringFlags.java (72%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQuery.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryBuilders.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryVariant.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookup.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryField.java (74%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryFieldBuilders.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TextQueryType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java (66%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/query_dsl/ZeroTermsQuery.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/BoundaryScanner.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/BuiltinHighlighterType.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/FieldCollapse.java (67%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Highlight.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/core/search/HighlightBase.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/core/search/HighlightField.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/HighlighterEncoder.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/HighlighterFragmenter.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/HighlighterOrder.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/HighlighterTagsSchema.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/HighlighterType.java (74%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/InnerHits.java (74%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/SourceConfig.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/SourceConfigBuilders.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/SourceFilter.java (72%) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQueryBuilders.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringFlagsBuilders.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/core/search/Highlight.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/core/search/HighlightField.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/core/search/HighlighterTypeBuilders.java delete mode 100644 java-client/src/main/java/org/opensearch/client/util/MissingRequiredPropertiesException.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShapeBase.java create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/HelperCtor.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Setter.mustache delete mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Setters.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/ConstructorImpl.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize/Fields.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/DiscriminatedUnionInterfaceImpl.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals/Fields.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode/Fields.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize/Fields.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Deserialize.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Serialize.mustache diff --git a/UPGRADING.md b/UPGRADING.md index 8316532651..7edfe5b589 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -112,4 +112,35 @@ After: - The `creationDate` property is now of type `Long` instead of `String`. - The `translogDurability` property now accepts a `TranslogDurability` enum instead of a `String`. - The `numberOfReplicas` property is now of type `Integer` instead of `String`. -- The `numberOfShards` property is now of type `Integer` instead of `String`. \ No newline at end of file +- The `numberOfShards` property is now of type `Integer` instead of `String`. + +### BoostingQuery +- The `negativeBoost` property has been corrected to be of type `float` instead of `double`. + +### DisMaxQuery +- The `tieBreaker` property has been corrected to be of type `Float` instead of `Double`. + +### FunctionScoreQuery +- The `maxBoost` property has been corrected to be of type `Float` instead of `Double`. +- The `minScore` property has been corrected to be of type `Float` instead of `Double`. + +### KnnQuery +- The `filter` property is now of type `List` instead of `Query`. +- The `vector` property is now of type `List` instead of `float[]`. + +### LikeDocument +- The `type` property has been removed as it is not supported by OpenSearch as of version 2.0.0. + +### MatchQuery +- The `cutoffFrequency` property has been corrected to be of type `Float` instead of `Double`. + +### MoreLikeThisQuery +- The `boostTerms` property has been corrected to be of type `Float` instead of `Double`. + +### MultiMatchQuery +- The `cutoffFrequency` property has been corrected to be of type `Float` instead of `Double`. +- The `tieBreaker` property has been corrected to be of type `Float` instead of `Double`. + +### QueryStringQuery +- The `phraseSlop` property has been corrected to be of type `Integer` instead of `Double`. +- The `tieBreaker` property has been corrected to be of type `Float` instead of `Double`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index a10d8d9293..4062ed6692 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -113,7 +113,6 @@ public final BuilderT acknowledged(boolean value) { this.acknowledged = value; return self(); } - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 7844ae7e27..8dfc818156 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -306,7 +306,6 @@ public final BuilderT transportAddress(@Nullable String value) { this.transportAddress = value; return self(); } - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java index c4a0e8fdf3..da0183f905 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java @@ -40,6 +40,7 @@ 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; @@ -136,10 +137,27 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } } + @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(BulkByScrollTaskStatusOrException o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder exception(ErrorCause v) { this._kind = Kind.Exception; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java index d6851e85f1..f4a02ab237 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java @@ -30,10 +30,16 @@ * 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.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,14 +47,16 @@ 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.CoordsGeoBounds @JsonpDeserializable -public class CoordsGeoBounds implements PlainJsonSerializable { - private final double top; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CoordsGeoBounds implements PlainJsonSerializable, ToCopyableBuilder { private final double bottom; @@ -56,28 +64,21 @@ public class CoordsGeoBounds implements PlainJsonSerializable { private final double right; + private final double top; + // --------------------------------------------------------------------------------------------- private CoordsGeoBounds(Builder builder) { - - this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); - + this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); } - public static CoordsGeoBounds of(Function> fn) { + public static CoordsGeoBounds of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code top} - */ - public final double top() { - return this.top; - } - /** * Required - API name: {@code bottom} */ @@ -99,9 +100,17 @@ public final double right() { return this.right; } + /** + * Required - API name: {@code top} + */ + public final double top() { + return this.top; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,10 +118,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("top"); - generator.write(this.top); - generator.writeKey("bottom"); generator.write(this.bottom); @@ -122,34 +127,58 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("right"); generator.write(this.right); + generator.writeKey("top"); + generator.write(this.top); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CoordsGeoBounds}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Double bottom; + private Double left; + private Double right; private Double top; - private Double bottom; + public Builder() {} - private Double left; + private Builder(CoordsGeoBounds o) { + this.bottom = o.bottom; + this.left = o.left; + this.right = o.right; + this.top = o.top; + } - private Double right; + private Builder(Builder o) { + this.bottom = o.bottom; + this.left = o.left; + this.right = o.right; + this.top = o.top; + } - /** - * Required - API name: {@code top} - */ - public final Builder top(double value) { - this.top = value; - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code bottom} */ + @Nonnull public final Builder bottom(double value) { this.bottom = value; return this; @@ -158,6 +187,7 @@ public final Builder bottom(double value) { /** * Required - API name: {@code left} */ + @Nonnull public final Builder left(double value) { this.left = value; return this; @@ -166,17 +196,28 @@ public final Builder left(double value) { /** * Required - API name: {@code right} */ + @Nonnull public final Builder right(double value) { this.right = value; return this; } + /** + * Required - API name: {@code top} + */ + @Nonnull + public final Builder top(double value) { + this.top = value; + return this; + } + /** * Builds a {@link CoordsGeoBounds}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CoordsGeoBounds build() { _checkSingleUse(); @@ -195,12 +236,27 @@ public CoordsGeoBounds build() { ); protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { - - op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); + op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.bottom); + result = 31 * result + Double.hashCode(this.left); + result = 31 * result + Double.hashCode(this.right); + result = 31 * result + Double.hashCode(this.top); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CoordsGeoBounds other = (CoordsGeoBounds) o; + return this.bottom == other.bottom && this.left == other.left && this.right == other.right && this.top == other.top; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DistanceUnit.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/DistanceUnit.java index fa3511a98c..ea808a7e54 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/DistanceUnit.java @@ -30,32 +30,38 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.DistanceUnit + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum DistanceUnit implements JsonEnum { - Inches("in"), + Centimeters("cm"), Feet("ft"), - Yards("yd"), - - Miles("mi"), - - NauticMiles("nmi"), + Inches("in"), Kilometers("km"), Meters("m"), - Centimeters("cm"), + Miles("mi"), Millimeters("mm"), - ; + NauticalMiles("nmi"), + + Yards("yd"); private final String jsonValue; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index cf7142a23d..f7e967d882 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -67,6 +67,9 @@ public class ErrorCause implements PlainJsonSerializable, ToCopyableBuilder metadata; + @Nullable private final String reason; @@ -82,19 +85,16 @@ public class ErrorCause implements PlainJsonSerializable, ToCopyableBuilder metadata; - // --------------------------------------------------------------------------------------------- private ErrorCause(Builder builder) { this.causedBy = builder.causedBy; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.reason = builder.reason; this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); this.stackTrace = builder.stackTrace; this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); } public static ErrorCause of(Function> fn) { @@ -109,6 +109,14 @@ public final ErrorCause causedBy() { return this.causedBy; } + /** + * Any additional information about the error. + */ + @Nonnull + public final Map metadata() { + return this.metadata; + } + /** * A human-readable explanation of the error, in English. *

@@ -158,14 +166,6 @@ public final String type() { return this.type; } - /** - * Any additional information about the error. - */ - @Nonnull - public final Map metadata() { - return this.metadata; - } - /** * Serialize this object to JSON. */ @@ -238,6 +238,8 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder @Nullable private ErrorCause causedBy; @Nullable + private Map metadata; + @Nullable private String reason; @Nullable private List rootCause; @@ -246,29 +248,27 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder @Nullable private List suppressed; private String type; - @Nullable - private Map metadata; public Builder() {} private Builder(ErrorCause o) { this.causedBy = o.causedBy; + this.metadata = _mapCopy(o.metadata); this.reason = o.reason; this.rootCause = _listCopy(o.rootCause); this.stackTrace = o.stackTrace; this.suppressed = _listCopy(o.suppressed); this.type = o.type; - this.metadata = _mapCopy(o.metadata); } private Builder(Builder o) { this.causedBy = o.causedBy; + this.metadata = _mapCopy(o.metadata); this.reason = o.reason; this.rootCause = _listCopy(o.rootCause); this.stackTrace = o.stackTrace; this.suppressed = _listCopy(o.suppressed); this.type = o.type; - this.metadata = _mapCopy(o.metadata); } @Override @@ -294,6 +294,32 @@ public final Builder causedBy(Function + * Adds all elements of map to metadata. + *

+ */ + @Nonnull + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * Any additional information about the error. + * + *

+ * Adds an entry to metadata. + *

+ */ + @Nonnull + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + /** * A human-readable explanation of the error, in English. *

@@ -406,32 +432,6 @@ public final Builder type(String value) { return this; } - /** - * Any additional information about the error. - * - *

- * Adds all elements of map to metadata. - *

- */ - @Nonnull - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Any additional information about the error. - * - *

- * Adds an entry to metadata. - *

- */ - @Nonnull - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - /** * Builds a {@link ErrorCause}. * @@ -475,12 +475,12 @@ protected static void setupErrorCauseDeserializer(ObjectDeserializer + * A geo-bounding box. It can be represented in the following ways: + *

*
    - *
  • as 4 top/bottom/left/right coordinates
  • - *
  • as 2 top_left / bottom_right points
  • - *
  • as 2 top_right / bottom_left points
  • - *
  • as a WKT bounding box
  • + *
  • As 4 top/bottom/left/right coordinates.
  • + *
  • As 2 top_left/bottom_right points.
  • + *
  • As 2 top_right/bottom_left points.
  • + *
  • As a Well Known Text (WKT) bounding box.
  • *
- * */ @JsonpDeserializable -public class GeoBounds implements TaggedUnion, JsonpSerializable { - +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GeoBounds implements TaggedUnion, PlainJsonSerializable { + /** + * {@link GeoBounds} variant kinds. + */ public enum Kind { Coords, Tlbr, Trbl, Wkt - } private final Kind _kind; @@ -87,13 +98,11 @@ private GeoBounds(Kind kind, Object value) { } private GeoBounds(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static GeoBounds of(Function> fn) { + public static GeoBounds of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -107,8 +116,7 @@ public boolean isCoords() { /** * Get the {@code coords} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. + * @throws IllegalStateException if the current variant is not the {@code coords} kind. */ public CoordsGeoBounds coords() { return TaggedUnionUtils.get(this, Kind.Coords); @@ -124,8 +132,7 @@ public boolean isTlbr() { /** * Get the {@code tlbr} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code tlbr} kind. + * @throws IllegalStateException if the current variant is not the {@code tlbr} kind. */ public TopLeftBottomRightGeoBounds tlbr() { return TaggedUnionUtils.get(this, Kind.Tlbr); @@ -141,8 +148,7 @@ public boolean isTrbl() { /** * Get the {@code trbl} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code trbl} kind. + * @throws IllegalStateException if the current variant is not the {@code trbl} kind. */ public TopRightBottomLeftGeoBounds trbl() { return TaggedUnionUtils.get(this, Kind.Trbl); @@ -158,8 +164,7 @@ public boolean isWkt() { /** * Get the {@code wkt} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code wkt} kind. + * @throws IllegalStateException if the current variant is not the {@code wkt} kind. */ public WktGeoBounds wkt() { return TaggedUnionUtils.get(this, Kind.Wkt); @@ -170,13 +175,29 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { if (_value instanceof JsonpSerializable) { ((JsonpSerializable) _value).serialize(generator, mapper); } + } + + @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(GeoBounds o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder coords(CoordsGeoBounds v) { this._kind = Kind.Coords; this._value = v; @@ -217,11 +238,11 @@ public ObjectBuilder wkt(Function buildGeoBoundsDeserializer() { @@ -236,4 +257,20 @@ private static JsonpDeserializer buildGeoBoundsDeserializer() { } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoBounds::buildGeoBoundsDeserializer); + + @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; + GeoBounds other = (GeoBounds) 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/GeoBoundsBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java index 614522f557..55706b8502 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java @@ -30,33 +30,37 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; + /** * Builders for {@link GeoBounds} variants. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GeoBoundsBuilders { private GeoBoundsBuilders() {} /** - * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} - * variant. + * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} variant. */ public static CoordsGeoBounds.Builder coords() { return new CoordsGeoBounds.Builder(); } /** - * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} - * {@code GeoBounds} variant. + * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} {@code GeoBounds} variant. */ public static TopLeftBottomRightGeoBounds.Builder tlbr() { return new TopLeftBottomRightGeoBounds.Builder(); } /** - * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} - * {@code GeoBounds} variant. + * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} {@code GeoBounds} variant. */ public static TopRightBottomLeftGeoBounds.Builder trbl() { return new TopRightBottomLeftGeoBounds.Builder(); @@ -68,5 +72,4 @@ public static TopRightBottomLeftGeoBounds.Builder trbl() { public static WktGeoBounds.Builder wkt() { return new WktGeoBounds.Builder(); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java index ff616f352f..dacd401b7f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java @@ -30,18 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.GeoDistanceType + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum GeoDistanceType implements JsonEnum { Arc("arc"), - Plane("plane"), - - ; + Plane("plane"); private final String jsonValue; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java index bd20ce101b..4555b1e87a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoLocation.java @@ -41,6 +41,7 @@ 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; @@ -190,10 +191,27 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } } + @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(GeoLocation o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder coords(List v) { this._kind = Kind.Coords; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java index f51d42a238..f9802a2130 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java @@ -30,22 +30,28 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.GeoShapeRelation + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum GeoShapeRelation implements JsonEnum { - Intersects("intersects"), + Contains("contains"), Disjoint("disjoint"), - Within("within"), - - Contains("contains"), + Intersects("intersects"), - ; + Within("within"); private final String jsonValue; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java index 4acf5c0423..4000cd23b4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java @@ -112,7 +112,6 @@ public final BuilderT shards(@Nullable ShardStatistics value) { public final BuilderT shards(Function> fn) { return shards(fn.apply(new ShardStatistics.Builder()).build()); } - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NestedSortValue.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/NestedSortValue.java index d6ad211a56..2a450edfff 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NestedSortValue.java @@ -30,10 +30,17 @@ * 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 javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,13 +50,17 @@ 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.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.NestedSortValue @JsonpDeserializable -public class NestedSortValue implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NestedSortValue implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final Query filter; @@ -59,20 +70,19 @@ public class NestedSortValue implements PlainJsonSerializable { @Nullable private final NestedSortValue nested; + @Nonnull private final String path; // --------------------------------------------------------------------------------------------- private NestedSortValue(Builder builder) { - this.filter = builder.filter; this.maxChildren = builder.maxChildren; this.nested = builder.nested; this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); - } - public static NestedSortValue of(Function> fn) { + public static NestedSortValue of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -103,6 +113,7 @@ public final NestedSortValue nested() { /** * Required - API name: {@code path} */ + @Nonnull public final String path() { return this.path; } @@ -110,6 +121,7 @@ public final String path() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -117,48 +129,76 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.filter != null) { generator.writeKey("filter"); this.filter.serialize(generator, mapper); - } + if (this.maxChildren != null) { generator.writeKey("max_children"); generator.write(this.maxChildren); - } + if (this.nested != null) { generator.writeKey("nested"); this.nested.serialize(generator, mapper); - } + generator.writeKey("path"); generator.write(this.path); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NestedSortValue}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Query filter; - @Nullable private Integer maxChildren; - @Nullable private NestedSortValue nested; - private String path; + public Builder() {} + + private Builder(NestedSortValue o) { + this.filter = o.filter; + this.maxChildren = o.maxChildren; + this.nested = o.nested; + this.path = o.path; + } + + private Builder(Builder o) { + this.filter = o.filter; + this.maxChildren = o.maxChildren; + this.nested = o.nested; + this.path = o.path; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code filter} */ + @Nonnull public final Builder filter(@Nullable Query value) { this.filter = value; return this; @@ -167,13 +207,15 @@ public final Builder filter(@Nullable Query value) { /** * API name: {@code filter} */ + @Nonnull public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); + return filter(fn.apply(new Query.Builder()).build()); } /** * API name: {@code max_children} */ + @Nonnull public final Builder maxChildren(@Nullable Integer value) { this.maxChildren = value; return this; @@ -182,6 +224,7 @@ public final Builder maxChildren(@Nullable Integer value) { /** * API name: {@code nested} */ + @Nonnull public final Builder nested(@Nullable NestedSortValue value) { this.nested = value; return this; @@ -190,13 +233,15 @@ public final Builder nested(@Nullable NestedSortValue value) { /** * API name: {@code nested} */ + @Nonnull public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + return nested(fn.apply(new NestedSortValue.Builder()).build()); } /** * Required - API name: {@code path} */ + @Nonnull public final Builder path(String value) { this.path = value; return this; @@ -205,9 +250,10 @@ public final Builder path(String value) { /** * Builds a {@link NestedSortValue}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NestedSortValue build() { _checkSingleUse(); @@ -226,12 +272,30 @@ public NestedSortValue build() { ); protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { - op.add(Builder::filter, Query._DESERIALIZER, "filter"); op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.filter); + result = 31 * result + Objects.hashCode(this.maxChildren); + result = 31 * result + Objects.hashCode(this.nested); + result = 31 * result + this.path.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NestedSortValue other = (NestedSortValue) o; + return Objects.equals(this.filter, other.filter) + && Objects.equals(this.maxChildren, other.maxChildren) + && Objects.equals(this.nested, other.nested) + && this.path.equals(other.path); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStat.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStat.java new file mode 100644 index 0000000000..2040ccd255 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStat.java @@ -0,0 +1,208 @@ +/* + * 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; + +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.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.ResourceStat + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResourceStat implements PlainJsonSerializable, ToCopyableBuilder { + + private final long cpuTimeInNanos; + + private final long memoryInBytes; + + // --------------------------------------------------------------------------------------------- + + private ResourceStat(Builder builder) { + this.cpuTimeInNanos = ApiTypeHelper.requireNonNull(builder.cpuTimeInNanos, this, "cpuTimeInNanos"); + this.memoryInBytes = ApiTypeHelper.requireNonNull(builder.memoryInBytes, this, "memoryInBytes"); + } + + public static ResourceStat of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code cpu_time_in_nanos} + */ + public final long cpuTimeInNanos() { + return this.cpuTimeInNanos; + } + + /** + * Required - API name: {@code memory_in_bytes} + */ + public final long memoryInBytes() { + return this.memoryInBytes; + } + + /** + * 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) { + generator.writeKey("cpu_time_in_nanos"); + generator.write(this.cpuTimeInNanos); + + generator.writeKey("memory_in_bytes"); + generator.write(this.memoryInBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ResourceStat}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Long cpuTimeInNanos; + private Long memoryInBytes; + + public Builder() {} + + private Builder(ResourceStat o) { + this.cpuTimeInNanos = o.cpuTimeInNanos; + this.memoryInBytes = o.memoryInBytes; + } + + private Builder(Builder o) { + this.cpuTimeInNanos = o.cpuTimeInNanos; + this.memoryInBytes = o.memoryInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code cpu_time_in_nanos} + */ + @Nonnull + public final Builder cpuTimeInNanos(long value) { + this.cpuTimeInNanos = value; + return this; + } + + /** + * Required - API name: {@code memory_in_bytes} + */ + @Nonnull + public final Builder memoryInBytes(long value) { + this.memoryInBytes = value; + return this; + } + + /** + * Builds a {@link ResourceStat}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ResourceStat build() { + _checkSingleUse(); + + return new ResourceStat(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ResourceStat} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ResourceStat::setupResourceStatDeserializer + ); + + protected static void setupResourceStatDeserializer(ObjectDeserializer op) { + op.add(Builder::cpuTimeInNanos, JsonpDeserializer.longDeserializer(), "cpu_time_in_nanos"); + op.add(Builder::memoryInBytes, JsonpDeserializer.longDeserializer(), "memory_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.cpuTimeInNanos); + result = 31 * result + Long.hashCode(this.memoryInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResourceStat other = (ResourceStat) o; + return this.cpuTimeInNanos == other.cpuTimeInNanos && this.memoryInBytes == other.memoryInBytes; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStats.java new file mode 100644 index 0000000000..a346fc4ec8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ResourceStats.java @@ -0,0 +1,343 @@ +/* + * 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; + +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.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.ResourceStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResourceStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final ResourceStat average; + + @Nonnull + private final ResourceStat max; + + @Nonnull + private final ResourceStat min; + + @Nonnull + private final ThreadInfo threadInfo; + + @Nonnull + private final ResourceStat total; + + // --------------------------------------------------------------------------------------------- + + private ResourceStats(Builder builder) { + this.average = ApiTypeHelper.requireNonNull(builder.average, this, "average"); + this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); + this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); + this.threadInfo = ApiTypeHelper.requireNonNull(builder.threadInfo, this, "threadInfo"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + } + + public static ResourceStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code average} + */ + @Nonnull + public final ResourceStat average() { + return this.average; + } + + /** + * Required - API name: {@code max} + */ + @Nonnull + public final ResourceStat max() { + return this.max; + } + + /** + * Required - API name: {@code min} + */ + @Nonnull + public final ResourceStat min() { + return this.min; + } + + /** + * Required - API name: {@code thread_info} + */ + @Nonnull + public final ThreadInfo threadInfo() { + return this.threadInfo; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final ResourceStat total() { + return this.total; + } + + /** + * 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) { + generator.writeKey("average"); + this.average.serialize(generator, mapper); + + generator.writeKey("max"); + this.max.serialize(generator, mapper); + + generator.writeKey("min"); + this.min.serialize(generator, mapper); + + generator.writeKey("thread_info"); + this.threadInfo.serialize(generator, mapper); + + generator.writeKey("total"); + this.total.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ResourceStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private ResourceStat average; + private ResourceStat max; + private ResourceStat min; + private ThreadInfo threadInfo; + private ResourceStat total; + + public Builder() {} + + private Builder(ResourceStats o) { + this.average = o.average; + this.max = o.max; + this.min = o.min; + this.threadInfo = o.threadInfo; + this.total = o.total; + } + + private Builder(Builder o) { + this.average = o.average; + this.max = o.max; + this.min = o.min; + this.threadInfo = o.threadInfo; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code average} + */ + @Nonnull + public final Builder average(ResourceStat value) { + this.average = value; + return this; + } + + /** + * Required - API name: {@code average} + */ + @Nonnull + public final Builder average(Function> fn) { + return average(fn.apply(new ResourceStat.Builder()).build()); + } + + /** + * Required - API name: {@code max} + */ + @Nonnull + public final Builder max(ResourceStat value) { + this.max = value; + return this; + } + + /** + * Required - API name: {@code max} + */ + @Nonnull + public final Builder max(Function> fn) { + return max(fn.apply(new ResourceStat.Builder()).build()); + } + + /** + * Required - API name: {@code min} + */ + @Nonnull + public final Builder min(ResourceStat value) { + this.min = value; + return this; + } + + /** + * Required - API name: {@code min} + */ + @Nonnull + public final Builder min(Function> fn) { + return min(fn.apply(new ResourceStat.Builder()).build()); + } + + /** + * Required - API name: {@code thread_info} + */ + @Nonnull + public final Builder threadInfo(ThreadInfo value) { + this.threadInfo = value; + return this; + } + + /** + * Required - API name: {@code thread_info} + */ + @Nonnull + public final Builder threadInfo(Function> fn) { + return threadInfo(fn.apply(new ThreadInfo.Builder()).build()); + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(ResourceStat value) { + this.total = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(Function> fn) { + return total(fn.apply(new ResourceStat.Builder()).build()); + } + + /** + * Builds a {@link ResourceStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ResourceStats build() { + _checkSingleUse(); + + return new ResourceStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ResourceStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ResourceStats::setupResourceStatsDeserializer + ); + + protected static void setupResourceStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::average, ResourceStat._DESERIALIZER, "average"); + op.add(Builder::max, ResourceStat._DESERIALIZER, "max"); + op.add(Builder::min, ResourceStat._DESERIALIZER, "min"); + op.add(Builder::threadInfo, ThreadInfo._DESERIALIZER, "thread_info"); + op.add(Builder::total, ResourceStat._DESERIALIZER, "total"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.average.hashCode(); + result = 31 * result + this.max.hashCode(); + result = 31 * result + this.min.hashCode(); + result = 31 * result + this.threadInfo.hashCode(); + result = 31 * result + this.total.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResourceStats other = (ResourceStats) o; + return this.average.equals(other.average) + && this.max.equals(other.max) + && this.min.equals(other.min) + && this.threadInfo.equals(other.threadInfo) + && this.total.equals(other.total); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java index 811438381d..a15e98f626 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Script.java @@ -40,12 +40,15 @@ 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.opensearch._types.query_dsl.IntervalsFilter; +import org.opensearch.client.opensearch._types.query_dsl.IntervalsFilterVariant; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -56,7 +59,7 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class Script implements TaggedUnion, PlainJsonSerializable { +public class Script implements TaggedUnion, IntervalsFilterVariant, PlainJsonSerializable { /** * {@link Script} variant kinds. */ @@ -65,6 +68,14 @@ public enum Kind { Stored } + /** + * {@link IntervalsFilter} variant kind. + */ + @Override + public IntervalsFilter.Kind _intervalsFilterKind() { + return IntervalsFilter.Kind.Script; + } + private final Kind _kind; private final Object _value; @@ -131,10 +142,27 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } } + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder