├── gradle.properties
├── .ci
├── opensearch
│ ├── opensearch.yml
│ ├── Dockerfile
│ └── docker-compose.yml
└── bump-version.sh
├── gradle
└── wrapper
│ └── gradle-wrapper.jar
├── java-codegen
└── src
│ ├── main
│ ├── resources
│ │ ├── org
│ │ │ └── opensearch
│ │ │ │ └── client
│ │ │ │ └── codegen
│ │ │ │ ├── templates
│ │ │ │ ├── ObjectShape
│ │ │ │ │ ├── Builder
│ │ │ │ │ │ ├── Fields.mustache
│ │ │ │ │ │ ├── Field.mustache
│ │ │ │ │ │ ├── CopyFnImpl.mustache
│ │ │ │ │ │ ├── SelfImpl.mustache
│ │ │ │ │ │ ├── HelperCtor.mustache
│ │ │ │ │ │ ├── BuildImpl.mustache
│ │ │ │ │ │ └── CopyCtorImpl.mustache
│ │ │ │ │ ├── FieldDoc
│ │ │ │ │ │ ├── Basic.mustache
│ │ │ │ │ │ ├── MapAdd.mustache
│ │ │ │ │ │ ├── ListAdd.mustache
│ │ │ │ │ │ ├── ListAddAll.mustache
│ │ │ │ │ │ ├── MapAddAll.mustache
│ │ │ │ │ │ ├── MapAddBuilderFn.mustache
│ │ │ │ │ │ ├── ListAddBuilderFn.mustache
│ │ │ │ │ │ └── BasicInner.mustache
│ │ │ │ │ ├── Fields.mustache
│ │ │ │ │ ├── ToBuilder.mustache
│ │ │ │ │ ├── Getters.mustache
│ │ │ │ │ ├── DiscriminatedUnionInterfaceImpl.mustache
│ │ │ │ │ ├── Deserialize
│ │ │ │ │ │ └── Fields.mustache
│ │ │ │ │ ├── HashCode.mustache
│ │ │ │ │ ├── Serialize
│ │ │ │ │ │ └── Fields.mustache
│ │ │ │ │ ├── FieldNullability.mustache
│ │ │ │ │ ├── HashCode
│ │ │ │ │ │ └── Fields.mustache
│ │ │ │ │ ├── Equals
│ │ │ │ │ │ └── Fields.mustache
│ │ │ │ │ ├── Equals.mustache
│ │ │ │ │ ├── Constructor.mustache
│ │ │ │ │ └── ConstructorImpl.mustache
│ │ │ │ ├── Type
│ │ │ │ │ ├── Serializer
│ │ │ │ │ │ └── Map.mustache
│ │ │ │ │ ├── isDefined.mustache
│ │ │ │ │ └── DirectSerializer
│ │ │ │ │ │ └── Map.mustache
│ │ │ │ ├── Partials
│ │ │ │ │ ├── Deserialize
│ │ │ │ │ │ ├── TypeParameterDeserializerParams.mustache
│ │ │ │ │ │ ├── CreateClassDeserializerFnSignature.mustache
│ │ │ │ │ │ └── TypeParametersNamedDeserializer.mustache
│ │ │ │ │ └── ClassDeclaration.mustache
│ │ │ │ ├── TaggedUnionShape
│ │ │ │ │ ├── VariantInterface.mustache
│ │ │ │ │ └── Builders.mustache
│ │ │ │ ├── RequestShape
│ │ │ │ │ ├── Serialize.mustache
│ │ │ │ │ ├── HttpPathBuilder.mustache
│ │ │ │ │ └── Deserialize.mustache
│ │ │ │ ├── ObjectShape.mustache
│ │ │ │ ├── DelegatedShape
│ │ │ │ │ └── Deserialize.mustache
│ │ │ │ ├── DelegatedShape.mustache
│ │ │ │ └── EnumShape.mustache
│ │ │ │ └── version.properties
│ │ └── log4j2.xml
│ └── java
│ │ └── org
│ │ └── opensearch
│ │ └── client
│ │ └── codegen
│ │ ├── utils
│ │ ├── json
│ │ │ ├── ToJson.java
│ │ │ ├── JsonException.java
│ │ │ └── JsonGenerationException.java
│ │ ├── builder
│ │ │ ├── SetBuilder.java
│ │ │ ├── ListBuilder.java
│ │ │ ├── MapBuilder.java
│ │ │ ├── ObjectBuilder.java
│ │ │ ├── ToBuilder.java
│ │ │ ├── ObjectSetBuilderBase.java
│ │ │ ├── ObjectListBuilderBase.java
│ │ │ ├── ObjectMapBuilderBase.java
│ │ │ ├── MapBuilderBase.java
│ │ │ └── SetBuilderBase.java
│ │ ├── matcher
│ │ │ └── StringMatcher.java
│ │ ├── Sets.java
│ │ ├── Versions.java
│ │ ├── Functional.java
│ │ ├── Clone.java
│ │ ├── JavaClassKind.java
│ │ └── Streams.java
│ │ ├── transformer
│ │ └── overrides
│ │ │ └── ShouldGenerate.java
│ │ ├── exceptions
│ │ ├── RenderException.java
│ │ ├── JavaFormatterException.java
│ │ └── ApiSpecificationParseException.java
│ │ ├── openapi
│ │ ├── walker
│ │ │ ├── ZippedOpenApiVisitor.java
│ │ │ └── ZippedOpenApiVisitorBase.java
│ │ └── In.java
│ │ ├── model
│ │ ├── ReferenceKind.java
│ │ ├── OperationGroupMatcher.java
│ │ └── Deprecation.java
│ │ └── renderer
│ │ ├── lambdas
│ │ └── TemplateStringLambda.java
│ │ ├── TemplateObjectCollector.java
│ │ └── TemplateFragmentUtils.java
│ └── test
│ └── java
│ └── org
│ └── opensearch
│ └── client
│ └── codegen
│ └── utils
│ ├── FunctionalTests.java
│ └── StreamsTests.java
├── NOTICE.txt
├── .github
├── CODEOWNERS
├── workflows
│ ├── links.yml
│ ├── add-untriaged.yml
│ ├── changelog_verifier.yml
│ ├── build.yml
│ ├── backport.yml
│ └── delete-merged-autocut-branches.yml
└── dependabot.yml
├── SECURITY.md
├── LICENSE_HEADER.txt
├── samples
├── src
│ └── main
│ │ ├── resources
│ │ └── log4j2.xml
│ │ └── java
│ │ └── org
│ │ └── opensearch
│ │ └── client
│ │ └── samples
│ │ └── util
│ │ ├── AppData.java
│ │ ├── IndexData.java
│ │ └── RandUtil.java
└── build.gradle.kts
├── java-client
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── opensearch
│ │ │ └── client
│ │ │ ├── transport
│ │ │ ├── httpclient5
│ │ │ │ └── internal
│ │ │ │ │ └── NodeState.java
│ │ │ ├── TransportHeaders.java
│ │ │ └── GenericSerializable.java
│ │ │ ├── json
│ │ │ └── JsonpMapperAttributes.java
│ │ │ ├── util
│ │ │ ├── MutableBuilder.java
│ │ │ └── CopyableBuilder.java
│ │ │ └── opensearch
│ │ │ └── generic
│ │ │ └── GenericInputStreamBody.java
│ └── resources
│ │ └── org
│ │ └── opensearch
│ │ └── client
│ │ └── version.properties
│ └── test
│ ├── java11
│ └── org
│ │ └── opensearch
│ │ └── client
│ │ └── opensearch
│ │ └── integTest
│ │ ├── httpclient5
│ │ ├── KnnIT.java
│ │ ├── CrudIT.java
│ │ ├── NodesIT.java
│ │ ├── CatIT.java
│ │ ├── RequestIT.java
│ │ ├── HighlightIT.java
│ │ ├── PingAndInfoIT.java
│ │ ├── TasksClientIT.java
│ │ ├── BulkIngesterIT.java
│ │ ├── GenericClientIT.java
│ │ ├── IndicesClientIT.java
│ │ ├── SearchRequestIT.java
│ │ ├── AsyncStacktraceIT.java
│ │ ├── AggregationRequestIT.java
│ │ ├── MultiSearchRequestIT.java
│ │ ├── SearchTemplateRequestIT.java
│ │ └── ClusterClientIT.java
│ │ ├── restclient
│ │ ├── KnnIT.java
│ │ ├── CrudIT.java
│ │ ├── NodesIT.java
│ │ ├── CatIT.java
│ │ ├── HighlightIT.java
│ │ ├── PingAndInfoIT.java
│ │ ├── TasksClientIT.java
│ │ ├── ClusterClientIT.java
│ │ ├── GenericClientIT.java
│ │ ├── IndicesClientIT.java
│ │ ├── SearchRequestIT.java
│ │ ├── AggregationRequestIT.java
│ │ ├── MultiSearchRequestIT.java
│ │ └── SearchTemplateRequestIT.java
│ │ ├── AbstractAsyncStracktraceIT.java
│ │ └── OpenSearchTransportSupport.java
│ └── java
│ └── org
│ └── opensearch
│ └── client
│ ├── opensearch
│ ├── core
│ │ ├── MgetRequestTest.java
│ │ ├── CountRequestTest.java
│ │ ├── GetRequestTest.java
│ │ ├── GetScriptRequestTest.java
│ │ ├── UpdateRequestTest.java
│ │ ├── DeleteRequestTest.java
│ │ ├── ExistsRequestTest.java
│ │ ├── ExplainRequestTest.java
│ │ ├── FieldCapsRequestTest.java
│ │ ├── ScrollRequestTest.java
│ │ ├── DeleteScriptRequestTest.java
│ │ ├── GetSourceRequestTest.java
│ │ ├── MtermvectorsRequestTest.java
│ │ ├── SearchShardsRequestTest.java
│ │ ├── ExistsSourceRequestTest.java
│ │ ├── ReindexRethrottleRequestTest.java
│ │ ├── RenderSearchTemplateRequestTest.java
│ │ ├── RankEvalRequestTest.java
│ │ ├── TermvectorsRequestTest.java
│ │ ├── UpdateByQueryRethrottleRequestTest.java
│ │ ├── DeleteByQueryRethrottleRequestTest.java
│ │ ├── ScriptsPainlessExecuteRequestTest.java
│ │ ├── ClearScrollRequestTest.java
│ │ ├── MsearchTemplateRequestTest.java
│ │ ├── PutScriptRequestTest.java
│ │ ├── IndexRequestTest.java
│ │ ├── CreateRequestTest.java
│ │ └── BulkRequestTest.java
│ ├── IOUtils.java
│ └── _types
│ │ ├── query_dsl
│ │ ├── LikeTest.java
│ │ ├── IdsQueryTest.java
│ │ ├── FieldLookupTest.java
│ │ ├── TypeQueryTest.java
│ │ ├── RangeQueryTest.java
│ │ ├── ExistsQueryTest.java
│ │ ├── ParentIdQueryTest.java
│ │ ├── WrapperQueryTest.java
│ │ ├── FieldAndFormatTest.java
│ │ ├── IntervalsMatchTest.java
│ │ ├── PrefixQueryTest.java
│ │ ├── RegexpQueryTest.java
│ │ ├── SpanGapQueryTest.java
│ │ ├── IntervalsPrefixTest.java
│ │ ├── MultiMatchQueryTest.java
│ │ ├── PercolateQueryTest.java
│ │ ├── TermsLookupTest.java
│ │ ├── QueryStringQueryTest.java
│ │ ├── RankFeatureQueryTest.java
│ │ ├── SpanTermQueryTest.java
│ │ ├── TermsSetQueryTest.java
│ │ ├── WildcardQueryTest.java
│ │ ├── GeoShapeQueryFieldTest.java
│ │ ├── IntervalsTest.java
│ │ ├── IntervalsFuzzyTest.java
│ │ ├── KnnQueryTest.java
│ │ ├── CommonTermsQueryTest.java
│ │ ├── MatchPhraseQueryTest.java
│ │ ├── CombinedFieldsQueryTest.java
│ │ ├── IntervalsWildcardTest.java
│ │ ├── SimpleQueryStringQueryTest.java
│ │ ├── MatchBoolPrefixQueryTest.java
│ │ ├── MoreLikeThisQueryTest.java
│ │ ├── DecayPlacementTest.java
│ │ ├── MatchPhrasePrefixQueryTest.java
│ │ ├── TermQueryTest.java
│ │ ├── FuzzyQueryTest.java
│ │ ├── RankFeatureFunctionSaturationTest.java
│ │ ├── RankFeatureFunctionSigmoidTest.java
│ │ ├── SpanQueryTest.java
│ │ ├── FieldValueFactorScoreFunctionTest.java
│ │ ├── RankFeatureFunctionLogarithmTest.java
│ │ ├── RandomScoreFunctionTest.java
│ │ ├── MatchQueryTest.java
│ │ ├── DistanceFeatureQueryTest.java
│ │ ├── GeoPolygonPointsTest.java
│ │ ├── IntervalsAllOfTest.java
│ │ ├── IntervalsAnyOfTest.java
│ │ ├── IntervalsFilterTest.java
│ │ ├── TermsQueryFieldTest.java
│ │ ├── DecayFunctionTest.java
│ │ ├── SpanFirstQueryTest.java
│ │ ├── QueryTest.java
│ │ ├── TermsQueryTest.java
│ │ ├── SpanFieldMaskingQueryTest.java
│ │ ├── SpanOrQueryTest.java
│ │ ├── ScriptQueryTest.java
│ │ ├── SpanNearQueryTest.java
│ │ ├── GeoDistanceQueryTest.java
│ │ ├── ScriptScoreFunctionTest.java
│ │ ├── IntervalsQueryTest.java
│ │ ├── SpanNotQueryTest.java
│ │ ├── SpanWithinQueryTest.java
│ │ ├── SpanContainingQueryTest.java
│ │ ├── BoolQueryTest.java
│ │ ├── LikeDocumentTest.java
│ │ ├── DisMaxQueryTest.java
│ │ ├── GeoBoundingBoxQueryTest.java
│ │ ├── NestedQueryTest.java
│ │ ├── HasChildQueryTest.java
│ │ └── SpanMultiTermQueryTest.java
│ │ ├── aggregations
│ │ ├── FilterAggregateTest.java
│ │ └── CompositeDateHistogramAggregationSourceTest.java
│ │ ├── mapping
│ │ └── DynamicTemplateTest.java
│ │ └── analysis
│ │ └── NormalizerDeserializerTest.java
│ └── transport
│ └── aws
│ └── AwsSdk2TransportOptionsTestCase.java
├── .whitesource
├── .gitignore
├── ADMINS.md
└── jenkins
└── release.jenkinsFile
/gradle.properties:
--------------------------------------------------------------------------------
1 | systemProp.version = 4.0.0
--------------------------------------------------------------------------------
/.ci/opensearch/opensearch.yml:
--------------------------------------------------------------------------------
1 | cluster.name: "docker-cluster"
2 | network.host: 0.0.0.0
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/opensearch-project/opensearch-java/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#fields}}
2 | {{>ObjectShape/Builder/Field}}
3 | {{/fields}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/Serializer/Map.mustache:
--------------------------------------------------------------------------------
1 | generator.writeStartObject();
2 | {{>Type/directSerializer}}
3 | generator.writeEnd();
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Field.mustache:
--------------------------------------------------------------------------------
1 | {{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}private {{type.boxed}} {{name}};
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/Basic.mustache:
--------------------------------------------------------------------------------
1 | {{#needsJavaDocSummary}}/**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 | */{{/needsJavaDocSummary}}
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | OpenSearch (https://opensearch.org/)
2 | Copyright OpenSearch Contributors
3 |
4 | This product includes software developed by
5 | Elasticsearch Java Client
6 | Copyright 2021 Elasticsearch B.V.
7 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAdd.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | *
Adds an entry to {{name}}.
5 | */
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAdd.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | * Adds one or more values to {{name}}.
5 | */
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # This should match the team set up in https://github.com/orgs/opensearch-project/teams and include any additional contributors
2 | * @reta @Bukhtawar @szczepanczykd @madhusudhankonda @saratvemulapalli @VachaShah @Xtansia
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddAll.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | * Adds all elements of list to {{name}}.
5 | */
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddAll.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | * Adds all elements of map to {{name}}.
5 | */
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddBuilderFn.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | * Adds a value to {{name}} using a builder lambda.
5 | */
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | ## Reporting a Vulnerability
2 |
3 | If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do **not** create a public GitHub issue.
4 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddBuilderFn.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | {{>ObjectShape/FieldDoc/BasicInner}}
3 |
4 | * Adds a value to {{name}} using a builder lambda.
5 | */
--------------------------------------------------------------------------------
/LICENSE_HEADER.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/isDefined.mustache:
--------------------------------------------------------------------------------
1 | {{#type.isListOrMap}}
2 | {{TYPES.Client.Util.ApiTypeHelper}}.isDefined({{value}})
3 | {{/type.isListOrMap}}
4 | {{^type.isListOrMap}}
5 | {{value}} != null
6 | {{/type.isListOrMap}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#fields}}
2 | {{^-first}}
3 |
4 | {{/-first}}
5 | {{#deprecation}}@Deprecated{{/deprecation}}
6 | {{>ObjectShape/FieldNullability}}
7 | private final {{type}} {{name}};
8 | {{/fields}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/CopyFnImpl.mustache:
--------------------------------------------------------------------------------
1 | @Override
2 | @{{TYPES.Javax.Annotation.Nonnull}}
3 | public Builder{{#typeParameters}}{{.}}{{/typeParameters}} copy() {
4 | return new Builder{{#typeParameters}}<>{{/typeParameters}}(this);
5 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/Deserialize/TypeParameterDeserializerParams.mustache:
--------------------------------------------------------------------------------
1 | {{#typeParameterDefinitions}}{{TYPES.Client.Json.JsonpDeserializer}}<{{name}}> {{#camelCase}}{{name}}{{/camelCase}}Deserializer{{^-last}}, {{/-last}}{{/typeParameterDefinitions}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/ToBuilder.mustache:
--------------------------------------------------------------------------------
1 | {{^abstract}}
2 | @Override
3 | @{{TYPES.Javax.Annotation.Nonnull}}
4 | public Builder{{#typeParameters}}{{.}}{{/typeParameters}} toBuilder() {
5 | return new Builder{{#typeParameters}}<>{{/typeParameters}}(this);
6 | }
7 | {{/abstract}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache:
--------------------------------------------------------------------------------
1 | {{#needsJavaDocSummary}}
2 | * {{#required}}Required - {{/required}}{{#description}}{{.}}{{/description}}{{#wireName}}{{#description}}{{/description}}API name: {@code {{.}}}{{#description}}
{{/description}}{{/wireName}}
3 | {{/needsJavaDocSummary}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Getters.mustache:
--------------------------------------------------------------------------------
1 | {{#fields}}
2 |
3 | {{>ObjectShape/FieldDoc/Basic}}
4 | {{#deprecation}}@Deprecated{{/deprecation}}
5 | {{>ObjectShape/FieldNullability}}
6 | public final {{type}} {{name}}() {
7 | return this.{{name}};
8 | }
9 | {{/fields}}
10 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/DiscriminatedUnionInterfaceImpl.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | * {@link {{union.className}}} variant kind.
3 | */
4 | @Override
5 | public {{unionKindType}} _{{#camelCase}}{{union.className}}{{/camelCase}}Kind() {
6 | return {{unionKindType}}.{{#pascalCase}}{{discriminatorValue}}{{/pascalCase}};
7 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/version.properties:
--------------------------------------------------------------------------------
1 | #
2 | # SPDX-License-Identifier: Apache-2.0
3 | #
4 | # The OpenSearch Contributors require contributions made to
5 | # this file be licensed under the Apache-2.0 license or a
6 | # compatible open source license.
7 | #
8 |
9 | version=${version}
10 | git_revision=${git_revision}
11 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#fieldsToDeserialize}}
2 | op.add({{#extendedByOtherShape}}Abstract{{/extendedByOtherShape}}Builder::{{name}}, {{#type}}{{>Type/deserializer}}{{/type}}, {{#quoted}}{{wireName}}{{/quoted}}{{#aliases}}, {{#quoted}}{{.}}{{/quoted}}{{/aliases}});
3 | {{/fieldsToDeserialize}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/SelfImpl.mustache:
--------------------------------------------------------------------------------
1 | @Override
2 | @{{TYPES.Javax.Annotation.Nonnull}}
3 | {{#shouldImplementPlainDeserializable}}public{{/shouldImplementPlainDeserializable}}{{^shouldImplementPlainDeserializable}}protected{{/shouldImplementPlainDeserializable}} Builder{{#typeParameters}}{{.}}{{/typeParameters}} self() {
4 | return this;
5 | }
--------------------------------------------------------------------------------
/.ci/opensearch/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG OPENSEARCH_VERSION
2 | FROM opensearchproject/opensearch:$OPENSEARCH_VERSION
3 |
4 | ARG opensearch_path=/usr/share/opensearch
5 | ARG opensearch_yml=$opensearch_path/config/opensearch.yml
6 |
7 | ARG SECURE_INTEGRATION
8 | ENV OPENSEARCH_INITIAL_ADMIN_PASSWORD=0_aD^min_0
9 | RUN if [ "$SECURE_INTEGRATION" != "true" ] ; then echo "plugins.security.disabled: true" >> $opensearch_yml; fi
10 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/VariantInterface.mustache:
--------------------------------------------------------------------------------
1 | {{>Partials/ClassDeclaration}} {
2 | {{unionClassName}}.Kind _{{#camelCase}}{{unionClassName}}{{/camelCase}}Kind();
3 | {{#includeToUnionMethod}}
4 |
5 | default {{unionClassName}} to{{unionClassName}}() {
6 | return new {{unionClassName}}(this);
7 | }
8 | {{/includeToUnionMethod}}
9 | }
10 |
--------------------------------------------------------------------------------
/samples/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/HelperCtor.mustache:
--------------------------------------------------------------------------------
1 | @{{TYPES.Javax.Annotation.Nonnull}}
2 | public static{{#typeParameters}} {{.}}{{/typeParameters}} Builder {{#extendedByOtherShape}}{{#camelCase}}{{className}}{{/camelCase}}B{{/extendedByOtherShape}}{{^extendedByOtherShape}}b{{/extendedByOtherShape}}uilder() {
3 | return new Builder{{#typeParameters}}<>{{/typeParameters}}();
4 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache:
--------------------------------------------------------------------------------
1 | @Override
2 | public int hashCode() {
3 | {{#extendsOtherShape}}
4 | int result = super.hashCode();
5 | {{/extendsOtherShape}}
6 | {{^extendsOtherShape}}
7 | int result = 17;
8 | {{/extendsOtherShape}}
9 | {{>ObjectShape/HashCode/Fields}}
10 | return result;
11 | }
12 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/BuildImpl.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | * Builds a {@link {{className}}}.
3 | *
4 | * @throws NullPointerException if some of the required fields are null.
5 | */
6 | @Override
7 | @{{TYPES.Javax.Annotation.Nonnull}}
8 | public {{selfType}} build() {
9 | _checkSingleUse();
10 |
11 | return new {{className}}{{#typeParameters}}<>{{/typeParameters}}(this);
12 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/json/ToJson.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.json;
10 |
11 | public interface ToJson {
12 | void toJson(JsonGenerator generator);
13 | }
14 |
--------------------------------------------------------------------------------
/.ci/opensearch/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 |
5 | opensearch:
6 | build:
7 | context: .
8 | dockerfile: Dockerfile
9 | args:
10 | - SECURE_INTEGRATION=${SECURE_INTEGRATION:-true}
11 | - OPENSEARCH_VERSION=${OPENSEARCH_VERSION}
12 | environment:
13 | - discovery.type=single-node
14 | - bootstrap.memory_lock=true
15 | ports:
16 | - "9200:9200"
17 | user: opensearch
18 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/transport/httpclient5/internal/NodeState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.transport.httpclient5.internal;
10 |
11 | public enum NodeState {
12 | Active,
13 | Unavailable
14 | }
15 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/transformer/overrides/ShouldGenerate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.transformer.overrides;
10 |
11 | public enum ShouldGenerate {
12 | Always,
13 | IfNeeded,
14 | Never
15 | }
16 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#fieldsToSerialize}}
2 | {{^required}}
3 | if ({{#type.isDefined}}this.{{name}}{{/type.isDefined}}) {
4 | {{/required}}
5 | generator.writeKey({{#quoted}}{{wireName}}{{/quoted}});
6 | {{#type.serializer}}this.{{name}}{{/type.serializer}}
7 | {{^required}}
8 | }
9 | {{/required}}
10 | {{^-last}}
11 |
12 | {{/-last}}
13 | {{/fieldsToSerialize}}
--------------------------------------------------------------------------------
/.whitesource:
--------------------------------------------------------------------------------
1 | {
2 | "scanSettings": {
3 | "configMode": "AUTO",
4 | "configExternalURL": "",
5 | "projectToken": "",
6 | "baseBranches": []
7 | },
8 | "checkRunSettings": {
9 | "vulnerableCheckRunConclusionLevel": "failure",
10 | "displayMode": "diff"
11 | },
12 | "issueSettings": {
13 | "minSeverityLevel": "LOW",
14 | "issueType": "DEPENDENCY"
15 | },
16 | "remediateSettings": {
17 | "workflowRules": {
18 | "enabled": true
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/SetBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | public final class SetBuilder extends SetBuilderBase> {
12 | public SetBuilder() {}
13 | }
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ListBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | public final class ListBuilder extends ListBuilderBase> {
12 | public ListBuilder() {}
13 | }
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldNullability.mustache:
--------------------------------------------------------------------------------
1 | {{#type.isListOrMap}}
2 | @{{TYPES.Javax.Annotation.Nonnull}}
3 | {{/type.isListOrMap}}
4 | {{^type.isListOrMap}}
5 | {{#required}}
6 | {{^type.isPrimitive}}
7 | @{{TYPES.Javax.Annotation.Nonnull}}
8 | {{/type.isPrimitive}}
9 | {{/required}}
10 | {{^required}}
11 | @{{TYPES.Javax.Annotation.Nullable}}
12 | {{/required}}
13 | {{/type.isListOrMap}}
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/MapBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | public final class MapBuilder extends MapBuilderBase> {
12 | public MapBuilder() {}
13 | }
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ObjectBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import javax.annotation.Nonnull;
12 |
13 | public interface ObjectBuilder {
14 | @Nonnull
15 | T build();
16 | }
17 |
--------------------------------------------------------------------------------
/.github/workflows/links.yml:
--------------------------------------------------------------------------------
1 | name: Link Checker
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | linkchecker:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v6
12 | - name: lychee Link Checker
13 | id: lychee
14 | uses: lycheeverse/lychee-action@v2.7.0
15 | with:
16 | args: --accept=200,403,429 "**/*.html" "**/*.md" "**/*.txt" "**/*.json"
17 | fail: true
18 | env:
19 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
20 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/exceptions/RenderException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.exceptions;
10 |
11 | public class RenderException extends Exception {
12 | public RenderException(String msg, Throwable inner) {
13 | super(msg, inner);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ToBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import javax.annotation.Nonnull;
12 |
13 | public interface ToBuilder> {
14 | @Nonnull
15 | Builder toBuilder();
16 | }
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build/
3 |
4 | # Ignore Gradle GUI config
5 | gradle-app.setting
6 |
7 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
8 | !gradle-wrapper.jar
9 |
10 | # Cache of project
11 | .gradletasknamecache
12 |
13 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
14 | # gradle/wrapper/gradle-wrapper.properties
15 |
16 | # IntelliJ Idea
17 | .idea
18 | *.iml
19 |
20 | # vscode
21 | .vscode/
22 |
23 | .ci/output
24 | java-client/bin
25 | samples/bin
26 |
27 | .DS_Store
28 |
29 | .kotlin/
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Builders.mustache:
--------------------------------------------------------------------------------
1 | {{>Partials/ClassDeclaration}} {
2 | private {{className}}() {}
3 |
4 | {{#variants}}
5 | /**
6 | * Creates a builder for the {@link {{type.name}} {{name}}} {@code {{union.className}}} variant.
7 | */
8 | public static {{#union.typeParameters}}{{.}}{{/union.typeParameters}} {{type.builderType}} {{#asFieldName}}{{name}}{{/asFieldName}}() {
9 | return new {{type.builderType}}();
10 | }
11 | {{/variants}}
12 | }
13 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractKnnIT;
12 |
13 | public class KnnIT extends AbstractKnnIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractCrudIT;
12 |
13 | public class CrudIT extends AbstractCrudIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/CopyCtorImpl.mustache:
--------------------------------------------------------------------------------
1 | {{#doesExtendType}}
2 | super(o);
3 | {{/doesExtendType}}
4 | {{#fields}}
5 | {{#type.isList}}
6 | this.{{name}} = _listCopy(o.{{name}});
7 | {{/type.isList}}
8 | {{^type.isList}}
9 | {{#type.isMap}}
10 | this.{{name}} = _mapCopy(o.{{name}});
11 | {{/type.isMap}}
12 | {{^type.isMap}}
13 | this.{{name}} = o.{{name}};
14 | {{/type.isMap}}
15 | {{/type.isList}}
16 | {{/fields}}
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#hashableFields}}
2 | result = 31 * result +
3 | {{#required}}
4 | {{#type.isPrimitive}}
5 | {{type.boxed}}.hashCode(this.{{name}});
6 | {{/type.isPrimitive}}
7 | {{^type.isPrimitive}}
8 | this.{{name}}.hashCode();
9 | {{/type.isPrimitive}}
10 | {{/required}}
11 | {{^required}}
12 | {{TYPES.Java.Util.Objects}}.hashCode(this.{{name}});
13 | {{/required}}
14 | {{/hashableFields}}
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractNodesIT;
12 |
13 | public class NodesIT extends AbstractNodesIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/transport/TransportHeaders.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.transport;
10 |
11 | public final class TransportHeaders {
12 | public static final String ACCEPT = "Accept";
13 | public static final String USER_AGENT = "User-Agent";
14 |
15 | private TransportHeaders() {}
16 | }
17 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractCatClientIT;
12 |
13 | public class CatIT extends AbstractCatClientIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractRequestIT;
12 |
13 | public class RequestIT extends AbstractRequestIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/json/JsonpMapperAttributes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.json;
10 |
11 | public final class JsonpMapperAttributes {
12 | private JsonpMapperAttributes() {}
13 |
14 | public static final String SERIALIZE_TYPED_KEYS = JsonpMapperAttributes.class.getName() + ":SERIALIZE_TYPED_KEYS";
15 | }
16 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractHighlightIT;
12 |
13 | public class HighlightIT extends AbstractHighlightIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractPingAndInfoIT;
12 |
13 | public class PingAndInfoIT extends AbstractPingAndInfoIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/TasksClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractTasksClientIT;
12 |
13 | public class TasksClientIT extends AbstractTasksClientIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape/Serialize.mustache:
--------------------------------------------------------------------------------
1 | {{#hasDelegatedBodyField}}
2 | /**
3 | * Serialize this value to JSON.
4 | */
5 | @Override
6 | public void serialize({{TYPES.Jakarta.Json.Stream.JsonGenerator}} generator, {{TYPES.Client.Json.JsonpMapper}} mapper) {
7 | {{#delegatedBodyField.type.serializer}}this.{{delegatedBodyField.name}}{{/delegatedBodyField.type.serializer}}
8 | }
9 | {{/hasDelegatedBodyField}}
10 | {{^hasDelegatedBodyField}}
11 | {{>ObjectShape/Serialize}}
12 | {{/hasDelegatedBodyField}}
--------------------------------------------------------------------------------
/.github/workflows/add-untriaged.yml:
--------------------------------------------------------------------------------
1 | name: Apply 'untriaged' label during issue lifecycle
2 |
3 | on:
4 | issues:
5 | types: [opened, reopened, transferred]
6 |
7 | jobs:
8 | apply-label:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/github-script@v8
12 | with:
13 | script: |
14 | github.rest.issues.addLabels({
15 | issue_number: context.issue.number,
16 | owner: context.repo.owner,
17 | repo: context.repo.repo,
18 | labels: ['untriaged']
19 | })
20 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/BulkIngesterIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractBulkIngesterIT;
12 |
13 | public class BulkIngesterIT extends AbstractBulkIngesterIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/GenericClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractGenericClientIT;
12 |
13 | public class GenericClientIT extends AbstractGenericClientIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractIndicesClientIT;
12 |
13 | public class IndicesClientIT extends AbstractIndicesClientIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractSearchRequestIT;
12 |
13 | public class SearchRequestIT extends AbstractSearchRequestIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals/Fields.mustache:
--------------------------------------------------------------------------------
1 | {{#hashableFields}}
2 | {{^-first}}
3 | &&
4 | {{/-first}}
5 | {{#required}}
6 | {{#type.isPrimitive}}
7 | this.{{name}} == other.{{name}}
8 | {{/type.isPrimitive}}
9 | {{^type.isPrimitive}}
10 | this.{{name}}.equals(other.{{name}})
11 | {{/type.isPrimitive}}
12 | {{/required}}
13 | {{^required}}
14 | {{TYPES.Java.Util.Objects}}.equals(this.{{name}}, other.{{name}})
15 | {{/required}}
16 | {{/hashableFields}}
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/AsyncStacktraceIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractAsyncStracktraceIT;
12 |
13 | public class AsyncStacktraceIT extends AbstractAsyncStracktraceIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractAggregationRequestIT;
12 |
13 | public class AggregationRequestIT extends AbstractAggregationRequestIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractMultiSearchRequestIT;
12 |
13 | public class MultiSearchRequestIT extends AbstractMultiSearchRequestIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import org.opensearch.client.opensearch.integTest.AbstractSearchTemplateRequestIT;
12 |
13 | public class SearchTemplateRequestIT extends AbstractSearchTemplateRequestIT implements HttpClient5TransportSupport {}
14 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache:
--------------------------------------------------------------------------------
1 | {{#typedefName}}
2 | // typedef: {{.}}
3 |
4 | {{/typedefName}}
5 | {{#description}}
6 | /**
7 | * {{.}}
8 | */
9 | {{/description}}
10 | {{#annotations}}
11 | @{{.}}
12 | {{/annotations}}
13 | @{{TYPES.Javax.Annotation.Generated}}("org.opensearch.client.codegen.CodeGenerator")
14 | public {{abstractionLevel}} {{classKind}} {{className}}{{#typeParameters}}{{.}}{{/typeParameters}}{{#extendsType}} extends {{.}}{{/extendsType}}{{#implementsTypes}}{{#-first}} implements{{/-first}} {{.}}{{^-last}},{{/-last}}{{/implementsTypes}}
15 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/json/JsonException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.json;
10 |
11 | public class JsonException extends RuntimeException {
12 | public JsonException(String message) {
13 | super(message);
14 | }
15 |
16 | public JsonException(String message, Throwable cause) {
17 | super(message, cause);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.github/workflows/changelog_verifier.yml:
--------------------------------------------------------------------------------
1 | name: "Changelog Verifier"
2 | on:
3 | pull_request:
4 | types: [opened, edited, review_requested, synchronize, reopened, ready_for_review, labeled, unlabeled]
5 |
6 | jobs:
7 | # Enforces the update of a changelog file on every pull request
8 | verify-changelog:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v6
12 | with:
13 | token: ${{ secrets.GITHUB_TOKEN }}
14 | ref: ${{ github.event.pull_request.head.sha }}
15 |
16 | - uses: dangoslen/changelog-enforcer@v3
17 | with:
18 | skipLabels: "autocut, skip-changelog"
19 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape/HttpPathBuilder.mustache:
--------------------------------------------------------------------------------
1 | {{#hasParams}}
2 | StringBuilder buf = new StringBuilder();
3 | {{#parts}}
4 | {{#isParameter}}
5 | SimpleEndpoint.pathEncode({{#parameter.type.queryParamify}}request.{{parameter.name}}{{/parameter.type.queryParamify}}, buf);
6 | {{/isParameter}}
7 | {{^isParameter}}
8 | buf.append({{#quoted}}{{content}}{{/quoted}});
9 | {{/isParameter}}
10 | {{/parts}}
11 | return buf.toString();
12 | {{/hasParams}}
13 | {{^hasParams}}
14 | return {{#quoted}}{{this}}{{/quoted}};
15 | {{/hasParams}}
--------------------------------------------------------------------------------
/.ci/bump-version.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -ex
4 |
5 | IFS='.' read -r -a VERSION_COMPONENTS <<< "$1"
6 | MAJOR="${VERSION_COMPONENTS[0]}"
7 | MINOR="${VERSION_COMPONENTS[1]}"
8 | PATCH="${VERSION_COMPONENTS[2]}"
9 |
10 | if [[ -z "$MAJOR" || -z "$MINOR" || -z "$PATCH" ]]; then
11 | echo "Usage: $0 .."
12 | exit 1
13 | fi
14 |
15 | VERSION="$MAJOR.$MINOR.$PATCH"
16 |
17 | s=$(command -v gsed || command -v sed)
18 |
19 | if [[ -z "$s" ]]; then
20 | echo "sed command not found. Please install gsed or sed."
21 | exit 1
22 | fi
23 |
24 | "$s" -i'' -E "s/^(systemProp\.version =) [0-9]+\.[0-9]+\.[0-9]+/\1 $VERSION/" gradle.properties
--------------------------------------------------------------------------------
/ADMINS.md:
--------------------------------------------------------------------------------
1 | ## Admins
2 |
3 | | Admin | GitHub ID | Affiliation |
4 | | -------------------------| --------------------------------------- | ----------- |
5 | | Charlotte Henkle | [CEHENKLE](https://github.com/cehenkle) | Amazon |
6 | | Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
7 |
8 | [This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md) explains what admins do in this repo. and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
9 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/exceptions/JavaFormatterException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.exceptions;
10 |
11 | public class JavaFormatterException extends Exception {
12 | public JavaFormatterException(String message) {
13 | super(message);
14 | }
15 |
16 | public JavaFormatterException(String message, Throwable cause) {
17 | super(message, cause);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/Deserialize/CreateClassDeserializerFnSignature.mustache:
--------------------------------------------------------------------------------
1 | {{^typeParameters}}
2 | protected static {{TYPES.Client.Json.JsonpDeserializer}}<{{selfType}}> create{{className}}Deserializer()
3 | {{/typeParameters}}
4 | {{#typeParameters}}
5 | /**
6 | * Create a JSON deserializer for {{className}}.
7 | */
8 | public static {{.}} {{TYPES.Client.Json.JsonpDeserializer}}<{{selfType}}> create{{className}}Deserializer({{#typeParameterDefinitions}}{{TYPES.Client.Json.JsonpDeserializer}}<{{name}}> {{#camelCase}}{{name}}{{/camelCase}}Deserializer{{^-last}}, {{/-last}}{{/typeParameterDefinitions}})
9 | {{/typeParameters}}
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/json/JsonGenerationException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.json;
10 |
11 | public class JsonGenerationException extends JsonException {
12 | public JsonGenerationException(String message) {
13 | super(message);
14 | }
15 |
16 | public JsonGenerationException(String message, Throwable cause) {
17 | super(message, cause);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/Deserialize/TypeParametersNamedDeserializer.mustache:
--------------------------------------------------------------------------------
1 | /**
2 | * Json deserializer for {@link {{className}}} based on named deserializers provided by the calling {@code JsonMapper}.
3 | */
4 | public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}<{{#typeParameterDefinitions}}Object{{^-last}}, {{/-last}}{{/typeParameterDefinitions}}>> _DESERIALIZER = create{{className}}Deserializer(
5 | {{#typeParameterDefinitions}}
6 | new {{TYPES.Client.Json.NamedDeserializer}}<>("{{TYPES.Client.PACKAGE}}:Deserializer:{{typedefPrefix}}.{{name}}"){{^-last}},{{/-last}}
7 | {{/typeParameterDefinitions}}
8 | );
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: ${{ matrix.os }}
8 | strategy:
9 | matrix:
10 | java: [ 21, 25 ]
11 | os: [ubuntu-latest, windows-latest, macOS-14, macOS-latest]
12 | steps:
13 | - name: Checkout Java Client
14 | uses: actions/checkout@v6
15 |
16 | - name: Set up JDK ${{ matrix.java }}
17 | uses: actions/setup-java@v5
18 | with:
19 | java-version: ${{ matrix.java }}
20 | distribution: 'temurin'
21 | cache: 'gradle'
22 |
23 | - name: Build with Gradle
24 | run: ./gradlew clean build -x test
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/matcher/StringMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.matcher;
10 |
11 | public final class StringMatcher {
12 | private StringMatcher() {}
13 |
14 | public static Matcher endsWith(String suffix) {
15 | return s -> s.endsWith(suffix);
16 | }
17 |
18 | public static Matcher contains(String substring) {
19 | return s -> s.contains(substring);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/DirectSerializer/Map.mustache:
--------------------------------------------------------------------------------
1 | for ({{type.mapEntryType}} item{{depth}} : {{value}}.entrySet()) {
2 | generator.writeKey(item{{depth}}.getKey());
3 | {{#type.mapValueType.isList}}
4 | generator.writeStartArray();
5 | if (item{{depth}}.getValue() != null) {
6 | {{#type.mapValueType.directSerializer}}item{{depth}}.getValue(){{/type.mapValueType.directSerializer}}
7 | }
8 | generator.writeEnd();
9 | {{/type.mapValueType.isList}}
10 | {{^type.mapValueType.isList}}
11 | {{#type.mapValueType.serializer}}item{{depth}}.getValue(){{/type.mapValueType.serializer}}
12 | {{/type.mapValueType.isList}}
13 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/walker/ZippedOpenApiVisitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.openapi.walker;
10 |
11 | import javax.annotation.Nullable;
12 | import org.opensearch.client.codegen.openapi.OpenApiSchema;
13 |
14 | public interface ZippedOpenApiVisitor {
15 | void visitSchemaStart(@Nullable OpenApiSchema left, @Nullable OpenApiSchema right);
16 |
17 | void visitSchemaEnd(@Nullable OpenApiSchema left, @Nullable OpenApiSchema right);
18 | }
19 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | updates:
2 | - directory: /
3 | package-ecosystem: gradle
4 | open-pull-requests-limit: 3
5 | schedule:
6 | interval: weekly
7 | labels:
8 | - "dependabot"
9 | - "dependencies"
10 | - directory: /java-client/
11 | package-ecosystem: gradle
12 | open-pull-requests-limit: 3
13 | schedule:
14 | interval: weekly
15 | labels:
16 | - "dependabot"
17 | - "dependencies"
18 | - directory: /
19 | package-ecosystem: github-actions
20 | open-pull-requests-limit: 3
21 | schedule:
22 | interval: weekly
23 | labels:
24 | - "dependabot"
25 | - "dependencies"
26 | - "github-actions"
27 | - "skip-changelog"
28 | version: 2
29 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache:
--------------------------------------------------------------------------------
1 | @Override
2 | public boolean equals(Object o) {
3 | {{#extendsOtherShape}}
4 | if(!super.equals(o)) {
5 | return false;
6 | }
7 | {{/extendsOtherShape}}
8 | if(this == o) return true;
9 | if(o == null || this.getClass() != o.getClass()) return false;
10 | {{#hasFields}}
11 | {{className}}{{#typeParameters}}>{{/typeParameters}} other = ({{className}}{{#typeParameters}}>{{/typeParameters}})o;
12 | return {{>ObjectShape/Equals/Fields}};
13 | {{/hasFields}}
14 | {{^hasFields}}
15 | return true;
16 | {{/hasFields}}
17 | }
18 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/MgetRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class MgetRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | MgetRequest origin = new MgetRequest.Builder().index("index").build();
19 | MgetRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/IOUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch;
10 |
11 | import java.io.Closeable;
12 | import java.io.IOException;
13 |
14 | public final class IOUtils {
15 | public static void closeQueitly(final Closeable closeable) {
16 | try {
17 | if (closeable != null) {
18 | closeable.close();
19 | }
20 | } catch (final IOException | RuntimeException e) {
21 | // Do nothing
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/CountRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class CountRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | CountRequest origin = new CountRequest.Builder().index("index").build();
19 | CountRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/GetRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class GetRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | GetRequest origin = new GetRequest.Builder().index("index").id("id").build();
19 | GetRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/GetScriptRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class GetScriptRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | GetScriptRequest origin = new GetScriptRequest.Builder().id("id").build();
19 | GetScriptRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.id(), origin.id());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class UpdateRequestTest extends Assert {
15 | @Test
16 | public void toBuilder() {
17 | UpdateRequest origin = new UpdateRequest.Builder().index("index").id("id").build();
18 | UpdateRequest copied = origin.toBuilder().build();
19 |
20 | assertEquals(copied.index(), origin.index());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/model/ReferenceKind.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.model;
10 |
11 | public enum ReferenceKind {
12 | Extends(false),
13 | Field(true),
14 | UnionVariant(true),
15 | TypeParameter(true);
16 |
17 | private final boolean isConcreteUsage;
18 |
19 | ReferenceKind(boolean isConcreteUsage) {
20 | this.isConcreteUsage = isConcreteUsage;
21 | }
22 |
23 | public boolean isConcreteUsage() {
24 | return isConcreteUsage;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class DeleteRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | DeleteRequest origin = new DeleteRequest.Builder().id("id").index("index").build();
19 | DeleteRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ExistsRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ExistsRequest origin = new ExistsRequest.Builder().index("index").id("id").build();
19 | ExistsRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class LikeTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | Like origin = new Like.Builder().text("text").build();
18 | Like copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ExplainRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ExplainRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ExplainRequest origin = new ExplainRequest.Builder().index("index").id("id").build();
19 | ExplainRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/FieldCapsRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class FieldCapsRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | FieldCapsRequest origin = new FieldCapsRequest.Builder().index("index").build();
19 | FieldCapsRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ScrollRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ScrollRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ScrollRequest origin = new ScrollRequest.Builder().scrollId("scrollId").build();
19 | ScrollRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.scrollId(), origin.scrollId());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/exceptions/ApiSpecificationParseException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.exceptions;
10 |
11 | import java.util.List;
12 |
13 | public class ApiSpecificationParseException extends RuntimeException {
14 | public ApiSpecificationParseException(String msg, Exception inner) {
15 | super(msg, inner);
16 | }
17 |
18 | public ApiSpecificationParseException(String msg, List errors) {
19 | super(msg + "\n-" + String.join("\n-", errors));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteScriptRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class DeleteScriptRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | DeleteScriptRequest origin = new DeleteScriptRequest.Builder().id("id").build();
19 | DeleteScriptRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.id(), origin.id());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Sets.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import java.util.Collections;
12 | import java.util.Optional;
13 | import java.util.Set;
14 | import javax.annotation.Nonnull;
15 | import javax.annotation.Nullable;
16 |
17 | public final class Sets {
18 | private Sets() {}
19 |
20 | @Nonnull
21 | public static Optional> unmodifiableOpt(@Nullable Set set) {
22 | return Optional.ofNullable(set).map(Collections::unmodifiableSet);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/src/main/java/org/opensearch/client/samples/util/AppData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.samples.util;
10 |
11 | public class AppData {
12 | private int intValue;
13 | private String msg;
14 |
15 | public int getIntValue() {
16 | return intValue;
17 | }
18 |
19 | public void setIntValue(int intValue) {
20 | this.intValue = intValue;
21 | }
22 |
23 | public String getMsg() {
24 | return msg;
25 | }
26 |
27 | public void setMsg(String msg) {
28 | this.msg = msg;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IdsQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IdsQuery origin = new IdsQuery.Builder().build();
18 | IdsQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/GetSourceRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class GetSourceRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | GetSourceRequest origin = new GetSourceRequest.Builder().id("id").index("index").build();
19 | GetSourceRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/MtermvectorsRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class MtermvectorsRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | MtermvectorsRequest origin = new MtermvectorsRequest.Builder().index("index").build();
19 | MtermvectorsRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchShardsRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class SearchShardsRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | SearchShardsRequest origin = new SearchShardsRequest.Builder().index("index").build();
19 | SearchShardsRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/transport/GenericSerializable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.transport;
10 |
11 | import java.io.OutputStream;
12 |
13 | /**
14 | * The request that takes care of serializing its body (content) into the {@link OutputStream}
15 | */
16 | public interface GenericSerializable {
17 | /**
18 | * Serializes into the {@link OutputStream} and returns the content type
19 | * @param out {@link OutputStream} to serialize into
20 | * @return content type
21 | */
22 | String serialize(OutputStream out);
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsSourceRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ExistsSourceRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ExistsSourceRequest origin = new ExistsSourceRequest.Builder().index("index").id("id").build();
19 | ExistsSourceRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookupTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class FieldLookupTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | FieldLookup origin = new FieldLookup.Builder().id("id").build();
18 | FieldLookup copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class TypeQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | TypeQuery origin = new TypeQuery.Builder().value("value").build();
18 | TypeQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RangeQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RangeQuery origin = new RangeQuery.Builder().field("field").build();
18 | RangeQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class ExistsQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | ExistsQuery origin = new ExistsQuery.Builder().field("field").build();
18 | ExistsQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class ParentIdQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | ParentIdQuery origin = new ParentIdQuery.Builder().id("id").build();
18 | ParentIdQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class WrapperQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | WrapperQuery origin = new WrapperQuery.Builder().query("query").build();
18 | WrapperQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ReindexRethrottleRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ReindexRethrottleRequest origin = new ReindexRethrottleRequest.Builder().taskId("taskId").build();
19 | ReindexRethrottleRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.taskId(), origin.taskId());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class RenderSearchTemplateRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | RenderSearchTemplateRequest origin = new RenderSearchTemplateRequest.Builder().id("id").build();
19 | RenderSearchTemplateRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.id(), origin.id());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/jenkins/release.jenkinsFile:
--------------------------------------------------------------------------------
1 | lib = library(identifier: 'jenkins@10.2.2', retriever: modernSCM([
2 | $class: 'GitSCMSource',
3 | remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
4 | ]))
5 |
6 | standardReleasePipelineWithGenericTrigger(
7 | overrideDockerImage: 'opensearchstaging/ci-runner:release-centos7-clients-v4',
8 | tokenIdCredential: 'jenkins-opensearch-java-generic-webhook-token',
9 | causeString: 'A tag was cut on opensearch-project/opensearch-java repository causing this workflow to run',
10 | downloadReleaseAsset: true,
11 | publishRelease: true) {
12 | publishToMaven(
13 | signingArtifactsPath: "$WORKSPACE/repository/",
14 | mavenArtifactsPath: "$WORKSPACE/repository/",
15 | autoPublish: true
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormatTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class FieldAndFormatTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | FieldAndFormat origin = new FieldAndFormat.Builder().field("field").build();
18 | FieldAndFormat copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatchTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsMatchTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsMatch origin = new IntervalsMatch.Builder().query("query").build();
18 | IntervalsMatch copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class PrefixQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | PrefixQuery origin = new PrefixQuery.Builder().field("field").value("value").build();
18 | PrefixQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RegexpQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RegexpQuery origin = new RegexpQuery.Builder().field("field").value("value").build();
18 | RegexpQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class SpanGapQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | SpanGapQuery origin = new SpanGapQuery.Builder().field("field").spanWidth(1).build();
18 | SpanGapQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefixTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsPrefixTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsPrefix origin = new IntervalsPrefix.Builder().prefix("prefix").build();
18 | IntervalsPrefix copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class MultiMatchQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | MultiMatchQuery origin = new MultiMatchQuery.Builder().query("query").build();
18 | MultiMatchQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class PercolateQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | PercolateQuery origin = new PercolateQuery.Builder().id("id").field("field").build();
18 | PercolateQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookupTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class TermsLookupTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | TermsLookup origin = new TermsLookup.Builder().id("id").index("index").path("path").build();
18 | TermsLookup copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class QueryStringQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | QueryStringQuery origin = new QueryStringQuery.Builder().query("query").build();
18 | QueryStringQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RankFeatureQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RankFeatureQuery origin = new RankFeatureQuery.Builder().field("field").build();
18 | RankFeatureQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class SpanTermQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | SpanTermQuery origin = new SpanTermQuery.Builder().field("field").value("value").build();
18 | SpanTermQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class TermsSetQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | TermsSetQuery origin = new TermsSetQuery.Builder().field("field").terms("terms").build();
18 | TermsSetQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class WildcardQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | WildcardQuery origin = new WildcardQuery.Builder().field("field").value("value").build();
18 | WildcardQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/RankEvalRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import java.util.Collections;
12 | import org.junit.Assert;
13 | import org.junit.Test;
14 |
15 | public class RankEvalRequestTest extends Assert {
16 |
17 | @Test
18 | public void toBuilder() {
19 | RankEvalRequest origin = new RankEvalRequest.Builder().index("index").requests(Collections.emptyList()).build();
20 | RankEvalRequest copied = origin.toBuilder().build();
21 |
22 | assertEquals(copied.index(), origin.index());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQueryFieldTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class GeoShapeQueryFieldTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | GeoShapeQueryField origin = new GeoShapeQueryField.Builder().shape(s -> s).build();
18 | GeoShapeQueryField copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | Intervals origin = new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build();
18 | Intervals copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/TermvectorsRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class TermvectorsRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | TermvectorsRequest origin = new TermvectorsRequest.Builder().index("index").build();
19 | TermvectorsRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 |
24 | static class MyDoc {}
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class UpdateByQueryRethrottleRequestTest extends Assert {
15 | @Test
16 | public void toBuilder() {
17 | UpdateByQueryRethrottleRequest origin = new UpdateByQueryRethrottleRequest.Builder().taskId("taskId").build();
18 | UpdateByQueryRethrottleRequest copied = origin.toBuilder().build();
19 |
20 | assertEquals(copied.taskId(), origin.taskId());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/.github/workflows/backport.yml:
--------------------------------------------------------------------------------
1 | name: Backport
2 | on:
3 | pull_request_target:
4 | types:
5 | - closed
6 | - labeled
7 |
8 | jobs:
9 | backport:
10 | if: ${{ contains(github.event.label.name, 'backport') }}
11 | runs-on: ubuntu-latest
12 | permissions:
13 | contents: write
14 | pull-requests: write
15 | name: Backport
16 | steps:
17 | - name: GitHub App token
18 | id: github_app_token
19 | uses: actions/create-github-app-token@v2
20 | with:
21 | app-id: ${{ secrets.APP_ID }}
22 | private-key: ${{ secrets.APP_PRIVATE_KEY }}
23 |
24 | - name: Backport
25 | uses: VachaShah/backport@v2.2.0
26 | with:
27 | github_token: ${{ steps.github_app_token.outputs.token }}
28 | head_template: backport/backport-<%= number %>-to-<%= base %>
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzyTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsFuzzyTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsFuzzy origin = new IntervalsFuzzy.Builder().term("term").fuzziness("fuzziness").build();
18 | IntervalsFuzzy copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class KnnQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | KnnQuery origin = new KnnQuery.Builder().field("field").vector(1.0f).k(1).minScore(0.0f).maxDistance(1.0f).build();
18 | KnnQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class DeleteByQueryRethrottleRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | DeleteByQueryRethrottleRequest origin = new DeleteByQueryRethrottleRequest.Builder().taskId("taskId").build();
19 | DeleteByQueryRethrottleRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.taskId(), origin.taskId());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class ScriptsPainlessExecuteRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | ScriptsPainlessExecuteRequest origin = new ScriptsPainlessExecuteRequest.Builder().context("context").build();
19 | ScriptsPainlessExecuteRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.context(), origin.context());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/aggregations/FilterAggregateTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.aggregations;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class FilterAggregateTest extends ModelTestCase {
15 | @Test
16 | public void serializesNestedAggregates() {
17 | String json = "{\"sum#l2_result\":{\"value\":1.0},\"doc_count\":1}";
18 | FilterAggregate aggregate = fromJson(json, FilterAggregate._DESERIALIZER);
19 | assertEquals(json, toJson(aggregate));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class CommonTermsQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | CommonTermsQuery origin = new CommonTermsQuery.Builder().query("query").field("field").build();
18 | CommonTermsQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class MatchPhraseQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | MatchPhraseQuery origin = new MatchPhraseQuery.Builder().field("field").query("query").build();
18 | MatchPhraseQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/ClearScrollRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import java.util.Collections;
12 | import org.junit.Assert;
13 | import org.junit.Test;
14 |
15 | public class ClearScrollRequestTest extends Assert {
16 |
17 | @Test
18 | public void toBuilder() {
19 | ClearScrollRequest origin = new ClearScrollRequest.Builder().scrollId(Collections.singletonList("1")).build();
20 | ClearScrollRequest copied = origin.toBuilder().build();
21 |
22 | assertEquals(copied.scrollId(), origin.scrollId());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/walker/ZippedOpenApiVisitorBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.openapi.walker;
10 |
11 | import javax.annotation.Nullable;
12 | import org.opensearch.client.codegen.openapi.OpenApiSchema;
13 |
14 | public abstract class ZippedOpenApiVisitorBase implements ZippedOpenApiVisitor {
15 | @Override
16 | public void visitSchemaStart(@Nullable OpenApiSchema left, @Nullable OpenApiSchema right) {
17 |
18 | }
19 |
20 | @Override
21 | public void visitSchemaEnd(@Nullable OpenApiSchema left, @Nullable OpenApiSchema right) {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class CombinedFieldsQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | CombinedFieldsQuery origin = new CombinedFieldsQuery.Builder().fields("field").query("query").build();
18 | CombinedFieldsQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcardTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsWildcardTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsWildcard origin = new IntervalsWildcard.Builder().useField("useField").pattern("pattern").build();
18 | IntervalsWildcard copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class SimpleQueryStringQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | SimpleQueryStringQuery origin = new SimpleQueryStringQuery.Builder().query("query").build();
18 | SimpleQueryStringQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class MatchBoolPrefixQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | MatchBoolPrefixQuery origin = new MatchBoolPrefixQuery.Builder().field("field").query("query").build();
18 | MatchBoolPrefixQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class MoreLikeThisQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | MoreLikeThisQuery origin = new MoreLikeThisQuery.Builder().like(new Like.Builder().text("text").build()).build();
18 | MoreLikeThisQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacementTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.json.JsonData;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class DecayPlacementTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | DecayPlacement origin = new DecayPlacement.Builder().scale(JsonData.of("{}")).build();
19 | DecayPlacement copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class MatchPhrasePrefixQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | MatchPhrasePrefixQuery origin = new MatchPhrasePrefixQuery.Builder().field("field").query("query").build();
18 | MatchPhrasePrefixQuery copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/mapping/DynamicTemplateTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.mapping;
10 |
11 | import static org.junit.Assert.assertEquals;
12 |
13 | import org.junit.Ignore;
14 | import org.junit.Test;
15 |
16 | public class DynamicTemplateTest {
17 |
18 | @Test
19 | @Ignore
20 | public void test() {
21 | DynamicTemplate dynamicTemplate = new DynamicTemplate.Builder().matchMappingType("long")
22 | .mapping(t -> t.integer(i -> i.docValues(false)))
23 | .build();
24 | assertEquals("{}", dynamicTemplate.toJsonString());
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.model;
10 |
11 | import org.opensearch.client.codegen.utils.matcher.Matcher;
12 |
13 | public final class OperationGroupMatcher {
14 | private OperationGroupMatcher() {}
15 |
16 | public static Matcher name(Matcher nameMatcher) {
17 | return group -> nameMatcher.matches(group.getName());
18 | }
19 |
20 | public static Matcher namespace(Matcher namespaceMatcher) {
21 | return group -> namespaceMatcher.matches(group.getNamespace().orElse(null));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class TermQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | TermQuery origin = new TermQuery.Builder().field("field").value(FieldValue.of("1")).build();
19 | TermQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class FuzzyQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | FuzzyQuery origin = new FuzzyQuery.Builder().field("field").value(FieldValue.of("value")).build();
19 | FuzzyQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RankFeatureFunctionSaturationTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RankFeatureFunctionSaturation origin = new RankFeatureFunctionSaturation.Builder().pivot(1.0f).build();
18 | RankFeatureFunctionSaturation copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoidTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RankFeatureFunctionSigmoidTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RankFeatureFunctionSigmoid origin = new RankFeatureFunctionSigmoid.Builder().exponent(1.0f).pivot(1.0f).build();
18 | RankFeatureFunctionSigmoid copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanQuery origin = new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build();
19 | SpanQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunctionTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class FieldValueFactorScoreFunctionTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | FieldValueFactorScoreFunction origin = new FieldValueFactorScoreFunction.Builder().field("field").build();
18 | FieldValueFactorScoreFunction copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithmTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class RankFeatureFunctionLogarithmTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | RankFeatureFunctionLogarithm origin = new RankFeatureFunctionLogarithm.Builder().scalingFactor(1.0f).build();
18 | RankFeatureFunctionLogarithm copied = origin.toBuilder().build();
19 |
20 | assertEquals(toJson(copied), toJson(origin));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TemplateStringLambda.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.renderer.lambdas;
10 |
11 | import com.samskivert.mustache.Mustache;
12 | import java.util.Objects;
13 | import javax.annotation.Nonnull;
14 |
15 | @FunctionalInterface
16 | public interface TemplateStringLambda {
17 | @Nonnull
18 | String execute(@Nonnull String input);
19 |
20 | static Mustache.Lambda asMustacheLambda(@Nonnull TemplateStringLambda lambda) {
21 | Objects.requireNonNull(lambda, "lambda must not be null");
22 | return (fragment, out) -> out.write(lambda.execute(fragment.execute()));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Versions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import javax.annotation.Nonnull;
12 | import org.semver4j.Semver;
13 |
14 | public final class Versions {
15 | private Versions() {}
16 |
17 | public static final Semver V1_0_0 = Semver.of(1, 0, 0);
18 | public static final Semver V2_0_0 = Semver.of(2, 0, 0);
19 |
20 | @Nonnull
21 | public static Semver coerce(String str) {
22 | var version = Semver.coerce(str);
23 | if (version == null) throw new IllegalArgumentException("Unable to coerce `" + str + "` to semver");
24 | return version;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.github/workflows/delete-merged-autocut-branches.yml:
--------------------------------------------------------------------------------
1 | name: Delete merged autocut PR branches
2 | on:
3 | pull_request:
4 | types:
5 | - closed
6 |
7 | jobs:
8 | delete-branch:
9 | runs-on: ubuntu-latest
10 | if: |
11 | github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
12 | && (
13 | startsWith(github.event.pull_request.head.ref, 'backport/')
14 | || startsWith(github.event.pull_request.head.ref, 'bump-version/')
15 | )
16 | permissions:
17 | contents: write
18 | steps:
19 | - name: Delete merged branch
20 | uses: actions/github-script@v8
21 | with:
22 | script: |
23 | github.rest.git.deleteRef({
24 | owner: context.repo.owner,
25 | repo: context.repo.repo,
26 | ref: `heads/${context.payload.pull_request.head.ref}`,
27 | })
28 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache:
--------------------------------------------------------------------------------
1 | {{^extendedByOtherShape}}
2 | private {{className}}(Builder{{#typeParameters}}{{.}}{{/typeParameters}} builder) {
3 | {{/extendedByOtherShape}}
4 | {{#extendedByOtherShape}}
5 | protected {{className}}(AbstractBuilder<{{#typeParameters}}{{#typeParameterDefinitions}}{{.}}, {{/typeParameterDefinitions}}{{/typeParameters}}?> builder) {
6 | {{/extendedByOtherShape}}
7 | {{>ObjectShape/ConstructorImpl}}
8 | }
9 | {{^abstract}}
10 |
11 | public static{{#typeParameters}} {{.}}{{/typeParameters}} {{selfType}} {{#extendedByOtherShape}}{{#camelCase}}{{className}}{{/camelCase}}Of{{/extendedByOtherShape}}{{^extendedByOtherShape}}of{{/extendedByOtherShape}}({{selfType.builderFnType}} fn) {
12 | return fn.apply(new Builder{{#typeParameters}}<>{{/typeParameters}}()).build();
13 | }
14 | {{/abstract}}
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunctionTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.json.JsonData;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class RandomScoreFunctionTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | RandomScoreFunction origin = new RandomScoreFunction.Builder().seed(JsonData.of("seed")).build();
19 | RandomScoreFunction copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchTemplateRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import java.util.Collections;
12 | import org.junit.Assert;
13 | import org.junit.Test;
14 |
15 | public class MsearchTemplateRequestTest extends Assert {
16 |
17 | @Test
18 | public void toBuilder() {
19 | MsearchTemplateRequest origin = new MsearchTemplateRequest.Builder().index("index")
20 | .searchTemplates(Collections.emptyList())
21 | .build();
22 | MsearchTemplateRequest copied = origin.toBuilder().build();
23 |
24 | assertEquals(copied.index(), origin.index());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class MatchQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | MatchQuery origin = new MatchQuery.Builder().field("field").query(FieldValue.of("1")).queryName("name").boost(5f).build();
19 | MatchQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptionsTestCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.transport.aws;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class AwsSdk2TransportOptionsTestCase extends Assert {
15 | @Test
16 | public void testBuilderResponseCompression() throws Exception {
17 | AwsSdk2TransportOptions options = AwsSdk2TransportOptions.builder()
18 | .setResponseCompression(true)
19 | .setRequestCompressionSize(10)
20 | .build();
21 | assertEquals(10, options.requestCompressionSize().intValue());
22 | assertTrue(options.responseCompression());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Functional.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Function;
13 | import javax.annotation.Nonnull;
14 | import javax.annotation.Nullable;
15 | import org.jetbrains.annotations.Contract;
16 |
17 | public final class Functional {
18 | private Functional() {}
19 |
20 | @Contract("null,_->null;_,_->_")
21 | @Nullable
22 | public static R ifNonnull(@Nullable T value, @Nonnull Function mapper) {
23 | Objects.requireNonNull(mapper, "mapper must not be null");
24 | return value != null ? mapper.apply(value) : null;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.json.JsonData;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class DistanceFeatureQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | DistanceFeatureQuery origin = new DistanceFeatureQuery.Builder().origin(JsonData.of("{}")).pivot("{}").field("field").build();
19 | DistanceFeatureQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPointsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.GeoLocation;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class GeoPolygonPointsTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | GeoPolygonPoints origin = new GeoPolygonPoints.Builder().points(new GeoLocation.Builder().text("text").build()).build();
19 | GeoPolygonPoints copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOfTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsAllOfTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsAllOf origin = new IntervalsAllOf.Builder().intervals(
18 | new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build()
19 | ).build();
20 | IntervalsAllOf copied = origin.toBuilder().build();
21 |
22 | assertEquals(toJson(copied), toJson(origin));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOfTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsAnyOfTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsAnyOf origin = new IntervalsAnyOf.Builder().intervals(
18 | new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build()
19 | ).build();
20 | IntervalsAnyOf copied = origin.toBuilder().build();
21 |
22 | assertEquals(toJson(copied), toJson(origin));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/PutScriptRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch._types.StoredScript;
14 |
15 | public class PutScriptRequestTest extends Assert {
16 |
17 | @Test
18 | public void toBuilder() {
19 | PutScriptRequest origin = new PutScriptRequest.Builder().id("id")
20 | .script(StoredScript.of(a -> a.lang(l -> l.custom("lang")).source("source")))
21 | .build();
22 | PutScriptRequest copied = origin.toBuilder().build();
23 |
24 | assertEquals(copied.id(), origin.id());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache:
--------------------------------------------------------------------------------
1 | {{>Partials/ClassDeclaration}} {
2 | {{>ObjectShape/Fields}}
3 |
4 | // ---------------------------------------------------------------------------------------------
5 |
6 | {{>ObjectShape/Constructor}}
7 | {{#referencingDiscriminatedUnions}}
8 |
9 | {{>ObjectShape/DiscriminatedUnionInterfaceImpl}}
10 | {{/referencingDiscriminatedUnions}}
11 | {{>ObjectShape/Getters}}
12 |
13 | {{>ObjectShape/Serialize}}
14 |
15 | // ---------------------------------------------------------------------------------------------
16 |
17 | {{>ObjectShape/ToBuilder}}
18 |
19 | {{>ObjectShape/Builder}}
20 |
21 | // ---------------------------------------------------------------------------------------------
22 |
23 | {{>ObjectShape/Deserialize}}
24 |
25 | {{>ObjectShape/HashCode}}
26 |
27 | {{>ObjectShape/Equals}}
28 | }
29 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape/Deserialize.mustache:
--------------------------------------------------------------------------------
1 | {{#hasDelegatedBodyField}}
2 | public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = create{{className}}Deserializer();
3 |
4 | protected static {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> create{{className}}Deserializer() {
5 | {{TYPES.Client.Json.JsonpDeserializer}}<{{delegatedBodyField.type}}> valueDeserializer = {{#delegatedBodyField.type}}{{>Type/deserializer}}{{/delegatedBodyField.type}};
6 | return {{TYPES.Client.Json.JsonpDeserializer}}.of(
7 | valueDeserializer.acceptedEvents(),
8 | (parser, mapper) -> new Builder().{{delegatedBodyField.name}}(valueDeserializer.deserialize(parser, mapper)).build()
9 | );
10 | }
11 | {{/hasDelegatedBodyField}}
12 | {{^hasDelegatedBodyField}}
13 | {{>ObjectShape/Deserialize}}
14 | {{/hasDelegatedBodyField}}
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/analysis/NormalizerDeserializerTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.analysis;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class NormalizerDeserializerTest extends ModelTestCase {
15 |
16 | @Test
17 | public void deserializesTypelessCustomAnalyzer() {
18 | String json = "{\n" + " \"filter\": \"lowercase\"\n" + " }";
19 |
20 | Normalizer normalizer = fromJson(json, Normalizer._DESERIALIZER);
21 | assertTrue(normalizer.isCustom());
22 | assertEquals("lowercase", normalizer.custom().filter().get(0));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsFilterTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsFilter origin = new IntervalsFilter.Builder().after(
18 | new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build()
19 | ).build();
20 | IntervalsFilter copied = origin.toBuilder().build();
21 |
22 | assertEquals(toJson(copied), toJson(origin));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/DelegatedShape/Deserialize.mustache:
--------------------------------------------------------------------------------
1 | {{^typeParameters}}
2 | /**
3 | * Json deserializer for {@link {{className}}}
4 | */
5 | public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = create{{className}}Deserializer();
6 | {{/typeParameters}}
7 | {{#typeParameters}}
8 | {{>Partials/Deserialize/TypeParametersNamedDeserializer}}
9 | {{/typeParameters}}
10 |
11 | {{>Partials/Deserialize/CreateClassDeserializerFnSignature}} {
12 | {{TYPES.Client.Json.JsonpDeserializer}}<{{delegatedType}}> valueDeserializer = {{#delegatedType}}{{>Type/deserializer}}{{/delegatedType}};
13 | return {{TYPES.Client.Json.JsonpDeserializer}}.of(
14 | valueDeserializer.acceptedEvents(),
15 | (parser, mapper) -> new Builder{{#typeParameters}}{{.}}{{/typeParameters}}().valueBody(valueDeserializer.deserialize(parser, mapper)).build()
16 | );
17 | }
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/ConstructorImpl.mustache:
--------------------------------------------------------------------------------
1 | {{#doesExtendType}}
2 | super(builder);
3 | {{/doesExtendType}}
4 | {{#fields}}
5 | {{#type.isListOrMap}}
6 | {{#required}}
7 | this.{{name}} = {{TYPES.Client.Util.ApiTypeHelper}}.unmodifiableRequired(builder.{{name}}, this, {{#quoted}}{{name}}{{/quoted}});
8 | {{/required}}
9 | {{^required}}
10 | this.{{name}} = {{TYPES.Client.Util.ApiTypeHelper}}.unmodifiable(builder.{{name}});
11 | {{/required}}
12 | {{/type.isListOrMap}}
13 | {{^type.isListOrMap}}
14 | {{#required}}
15 | this.{{name}} = {{TYPES.Client.Util.ApiTypeHelper}}.requireNonNull(builder.{{name}}, this, {{#quoted}}{{name}}{{/quoted}});
16 | {{/required}}
17 | {{^required}}
18 | this.{{name}} = builder.{{name}};
19 | {{/required}}
20 | {{/type.isListOrMap}}
21 | {{/fields}}
--------------------------------------------------------------------------------
/java-codegen/src/test/java/org/opensearch/client/codegen/utils/FunctionalTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertEquals;
12 | import static org.junit.jupiter.api.Assertions.assertNull;
13 |
14 | import org.junit.jupiter.api.Test;
15 |
16 | public class FunctionalTests {
17 | @Test
18 | public void ifNonnull_withNullValue_shouldReturnNull() {
19 | assertNull(Functional.ifNonnull((String) null, Integer::parseInt));
20 | }
21 |
22 | @Test
23 | public void ifNonnull_withNonNullValue_shouldReturnMappedValue() {
24 | var mapped = Functional.ifNonnull("18", Integer::parseInt);
25 | assertEquals(18, mapped);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-client/src/main/resources/org/opensearch/client/version.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Licensed to Elasticsearch B.V. under one or more contributor
3 | # license agreements. See the NOTICE file distributed with
4 | # this work for additional information regarding copyright
5 | # ownership. Elasticsearch B.V. licenses this file to you under
6 | # the Apache License, Version 2.0 (the "License"); you may
7 | # not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | # KIND, either express or implied. See the License for the
16 | # specific language governing permissions and limitations
17 | # under the License.
18 | #
19 |
20 | version=${version}
21 | git_revision=${git_revision}
22 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryFieldTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch._types.FieldValue;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class TermsQueryFieldTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | TermsQueryField origin = new TermsQueryField.Builder().value(Collections.singletonList(FieldValue.of("1"))).build();
20 | TermsQueryField copied = origin.toBuilder().build();
21 |
22 | assertEquals(toJson(copied), toJson(origin));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/IndexRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class IndexRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | IndexRequest origin = new IndexRequest.Builder().id("id").index("index").document(new MyDoc("1")).build();
19 | IndexRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 |
24 | static class MyDoc {
25 | String key;
26 |
27 | MyDoc(String key) {
28 | this.key = key;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.httpclient5;
10 |
11 | import java.io.IOException;
12 | import org.opensearch.client.opensearch.integTest.AbstractClusterClientIT;
13 | import org.opensearch.client.transport.httpclient5.ResponseException;
14 |
15 | public class ClusterClientIT extends AbstractClusterClientIT implements HttpClient5TransportSupport {
16 | @Override
17 | public void testClusterHealthNotFoundIndex() throws IOException {
18 | try {
19 | super.testClusterHealthNotFoundIndex();
20 | } catch (ResponseException e) {
21 | assertNotNull(e);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Clone.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import java.util.Collection;
12 | import java.util.List;
13 | import java.util.Map;
14 | import java.util.stream.Collectors;
15 | import javax.annotation.Nonnull;
16 |
17 | public interface Clone {
18 | T clone();
19 |
20 | static > List clone(@Nonnull Collection list) {
21 | return list.stream().map(Clone::clone).collect(Collectors.toList());
22 | }
23 |
24 | static > Map clone(@Nonnull Map map) {
25 | return map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().clone()));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/CreateRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import org.junit.Assert;
12 | import org.junit.Test;
13 |
14 | public class CreateRequestTest extends Assert {
15 |
16 | @Test
17 | public void toBuilder() {
18 | CreateRequest origin = new CreateRequest.Builder().id("id").document(new MyDoc("1")).index("index").build();
19 | CreateRequest copied = origin.toBuilder().build();
20 |
21 | assertEquals(copied.index(), origin.index());
22 | }
23 |
24 | static class MyDoc {
25 | String key;
26 |
27 | MyDoc(String key) {
28 | this.key = key;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/util/MutableBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.util;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Consumer;
13 | import javax.annotation.Nonnull;
14 |
15 | public interface MutableBuilder, T> extends ObjectBuilder {
16 | /**
17 | * Apply a mutation to this object.
18 | *
19 | * @param mutator the mutation to apply
20 | * @return this object
21 | */
22 | @SuppressWarnings("unchecked")
23 | @Nonnull
24 | default B applyMutation(@Nonnull Consumer super B> mutator) {
25 | Objects.requireNonNull(mutator, "mutator must not be null").accept((B) this);
26 | return (B) this;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunctionTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.json.JsonData;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class DecayFunctionTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | DecayFunction origin = new DecayFunction.Builder().field("field")
19 | .placement(new DecayPlacement.Builder().scale(JsonData.of("{}")).build())
20 | .build();
21 | DecayFunction copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanFirstQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanFirstQuery origin = new SpanFirstQuery.Builder().end(1)
19 | .match(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build())
20 | .build();
21 | SpanFirstQuery copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSourceTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.aggregations;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class CompositeDateHistogramAggregationSourceTest extends ModelTestCase {
15 |
16 | @Test
17 | public void testSerializeSpecificFields() {
18 | String json = "{\"calendar_interval\":\"1d\",\"fixed_interval\":\"1d\",\"offset\":1,\"time_zone\":\"+01:00\"}";
19 | CompositeDateHistogramAggregationSource aggregation = fromJson(json, CompositeDateHistogramAggregationSource._DESERIALIZER);
20 | assertEquals(json, toJson(aggregation));
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class QueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | Query origin = Query.of(
19 | query -> query.bool(
20 | builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1)))))
21 | )
22 | );
23 | Query copied = origin.toBuilder().build();
24 |
25 | assertEquals(toJson(copied), toJson(origin));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ObjectSetBuilderBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Function;
13 | import javax.annotation.Nonnull;
14 |
15 | public abstract class ObjectSetBuilderBase, Builder extends ObjectSetBuilderBase>
16 | extends SetBuilderBase {
17 | protected ObjectSetBuilderBase() {}
18 |
19 | protected abstract @Nonnull VBuilder valueBuilder();
20 |
21 | public final @Nonnull Builder with(@Nonnull Function> fn) {
22 | return with(Objects.requireNonNull(fn, "fn must not be null").apply(valueBuilder()).build());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch._types.FieldValue;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class TermsQueryTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | TermsQuery origin = new TermsQuery.Builder().field("field")
20 | .terms(new TermsQueryField.Builder().value(Collections.singletonList(FieldValue.of("1"))).build())
21 | .build();
22 | TermsQuery copied = origin.toBuilder().build();
23 |
24 | assertEquals(toJson(copied), toJson(origin));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ObjectListBuilderBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Function;
13 | import javax.annotation.Nonnull;
14 |
15 | public abstract class ObjectListBuilderBase<
16 | V,
17 | VBuilder extends ObjectBuilder,
18 | Builder extends ObjectListBuilderBase> extends ListBuilderBase {
19 | protected ObjectListBuilderBase() {}
20 |
21 | protected abstract @Nonnull VBuilder valueBuilder();
22 |
23 | public final @Nonnull Builder with(@Nonnull Function> fn) {
24 | return with(Objects.requireNonNull(fn, "fn must not be null").apply(valueBuilder()).build());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanFieldMaskingQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanFieldMaskingQuery origin = new SpanFieldMaskingQuery.Builder().field("field")
19 | .query(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build())
20 | .build();
21 | SpanFieldMaskingQuery copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanOrQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanOrQuery origin = new SpanOrQuery.Builder().clauses(
19 | Collections.singletonList(
20 | new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()
21 | )
22 | ).build();
23 | SpanOrQuery copied = origin.toBuilder().build();
24 |
25 | assertEquals(toJson(copied), toJson(origin));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.InlineScript;
13 | import org.opensearch.client.opensearch._types.Script;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class ScriptQueryTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | ScriptQuery origin = new ScriptQuery.Builder().script(
20 | new Script.Builder().inline(new InlineScript.Builder().source("source").build()).build()
21 | ).build();
22 | ScriptQuery copied = origin.toBuilder().build();
23 |
24 | assertEquals(toJson(copied), toJson(origin));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanNearQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanNearQuery origin = new SpanNearQuery.Builder().clauses(
19 | Collections.singletonList(
20 | new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()
21 | )
22 | ).build();
23 | SpanNearQuery copied = origin.toBuilder().build();
24 |
25 | assertEquals(toJson(copied), toJson(origin));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-client/src/main/java/org/opensearch/client/util/CopyableBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.util;
10 |
11 | import javax.annotation.Nonnull;
12 |
13 | public interface CopyableBuilder, T extends ToCopyableBuilder> extends MutableBuilder {
14 | /**
15 | * Create a new builder {@link B} that is a copy of this one.
16 | *
17 | * @return a new builder instance.
18 | *
19 | * @implNote The default implementation of this method calls {@link #build()} and then {@link T#toBuilder()}.
20 | * Implementations can override this method to provide a more efficient implementation or to handle copying
21 | * partial state.
22 | */
23 | @Nonnull
24 | default B copy() {
25 | return build().toBuilder();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/ObjectMapBuilderBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Function;
13 | import javax.annotation.Nonnull;
14 |
15 | public abstract class ObjectMapBuilderBase<
16 | K,
17 | V,
18 | VBuilder extends ObjectBuilder,
19 | Builder extends ObjectMapBuilderBase> extends MapBuilderBase {
20 | protected ObjectMapBuilderBase() {}
21 |
22 | protected abstract @Nonnull VBuilder valueBuilder();
23 |
24 | public final @Nonnull Builder with(@Nonnull K key, @Nonnull Function> fn) {
25 | return with(key, Objects.requireNonNull(fn, "fn must not be null").apply(valueBuilder()).build());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/DelegatedShape.mustache:
--------------------------------------------------------------------------------
1 | {{>Partials/ClassDeclaration}} {
2 | {{>ObjectShape/Fields}}
3 |
4 | // ---------------------------------------------------------------------------------------------
5 |
6 | {{>ObjectShape/Constructor}}
7 |
8 | {{>ObjectShape/Getters}}
9 |
10 | /**
11 | * Serialize this value to JSON.
12 | */
13 | @Override
14 | public void serialize({{TYPES.Jakarta.Json.Stream.JsonGenerator}} generator, {{TYPES.Client.Json.JsonpMapper}} mapper) {
15 | {{#delegatedType.serializer}}this.valueBody{{/delegatedType.serializer}}
16 | }
17 |
18 | // ---------------------------------------------------------------------------------------------
19 |
20 | {{>ObjectShape/ToBuilder}}
21 |
22 | {{>ObjectShape/Builder}}
23 |
24 | // ---------------------------------------------------------------------------------------------
25 |
26 | {{>DelegatedShape/Deserialize}}
27 |
28 | {{>ObjectShape/HashCode}}
29 |
30 | {{>ObjectShape/Equals}}
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch._types.GeoLocation;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class GeoDistanceQueryTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | GeoDistanceQuery origin = new GeoDistanceQuery.Builder().field("field")
20 | .location(new GeoLocation.Builder().coords(Collections.singletonList(1.0)).build())
21 | .distance("1km")
22 | .build();
23 | GeoDistanceQuery copied = origin.toBuilder().build();
24 |
25 | assertEquals(toJson(copied), toJson(origin));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractKnnIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class KnnIT extends AbstractKnnIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunctionTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.InlineScript;
13 | import org.opensearch.client.opensearch._types.Script;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class ScriptScoreFunctionTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | ScriptScoreFunction origin = new ScriptScoreFunction.Builder().script(
20 | new Script.Builder().inline(new InlineScript.Builder().source("source").build()).build()
21 | ).build();
22 | ScriptScoreFunction copied = origin.toBuilder().build();
23 |
24 | assertEquals(toJson(copied), toJson(origin));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractCrudIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class CrudIT extends AbstractCrudIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractNodesIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class NodesIT extends AbstractNodesIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch.model.ModelTestCase;
13 |
14 | public class IntervalsQueryTest extends ModelTestCase {
15 | @Test
16 | public void toBuilder() {
17 | IntervalsQuery origin = new IntervalsQuery.Builder().field("field")
18 | .allOf(
19 | new IntervalsAllOf.Builder().intervals(
20 | new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build()
21 | ).build()
22 | )
23 | .build();
24 | IntervalsQuery copied = origin.toBuilder().build();
25 |
26 | assertEquals(toJson(copied), toJson(origin));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanNotQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanNotQuery origin = new SpanNotQuery.Builder().include(
19 | new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()
20 | ).exclude(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()).build();
21 | SpanNotQuery copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/JavaClassKind.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import java.util.Map;
12 | import javax.annotation.Nonnull;
13 |
14 | public enum JavaClassKind {
15 | Class,
16 | Enum,
17 | Interface;
18 |
19 | private static final Map VALUES = Maps.createLookupOf(values(), JavaClassKind::toString);
20 |
21 | @Nonnull
22 | public static JavaClassKind from(@Nonnull String kind) {
23 | var value = VALUES.get(Strings.requireNonBlank(kind, "kind must not be blank"));
24 | if (value == null) {
25 | throw new IllegalArgumentException("Unknown kind: " + kind);
26 | }
27 | return value;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return name().toLowerCase();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CatIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractCatClientIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class CatIT extends AbstractCatClientIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateObjectCollector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.renderer;
10 |
11 | import com.samskivert.mustache.DefaultCollector;
12 | import com.samskivert.mustache.Mustache;
13 | import java.util.Optional;
14 |
15 | public class TemplateObjectCollector extends DefaultCollector {
16 | @Override
17 | public Mustache.VariableFetcher createFetcher(Object ctx, String name) {
18 | var fetcher = super.createFetcher(ctx, name);
19 | if (fetcher == null) {
20 | return null;
21 | }
22 | return (ctx1, name1) -> {
23 | var value = fetcher.get(ctx1, name1);
24 | if (value instanceof Optional) {
25 | return ((Optional>) value).orElse(null);
26 | }
27 | return value;
28 | };
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanWithinQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanWithinQuery origin = new SpanWithinQuery.Builder().big(
19 | new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()
20 | ).little(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()).build();
21 | SpanWithinQuery copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/samples/src/main/java/org/opensearch/client/samples/util/IndexData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.samples.util;
10 |
11 | public class IndexData {
12 | private String title;
13 | private String text;
14 |
15 | public IndexData() {}
16 |
17 | public IndexData(String title, String text) {
18 | this.title = title;
19 | this.text = text;
20 | }
21 |
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | public void setTitle(String title) {
27 | this.title = title;
28 | }
29 |
30 | public String getText() {
31 | return text;
32 | }
33 |
34 | public void setText(String text) {
35 | this.text = text;
36 | }
37 |
38 | @Override
39 | public String toString() {
40 | return String.format("IndexData{title='%s', text='%s'}", title, text);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractHighlightIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class HighlightIT extends AbstractHighlightIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractPingAndInfoIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class PingAndInfoIT extends AbstractPingAndInfoIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/TasksClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractTasksClientIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class TasksClientIT extends AbstractTasksClientIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import java.util.Collections;
12 | import org.junit.Test;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class SpanContainingQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | SpanContainingQuery origin = new SpanContainingQuery.Builder().big(
19 | new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()
20 | ).little(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(Collections.emptyList()).build()).build()).build();
21 | SpanContainingQuery copied = origin.toBuilder().build();
22 |
23 | assertEquals(toJson(copied), toJson(origin));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractClusterClientIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class ClusterClientIT extends AbstractClusterClientIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/GenericClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractGenericClientIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class GenericClientIT extends AbstractGenericClientIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractIndicesClientIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class IndicesClientIT extends AbstractIndicesClientIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractSearchRequestIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class SearchRequestIT extends AbstractSearchRequestIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/In.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.openapi;
10 |
11 | import java.util.Map;
12 | import javax.annotation.Nonnull;
13 | import org.opensearch.client.codegen.utils.Maps;
14 | import org.opensearch.client.codegen.utils.Strings;
15 |
16 | public enum In {
17 | Query,
18 | Path;
19 |
20 | private static final Map VALUES = Maps.createLookupOf(values(), In::toString);
21 |
22 | @Nonnull
23 | public static In from(@Nonnull String in) {
24 | var value = VALUES.get(Strings.requireNonBlank(in, "in must not be blank"));
25 | if (value == null) {
26 | throw new IllegalArgumentException("Unknown in: " + in);
27 | }
28 | return value;
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return name().toLowerCase();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/core/BulkRequestTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.core;
10 |
11 | import java.util.Collections;
12 | import org.junit.Assert;
13 | import org.junit.Test;
14 | import org.opensearch.client.opensearch.core.bulk.BulkOperation;
15 | import org.opensearch.client.opensearch.core.bulk.DeleteOperation;
16 |
17 | public class BulkRequestTest extends Assert {
18 |
19 | @Test
20 | public void toBuilder() {
21 | BulkRequest origin = new BulkRequest.Builder().index("index")
22 | .operations(
23 | Collections.singletonList(new BulkOperation.Builder().delete(new DeleteOperation.Builder().id("id").build()).build())
24 | )
25 | .build();
26 | BulkRequest copied = origin.toBuilder().build();
27 |
28 | assertEquals(copied.index(), origin.index());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractAsyncStracktraceIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest;
10 |
11 | import org.apache.logging.log4j.core.util.Throwables;
12 | import org.junit.Test;
13 |
14 | public abstract class AbstractAsyncStracktraceIT extends OpenSearchJavaClientTestCase {
15 | @Test
16 | public void testFailureFromClientPreservesStacktraceOfCaller() throws Exception {
17 | var thrown = assertThrows(Exception.class, () -> javaClient().indices().get(g -> g.index("nonexisting-index")));
18 |
19 | var stacktraceElements = Throwables.toStringList(thrown);
20 | var someElementContainsCallerMethodName = stacktraceElements.stream()
21 | .anyMatch(it -> it.contains("testFailureFromClientPreservesStacktraceOfCaller"));
22 |
23 | assertTrue(someElementContainsCallerMethodName);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateFragmentUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.renderer;
10 |
11 | import com.samskivert.mustache.Template;
12 | import java.util.Optional;
13 |
14 | public final class TemplateFragmentUtils {
15 | private TemplateFragmentUtils() {}
16 |
17 | @SuppressWarnings("unchecked")
18 | public static Optional findParentContext(Template.Fragment fragment, Class clazz) {
19 | var i = 0;
20 | while (true) {
21 | Object ctx;
22 |
23 | try {
24 | ctx = fragment.context(i++);
25 | } catch (NullPointerException ignored) {
26 | return Optional.empty();
27 | }
28 |
29 | if (clazz.isAssignableFrom(ctx.getClass())) {
30 | return Optional.of((T) ctx);
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractAggregationRequestIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class AggregationRequestIT extends AbstractAggregationRequestIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractMultiSearchRequestIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class MultiSearchRequestIT extends AbstractMultiSearchRequestIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/test/java/org/opensearch/client/codegen/utils/StreamsTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import static org.junit.jupiter.api.Assertions.assertArrayEquals;
12 |
13 | import java.util.HashMap;
14 | import java.util.stream.Stream;
15 | import org.junit.jupiter.api.Test;
16 |
17 | public class StreamsTests {
18 | @Test
19 | public void sortedBy() {
20 | var stream = Stream.of("a", "b", "c", "d", "e");
21 | var ordering = new HashMap() {
22 | {
23 | put("c", 1);
24 | put("e", 2);
25 | put("a", 3);
26 | put("d", 4);
27 | put("b", 5);
28 | }
29 | };
30 | var output = Streams.sortedBy(stream, ordering::get).toArray(String[]::new);
31 | assertArrayEquals(new String[] { "c", "e", "a", "d", "b" }, output);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/samples/src/main/java/org/opensearch/client/samples/util/RandUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.samples.util;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class RandUtil {
15 | public static float rand2Sf() {
16 | return Math.round(Math.random() * 100.0) / 100.0f;
17 | }
18 |
19 | public static float[] rand2SfArray(int n) {
20 | var arr = new float[n];
21 | for (var i = 0; i < n; ++i) {
22 | arr[i] = rand2Sf();
23 | }
24 | return arr;
25 | }
26 |
27 | public static List rand2SfList(int n) {
28 | var arr = new ArrayList(n);
29 | for (var i = 0; i < n; ++i) {
30 | arr.add(rand2Sf());
31 | }
32 | return arr;
33 | }
34 |
35 | public static T choice(T[] arr) {
36 | return arr[(int) Math.floor(Math.random() * arr.length)];
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest.restclient;
10 |
11 | import java.io.IOException;
12 | import org.apache.hc.core5.http.HttpHost;
13 | import org.opensearch.client.json.jackson.JacksonJsonpMapper;
14 | import org.opensearch.client.opensearch.integTest.AbstractSearchTemplateRequestIT;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.client.transport.rest_client.RestClientTransport;
17 | import org.opensearch.common.settings.Settings;
18 |
19 | public class SearchTemplateRequestIT extends AbstractSearchTemplateRequestIT {
20 | @Override
21 | public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException {
22 | return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.model;
10 |
11 | import java.util.Objects;
12 | import java.util.Optional;
13 | import javax.annotation.Nonnull;
14 | import javax.annotation.Nullable;
15 | import org.semver4j.Semver;
16 |
17 | public class Deprecation {
18 | @Nullable
19 | private final String description;
20 | @Nonnull
21 | private final Semver version;
22 |
23 | public Deprecation(@Nullable String description, @Nonnull Semver version) {
24 | this.description = description;
25 | this.version = Objects.requireNonNull(version, "version must not be null");
26 | }
27 |
28 | @Nonnull
29 | public Optional getDescription() {
30 | return Optional.ofNullable(description);
31 | }
32 |
33 | @Nonnull
34 | public Semver getVersion() {
35 | return version;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class BoolQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | BoolQuery origin = new BoolQuery.Builder().must(buildDummyQuery()).build();
19 | BoolQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 |
24 | private Query buildDummyQuery() {
25 | return Query.of(
26 | query -> query.bool(
27 | builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1)))))
28 | )
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocumentTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class LikeDocumentTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | LikeDocument origin = new LikeDocument.Builder().id("1").build();
19 | LikeDocument copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 |
24 | private Query buildDummyQuery() {
25 | return Query.of(
26 | query -> query.bool(
27 | builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1)))))
28 | )
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class DisMaxQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | DisMaxQuery origin = new DisMaxQuery.Builder().queries(buildDummyQuery()).build();
19 | DisMaxQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 |
24 | private Query buildDummyQuery() {
25 | return Query.of(
26 | query -> query.bool(
27 | builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1)))))
28 | )
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/EnumShape.mustache:
--------------------------------------------------------------------------------
1 | {{>Partials/ClassDeclaration}} {
2 | {{#variants}}
3 | {{^-first}}
4 |
5 | {{/-first}}
6 | {{#description}}
7 | /**
8 | * {{.}}
9 | */
10 | {{/description}}
11 | {{#deprecated}}
12 | @Deprecated
13 | {{/deprecated}}
14 | {{name}}({{#quoted}}{{wireName}}{{/quoted}}{{#aliases}}, {{#quoted}}{{.}}{{/quoted}}{{/aliases}}){{#-last}};{{/-last}}{{^-last}},{{/-last}}
15 | {{/variants}}
16 |
17 | private final String jsonValue;
18 | {{#anyHasAliases}}
19 | private final String[] aliases;
20 | {{/anyHasAliases}}
21 |
22 | {{className}}(String jsonValue{{#anyHasAliases}}, String... aliases{{/anyHasAliases}}) {
23 | this.jsonValue = jsonValue;
24 | {{#anyHasAliases}}
25 | this.aliases = aliases;
26 | {{/anyHasAliases}}
27 | }
28 |
29 | public String jsonValue() { return this.jsonValue; }
30 | {{#anyHasAliases}}
31 |
32 | public String[] aliases() {
33 | return this.aliases;
34 | }
35 | {{/anyHasAliases}}
36 |
37 | public static final JsonEnum.Deserializer<{{className}}> _DESERIALIZER = new JsonEnum.Deserializer<>({{className}}.values());
38 | }
--------------------------------------------------------------------------------
/samples/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | plugins {
10 | java
11 | application
12 |
13 | id("opensearch-java.spotless-conventions")
14 | }
15 |
16 | java {
17 | targetCompatibility = JavaVersion.VERSION_11
18 | sourceCompatibility = JavaVersion.VERSION_11
19 | }
20 |
21 | dependencies {
22 | implementation(project(":java-client"))
23 | implementation("org.apache.logging.log4j", "log4j-api","[2.17.1,3.0)")
24 | implementation("org.apache.logging.log4j", "log4j-core","[2.17.1,3.0)")
25 | implementation("org.apache.logging.log4j", "log4j-slf4j2-impl","[2.17.1,3.0)")
26 | implementation("commons-logging", "commons-logging", "1.2")
27 | implementation("com.fasterxml.jackson.core", "jackson-databind", "2.15.2")
28 | }
29 |
30 | application {
31 | mainClass.set("org.opensearch.client.samples.Main")
32 | }
33 |
34 | tasks.named("run") {
35 | systemProperty("samples.mainClass", System.getProperty("samples.mainClass"))
36 | }
37 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.CoordsGeoBounds;
13 | import org.opensearch.client.opensearch._types.GeoBounds;
14 | import org.opensearch.client.opensearch.model.ModelTestCase;
15 |
16 | public class GeoBoundingBoxQueryTest extends ModelTestCase {
17 | @Test
18 | public void toBuilder() {
19 | GeoBoundingBoxQuery origin = new GeoBoundingBoxQuery.Builder().field("field")
20 | .boundingBox(
21 | new GeoBounds.Builder().coords(new CoordsGeoBounds.Builder().top(1.0f).bottom(1.0f).left(1.0f).right(1.0f).build()).build()
22 | )
23 | .build();
24 | GeoBoundingBoxQuery copied = origin.toBuilder().build();
25 |
26 | assertEquals(toJson(copied), toJson(origin));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQueryTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch._types.query_dsl;
10 |
11 | import org.junit.Test;
12 | import org.opensearch.client.opensearch._types.FieldValue;
13 | import org.opensearch.client.opensearch.model.ModelTestCase;
14 |
15 | public class NestedQueryTest extends ModelTestCase {
16 | @Test
17 | public void toBuilder() {
18 | NestedQuery origin = new NestedQuery.Builder().query(buildDummyQuery()).path("path").build();
19 | NestedQuery copied = origin.toBuilder().build();
20 |
21 | assertEquals(toJson(copied), toJson(origin));
22 | }
23 |
24 | private Query buildDummyQuery() {
25 | return Query.of(
26 | query -> query.bool(
27 | builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1)))))
28 | )
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.opensearch.integTest;
10 |
11 | import java.io.IOException;
12 | import java.util.Optional;
13 | import org.apache.hc.core5.http.HttpHost;
14 | import org.opensearch.client.opensearch.OpenSearchClient;
15 | import org.opensearch.client.transport.OpenSearchTransport;
16 | import org.opensearch.common.settings.Settings;
17 |
18 | public interface OpenSearchTransportSupport {
19 | default boolean isHttps() {
20 | return Optional.ofNullable(System.getProperty("https")).map("true"::equalsIgnoreCase).orElse(false);
21 | }
22 |
23 | default OpenSearchClient buildJavaClient(Settings settings, HttpHost[] hosts) throws IOException {
24 | return new OpenSearchClient(buildTransport(settings, hosts));
25 | }
26 |
27 | OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException;
28 | }
29 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Streams.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils;
10 |
11 | import java.util.Objects;
12 | import java.util.function.Function;
13 | import java.util.stream.Stream;
14 | import javax.annotation.Nonnull;
15 |
16 | public final class Streams {
17 | private Streams() {}
18 |
19 | @Nonnull
20 | public static > Stream sortedBy(@Nonnull Stream stream, @Nonnull Function keyExtractor) {
21 | Objects.requireNonNull(stream, "stream must not be null");
22 | Objects.requireNonNull(keyExtractor, "keyExtractor must not be null");
23 | return stream.sorted((a, b) -> {
24 | var ka = keyExtractor.apply(a);
25 | var kb = keyExtractor.apply(b);
26 | if (ka == null) return kb == null ? 0 : -1;
27 | if (kb == null) return 1;
28 | return ka.compareTo(kb);
29 | });
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/java-codegen/src/main/java/org/opensearch/client/codegen/utils/builder/MapBuilderBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-License-Identifier: Apache-2.0
3 | *
4 | * The OpenSearch Contributors require contributions made to
5 | * this file be licensed under the Apache-2.0 license or a
6 | * compatible open source license.
7 | */
8 |
9 | package org.opensearch.client.codegen.utils.builder;
10 |
11 | import java.util.Map;
12 | import javax.annotation.Nonnull;
13 | import javax.annotation.Nullable;
14 |
15 | public abstract class MapBuilderBase> extends ObjectBuilderBase