From 0bc6609d1b5fffd33773c4bf6a6490377bbf63e9 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 9 Aug 2024 10:20:41 +1200 Subject: [PATCH 01/37] Update changelog with 2.13.0 entry (#1133) Signed-off-by: Thomas Farr --- CHANGELOG.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 402c2bc617..dae19dce74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,18 +36,26 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Dependencies ### Changed -- Changed URL path encoding to own implementation adapted from Apache HTTP Client 5's ([#1109](https://github.com/opensearch-project/opensearch-java/pull/1109)) ### Deprecated ### Removed ### Fixed -- Fixed error when deserializing a normalizer without 'type' ([#1111](https://github.com/opensearch-project/opensearch-java/pull/1111)) -- Fixed deserialization of SearchRequest when `_source` is an array ([#1117](https://github.com/opensearch-project/opensearch-java/pull/1117)) ### Security +## [2.13.0] - 08/01/2024 +### Added +- Added `searchAfterVals` to `SearchRequest` to allow passing arbitrary `FieldValue`s to `search_after` ([#1105](https://github.com/opensearch-project/opensearch-java/pull/1105)) + +### Changed +- Changed URL path encoding to own implementation adapted from Apache HTTP Client 5's ([#1109](https://github.com/opensearch-project/opensearch-java/pull/1109)) + +### Fixed +- Fixed error when deserializing a normalizer without 'type' ([#1111](https://github.com/opensearch-project/opensearch-java/pull/1111)) +- Fixed deserialization of SearchRequest when `_source` is an array ([#1117](https://github.com/opensearch-project/opensearch-java/pull/1117)) + ## [2.12.0] - 07/22/2024 ### Added - Added support for the `parent` aggregation type ([#706](https://github.com/opensearch-project/opensearch-java/pull/706)) From 7b3094e4efbf54c867ef5b114ae160f35d878338 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 07:07:33 -0400 Subject: [PATCH 02/37] Bump org.hamcrest:hamcrest from 2.2 to 3.0 in /java-client (#1135) * Bump org.hamcrest:hamcrest from 2.2 to 3.0 in /java-client Bumps [org.hamcrest:hamcrest](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0. - [Release notes](https://github.com/hamcrest/JavaHamcrest/releases) - [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md) - [Commits](https://github.com/hamcrest/JavaHamcrest/compare/v2.2...v3.0) --- updated-dependencies: - dependency-name: org.hamcrest:hamcrest dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dae19dce74..e1621dfe13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.junit:junit-bom` from 5.10.2 to 5.10.3 - Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 +- Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 2f3144bd73..41b08fd8d1 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -179,7 +179,7 @@ dependencies { // Apache 2.0 api("commons-logging:commons-logging:1.3.3") compileOnly("org.opensearch.client", "opensearch-rest-client", opensearchVersion) - testImplementation("org.hamcrest:hamcrest:2.2") + testImplementation("org.hamcrest:hamcrest:3.0") testImplementation("com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.1") { exclude(group = "junit") } From 814ff4b07fc42ba6c20c401a676086e929ad81a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 07:07:51 -0400 Subject: [PATCH 03/37] Bump org.hamcrest:hamcrest from 2.2 to 3.0 (#1134) * Bump org.hamcrest:hamcrest from 2.2 to 3.0 Bumps [org.hamcrest:hamcrest](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0. - [Release notes](https://github.com/hamcrest/JavaHamcrest/releases) - [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md) - [Commits](https://github.com/hamcrest/JavaHamcrest/compare/v2.2...v3.0) --- updated-dependencies: - dependency-name: org.hamcrest:hamcrest dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] From 94171f8186ba3329080191e2dc60da1844d0d7fa Mon Sep 17 00:00:00 2001 From: Dan Cristian Cecoi Date: Mon, 12 Aug 2024 21:57:42 +0100 Subject: [PATCH 04/37] Removed null constraints on NodeInfo fields that are returned null from Amazon OpenSearch Service (#1132) * Removed the null constraints on NodeInfo.host, NodeInfo.Ip, NodeInfo.TransportAddress Signed-off-by: Dan Cecoi * Added a CHANGELOG entry, made the getters nullable and removed extra white space Signed-off-by: Dan Cecoi * modified the PR link in the changelog Signed-off-by: Dan Cecoi --------- Signed-off-by: Dan Cecoi Co-authored-by: Dan Cecoi --- CHANGELOG.md | 1 + .../opensearch/nodes/info/NodeInfo.java | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1621dfe13..913bfa0d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed ### Fixed +- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1132](https://github.com/opensearch-project/opensearch-java/pull/1132)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java index 94df6b761c..4b97120434 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java @@ -60,11 +60,13 @@ public class NodeInfo implements PlainJsonSerializable { private final String buildType; + @Nullable private final String host; @Nullable private final NodeInfoHttp http; + @Nullable private final String ip; @Nullable @@ -99,6 +101,7 @@ public class NodeInfo implements PlainJsonSerializable { @Nullable private final NodeInfoTransport transport; + @Nullable private final String transportAddress; private final String version; @@ -117,9 +120,9 @@ private NodeInfo(Builder builder) { this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host"); + this.host = builder.host; this.http = builder.http; - this.ip = ApiTypeHelper.requireNonNull(builder.ip, this, "ip"); + this.ip = builder.ip; this.jvm = builder.jvm; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.network = builder.network; @@ -132,7 +135,7 @@ private NodeInfo(Builder builder) { this.totalIndexingBuffer = builder.totalIndexingBuffer; this.totalIndexingBufferInBytes = builder.totalIndexingBufferInBytes; this.transport = builder.transport; - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); + this.transportAddress = builder.transportAddress; this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); this.modules = ApiTypeHelper.unmodifiable(builder.modules); this.ingest = builder.ingest; @@ -173,6 +176,7 @@ public final String buildType() { *

* API name: {@code host} */ + @Nullable public final String host() { return this.host; } @@ -190,6 +194,7 @@ public final NodeInfoHttp http() { *

* API name: {@code ip} */ + @Nullable public final String ip() { return this.ip; } @@ -299,6 +304,7 @@ public final NodeInfoTransport transport() { *

* API name: {@code transport_address} */ + @Nullable public final String transportAddress() { return this.transportAddress; } @@ -496,11 +502,13 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code host} */ - public final Builder host(String value) { + public final Builder host(@Nullable String value) { this.host = value; return this; } @@ -618,7 +627,7 @@ public final Builder http(Function * API name: {@code ip} */ - public final Builder ip(String value) { + public final Builder ip(@Nullable String value) { this.ip = value; return this; } @@ -828,7 +837,7 @@ public final Builder transport(Function * API name: {@code transport_address} */ - public final Builder transportAddress(String value) { + public final Builder transportAddress(@Nullable String value) { this.transportAddress = value; return this; } From 7b3719bb05db586b02881d96203278c8dcce05c0 Mon Sep 17 00:00:00 2001 From: Uriel Dan Nudelman Date: Wed, 14 Aug 2024 21:10:36 -0400 Subject: [PATCH 05/37] Fixes #1137 - Adding query_image to Neural query (#1138) * Fixes #1137 Signed-off-by: uri.nudelman * Adds missing documentation. Added changelog Signed-off-by: uri.nudelman * Added deserialization test Signed-off-by: uri.nudelman --------- Signed-off-by: uri.nudelman Co-authored-by: uri.nudelman --- CHANGELOG.md | 1 + .../_types/query_dsl/NeuralQuery.java | 48 +++++++++++++++-- .../MissingRequiredPropertiesException.java | 53 +++++++++++++++++++ .../_types/query_dsl/NeuralQueryTest.java | 36 ++++++++++++- .../client/opensearch/model/VariantsTest.java | 5 ++ 5 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 java-client/src/main/java/org/opensearch/client/util/MissingRequiredPropertiesException.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 913bfa0d9c..98b1ce4fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ## [Unreleased 2.x] ### Added +- Adds `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) ### Dependencies diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java index 2bf6d0baef..baadf3e849 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java @@ -17,6 +17,7 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.MissingRequiredPropertiesException; import org.opensearch.client.util.ObjectBuilder; @JsonpDeserializable @@ -24,6 +25,7 @@ public class NeuralQuery extends QueryBase implements QueryVariant { private final String field; private final String queryText; + private final String queryImage; private final int k; @Nullable private final String modelId; @@ -34,7 +36,11 @@ private NeuralQuery(NeuralQuery.Builder builder) { super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.queryText = ApiTypeHelper.requireNonNull(builder.queryText, this, "queryText"); + if (builder.queryText == null && builder.queryImage == null && !ApiTypeHelper.requiredPropertiesCheckDisabled()) { + throw new MissingRequiredPropertiesException(this, "queryText", "queryImage"); + } + this.queryText = builder.queryText; + this.queryImage = builder.queryImage; this.k = ApiTypeHelper.requireNonNull(builder.k, this, "k"); this.modelId = builder.modelId; this.filter = builder.filter; @@ -64,7 +70,8 @@ public final String field() { } /** - * Required - Search query text. + * Required - The query_text if query_image is not set. + * Optional - The query_text if query_image is set. * * @return Search query text. */ @@ -72,6 +79,16 @@ public final String queryText() { return this.queryText; } + /** + * Required - The query_image if query_text is not set. + * Optional - The query_image if query_text is set. + * + * @return Search query image. + */ + public final String queryImage() { + return this.queryImage; + } + /** * Required - The number of neighbors to return. * @@ -112,7 +129,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - generator.write("query_text", this.queryText); + if (this.queryText != null) { + generator.write("query_text", this.queryText); + } + + if (this.queryImage != null) { + generator.write("query_image", this.queryImage); + } if (this.modelId != null) { generator.write("model_id", this.modelId); @@ -129,7 +152,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).queryText(queryText).k(k).modelId(modelId).filter(filter); + return new Builder().field(field).queryText(queryText).queryImage(queryImage).k(k).modelId(modelId).filter(filter); } /** @@ -138,6 +161,7 @@ public Builder toBuilder() { public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { private String field; private String queryText; + private String queryImage; private Integer k; @Nullable private String modelId; @@ -156,7 +180,8 @@ public NeuralQuery.Builder field(@Nullable String field) { } /** - * Required - Search query text. + * Required - The query_text if query_image is not set. + * Optional - The query_text if query_image is set. * * @param queryText Search query text. * @return This builder. @@ -166,6 +191,18 @@ public NeuralQuery.Builder queryText(@Nullable String queryText) { return this; } + /** + * Required - The query_image if query_text is not set. + * Optional - The query_image if query_text is set. + * + * @param queryImage Search query image. + * @return This builder. + */ + public NeuralQuery.Builder queryImage(@Nullable String queryImage) { + this.queryImage = queryImage; + return this; + } + /** * Optional - The model_id field if the default model for the index or field is set. * Required - The model_id field if there is no default model set for the index or field. @@ -227,6 +264,7 @@ protected static void setupNeuralQueryDeserializer(ObjectDeserializer + * If you think this is an error and that the reported property is actually optional, a workaround is + * available in {@link ApiTypeHelper} to disable checks. Use with caution. + */ +public class MissingRequiredPropertiesException extends RuntimeException { + private Class clazz; + private String[] properties; + + public MissingRequiredPropertiesException(Object obj, String... properties) { + super( + "Missing at least one required property between " + + buildPropertiesMsg(properties) + + " in '" + + obj.getClass().getSimpleName() + + "'" + ); + this.clazz = obj.getClass(); + this.properties = properties; + } + + /** + * The class where the missing property was found + */ + public Class getObjectClass() { + return clazz; + } + + public String[] getPropertiesName() { + return properties; + } + + private static String buildPropertiesMsg(String[] properties) { + final StringJoiner sj = new StringJoiner(",", "'", "'"); + for (final String property : properties) { + sj.add(property); + } + return sj.toString(); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java index 7bc16e6fd6..76f0d59a74 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java @@ -10,10 +10,11 @@ import org.junit.Test; import org.opensearch.client.opensearch.model.ModelTestCase; +import org.opensearch.client.util.MissingRequiredPropertiesException; public class NeuralQueryTest extends ModelTestCase { @Test - public void toBuilder() { + public void toBuilder_queryText() { NeuralQuery origin = new NeuralQuery.Builder().field("field") .queryText("queryText") .k(1) @@ -23,4 +24,37 @@ public void toBuilder() { assertEquals(toJson(copied), toJson(origin)); } + + @Test + public void toBuilder_queryImage() { + NeuralQuery origin = new NeuralQuery.Builder().field("field") + .queryImage("queryImage") + .k(1) + .filter(IdsQuery.of(builder -> builder.values("Some_ID")).toQuery()) + .build(); + NeuralQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + @Test + public void toBuilder_both() { + NeuralQuery origin = new NeuralQuery.Builder().field("field") + .queryText("queryText") + .queryImage("queryImage") + .k(1) + .filter(IdsQuery.of(builder -> builder.values("Some_ID")).toQuery()) + .build(); + NeuralQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + @Test + public void toBuilder_missing_query() { + assertThrows( + MissingRequiredPropertiesException.class, + () -> new NeuralQuery.Builder().field("field").k(1).filter(IdsQuery.of(builder -> builder.values("Some_ID")).toQuery()).build() + ); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/VariantsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/VariantsTest.java index addb6af775..f647ae56f0 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/VariantsTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/VariantsTest.java @@ -234,6 +234,7 @@ public void testNeuralQueryFromJson() { + " \"neural\": {\n" + " \"passage_embedding\": {\n" + " \"query_text\": \"Hi world!\",\n" + + " \"query_image\": \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+L+U4T8ABu8CpCYJ1DQAAAAASUVORK5CYII=\",\n" + " \"model_id\": \"bQ1J8ooBpBj3wT4HVUsb\",\n" + " \"k\": 100\n" + " }\n" @@ -245,6 +246,10 @@ public void testNeuralQueryFromJson() { assertEquals("passage_embedding", searchRequest.query().neural().field()); assertEquals("Hi world!", searchRequest.query().neural().queryText()); + assertEquals( + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+L+U4T8ABu8CpCYJ1DQAAAAASUVORK5CYII=", + searchRequest.query().neural().queryImage() + ); assertEquals("bQ1J8ooBpBj3wT4HVUsb", searchRequest.query().neural().modelId()); assertEquals(100, searchRequest.query().neural().k()); } From 7d894d65d0dd162461865012fb90405468134b2e Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Thu, 15 Aug 2024 13:33:48 -0400 Subject: [PATCH 06/37] Update Gradle to 8.10 (#1140) * Update Gradle to 8.10 Signed-off-by: Andriy Redko * Address code review comments Signed-off-by: Andriy Redko --------- Signed-off-by: Andriy Redko --- .../workflows/test-integration-unreleased.yml | 20 +++++++++++++++--- gradle/wrapper/gradle-wrapper.jar | Bin 43504 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-integration-unreleased.yml b/.github/workflows/test-integration-unreleased.yml index 2c0d59a450..651231a894 100644 --- a/.github/workflows/test-integration-unreleased.yml +++ b/.github/workflows/test-integration-unreleased.yml @@ -16,10 +16,12 @@ jobs: matrix: entry: - { opensearch_ref: '1.x', java: 11 } - - { opensearch_ref: '2.x', java: 11 } + # See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version + - { opensearch_ref: '2.x', java: 11, gradle-runtime: 17 } - { opensearch_ref: '2.x', java: 17 } - { opensearch_ref: '2.x', java: 21 } - - { opensearch_ref: 'main', java: 11 } + # See please https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version + - { opensearch_ref: 'main', java: 11, gradle-runtime: 17 } - { opensearch_ref: 'main', java: 17 } - { opensearch_ref: 'main', java: 21 } steps: @@ -48,10 +50,22 @@ jobs: path: opensearch/distribution/archives/linux-tar/build/distributions key: ${{ steps.get-key.outputs.key }} + - name: Set up Gradle JDK runtime + if: matrix.entry.gradle-runtime + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.entry.gradle-runtime }} + distribution: temurin + + - name: Set JAVA${{ matrix.java }}_HOME + shell: bash + run: | + echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV + - name: Assemble OpenSearch if: steps.cache-restore.outputs.cache-hit != 'true' working-directory: opensearch - run: ./gradlew :distribution:archives:linux-tar:assemble + run: ./gradlew :distribution:archives:linux-tar:assemble -Druntime.java=${{ matrix.java }} - name: Save cached build if: steps.cache-restore.outputs.cache-hit != 'true' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c3521197d7c4586c843d1d3e9090525f1898cde..a4b76b9530d66f5e68d973ea569d8e19de379189 100644 GIT binary patch delta 3990 zcmV;H4{7l5(*nQL0Kr1kzC=_KMxQY0|W5(lc#i zH*M1^P4B}|{x<+fkObwl)u#`$GxKKV&3pg*-y6R6txw)0qU|Clf9Uds3x{_-**c=7 z&*)~RHPM>Rw#Hi1R({;bX|7?J@w}DMF>dQQU2}9yj%iLjJ*KD6IEB2^n#gK7M~}6R zkH+)bc--JU^pV~7W=3{E*4|ZFpDpBa7;wh4_%;?XM-5ZgZNnVJ=vm!%a2CdQb?oTa z70>8rTb~M$5Tp!Se+4_OKWOB1LF+7gv~$$fGC95ToUM(I>vrd$>9|@h=O?eARj0MH zT4zo(M>`LWoYvE>pXvqG=d96D-4?VySz~=tPVNyD$XMshoTX(1ZLB5OU!I2OI{kb) zS8$B8Qm>wLT6diNnyJZC?yp{Kn67S{TCOt-!OonOK7$K)e-13U9GlnQXPAb&SJ0#3 z+vs~+4Qovv(%i8g$I#FCpCG^C4DdyQw3phJ(f#y*pvNDQCRZ~MvW<}fUs~PL=4??j zmhPyg<*I4RbTz|NHFE-DC7lf2=}-sGkE5e!RM%3ohM7_I^IF=?O{m*uUPH(V?gqyc(Rp?-Qu(3bBIL4Fz(v?=_Sh?LbK{nqZMD>#9D_hNhaV$0ef3@9V90|0u#|PUNTO>$F=qRhg1duaE z0`v~X3G{8RVT@kOa-pU+z8{JWyP6GF*u2e8eKr7a2t1fuqQy)@d|Qn(%YLZ62TWtoX@$nL}9?atE#Yw`rd(>cr0gY;dT9~^oL;u)zgHUvxc2I*b&ZkGM-iq=&(?kyO(3}=P! zRp=rErEyMT5UE9GjPHZ#T<`cnD)jyIL!8P{H@IU#`e8cAG5jMK zVyKw7--dAC;?-qEu*rMr$5@y535qZ6p(R#+fLA_)G~!wnT~~)|s`}&fA(s6xXN`9j zP#Fd3GBa#HeS{5&8p?%DKUyN^X9cYUc6vq}D_3xJ&d@=6j(6BZKPl?!k1?!`f3z&a zR4ZF60Mx7oBxLSxGuzA*Dy5n-d2K=+)6VMZh_0KetK|{e;E{8NJJ!)=_E~1uu=A=r zrn&gh)h*SFhsQJo!f+wKMIE;-EOaMSMB@aXRU(UcnJhZW^B^mgs|M9@5WF@s6B0p& zm#CTz)yiQCgURE{%hjxHcJ6G&>G9i`7MyftL!QQd5 z@RflRs?7)99?X`kHNt>W3l7YqscBpi*R2+fsgABor>KVOu(i(`03aytf2UA!&SC9v z!E}whj#^9~=XHMinFZ;6UOJjo=mmNaWkv~nC=qH9$s-8roGeyaW-E~SzZ3Gg>j zZ8}<320rg4=$`M0nxN!w(PtHUjeeU?MvYgWKZ6kkzABK;vMN0|U;X9abJleJA(xy<}5h5P(5 z{RzAFPvMnX2m0yH0Jn2Uo-p`daE|(O`YQiC#jB8;6bVIUf?SY(k$#C0`d6qT`>Xe0+0}Oj0=F&*D;PVe=Z<=0AGI<6$gYLwa#r` zm449x*fU;_+J>Mz!wa;T-wldoBB%&OEMJgtm#oaI60TSYCy7;+$5?q!zi5K`u66Wq zvg)Fx$s`V3Em{=OEY{3lmh_7|08ykS&U9w!kp@Ctuzqe1JFOGz6%i5}Kmm9>^=gih z?kRxqLA<3@e=}G4R_?phW{4DVr?`tPfyZSN@R=^;P;?!2bh~F1I|fB7P=V=9a6XU5 z<#0f>RS0O&rhc&nTRFOW7&QhevP0#>j0eq<1@D5yAlgMl5n&O9X|Vq}%RX}iNyRFF z7sX&u#6?E~bm~N|z&YikXC=I0E*8Z$v7PtWfjy)$e_Ez25fnR1Q=q1`;U!~U>|&YS zaOS8y!^ORmr2L4ik!IYR8@Dcx8MTC=(b4P6iE5CnrbI~7j7DmM8em$!da&D!6Xu)!vKPdLG z9f#)se|6=5yOCe)N6xDhPI!m81*dNe7u985zi%IVfOfJh69+#ag4ELzGne?o`eA`42K4T)h3S+s)5IT97%O>du- z0U54L8m4}rkRQ?QBfJ%DLssy^+a7Ajw;0&`NOTY4o;0-ivm9 zBz1C%nr_hQ)X)^QM6T1?=yeLkuG9Lf50(eH}`tFye;01&(p?8i+6h};VV-2B~qdxeC#=X z(JLlzy&fHkyi9Ksbcs~&r^%lh^2COldLz^H@X!s~mr9Dr6z!j+4?zkD@Ls7F8(t(f z9`U?P$Lmn*Y{K}aR4N&1N=?xtQ1%jqf1~pJyQ4SgBrEtR`j4lQuh7cqP49Em5cO=I zB(He2`iPN5M=Y0}h(IU$37ANTGx&|b-u1BYA*#dE(L-lptoOpo&th~E)_)y-`6kSH z3vvyVrcBwW^_XYReJ=JYd9OBQrzv;f2AQdZH#$Y{Y+Oa33M70XFI((fs;mB4e`<<{ ze4dv2B0V_?Ytsi>>g%qs*}oDGd5d(RNZ*6?7qNbdp7wP4T72=F&r?Ud#kZr8Ze5tB z_oNb7{G+(o2ajL$!69FW@jjPQ2a5C)m!MKKRirC$_VYIuVQCpf9rIms0GRDf)8AH${I`q^~5rjot@#3$2#zT2f`(N^P7Z;6(@EK$q*Jgif00I6*^ZGV+XB5uw*1R-@23yTw&WKD{s1;HTL;dO)%5i#`dc6b7;5@^{KU%N|A-$zsYw4)7LA{3`Zp>1 z-?K9_IE&z)dayUM)wd8K^29m-l$lFhi$zj0l!u~4;VGR6Y!?MAfBC^?QD53hy6VdD z@eUZIui}~L%#SmajaRq1J|#> z4m=o$vZ*34=ZWK2!QMNEcp2Lbc5N1q!lEDq(bz0b;WI9;e>l=CG9^n#ro`w>_0F$Q zfZ={2QyTkfByC&gy;x!r*NyXXbk=a%~~(#K?< zTke0HuF5{Q+~?@!KDXR|g+43$+;ab`^flS%miup_0OUTm=nIc%d5nLP)i308PIjl_YMF6cpQ__6&$n6it8K- z8PIjl_YMF6cpQ_!r)L8IivW`WdK8mBs6PXdjR2DYdK8nCs73=4j{uVadK8oNjwX|E wpAeHLsTu^*Y>Trk?aBtSQ(D-o$(D8Px^?ZI-PUB? z*1fv!{YdHme3Fc8%cR@*@zc5A_nq&2=R47Hp@$-JF4Fz*;SLw5}K^y>s-s;V!}b2i=5=M- zComP?ju>8Fe@=H@rlwe1l`J*6BTTo`9b$zjQ@HxrAhp0D#u?M~TxGC_!?ccCHCjt| zF*PgJf@kJB`|Ml}cmsyrAjO#Kjr^E5p29w+#>$C`Q|54BoDv$fQ9D?3n32P9LPMIzu?LjNqggOH=1@T{9bMn*u8(GI z!;MLTtFPHal^S>VcJdiYqX0VU|Rn@A}C1xOlxCribxes0~+n2 z6qDaIA2$?e`opx3_KW!rAgbpzU)gFdjAKXh|5w``#F0R|c)Y)Du0_Ihhz^S?k^pk% zP>9|pIDx)xHH^_~+aA=^$M!<8K~Hy(71nJGf6`HnjtS=4X4=Hk^O71oNia2V{HUCC zoN3RSBS?mZCLw;l4W4a+D8qc)XJS`pUJ5X-f^1ytxwr`@si$lAE?{4G|o; zO0l>`rr?;~c;{ZEFJ!!3=7=FdGJ?Q^xfNQh4A?i;IJ4}B+A?4olTK(fN++3CRBP97 ze~lG9h%oegkn)lpW-4F8o2`*WW0mZHwHez`ko@>U1_;EC_6ig|Drn@=DMV9YEUSCa zIf$kHei3(u#zm9I!Jf(4t`Vm1lltJ&lVHy(eIXE8sy9sUpmz%I_gA#8x^Zv8%w?r2 z{GdkX1SkzRIr>prRK@rqn9j2wG|rUvf6PJbbin=yy-TAXrguvzN8jL$hUrIXzr^s5 zVM?H4;eM-QeRFr06@ifV(ocvk?_)~N@1c2ien56UjWXid6W%6ievIh)>dk|rIs##^kY67ib8Kw%#-oVFaXG7$ERyA9(NSJUvWiOA5H(!{uOpcW zg&-?iqPhds%3%tFspHDqqr;A!e@B#iPQjHd=c>N1LoOEGRehVoPOdxJ>b6>yc#o#+ zl8s8!(|NMeqjsy@0x{8^j0d00SqRZjp{Kj)&4UHYGxG+z9b-)72I*&J70?+8e?p_@ z=>-(>l6z5vYlP~<2%DU02b!mA{7mS)NS_eLe=t)sm&+Pmk?asOEKlkPQ)EUvvfC=;4M&*|I!w}(@V_)eUKLA_t^%`o z0PM9LV|UKTLnk|?M3u!|f2S0?UqZsEIH9*NJS-8lzu;A6-rr-ot=dg9SASoluZUkFH$7X; zP=?kYX!K?JL-b~<#7wU;b;eS)O;@?h%sPPk{4xEBxb{!sm0AY|f9cNvx6>$3F!*0c z75H=dy8JvTyO8}g1w{$9T$p~5en}AeSLoCF>_RT9YPMpChUjl310o*$QocjbH& zbnwg#gssR#jDVN{uEi3n(PZ%PFZ|6J2 z5_rBf0-u>e4sFe0*Km49ATi7>Kn0f9!uc|rRMR1Dtt6m1LW8^>qFlo}h$@br=Rmpi z;mI&>OF64Be{dVeHI8utrh)v^wsZ0jii%x8UgZ8TC%K~@I(4E};GFW&(;WVov}3%H zH;IhRkfD^(vt^DjZz(MyHLZxv8}qzPc(%itBkBwf_fC~sDBgh<3XAv5cxxfF3<2U! z03Xe&z`is!JDHbe;mNmfkH+_LFE*I2^mdL@7(@9DfAcP6O04V-ko;Rpgp<%Cj5r8Z zd0`sXoIjV$j)--;jA6Zy^D5&5v$o^>e%>Q?9GLm{i~p^lAn!%ZtF$I~>39XVZxk0b zROh^Bk9cE0AJBLozZIEmy7xG(yHWGztvfnr0(2ro1%>zsGMS^EMu+S$r=_;9 zWwZkgf7Q7`H9sLf2Go^Xy6&h~a&%s2_T@_Csf19MntF$aVFiFkvE3_hUg(B@&Xw@YJ zpL$wNYf78=0c@!QU6_a$>CPiXT7QAGDM}7Z(0z#_ZA=fmLUj{2z7@Ypo71UDy8GHr z-&TLKf6a5WCf@Adle3VglBt4>Z>;xF}}-S~B7<(%B;Y z0QR55{z-buw>8ilNM3u6I+D$S%?)(p>=eBx-HpvZj{7c*_?K=d()*7q?93us}1dq%FAFYLsW8ZTQ_XZLh`P2*6(NgS}qGcfGXVWpwsp#Rs}IuKbk*`2}&) zI^Vsk6S&Q4@oYS?dJ`NwMVBs6f57+RxdqVub#PvMu?$=^OJy5xEl0<5SLsSRy%%a0 zi}Y#1-F3m;Ieh#Y12UgW?-R)|eX>ZuF-2cc!1>~NS|XSF-6In>zBoZg+ml!6%fk7U zw0LHcz8VQk(jOJ+Yu)|^|15ufl$KQd_1eUZZzj`aC%umU6F1&D5XVWce_wAe(qCSZ zpX-QF4e{EmEVN9~6%bR5U*UT{eMHfcUo`jw*u?4r2s_$`}U{?NjvEm(u&<>B|%mq$Q3weshxk z76<``8vh{+nX`@9CB6IE&z)I%IFjR^LH{s1p|eppv=x za(g_jLU|xjWMAn-V7th$f({|LG8zzIE0g?cyW;%Dmtv%C+0@xVxPE^ zyZzi9P%JAD6ynwHptuzP`Kox7*9h7XSMonCalv;Md0i9Vb-c*!f0ubfk?&T&T}AHh z4m8Bz{JllKcdNg?D^%a5MFQ;#1z|*}H^qHLzW)L}wp?2tY7RejtSh8<;Zw)QGJYUm z|MbTxyj*McKlStlT9I5XlSWtQGN&-LTr2XyNU+`490rg?LYLMRnz-@oKqT1hpCGqP zyRXt4=_Woj$%n5ee<3zhLF>5>`?m9a#xQH+Jk_+|RM8Vi;2*XbK- zEL6sCpaGPzP>k8f4Kh|##_imt#zJMB;ir|JrMPGW`rityK1vHXMLy18%qmMQAm4WZ zP)i30KR&5vs15)C+8dM66&$k~i|ZT;KR&5vs15)C+8dJ(sAmGPijyIz6_bsqKLSFH zlOd=TljEpH0>h4zA*dCTK&emy#FCRCs1=i^sZ9bFmXjf<6_X39E(XY)00000#N437 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d51870384b..176d08d230 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -28,7 +28,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab +distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a From 7cdff843cb34979860a0ca7ccb1133f69f4a84b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:55:14 -0400 Subject: [PATCH 07/37] Bump com.github.jk1.dependency-license-report from 2.8 to 2.9 in /java-client (#1143) * Bump com.github.jk1.dependency-license-report in /java-client Bumps com.github.jk1.dependency-license-report from 2.8 to 2.9. --- updated-dependencies: - dependency-name: com.github.jk1.dependency-license-report dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b1ce4fbc..bbae3767c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 +- Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 41b08fd8d1..42c019b852 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -51,7 +51,7 @@ plugins { java `java-library` `maven-publish` - id("com.github.jk1.dependency-license-report") version "2.8" + id("com.github.jk1.dependency-license-report") version "2.9" id("org.owasp.dependencycheck") version "10.0.3" id("com.diffplug.spotless") version "6.25.0" } From 2c5f22cb39c70c482e51d9ae973bb9d7e875a3c6 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Mon, 19 Aug 2024 09:04:31 -0400 Subject: [PATCH 08/37] Fix Github Action workflow (#1145) Signed-off-by: Andriy Redko --- .github/workflows/test-integration-unreleased.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-integration-unreleased.yml b/.github/workflows/test-integration-unreleased.yml index 651231a894..82d184ff86 100644 --- a/.github/workflows/test-integration-unreleased.yml +++ b/.github/workflows/test-integration-unreleased.yml @@ -57,10 +57,10 @@ jobs: java-version: ${{ matrix.entry.gradle-runtime }} distribution: temurin - - name: Set JAVA${{ matrix.java }}_HOME + - name: Set JAVA${{ matrix.entry.java }}_HOME shell: bash run: | - echo "JAVA${{ matrix.java }}_HOME=$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}" >> $GITHUB_ENV + echo "JAVA${{ matrix.entry.java }}_HOME=$JAVA_HOME_${{ matrix.entry.java }}_${{ runner.arch }}" >> $GITHUB_ENV - name: Assemble OpenSearch if: steps.cache-restore.outputs.cache-hit != 'true' From 08e7e6504d4e6029640940f4bb4670e5e183c700 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:51:29 -0400 Subject: [PATCH 09/37] Bump com.github.jk1.dependency-license-report from 2.8 to 2.9 (#1144) Bumps com.github.jk1.dependency-license-report from 2.8 to 2.9. --- updated-dependencies: - dependency-name: com.github.jk1.dependency-license-report dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- java-codegen/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index 732bfb1fd7..c5f1933713 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -30,7 +30,7 @@ buildscript { plugins { application - id("com.github.jk1.dependency-license-report") version "2.8" + id("com.github.jk1.dependency-license-report") version "2.9" id("org.owasp.dependencycheck") version "10.0.2" id("com.diffplug.spotless") version "6.25.0" id("de.undercouch.download") version "5.6.0" From c84ad24739f46abae5c8358ffc38f2eb77bbfe56 Mon Sep 17 00:00:00 2001 From: Uriel Dan Nudelman Date: Wed, 21 Aug 2024 19:31:01 -0400 Subject: [PATCH 10/37] Fixes #1116 - Add cancel_after_time_interval (#1147) * Fixes #1116 Signed-off-by: uri.nudelman * Adds MsearchRequest. Fixes SearchRequest. Signed-off-by: uri.nudelman * Update CHANGELOG.md Signed-off-by: uri.nudelman * spotlessJavaCheck Signed-off-by: uri.nudelman * Adds Builder Function method in MSearch Signed-off-by: uri.nudelman --------- Signed-off-by: uri.nudelman Co-authored-by: uri.nudelman --- CHANGELOG.md | 1 + .../opensearch/core/MsearchRequest.java | 44 +++++++++++++++++++ .../client/opensearch/core/SearchRequest.java | 43 ++++++++++++++++++ .../opensearch/core/MsearchRequestTest.java | 18 +++++++- .../opensearch/core/SearchRequestTest.java | 11 +++++ 5 files changed, 115 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbae3767c5..aefa38cbbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Added - Adds `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) +- Adds `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) ### Dependencies diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java index 931be38b15..a417915504 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java @@ -48,6 +48,7 @@ import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.SearchType; +import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch.core.msearch.RequestItem; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; @@ -66,6 +67,9 @@ public class MsearchRequest extends RequestBase implements NdJsonpSerializable, @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time cancelAfterTimeInterval; + @Nullable private final Boolean ccsMinimizeRoundtrips; @@ -98,6 +102,7 @@ public class MsearchRequest extends RequestBase implements NdJsonpSerializable, private MsearchRequest(Builder builder) { this.allowNoIndices = builder.allowNoIndices; + this.cancelAfterTimeInterval = builder.cancelAfterTimeInterval; this.ccsMinimizeRoundtrips = builder.ccsMinimizeRoundtrips; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreThrottled = builder.ignoreThrottled; @@ -134,6 +139,17 @@ public final Boolean allowNoIndices() { return this.allowNoIndices; } + /** + * The time after which the search request will be canceled. + * Request-level parameter takes precedence over cancel_after_time_interval cluster setting. + *

+ * API name: {@code cancel_after_time_interval} + */ + @Nullable + public final Time cancelAfterTimeInterval() { + return this.cancelAfterTimeInterval; + } + /** * If true, network roundtrips between the coordinating node and remote clusters * are minimized for cross-cluster search requests. @@ -256,6 +272,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { public Builder toBuilder() { return new Builder().allowNoIndices(allowNoIndices) + .cancelAfterTimeInterval(cancelAfterTimeInterval) .ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) .expandWildcards(expandWildcards) .ignoreThrottled(ignoreThrottled) @@ -278,6 +295,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder + * API name: {@code cancel_after_time_interval} + */ + public final Builder cancelAfterTimeInterval(@Nullable Time value) { + this.cancelAfterTimeInterval = value; + return this; + } + + /** + * The time after which the search request will be canceled. + * Request-level parameter takes precedence over cancel_after_time_interval cluster setting. + *

+ * API name: {@code cancel_after_time_interval} + */ + public final Builder cancelAfterTimeInterval(Function> fn) { + return this.cancelAfterTimeInterval(fn.apply(new Time.Builder()).build()); + } + /** * If true, network roundtrips between the coordinating node and remote clusters * are minimized for cross-cluster search requests. @@ -540,6 +581,9 @@ public MsearchRequest build() { request -> { Map params = new HashMap<>(); params.put("typed_keys", "true"); + if (request.cancelAfterTimeInterval != null) { + params.put("cancel_after_time_interval", request.cancelAfterTimeInterval._toJsonString()); + } if (request.preFilterShardSize != null) { params.put("pre_filter_shard_size", String.valueOf(request.preFilterShardSize)); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java index 3b7166c1fc..28faf4c174 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java @@ -110,6 +110,9 @@ public class SearchRequest extends RequestBase implements PlainJsonSerializable @Nullable private final String pipeline; + @Nullable + private final Time cancelAfterTimeInterval; + @Nullable private final FieldCollapse collapse; @@ -246,6 +249,7 @@ private SearchRequest(Builder builder) { this.ccsMinimizeRoundtrips = builder.ccsMinimizeRoundtrips; this.phaseTook = builder.phaseTook; this.pipeline = builder.pipeline; + this.cancelAfterTimeInterval = builder.cancelAfterTimeInterval; this.collapse = builder.collapse; this.defaultOperator = builder.defaultOperator; this.df = builder.df; @@ -405,6 +409,17 @@ public final String pipeline() { return this.pipeline; } + /** + * The time after which the search request will be canceled. + * Request-level parameter takes precedence over cancel_after_time_interval cluster setting. + *

+ * API name: {@code cancel_after_time_interval} + */ + @Nullable + public final Time cancelAfterTimeInterval() { + return this.cancelAfterTimeInterval; + } + /** * API name: {@code collapse} */ @@ -1114,6 +1129,7 @@ public Builder toBuilder() { .ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) .phaseTook(phaseTook) .pipeline(pipeline) + .cancelAfterTimeInterval(cancelAfterTimeInterval) .collapse(collapse) .defaultOperator(defaultOperator) .df(df) @@ -1198,6 +1214,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder + * API name: {@code cancel_after_time_interval} + */ + public final Builder cancelAfterTimeInterval(@Nullable Time value) { + this.cancelAfterTimeInterval = value; + return this; + } + + /** + * The time after which the search request will be canceled. + * Request-level parameter takes precedence over cancel_after_time_interval cluster setting. + *

+ * API name: {@code cancel_after_time_interval} + */ + public final Builder cancelAfterTimeInterval(Function> fn) { + return this.cancelAfterTimeInterval(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code collapse} */ @@ -2405,6 +2445,9 @@ protected static void setupSearchRequestDeserializer(ObjectDeserializer ti.time("1000ms")); + MsearchRequest request = new MsearchRequest.Builder().index("index") + .searches(Collections.emptyList()) + .cancelAfterTimeInterval(cancelAfterTimeInterval) + .build(); + + assertEquals("[]", toJson(request)); + assertEquals(cancelAfterTimeInterval, request.cancelAfterTimeInterval()); + assertEquals("1000ms", MsearchRequest._ENDPOINT.queryParameters(request).get("cancel_after_time_interval")); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java index addeb30493..e5824981f1 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java @@ -13,6 +13,7 @@ import org.junit.Test; import org.opensearch.client.json.JsonData; import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch.core.search.SourceConfig; import org.opensearch.client.opensearch.core.search.SourceFilter; import org.opensearch.client.opensearch.model.ModelTestCase; @@ -53,6 +54,16 @@ public void pipeline() { assertEquals("my_pipeline", SearchRequest._ENDPOINT.queryParameters(request).get("search_pipeline")); } + @Test + public void cancelAfterTimeInterval() { + Time cancelAfterTimeInterval = Time.of(ti -> ti.time("1000ms")); + SearchRequest request = new SearchRequest.Builder().cancelAfterTimeInterval(cancelAfterTimeInterval).build(); + + assertEquals("{}", toJson(request)); + assertEquals(cancelAfterTimeInterval, request.cancelAfterTimeInterval()); + assertEquals("1000ms", SearchRequest._ENDPOINT.queryParameters(request).get("cancel_after_time_interval")); + } + @Test public void toBuilder() { SearchRequest origin = new SearchRequest.Builder().index("index").build(); From 7b954af625ec3cba3f959efd51581a16991cf430 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 23 Aug 2024 08:51:41 +1200 Subject: [PATCH 11/37] Tweak codegen logic for formatting, documentation and handling of anyOf (#1152) * Re-generate code Signed-off-by: Thomas Farr * Improve builder doc comments Signed-off-by: Thomas Farr * Fix list/map isDefined serialize logic Signed-off-by: Thomas Farr * Add support for deprecated enums Signed-off-by: Thomas Farr * Improve isDefined logic Signed-off-by: Thomas Farr * Allow overriding request/response naming Signed-off-by: Thomas Farr * Support anyOf Signed-off-by: Thomas Farr * Update spec Signed-off-by: Thomas Farr * spotlessApply Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- .../_types/AcknowledgedResponseBase.java | 1 - .../client/opensearch/_types/ErrorCause.java | 24 +- .../opensearch/_types/NodeStatistics.java | 3 - .../_types/OpenSearchVersionInfo.java | 2 - .../client/opensearch/core/InfoResponse.java | 1 - .../ListDanglingIndicesResponse.java | 4 - .../list_dangling_indices/DanglingIndex.java | 3 - java-codegen/opensearch-openapi.yaml | 3661 +++++++++++++---- .../client/codegen/model/EnumShape.java | 8 +- .../client/codegen/model/RequestShape.java | 15 +- .../client/codegen/model/Shape.java | 2 +- .../client/codegen/model/SpecTransformer.java | 91 +- .../opensearch/client/codegen/model/Type.java | 5 + .../codegen/openapi/HttpStatusCode.java | 1 + .../client/codegen/openapi/OpenApiSchema.java | 56 +- .../codegen/openapi/OpenApiSchemaFormat.java | 3 +- .../lambdas/TemplateRenderingLambda.java | 3 +- .../renderer/lambdas/TypeIsDefinedLambda.java | 52 + .../codegen/templates/EnumShape.mustache | 13 +- .../templates/ObjectShape/Builder.mustache | 12 +- .../ObjectShape/FieldDoc/BasicInner.mustache | 4 +- .../ObjectShape/FieldDoc/MapAdd.mustache | 5 + .../ObjectShape/FieldDoc/MapAddAll.mustache | 5 + .../FieldDoc/MapAddBuilderFn.mustache | 5 + .../templates/ObjectShape/Fields.mustache | 10 +- .../templates/ObjectShape/Serialize.mustache | 24 +- .../codegen/templates/RequestShape.mustache | 9 +- .../templates/TaggedUnionShape.mustache | 2 + .../codegen/templates/Type/isDefined.mustache | 6 + 29 files changed, 3097 insertions(+), 933 deletions(-) create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TypeIsDefinedLambda.java create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAdd.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddAll.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddBuilderFn.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/isDefined.mustache diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index c7ab7d8510..ee2f0572f9 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -81,7 +81,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("acknowledged"); generator.write(this.acknowledged); - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index 2941b7ea30..5184be7b16 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -148,7 +148,7 @@ public final String type() { } /** - * Additional details about the error + * Additional details about the error. */ public final Map metadata() { return this.metadata; @@ -168,19 +168,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.metadata.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } - if (this.causedBy != null) { generator.writeKey("caused_by"); this.causedBy.serialize(generator, mapper); - } if (this.reason != null) { generator.writeKey("reason"); generator.write(this.reason); - } if (ApiTypeHelper.isDefined(this.rootCause)) { @@ -188,16 +184,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (ErrorCause item0 : this.rootCause) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } if (this.stackTrace != null) { generator.writeKey("stack_trace"); generator.write(this.stackTrace); - } if (ApiTypeHelper.isDefined(this.suppressed)) { @@ -205,15 +198,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (ErrorCause item0 : this.suppressed) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } generator.writeKey("type"); generator.write(this.type); - } // --------------------------------------------------------------------------------------------- @@ -355,7 +345,11 @@ public final Builder type(String value) { } /** - * Additional details about the error + * Additional details about the error. + * + *

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

*/ public final Builder metadata(Map map) { this.metadata = _mapPutAll(this.metadata, map); @@ -363,7 +357,11 @@ public final Builder metadata(Map map) { } /** - * Additional details about the error + * Additional details about the error. + * + *

+ * Adds an entry to metadata. + *

*/ public final Builder metadata(String key, JsonData value) { this.metadata = _mapPut(this.metadata, key, value); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index 12b40c0fe4..098d4aa483 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -135,10 +135,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (ErrorCause item0 : this.failures) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } generator.writeKey("successful"); @@ -146,7 +144,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total"); generator.write(this.total); - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index fe6603175b..1a168dc946 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -192,7 +192,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.buildFlavor != null) { generator.writeKey("build_flavor"); generator.write(this.buildFlavor); - } generator.writeKey("build_hash"); @@ -218,7 +217,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("number"); generator.write(this.number); - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index 08293ca62a..f3c81d7cc6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -140,7 +140,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("version"); this.version.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 1c26867fa5..989611ecb7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -118,23 +118,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.clusterName != null) { generator.writeKey("cluster_name"); generator.write(this.clusterName); - } generator.writeKey("dangling_indices"); generator.writeStartArray(); for (DanglingIndex item0 : this.danglingIndices) { item0.serialize(generator, mapper); - } generator.writeEnd(); if (this.nodes != null) { generator.writeKey("_nodes"); this.nodes.serialize(generator, mapper); - } - } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index 822758ab0f..914101a624 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -132,7 +132,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.creationDate != null) { generator.writeKey("creation_date"); generator.write(this.creationDate); - } generator.writeKey("creation_date_millis"); @@ -148,10 +147,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartArray(); for (String item0 : this.nodeIds) { generator.write(item0); - } generator.writeEnd(); - } // --------------------------------------------------------------------------------------------- diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index fb5695388c..fc23f29fe3 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -2,13 +2,15 @@ openapi: 3.1.0 info: title: OpenSearch API Specification version: 1.0.0 - x-api-version: 2.15.0 + x-api-version: 2.16.0 paths: /: get: operationId: info.0 x-operation-group: info x-version-added: '1.0' + x-distributions-excluded: + - amazon-serverless description: Returns basic information about the cluster. externalDocs: url: https://opensearch.org/docs/latest @@ -58,6 +60,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.get_alias@200' + '404': + $ref: '#/components/responses/indices.get_alias@404' put: operationId: indices.put_alias.0 x-operation-group: indices.put_alias @@ -101,6 +105,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.get_alias@200' + '404': + $ref: '#/components/responses/indices.get_alias@404' head: operationId: indices.exists_alias.0 x-operation-group: indices.exists_alias @@ -122,6 +128,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.exists_alias@200' + '404': + $ref: '#/components/responses/indices.exists_alias@404' post: operationId: indices.put_alias.1 x-operation-group: indices.put_alias @@ -334,6 +342,9 @@ paths: operationId: indices.clear_cache.0 x-operation-group: indices.clear_cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Clears all or specific caches for one or more indices. externalDocs: url: https://opensearch.org/docs/latest/api-reference/index-apis/clear-index-cache/ @@ -713,6 +724,9 @@ paths: operationId: cat.nodeattrs.0 x-operation-group: cat.nodeattrs x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns information about custom node attributes. externalDocs: url: https://opensearch.org/docs/latest/api-reference/cat/cat-nodeattrs/ @@ -2342,6 +2356,9 @@ paths: operationId: indices.forcemerge.0 x-operation-group: indices.forcemerge x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Performs the force merge operation on one or more indices. externalDocs: url: https://opensearch.org/docs/latest @@ -3839,6 +3856,36 @@ paths: responses: '200': $ref: '#/components/responses/ml.delete_model@200' + /_plugins/_ml/models/{model_id}/_deploy: + post: + operationId: ml.deploy_model.0 + x-operation-group: ml.deploy_model + description: Deploys a model. + parameters: + - $ref: '#/components/parameters/ml.deploy_model::path.model_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.deploy_model@200' + /_plugins/_ml/models/{model_id}/_undeploy: + post: + operationId: ml.undeploy_model.0 + x-operation-group: ml.undeploy_model + description: Undeploys a model. + parameters: + - $ref: '#/components/parameters/ml.undeploy_model::path.model_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.undeploy_model@200' /_plugins/_ml/tasks/{task_id}: get: operationId: ml.get_task.0 @@ -4071,6 +4118,309 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_observability/_local/stats: + get: + operationId: observability.get_localstats.0 + x-operation-group: observability.get_localstats + x-version-added: '1.1' + description: Retrieves Local Stats of all observability objects. + responses: + '200': + $ref: '#/components/responses/observability.get_localstats@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_observability/object: + delete: + operationId: observability.delete_objects.0 + x-operation-group: observability.delete_objects + x-version-added: '1.1' + description: Deletes specific observability objects specified by ID or a list of IDs. + parameters: + - $ref: '#/components/parameters/observability.delete_objects::query.objectId' + - $ref: '#/components/parameters/observability.delete_objects::query.objectIdList' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/observability.delete_objects@200' + '404': + $ref: '#/components/responses/observability.delete_objects@404' + get: + operationId: observability.list_objects.0 + x-operation-group: observability.list_objects + x-version-added: '1.1' + description: Retrieves list of all observability objects. + responses: + '200': + $ref: '#/components/responses/observability.list_objects@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: observability.create_object.0 + x-operation-group: observability.create_object + x-version-added: '1.1' + description: Creates a new observability object. + requestBody: + $ref: '#/components/requestBodies/observability.create_object' + responses: + '200': + $ref: '#/components/responses/observability.create_object@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_observability/object/{object_id}: + delete: + operationId: observability.delete_object.0 + x-operation-group: observability.delete_object + x-version-added: '1.1' + description: Deletes specific observability object specified by ID. + parameters: + - $ref: '#/components/parameters/observability.delete_object::path.object_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/observability.delete_object@200' + '404': + $ref: '#/components/responses/observability.delete_object@404' + get: + operationId: observability.get_object.0 + x-operation-group: observability.get_object + x-version-added: '1.1' + description: Retrieves specific observability object specified by ID. + parameters: + - $ref: '#/components/parameters/observability.get_object::path.object_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/observability.get_object@200' + '404': + $ref: '#/components/responses/observability.get_object@404' + put: + operationId: observability.update_object.0 + x-operation-group: observability.update_object + x-version-added: '1.1' + description: Updates an existing observability object. + parameters: + - $ref: '#/components/parameters/observability.update_object::path.object_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/observability.update_object' + responses: + '200': + $ref: '#/components/responses/observability.update_object@200' + '404': + $ref: '#/components/responses/observability.update_object@404' + /_plugins/_ppl: + post: + operationId: ppl.query.0 + x-operation-group: ppl.query + x-version-added: '1.0' + description: Send a PPL query to the PPL plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.query::query.format' + - $ref: '#/components/parameters/ppl.query::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.query' + responses: + '200': + $ref: '#/components/responses/ppl.query@200' + /_plugins/_ppl/_explain: + post: + operationId: ppl.explain.0 + x-operation-group: ppl.explain + x-version-added: '1.0' + description: Shows how a query is executed against OpenSearch. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.explain::query.format' + - $ref: '#/components/parameters/ppl.explain::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.explain' + responses: + '200': + $ref: '#/components/responses/ppl.explain@200' + /_plugins/_ppl/stats: + get: + operationId: ppl.get_stats.0 + x-operation-group: ppl.get_stats + x-version-added: '1.0' + description: Collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.get_stats::query.format' + - $ref: '#/components/parameters/ppl.get_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ppl.get_stats@200' + post: + operationId: ppl.post_stats.1 + x-operation-group: ppl.post_stats + x-version-added: '1.0' + description: By a stats endpoint, you are able to collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.post_stats::query.format' + - $ref: '#/components/parameters/ppl.post_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.post_stats' + responses: + '200': + $ref: '#/components/responses/ppl.post_stats@200' + /_plugins/_query/_datasources: + get: + operationId: query.datasources_list.0 + x-operation-group: query.datasources_list + x-version-added: '2.7' + description: Retrieves list of all datasources. + responses: + '200': + $ref: '#/components/responses/query.datasources_list@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: query.datasources_create.0 + x-operation-group: query.datasources_create + x-version-added: '2.7' + description: Creates a new query datasource. + requestBody: + $ref: '#/components/requestBodies/query.datasources_create' + responses: + '201': + $ref: '#/components/responses/query.datasources_create@201' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + put: + operationId: query.datasources_update.0 + x-operation-group: query.datasources_update + x-version-added: '2.7' + description: Updates an existing query datasource. + requestBody: + $ref: '#/components/requestBodies/query.datasources_update' + responses: + '200': + $ref: '#/components/responses/query.datasources_update@200' + '404': + $ref: '#/components/responses/query.datasources_update@404' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_query/_datasources/{datasource_name}: + delete: + operationId: query.datasource_delete.0 + x-operation-group: query.datasource_delete + x-version-added: '2.7' + description: Deletes specific datasource specified by name. + parameters: + - $ref: '#/components/parameters/query.datasource_delete::path.datasource_name' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '204': + $ref: '#/components/responses/query.datasource_delete@204' + '404': + $ref: '#/components/responses/query.datasource_delete@404' + get: + operationId: query.datasource_retrieve.0 + x-operation-group: query.datasource_retrieve + x-version-added: '2.7' + description: Retrieves specific datasource specified by name. + parameters: + - $ref: '#/components/parameters/query.datasource_retrieve::path.datasource_name' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/query.datasource_retrieve@200' + '404': + $ref: '#/components/responses/query.datasource_retrieve@404' + /_plugins/_query/settings: + put: + operationId: sql.settings.0 + x-operation-group: sql.settings + x-version-added: '1.0' + description: Adds SQL settings to the standard OpenSearch cluster settings. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/settings/ + parameters: + - $ref: '#/components/parameters/sql.settings::query.format' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.settings' + responses: + '200': + $ref: '#/components/responses/sql.settings@200' /_plugins/_rollup/jobs/{id}: delete: operationId: rollups.delete.0 @@ -4181,11 +4531,14 @@ paths: responses: '200': $ref: '#/components/responses/rollups.stop@200' - /_plugins/_security/_upgrade_check: + /_plugins/_security/api/_upgrade_check: get: operationId: security.config_upgrade_check.0 x-operation-group: security.config_upgrade_check x-version-added: '2.14' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Check whether or not an upgrade can be performed and what resources can be updated. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#configuration-upgrade-check @@ -4198,11 +4551,14 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' - /_plugins/_security/_upgrade_perform: + /_plugins/_security/api/_upgrade_perform: post: operationId: security.config_upgrade_perform.0 x-operation-group: security.config_upgrade_perform x-version-added: '2.14' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Helps cluster operator upgrade missing defaults and stale default definitions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#configuration-upgrade @@ -4211,6 +4567,8 @@ paths: responses: '200': $ref: '#/components/responses/security.config_upgrade_perform@200' + '400': + $ref: '#/components/responses/security.config_upgrade_perform@400' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -4222,6 +4580,9 @@ paths: operationId: security.get_account_details.0 x-operation-group: security.get_account_details x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns account details for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-account-details @@ -4238,6 +4599,9 @@ paths: operationId: security.change_password.0 x-operation-group: security.change_password x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Changes the password for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#change-password @@ -4246,6 +4610,8 @@ paths: responses: '200': $ref: '#/components/responses/security.change_password@200' + '403': + $ref: '#/components/responses/security.change_password@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -4257,6 +4623,9 @@ paths: operationId: security.get_action_groups.0 x-operation-group: security.get_action_groups x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves all action groups. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-action-groups @@ -4273,6 +4642,9 @@ paths: operationId: security.patch_action_groups.1 x-operation-group: security.patch_action_groups x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates, updates, or deletes multiple action groups in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-groups @@ -4292,6 +4664,9 @@ paths: operationId: security.delete_action_group.0 x-operation-group: security.delete_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete a specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group @@ -4309,6 +4684,9 @@ paths: operationId: security.get_action_group.0 x-operation-group: security.get_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-action-group @@ -4326,6 +4704,9 @@ paths: operationId: security.patch_action_group.0 x-operation-group: security.patch_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of an action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-group @@ -4345,6 +4726,9 @@ paths: operationId: security.create_action_group.0 x-operation-group: security.create_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-action-group @@ -4360,17 +4744,24 @@ paths: responses: '200': $ref: '#/components/responses/security.create_action_group@200' + '201': + $ref: '#/components/responses/security.create_action_group@201' /_plugins/_security/api/allowlist: get: operationId: security.get_allowlist.0 x-operation-group: security.get_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the current list of allowed API accessible to normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api responses: '200': $ref: '#/components/responses/security.get_allowlist@200' + '403': + $ref: '#/components/responses/security.get_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -4380,7 +4771,10 @@ paths: patch: operationId: security.patch_allowlist.0 x-operation-group: security.patch_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the current list of allowed API accessible to normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api @@ -4389,6 +4783,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_allowlist@200' + '403': + $ref: '#/components/responses/security.patch_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -4398,7 +4794,10 @@ paths: put: operationId: security.create_allowlist.0 x-operation-group: security.create_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the allowlisted APIs. Accessible via Super Admin certificate or REST API permission. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api @@ -4407,6 +4806,8 @@ paths: responses: '200': $ref: '#/components/responses/security.create_allowlist@200' + '403': + $ref: '#/components/responses/security.create_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -4418,6 +4819,9 @@ paths: operationId: security.get_audit_configuration.0 x-operation-group: security.get_audit_configuration x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the audit configuration. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#audit-logs @@ -4434,6 +4838,9 @@ paths: operationId: security.patch_audit_configuration.0 x-operation-group: security.patch_audit_configuration x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: A PATCH call is used to update specified fields in the audit configuration. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#audit-logs @@ -4453,6 +4860,9 @@ paths: operationId: security.update_audit_configuration.0 x-operation-group: security.update_audit_configuration x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the audit configuration. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#audit-logs @@ -4472,6 +4882,9 @@ paths: operationId: security.authtoken.0 x-operation-group: security.authtoken x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authorization token. responses: '200': @@ -4487,6 +4900,9 @@ paths: operationId: security.flush_cache.0 x-operation-group: security.flush_cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Flushes the Security plugin user, authentication, and authorization cache. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#flush-cache @@ -4504,6 +4920,9 @@ paths: x-operation-group: security.cache x-ignorable: true x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Not supported for cache API. responses: '501': @@ -4518,6 +4937,9 @@ paths: operationId: security.cache.2 x-operation-group: security.cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless x-ignorable: true description: Not supported for cache API. responses: @@ -4533,6 +4955,9 @@ paths: operationId: security.cache.3 x-operation-group: security.cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless x-ignorable: true description: Not supported for cache API. responses: @@ -4544,11 +4969,63 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_security/api/certificates: + get: + operationId: security.get_all_certificates.0 + x-operation-group: security.get_all_certificates + x-version-added: '2.15' + x-distributions-excluded: + - amazon-managed + - amazon-serverless + description: Retrieves the cluster security certificates. + parameters: + - $ref: '#/components/parameters/security.get_all_certificates::query.cert_type' + - $ref: '#/components/parameters/security.get_all_certificates::query.timeout' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/security.get_all_certificates@200' + '403': + $ref: '#/components/responses/security.get_all_certificates@403' + '500': + $ref: '#/components/responses/security.get_all_certificates@500' + /_plugins/_security/api/certificates/{node_id}: + get: + operationId: security.get_node_certificates.0 + x-operation-group: security.get_node_certificates + x-version-added: '2.15' + x-distributions-excluded: + - amazon-managed + - amazon-serverless + description: Retrieves the given node's security certificates. + parameters: + - $ref: '#/components/parameters/security.get_node_certificates::path.node_id' + - $ref: '#/components/parameters/security.get_node_certificates::query.cert_type' + - $ref: '#/components/parameters/security.get_node_certificates::query.timeout' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/security.get_node_certificates@200' + '403': + $ref: '#/components/responses/security.get_node_certificates@403' + '500': + $ref: '#/components/responses/security.get_node_certificates@500' /_plugins/_security/api/generateonbehalfoftoken: post: operationId: security.generate_obo_token.0 x-operation-group: security.generate_obo_token x-version-added: '2.12' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Generates On-Behalf-Of token for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/authentication-tokens/#api-endpoint @@ -4570,6 +5047,9 @@ paths: operationId: security.get_users.0 x-operation-group: security.get_users x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve all internal users. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-users @@ -4586,6 +5066,9 @@ paths: operationId: security.patch_users.0 x-operation-group: security.patch_users x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates, updates, or deletes multiple internal users in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-users @@ -4605,6 +5088,9 @@ paths: operationId: security.delete_user.0 x-operation-group: security.delete_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-user @@ -4622,6 +5108,9 @@ paths: operationId: security.get_user.0 x-operation-group: security.get_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve one internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-user @@ -4639,6 +5128,9 @@ paths: operationId: security.patch_user.0 x-operation-group: security.patch_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of an internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-user @@ -4658,6 +5150,9 @@ paths: operationId: security.create_user.0 x-operation-group: security.create_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-user @@ -4677,7 +5172,10 @@ paths: post: operationId: security.generate_user_token.0 x-operation-group: security.generate_user_token - x-version-added: '1.0' + x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Generates authorization token for the given user. parameters: - $ref: '#/components/parameters/security.generate_user_token::path.username' @@ -4696,6 +5194,9 @@ paths: operationId: security.migrate.0 x-operation-group: security.migrate x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Migrates security configuration from v6 to v7. responses: '200': @@ -4713,6 +5214,9 @@ paths: operationId: security.get_distinguished_names.0 x-operation-group: security.get_distinguished_names x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names @@ -4726,12 +5230,17 @@ paths: responses: '200': $ref: '#/components/responses/security.get_distinguished_names@200' + '400': + $ref: '#/components/responses/security.get_distinguished_names@400' '403': $ref: '#/components/responses/security.get_distinguished_names@403' patch: operationId: security.patch_distinguished_names.0 x-operation-group: security.patch_distinguished_names x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Bulk update of distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-all-distinguished-names @@ -4740,6 +5249,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_distinguished_names@200' + '400': + $ref: '#/components/responses/security.patch_distinguished_names@400' '403': $ref: '#/components/responses/security.patch_distinguished_names@403' parameters: @@ -4753,6 +5264,9 @@ paths: operationId: security.delete_distinguished_name.0 x-operation-group: security.delete_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-distinguished-names @@ -4766,12 +5280,17 @@ paths: responses: '200': $ref: '#/components/responses/security.delete_distinguished_name@200' + '400': + $ref: '#/components/responses/security.delete_distinguished_name@400' '403': $ref: '#/components/responses/security.delete_distinguished_name@403' get: operationId: security.get_distinguished_name.0 x-operation-group: security.get_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names @@ -4786,12 +5305,17 @@ paths: responses: '200': $ref: '#/components/responses/security.get_distinguished_name@200' + '400': + $ref: '#/components/responses/security.get_distinguished_name@400' '403': $ref: '#/components/responses/security.get_distinguished_name@403' patch: operationId: security.patch_distinguished_name.0 x-operation-group: security.patch_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. parameters: - $ref: '#/components/parameters/security.patch_distinguished_name::path.cluster_name' @@ -4805,12 +5329,17 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_distinguished_name@200' + '400': + $ref: '#/components/responses/security.patch_distinguished_name@400' '403': $ref: '#/components/responses/security.patch_distinguished_name@403' put: operationId: security.update_distinguished_name.0 x-operation-group: security.update_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-distinguished-names @@ -4826,6 +5355,8 @@ paths: responses: '200': $ref: '#/components/responses/security.update_distinguished_name@200' + '400': + $ref: '#/components/responses/security.update_distinguished_name@400' '403': $ref: '#/components/responses/security.update_distinguished_name@403' /_plugins/_security/api/permissionsinfo: @@ -4833,6 +5364,9 @@ paths: operationId: security.get_permissions_info.0 x-operation-group: security.get_permissions_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Gets the evaluated REST API permissions for the currently logged in user. responses: '200': @@ -4850,6 +5384,9 @@ paths: operationId: security.get_roles.0 x-operation-group: security.get_roles x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves all roles. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-roles @@ -4866,6 +5403,9 @@ paths: operationId: security.patch_roles.0 x-operation-group: security.patch_roles x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates, updates, or deletes multiple roles in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-roles @@ -4887,6 +5427,9 @@ paths: operationId: security.delete_role.0 x-operation-group: security.delete_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role @@ -4904,6 +5447,9 @@ paths: operationId: security.get_role.0 x-operation-group: security.get_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role @@ -4921,6 +5467,9 @@ paths: operationId: security.patch_role.0 x-operation-group: security.patch_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of a role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role @@ -4942,6 +5491,9 @@ paths: operationId: security.create_role.0 x-operation-group: security.create_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-role @@ -4957,11 +5509,16 @@ paths: responses: '200': $ref: '#/components/responses/security.create_role@200' + '201': + $ref: '#/components/responses/security.create_role@201' /_plugins/_security/api/rolesmapping: get: operationId: security.get_role_mappings.0 x-operation-group: security.get_role_mappings x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves all role mappings. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role-mappings @@ -4978,6 +5535,9 @@ paths: operationId: security.patch_role_mappings.0 x-operation-group: security.patch_role_mappings x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or updates multiple role mappings in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mappings @@ -4999,6 +5559,9 @@ paths: operationId: security.delete_role_mapping.0 x-operation-group: security.delete_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Deletes the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role-mapping @@ -5016,6 +5579,9 @@ paths: operationId: security.get_role_mapping.0 x-operation-group: security.get_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role-mapping @@ -5033,6 +5599,9 @@ paths: operationId: security.patch_role_mapping.0 x-operation-group: security.patch_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of a role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mapping @@ -5054,6 +5623,9 @@ paths: operationId: security.create_role_mapping.0 x-operation-group: security.create_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-role-mapping @@ -5069,11 +5641,16 @@ paths: responses: '200': $ref: '#/components/responses/security.create_role_mapping@200' + '201': + $ref: '#/components/responses/security.create_role_mapping@201' /_plugins/_security/api/securityconfig: get: operationId: security.get_configuration.0 x-operation-group: security.get_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the current Security plugin configuration in JSON format. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-configuration @@ -5089,7 +5666,10 @@ paths: patch: operationId: security.patch_configuration.0 x-operation-group: security.patch_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: A PATCH call is used to update the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-configuration @@ -5098,6 +5678,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_configuration@200' + '403': + $ref: '#/components/responses/security.patch_configuration@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -5108,7 +5690,10 @@ paths: put: operationId: security.update_configuration.0 x-operation-group: security.update_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Adds or updates the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-configuration @@ -5117,6 +5702,8 @@ paths: responses: '200': $ref: '#/components/responses/security.update_configuration@200' + '403': + $ref: '#/components/responses/security.update_configuration@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -5127,7 +5714,10 @@ paths: get: operationId: security.get_certificates.0 x-operation-group: security.get_certificates - x-version-added: '1.0' + x-version-added: '2.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the cluster security certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-certificates @@ -5136,6 +5726,8 @@ paths: $ref: '#/components/responses/security.get_certificates@200' '400': $ref: '#/components/responses/security.get_certificates@400' + '403': + $ref: '#/components/responses/security.get_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -5146,7 +5738,10 @@ paths: put: operationId: security.reload_http_certificates.0 x-operation-group: security.reload_http_certificates - x-version-added: '1.0' + x-version-added: '2.8' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Reload HTTP layer communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-http-certificates @@ -5155,6 +5750,8 @@ paths: $ref: '#/components/responses/security.reload_http_certificates@200' '400': $ref: '#/components/responses/security.reload_http_certificates@400' + '403': + $ref: '#/components/responses/security.reload_http_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -5165,7 +5762,10 @@ paths: put: operationId: security.reload_transport_certificates.0 x-operation-group: security.reload_transport_certificates - x-version-added: '1.0' + x-version-added: '2.8' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Reload Transport layer communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-transport-certificates @@ -5174,6 +5774,8 @@ paths: $ref: '#/components/responses/security.reload_transport_certificates@200' '400': $ref: '#/components/responses/security.reload_transport_certificates@400' + '403': + $ref: '#/components/responses/security.reload_transport_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -5185,6 +5787,9 @@ paths: operationId: security.get_tenancy_config.0 x-operation-group: security.get_tenancy_config x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api @@ -5203,6 +5808,9 @@ paths: operationId: security.create_update_tenancy_config.0 x-operation-group: security.create_update_tenancy_config x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api @@ -5224,6 +5832,9 @@ paths: operationId: security.get_tenants.0 x-operation-group: security.get_tenants x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves all tenants. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenants @@ -5242,6 +5853,9 @@ paths: operationId: security.patch_tenants.0 x-operation-group: security.patch_tenants x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Add, delete, or modify multiple tenants in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenants @@ -5263,6 +5877,9 @@ paths: operationId: security.delete_tenant.0 x-operation-group: security.delete_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group @@ -5282,6 +5899,9 @@ paths: operationId: security.get_tenant.0 x-operation-group: security.get_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenant @@ -5299,6 +5919,9 @@ paths: operationId: security.patch_tenant.0 x-operation-group: security.patch_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Add, delete, or modify a single tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenant @@ -5320,6 +5943,9 @@ paths: operationId: security.create_tenant.0 x-operation-group: security.create_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-tenant @@ -5335,6 +5961,8 @@ paths: responses: '200': $ref: '#/components/responses/security.create_tenant@200' + '201': + $ref: '#/components/responses/security.create_tenant@201' '400': $ref: '#/components/responses/security.create_tenant@400' /_plugins/_security/api/user: @@ -5342,6 +5970,9 @@ paths: operationId: security.get_users_legacy.0 x-operation-group: security.get_users_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve all internal users. Legacy API. responses: '200': @@ -5357,6 +5988,9 @@ paths: operationId: security.delete_user_legacy.0 x-operation-group: security.delete_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified user. Legacy API. parameters: - $ref: '#/components/parameters/security.delete_user_legacy::path.username' @@ -5372,6 +6006,9 @@ paths: operationId: security.get_user_legacy.0 x-operation-group: security.get_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve one user. Legacy API. parameters: - $ref: '#/components/parameters/security.get_user_legacy::path.username' @@ -5387,6 +6024,9 @@ paths: operationId: security.create_user_legacy.0 x-operation-group: security.create_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified user. Legacy API. parameters: - $ref: '#/components/parameters/security.create_user_legacy::path.username' @@ -5400,12 +6040,17 @@ paths: responses: '200': $ref: '#/components/responses/security.create_user_legacy@200' + '201': + $ref: '#/components/responses/security.create_user_legacy@201' /_plugins/_security/api/user/{username}/authtoken: post: operationId: security.generate_user_token_legacy.0 x-operation-group: security.generate_user_token_legacy - x-version-added: '1.0' - description: Generates authorization token for the given user. Legacy API. + x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless + description: Generates authorization token for the given user. Legacy API. Not Implemented. parameters: - $ref: '#/components/parameters/security.generate_user_token_legacy::path.username' - $ref: '#/components/parameters/_global::query.pretty' @@ -5414,15 +6059,16 @@ paths: - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' responses: - '200': - $ref: '#/components/responses/security.generate_user_token_legacy@200' - '400': - $ref: '#/components/responses/security.generate_user_token_legacy@400' + '501': + $ref: '#/components/responses/security.generate_user_token_legacy@501' /_plugins/_security/api/validate: get: operationId: security.validate.0 x-operation-group: security.validate x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks whether the v6 security configuration is valid and ready to be migrated to v7. parameters: - $ref: '#/components/parameters/security.validate::query.accept_invalid' @@ -5441,6 +6087,9 @@ paths: operationId: security.authinfo.0 x-operation-group: security.authinfo x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authentication information. parameters: - $ref: '#/components/parameters/security.authinfo::query.auth_type' @@ -5459,6 +6108,9 @@ paths: operationId: security.authinfo.1 x-operation-group: security.authinfo x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authentication information. parameters: - $ref: '#/components/parameters/security.authinfo::query.auth_type' @@ -5478,6 +6130,9 @@ paths: operationId: security.get_dashboards_info.0 x-operation-group: security.get_dashboards_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the current security-dashboards plugin configuration. responses: '200': @@ -5494,9 +6149,10 @@ paths: operationId: security.post_dashboards_info.1 x-operation-group: security.post_dashboards_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the current security-dashboards plugin configuration. - requestBody: - $ref: '#/components/requestBodies/security.post_dashboards_info' responses: '200': $ref: '#/components/responses/security.post_dashboards_info@200' @@ -5513,6 +6169,9 @@ paths: operationId: security.health.0 x-operation-group: security.health x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks to see if the Security plugin is up and running. parameters: - $ref: '#/components/parameters/security.health::query.mode' @@ -5530,6 +6189,9 @@ paths: operationId: security.health.1 x-operation-group: security.health x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks to see if the Security plugin is up and running. parameters: - $ref: '#/components/parameters/security.health::query.mode' @@ -5548,10 +6210,15 @@ paths: operationId: security.tenant_info.0 x-operation-group: security.tenant_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. responses: '200': $ref: '#/components/responses/security.tenant_info@200' + '403': + $ref: '#/components/responses/security.tenant_info@403' '500': $ref: '#/components/responses/security.tenant_info@500' parameters: @@ -5564,10 +6231,15 @@ paths: operationId: security.tenant_info.1 x-operation-group: security.tenant_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. responses: '200': $ref: '#/components/responses/security.tenant_info@200' + '403': + $ref: '#/components/responses/security.tenant_info@403' '500': $ref: '#/components/responses/security.tenant_info@500' parameters: @@ -5580,7 +6252,10 @@ paths: get: operationId: security.who_am_i.0 x-operation-group: security.who_am_i - x-version-added: '1.0' + x-version-added: '2.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Gets the user identity related information for currently logged in user. responses: '200': @@ -5596,7 +6271,10 @@ paths: post: operationId: security.who_am_i.1 x-operation-group: security.who_am_i - x-version-added: '1.0' + x-version-added: '2.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Gets the user identity related information for currently logged in user. responses: '200': @@ -5614,6 +6292,9 @@ paths: operationId: security.who_am_i_protected.0 x-operation-group: security.who_am_i_protected x-version-added: '2.11' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Gets the user identity related information for currently logged in user. User needs to have access to this endpoint when authorization at REST layer is enabled. responses: '200': @@ -5864,7 +6545,7 @@ paths: operationId: transforms.stop.0 x-operation-group: transforms.stop x-version-added: '1.0' - description: stop transform. + description: Stop transform. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/index-transforms/transforms-apis/#stop-a-transform-job parameters: @@ -6429,6 +7110,10 @@ paths: responses: '200': $ref: '#/components/responses/search@200' + '400': + $ref: '#/components/responses/search@400' + '404': + $ref: '#/components/responses/search@404' post: operationId: search.1 x-operation-group: search @@ -6493,6 +7178,10 @@ paths: responses: '200': $ref: '#/components/responses/search@200' + '400': + $ref: '#/components/responses/search@400' + '404': + $ref: '#/components/responses/search@404' /_search_shards: get: operationId: search_shards.0 @@ -6863,6 +7552,9 @@ paths: operationId: indices.segments.0 x-operation-group: indices.segments x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Provides low-level information about segments in a Lucene index. externalDocs: url: https://opensearch.org/docs/latest @@ -6884,6 +7576,9 @@ paths: operationId: indices.get_settings.0 x-operation-group: indices.get_settings x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns settings for one or more indices. externalDocs: url: https://opensearch.org/docs/latest/api-reference/index-apis/get-settings/ @@ -7892,6 +8587,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.get_alias@200' + '404': + $ref: '#/components/responses/indices.get_alias@404' put: operationId: indices.put_alias.5 x-operation-group: indices.put_alias @@ -7958,6 +8655,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.get_alias@200' + '404': + $ref: '#/components/responses/indices.get_alias@404' head: operationId: indices.exists_alias.1 x-operation-group: indices.exists_alias @@ -7980,6 +8679,8 @@ paths: responses: '200': $ref: '#/components/responses/indices.exists_alias@200' + '404': + $ref: '#/components/responses/indices.exists_alias@404' post: operationId: indices.put_alias.6 x-operation-group: indices.put_alias @@ -9417,6 +10118,10 @@ paths: responses: '200': $ref: '#/components/responses/search@200' + '400': + $ref: '#/components/responses/search@400' + '404': + $ref: '#/components/responses/search@404' post: operationId: search.3 x-operation-group: search @@ -9482,6 +10187,10 @@ paths: responses: '200': $ref: '#/components/responses/search@200' + '400': + $ref: '#/components/responses/search@400' + '404': + $ref: '#/components/responses/search@404' /{index}/_search_shards: get: operationId: search_shards.2 @@ -9622,6 +10331,9 @@ paths: operationId: indices.segments.1 x-operation-group: indices.segments x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Provides low-level information about segments in a Lucene index. externalDocs: url: https://opensearch.org/docs/latest @@ -10343,6 +11055,95 @@ paths: $ref: '#/components/responses/knn.stats@200' deprecated: true x-ignorable: true + /_opendistro/_ppl: + post: + operationId: ppl.query.0_superseded + x-operation-group: ppl.query + x-version-added: '1.0' + description: Send a PPL query to the PPL plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.query::query.format' + - $ref: '#/components/parameters/ppl.query::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.query' + responses: + '200': + $ref: '#/components/responses/ppl.query@200' + deprecated: true + x-ignorable: true + /_opendistro/_ppl/_explain: + post: + operationId: ppl.explain.0_superseded + x-operation-group: ppl.explain + x-version-added: '1.0' + description: Shows how a query is executed against OpenSearch. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.explain::query.format' + - $ref: '#/components/parameters/ppl.explain::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.explain' + responses: + '200': + $ref: '#/components/responses/ppl.explain@200' + deprecated: true + x-ignorable: true + /_opendistro/_ppl/stats: + get: + operationId: ppl.get_stats.0_superseded + x-operation-group: ppl.get_stats + x-version-added: '1.0' + description: Collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.get_stats::query.format' + - $ref: '#/components/parameters/ppl.get_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ppl.get_stats@200' + deprecated: true + x-ignorable: true + post: + operationId: ppl.post_stats.1_superseded + x-operation-group: ppl.post_stats + x-version-added: '1.0' + description: By a stats endpoint, you are able to collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.post_stats::query.format' + - $ref: '#/components/parameters/ppl.post_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ppl.post_stats' + responses: + '200': + $ref: '#/components/responses/ppl.post_stats@200' + deprecated: true + x-ignorable: true /_opendistro/_rollup/jobs/{rollupID}: get: operationId: rollups.get.0_superseded @@ -10470,6 +11271,9 @@ paths: operationId: security.get_account_details.0_superseded x-operation-group: security.get_account_details x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns account details for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-account-details @@ -10488,6 +11292,9 @@ paths: operationId: security.change_password.0_superseded x-operation-group: security.change_password x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Changes the password for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#change-password @@ -10496,6 +11303,8 @@ paths: responses: '200': $ref: '#/components/responses/security.change_password@200' + '403': + $ref: '#/components/responses/security.change_password@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -10509,6 +11318,9 @@ paths: operationId: security.get_action_group.0_superseded x-operation-group: security.get_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-action-group @@ -10528,6 +11340,9 @@ paths: operationId: security.create_action_group.0_superseded x-operation-group: security.create_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-action-group @@ -10543,12 +11358,17 @@ paths: responses: '200': $ref: '#/components/responses/security.create_action_group@200' + '201': + $ref: '#/components/responses/security.create_action_group@201' deprecated: true x-ignorable: true patch: operationId: security.patch_action_group.0_superseded x-operation-group: security.patch_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of an action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-group @@ -10570,6 +11390,9 @@ paths: operationId: security.delete_action_group.0_superseded x-operation-group: security.delete_action_group x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete a specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group @@ -10590,6 +11413,9 @@ paths: operationId: security.update_audit_configuration.0_superseded x-operation-group: security.update_audit_configuration x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the audit configuration. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#audit-logs @@ -10611,6 +11437,9 @@ paths: operationId: security.authtoken.0_superseded x-operation-group: security.authtoken x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authorization token. responses: '200': @@ -10629,6 +11458,9 @@ paths: x-operation-group: security.cache x-ignorable: true x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Not supported for cache API. responses: '501': @@ -10644,6 +11476,9 @@ paths: operationId: security.cache.2_superseded x-operation-group: security.cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless x-ignorable: true description: Not supported for cache API. responses: @@ -10660,6 +11495,9 @@ paths: operationId: security.cache.3_superseded x-operation-group: security.cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless x-ignorable: true description: Not supported for cache API. responses: @@ -10676,6 +11514,9 @@ paths: operationId: security.flush_cache.0_superseded x-operation-group: security.flush_cache x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Flushes the Security plugin user, authentication, and authorization cache. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#flush-cache @@ -10695,6 +11536,9 @@ paths: operationId: security.get_user.0_superseded x-operation-group: security.get_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve one internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-user @@ -10714,6 +11558,9 @@ paths: operationId: security.create_user.0_superseded x-operation-group: security.create_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-user @@ -10735,6 +11582,9 @@ paths: operationId: security.patch_user.0_superseded x-operation-group: security.patch_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of an internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-user @@ -10756,6 +11606,9 @@ paths: operationId: security.delete_user.0_superseded x-operation-group: security.delete_user x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-user @@ -10775,7 +11628,10 @@ paths: post: operationId: security.generate_user_token.0_superseded x-operation-group: security.generate_user_token - x-version-added: '1.0' + x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Generates authorization token for the given user. parameters: - $ref: '#/components/parameters/security.generate_user_token::path.username' @@ -10796,6 +11652,9 @@ paths: operationId: security.migrate.0_superseded x-operation-group: security.migrate x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Migrates security configuration from v6 to v7. responses: '200': @@ -10815,6 +11674,9 @@ paths: operationId: security.get_permissions_info.0_superseded x-operation-group: security.get_permissions_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Gets the evaluated REST API permissions for the currently logged in user. responses: '200': @@ -10834,6 +11696,9 @@ paths: operationId: security.get_role.0_superseded x-operation-group: security.get_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role @@ -10853,6 +11718,9 @@ paths: operationId: security.create_role.0_superseded x-operation-group: security.create_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-role @@ -10868,12 +11736,17 @@ paths: responses: '200': $ref: '#/components/responses/security.create_role@200' + '201': + $ref: '#/components/responses/security.create_role@201' deprecated: true x-ignorable: true patch: operationId: security.patch_role.0_superseded x-operation-group: security.patch_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of a role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role @@ -10897,6 +11770,9 @@ paths: operationId: security.delete_role.0_superseded x-operation-group: security.delete_role x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role @@ -10917,6 +11793,9 @@ paths: operationId: security.get_role_mapping.0_superseded x-operation-group: security.get_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role-mapping @@ -10936,6 +11815,9 @@ paths: operationId: security.create_role_mapping.0_superseded x-operation-group: security.create_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-role-mapping @@ -10951,12 +11833,17 @@ paths: responses: '200': $ref: '#/components/responses/security.create_role_mapping@200' + '201': + $ref: '#/components/responses/security.create_role_mapping@201' deprecated: true x-ignorable: true patch: operationId: security.patch_role_mapping.0_superseded x-operation-group: security.patch_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates individual attributes of a role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mapping @@ -10980,6 +11867,9 @@ paths: operationId: security.delete_role_mapping.0_superseded x-operation-group: security.delete_role_mapping x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Deletes the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role-mapping @@ -10999,7 +11889,10 @@ paths: get: operationId: security.get_configuration.0_superseded x-operation-group: security.get_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the current Security plugin configuration in JSON format. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-configuration @@ -11017,7 +11910,10 @@ paths: patch: operationId: security.patch_configuration.0_superseded x-operation-group: security.patch_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: A PATCH call is used to update the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-configuration @@ -11026,6 +11922,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_configuration@200' + '403': + $ref: '#/components/responses/security.patch_configuration@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11038,7 +11936,10 @@ paths: put: operationId: security.update_configuration.0_superseded x-operation-group: security.update_configuration - x-version-added: '1.0' + x-version-added: '2.10' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Adds or updates the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-configuration @@ -11047,6 +11948,8 @@ paths: responses: '200': $ref: '#/components/responses/security.update_configuration@200' + '403': + $ref: '#/components/responses/security.update_configuration@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11059,7 +11962,10 @@ paths: get: operationId: security.get_certificates.0_superseded x-operation-group: security.get_certificates - x-version-added: '1.0' + x-version-added: '2.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the cluster security certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-certificates @@ -11068,6 +11974,8 @@ paths: $ref: '#/components/responses/security.get_certificates@200' '400': $ref: '#/components/responses/security.get_certificates@400' + '403': + $ref: '#/components/responses/security.get_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11080,7 +11988,10 @@ paths: put: operationId: security.reload_transport_certificates.0_superseded x-operation-group: security.reload_transport_certificates - x-version-added: '1.0' + x-version-added: '2.8' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Reload Transport layer communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-transport-certificates @@ -11089,6 +12000,8 @@ paths: $ref: '#/components/responses/security.reload_transport_certificates@200' '400': $ref: '#/components/responses/security.reload_transport_certificates@400' + '403': + $ref: '#/components/responses/security.reload_transport_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11101,7 +12014,10 @@ paths: put: operationId: security.reload_http_certificates.0_superseded x-operation-group: security.reload_http_certificates - x-version-added: '1.0' + x-version-added: '2.8' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Reload HTTP layer communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-http-certificates @@ -11110,6 +12026,8 @@ paths: $ref: '#/components/responses/security.reload_http_certificates@200' '400': $ref: '#/components/responses/security.reload_http_certificates@400' + '403': + $ref: '#/components/responses/security.reload_http_certificates@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11123,6 +12041,9 @@ paths: operationId: security.get_distinguished_name.0_superseded x-operation-group: security.get_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names @@ -11137,6 +12058,8 @@ paths: responses: '200': $ref: '#/components/responses/security.get_distinguished_name@200' + '400': + $ref: '#/components/responses/security.get_distinguished_name@400' '403': $ref: '#/components/responses/security.get_distinguished_name@403' deprecated: true @@ -11145,6 +12068,9 @@ paths: operationId: security.update_distinguished_name.0_superseded x-operation-group: security.update_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-distinguished-names @@ -11160,6 +12086,8 @@ paths: responses: '200': $ref: '#/components/responses/security.update_distinguished_name@200' + '400': + $ref: '#/components/responses/security.update_distinguished_name@400' '403': $ref: '#/components/responses/security.update_distinguished_name@403' deprecated: true @@ -11168,6 +12096,9 @@ paths: operationId: security.patch_distinguished_name.0_superseded x-operation-group: security.patch_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. parameters: - $ref: '#/components/parameters/security.patch_distinguished_name::path.cluster_name' @@ -11181,6 +12112,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_distinguished_name@200' + '400': + $ref: '#/components/responses/security.patch_distinguished_name@400' '403': $ref: '#/components/responses/security.patch_distinguished_name@403' deprecated: true @@ -11189,6 +12122,9 @@ paths: operationId: security.delete_distinguished_name.0_superseded x-operation-group: security.delete_distinguished_name x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-distinguished-names @@ -11202,6 +12138,8 @@ paths: responses: '200': $ref: '#/components/responses/security.delete_distinguished_name@200' + '400': + $ref: '#/components/responses/security.delete_distinguished_name@400' '403': $ref: '#/components/responses/security.delete_distinguished_name@403' deprecated: true @@ -11211,6 +12149,9 @@ paths: operationId: security.get_tenancy_config.0_superseded x-operation-group: security.get_tenancy_config x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api @@ -11231,6 +12172,9 @@ paths: operationId: security.create_update_tenancy_config.0_superseded x-operation-group: security.create_update_tenancy_config x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api @@ -11254,6 +12198,9 @@ paths: operationId: security.get_tenants.0_superseded x-operation-group: security.get_tenants x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves all tenants. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenants @@ -11274,6 +12221,9 @@ paths: operationId: security.patch_tenants.0_superseded x-operation-group: security.patch_tenants x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Add, delete, or modify multiple tenants in a single call. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenants @@ -11297,6 +12247,9 @@ paths: operationId: security.get_tenant.0_superseded x-operation-group: security.get_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves one tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenant @@ -11316,6 +12269,9 @@ paths: operationId: security.create_tenant.0_superseded x-operation-group: security.create_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#create-tenant @@ -11331,6 +12287,8 @@ paths: responses: '200': $ref: '#/components/responses/security.create_tenant@200' + '201': + $ref: '#/components/responses/security.create_tenant@201' '400': $ref: '#/components/responses/security.create_tenant@400' deprecated: true @@ -11339,6 +12297,9 @@ paths: operationId: security.patch_tenant.0_superseded x-operation-group: security.patch_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Add, delete, or modify a single tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenant @@ -11362,6 +12323,9 @@ paths: operationId: security.delete_tenant.0_superseded x-operation-group: security.delete_tenant x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group @@ -11384,6 +12348,9 @@ paths: operationId: security.get_users_legacy.0_superseded x-operation-group: security.get_users_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve all internal users. Legacy API. responses: '200': @@ -11401,6 +12368,9 @@ paths: operationId: security.get_user_legacy.0_superseded x-operation-group: security.get_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieve one user. Legacy API. parameters: - $ref: '#/components/parameters/security.get_user_legacy::path.username' @@ -11418,6 +12388,9 @@ paths: operationId: security.create_user_legacy.0_superseded x-operation-group: security.create_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the specified user. Legacy API. parameters: - $ref: '#/components/parameters/security.create_user_legacy::path.username' @@ -11431,12 +12404,17 @@ paths: responses: '200': $ref: '#/components/responses/security.create_user_legacy@200' + '201': + $ref: '#/components/responses/security.create_user_legacy@201' deprecated: true x-ignorable: true delete: operationId: security.delete_user_legacy.0_superseded x-operation-group: security.delete_user_legacy x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Delete the specified user. Legacy API. parameters: - $ref: '#/components/parameters/security.delete_user_legacy::path.username' @@ -11454,8 +12432,11 @@ paths: post: operationId: security.generate_user_token_legacy.0_superseded x-operation-group: security.generate_user_token_legacy - x-version-added: '1.0' - description: Generates authorization token for the given user. Legacy API. + x-version-added: '2.7' + x-distributions-excluded: + - amazon-managed + - amazon-serverless + description: Generates authorization token for the given user. Legacy API. Not Implemented. parameters: - $ref: '#/components/parameters/security.generate_user_token_legacy::path.username' - $ref: '#/components/parameters/_global::query.pretty' @@ -11464,10 +12445,8 @@ paths: - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' responses: - '200': - $ref: '#/components/responses/security.generate_user_token_legacy@200' - '400': - $ref: '#/components/responses/security.generate_user_token_legacy@400' + '501': + $ref: '#/components/responses/security.generate_user_token_legacy@501' deprecated: true x-ignorable: true /_opendistro/_security/api/validate: @@ -11475,6 +12454,9 @@ paths: operationId: security.validate.0_superseded x-operation-group: security.validate x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks whether the v6 security configuration is valid and ready to be migrated to v7. parameters: - $ref: '#/components/parameters/security.validate::query.accept_invalid' @@ -11494,13 +12476,18 @@ paths: get: operationId: security.get_allowlist.0_superseded x-operation-group: security.get_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the current list of allowed API accessible to normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api responses: '200': $ref: '#/components/responses/security.get_allowlist@200' + '403': + $ref: '#/components/responses/security.get_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11512,7 +12499,10 @@ paths: put: operationId: security.create_allowlist.0_superseded x-operation-group: security.create_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Creates or replaces the allowlisted APIs. Accessible via Super Admin certificate or REST API permission. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api @@ -11521,6 +12511,8 @@ paths: responses: '200': $ref: '#/components/responses/security.create_allowlist@200' + '403': + $ref: '#/components/responses/security.create_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11532,7 +12524,10 @@ paths: patch: operationId: security.patch_allowlist.0_superseded x-operation-group: security.patch_allowlist - x-version-added: '1.0' + x-version-added: '2.1' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the current list of allowed API accessible to normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api @@ -11541,6 +12536,8 @@ paths: responses: '200': $ref: '#/components/responses/security.patch_allowlist@200' + '403': + $ref: '#/components/responses/security.patch_allowlist@403' parameters: - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' @@ -11554,6 +12551,9 @@ paths: operationId: security.authinfo.0_superseded x-operation-group: security.authinfo x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authentication information. parameters: - $ref: '#/components/parameters/security.authinfo::query.auth_type' @@ -11574,6 +12574,9 @@ paths: operationId: security.authinfo.1_superseded x-operation-group: security.authinfo x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Returns the authentication information. parameters: - $ref: '#/components/parameters/security.authinfo::query.auth_type' @@ -11595,6 +12598,9 @@ paths: operationId: security.health.0_superseded x-operation-group: security.health x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks to see if the Security plugin is up and running. parameters: - $ref: '#/components/parameters/security.health::query.mode' @@ -11614,6 +12620,9 @@ paths: operationId: security.health.1_superseded x-operation-group: security.health x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Checks to see if the Security plugin is up and running. parameters: - $ref: '#/components/parameters/security.health::query.mode' @@ -11634,6 +12643,9 @@ paths: operationId: security.get_dashboards_info.0_superseded x-operation-group: security.get_dashboards_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the current security-dashboards plugin configuration. responses: '200': @@ -11652,9 +12664,10 @@ paths: operationId: security.post_dashboards_info.1_superseded x-operation-group: security.post_dashboards_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Updates the current security-dashboards plugin configuration. - requestBody: - $ref: '#/components/requestBodies/security.post_dashboards_info' responses: '200': $ref: '#/components/responses/security.post_dashboards_info@200' @@ -11673,10 +12686,15 @@ paths: operationId: security.tenant_info.0_superseded x-operation-group: security.tenant_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. responses: '200': $ref: '#/components/responses/security.tenant_info@200' + '403': + $ref: '#/components/responses/security.tenant_info@403' '500': $ref: '#/components/responses/security.tenant_info@500' parameters: @@ -11691,10 +12709,15 @@ paths: operationId: security.tenant_info.1_superseded x-operation-group: security.tenant_info x-version-added: '1.0' + x-distributions-excluded: + - amazon-managed + - amazon-serverless description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. responses: '200': $ref: '#/components/responses/security.tenant_info@200' + '403': + $ref: '#/components/responses/security.tenant_info@403' '500': $ref: '#/components/responses/security.tenant_info@500' parameters: @@ -11774,6 +12797,28 @@ paths: $ref: '#/components/responses/sql.close@200' deprecated: true x-ignorable: true + /_opendistro/_sql/settings: + put: + operationId: sql.settings.0_superseded + x-operation-group: sql.settings + x-version-added: '1.0' + description: Adds SQL settings to the standard OpenSearch cluster settings. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/settings/ + parameters: + - $ref: '#/components/parameters/sql.settings::query.format' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.settings' + responses: + '200': + $ref: '#/components/responses/sql.settings@200' + deprecated: true + x-ignorable: true /_opendistro/_sql/stats: get: operationId: sql.get_stats.0_superseded @@ -18991,6 +20036,12 @@ components: required: true schema: type: string + ml.deploy_model::path.model_id: + name: model_id + in: path + required: true + schema: + type: string ml.get_model_group::path.model_group_id: name: model_group_id in: path @@ -19003,6 +20054,12 @@ components: required: true schema: type: string + ml.undeploy_model::path.model_id: + name: model_id + in: path + required: true + schema: + type: string msearch_template::path.index: in: path name: index @@ -19689,6 +20746,98 @@ components: schema: type: string required: true + observability.delete_object::path.object_id: + in: path + name: object_id + description: The ID of the Observability Object. + required: true + schema: + type: string + style: simple + observability.delete_objects::query.objectId: + in: query + name: objectId + description: The ID of a single Observability Object to delete. + required: false + schema: + type: string + style: form + observability.delete_objects::query.objectIdList: + in: query + name: objectIdList + description: A comma-separated list of Observability Object IDs to delete. + required: false + schema: + type: string + style: form + observability.get_object::path.object_id: + in: path + name: object_id + description: The ID of the Observability Object. + required: true + schema: + type: string + style: simple + observability.update_object::path.object_id: + in: path + name: object_id + description: The ID of the Observability Object. + required: true + schema: + type: string + style: simple + ppl.explain::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + ppl.explain::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results. + schema: + type: boolean + default: true + ppl.get_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + ppl.get_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results. + schema: + type: boolean + default: true + ppl.post_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + ppl.post_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results. + schema: + type: boolean + default: true + ppl.query::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + ppl.query::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results. + schema: + type: boolean + default: true put_script::path.context: in: path name: context @@ -19737,6 +20886,20 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form + query.datasource_delete::path.datasource_name: + name: datasource_name + in: path + description: The Name of the DataSource to delete. + schema: + type: string + required: true + query.datasource_retrieve::path.datasource_name: + name: datasource_name + in: path + description: The Name of the DataSource to retrieve. + schema: + type: string + required: true rank_eval::path.index: in: path name: index @@ -20662,120 +21825,168 @@ components: description: The name of the action group to create or replace. schema: type: string - description: The name of the action group to create or replace. required: true security.create_role_mapping::path.role: name: role in: path + description: The name of the role to create a role mapping for. schema: type: string required: true security.create_role::path.role: name: role in: path + description: The name of the role to be created. schema: type: string required: true security.create_tenant::path.tenant: name: tenant in: path + description: The name of the tenant to be created. schema: type: string required: true security.create_user_legacy::path.username: name: username in: path + description: The name of the user to be created. schema: type: string required: true security.create_user::path.username: name: username in: path + description: The name of the user to be created. schema: type: string required: true security.delete_action_group::path.action_group: name: action_group in: path - description: Action group to delete. + description: The name of the action group to delete. schema: type: string - description: Action group to delete. required: true security.delete_distinguished_name::path.cluster_name: name: cluster_name in: path + description: The cluster-name to delete from list of distinguished names. schema: type: string required: true security.delete_role_mapping::path.role: name: role in: path + description: The name of the role whose mapping needs to delete. schema: type: string required: true security.delete_role::path.role: name: role in: path + description: The name of the role to delete. schema: type: string required: true security.delete_tenant::path.tenant: name: tenant in: path + description: The name of the tenant to delete. schema: type: string required: true security.delete_user_legacy::path.username: name: username in: path + description: The name of the user to delete. schema: type: string required: true security.delete_user::path.username: name: username in: path + description: The name of the user to delete. schema: type: string required: true security.generate_user_token_legacy::path.username: name: username in: path + description: The name of the user for whom an auth token is to be vended. schema: type: string required: true security.generate_user_token::path.username: name: username in: path + description: The name of the user for whom an auth token is to be vended. schema: type: string required: true security.get_action_group::path.action_group: name: action_group in: path - description: Action group to retrieve. + description: The name of the action group to retrieve. schema: type: string - description: Action group to retrieve. required: true + security.get_all_certificates::query.cert_type: + name: cert_type + in: query + description: The type of certificates (HTTP, TRANSPORT, ALL) to retrieve from all nodes. + schema: + type: string + required: false + security.get_all_certificates::query.timeout: + name: timeout + in: query + description: The maximum duration, in seconds, to be spent to retrieve certificates from all nodes. + schema: + $ref: '#/components/schemas/_common:Duration' + required: false security.get_distinguished_name::path.cluster_name: name: cluster_name in: path + description: The cluster-name to retrieve nodes DN setting for. schema: type: string required: true security.get_distinguished_name::query.show_all: name: show_all in: query + description: A boolean flag to include/exclude static nodes DN from final result. schema: type: boolean required: false security.get_distinguished_names::query.show_all: name: show_all in: query + description: A boolean flag to include/exclude static nodes DN from final result. schema: type: boolean required: false + security.get_node_certificates::path.node_id: + name: node_id + in: path + description: The full-id of the node to retrieve certificates. + schema: + type: string + required: true + security.get_node_certificates::query.cert_type: + name: cert_type + in: query + description: The type of certificates (HTTP, TRANSPORT, ALL) to retrieve for a node. + schema: + type: string + required: false + security.get_node_certificates::query.timeout: + name: timeout + in: query + description: The maximum duration, in seconds, to be spent to retrieve a node's certificates. + schema: + $ref: '#/components/schemas/_common:Duration' + required: false security.get_role_mapping::path.role: name: role in: path @@ -20791,80 +22002,93 @@ components: security.get_sslinfo::query.show_dn: name: show_dn in: query - description: The domain names from all certificates. + description: A boolean flag to indicate whether all domain names should be returned. schema: - type: string - description: A boolean flag to indicate whether all domain names should be returned. + type: + - boolean + - string required: false security.get_tenant::path.tenant: name: tenant in: path + description: The name of the tenant to retrieve. schema: type: string required: true security.get_user_legacy::path.username: name: username in: path + description: The name of the user to retrieve. schema: type: string required: true security.get_user::path.username: name: username in: path + description: The name of the user to retrieve. schema: type: string required: true security.health::query.mode: name: mode in: query + description: A flag to indicate whether service should consider security-plugin's status before returning health response. `strict` mode indicates service should check security plugin status. schema: type: string required: false security.patch_action_group::path.action_group: name: action_group in: path + description: The name of the action group to update. schema: type: string required: true security.patch_distinguished_name::path.cluster_name: name: cluster_name in: path + description: The cluster-name to update nodesDn value. schema: type: string required: true security.patch_role_mapping::path.role: name: role in: path + description: The name of the role to update role-mapping for. schema: type: string required: true security.patch_role::path.role: name: role in: path + description: The name of the role to update. schema: type: string required: true security.patch_tenant::path.tenant: name: tenant in: path + description: The name of the tenant to update. schema: type: string required: true security.patch_user::path.username: name: username in: path + description: The name of the user to update. schema: type: string required: true security.update_distinguished_name::path.cluster_name: name: cluster_name in: path + description: The cluster-name to create/update nodesDn value for. schema: type: string required: true security.validate::query.accept_invalid: name: accept_invalid in: query + description: A boolean flag to indicate whether invalid v6 configuration should be allowed. schema: type: boolean required: false @@ -21290,7 +22514,6 @@ components: description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. sql.close::query.sanitize: name: sanitize in: query @@ -21298,14 +22521,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results sql.explain::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. sql.explain::query.sanitize: name: sanitize in: query @@ -21313,14 +22534,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results sql.get_stats::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. sql.get_stats::query.sanitize: name: sanitize in: query @@ -21328,14 +22547,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results sql.post_stats::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. sql.post_stats::query.sanitize: name: sanitize in: query @@ -21343,14 +22560,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results sql.query::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. sql.query::query.sanitize: name: sanitize in: query @@ -21358,7 +22573,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results + sql.settings::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string tasks.cancel::path.task_id: in: path name: task_id @@ -22810,7 +24030,8 @@ components: ml.search_models: content: application/json: - $ref: '#/components/schemas/ml._common:SearchModelsQuery' + schema: + $ref: '#/components/schemas/ml._common:SearchModelsQuery' msearch: content: application/x-ndjson: @@ -22887,6 +24108,34 @@ components: schema: $ref: '#/components/schemas/notifications._common:NotificationsConfig' required: true + observability.create_object: + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:ObservabilityObject' + observability.update_object: + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:ObservabilityObject' + ppl.explain: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:Explain' + required: true + ppl.post_stats: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:Stats' + required: true + ppl.query: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:Query' + required: true put_script: content: application/json: @@ -22899,6 +24148,16 @@ components: - script description: The document required: true + query.datasources_create: + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSource' + query.datasources_update: + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSource' rank_eval: content: application/json: @@ -22956,7 +24215,6 @@ components: examples: RemoteStoreRestore_example1: summary: Examples for Post Remote Storage Restore Operation. - description: '' value: indices: - books @@ -23243,9 +24501,7 @@ components: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/security._common:MultiTenancyConfig' + $ref: '#/components/schemas/security._common:MultiTenancyConfig' required: true security.create_user: content: @@ -23382,12 +24638,6 @@ components: items: $ref: '#/components/schemas/security._common:PatchOperation' required: true - security.post_dashboards_info: - content: - application/json: - schema: - $ref: '#/components/schemas/security._common:DashboardsInfo' - required: false security.update_audit_configuration: content: application/json: @@ -23404,7 +24654,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/security._common:PatchOperation' + $ref: '#/components/schemas/security._common:DistinguishedNames' snapshot.clone: content: application/json: @@ -23500,19 +24750,27 @@ components: content: application/json: schema: - $ref: '#/components/schemas/sql._common:SqlExplain' + $ref: '#/components/schemas/sql._common:Explain' required: true sql.post_stats: content: application/json: schema: - $ref: '#/components/schemas/sql._common:SqlStats' + $ref: '#/components/schemas/sql._common:Stats' required: true sql.query: content: application/json: schema: - $ref: '#/components/schemas/sql._common:SqlQuery' + $ref: '#/components/schemas/sql._common:Query' + required: true + sql.settings: + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/sql._common:SqlSettingsPlain' + - $ref: '#/components/schemas/sql._common:SqlSettings' required: true termvectors: content: @@ -23587,7 +24845,6 @@ components: description: The search definition using the Query DSL responses: bulk@200: - description: '' content: application/json: schema: @@ -23612,7 +24869,6 @@ components: - items - took cat.aliases@200: - description: '' content: text/plain: type: string @@ -23622,7 +24878,6 @@ components: items: $ref: '#/components/schemas/cat.aliases:AliasesRecord' cat.all_pit_segments@200: - description: '' content: text/plain: type: string @@ -23632,7 +24887,6 @@ components: items: $ref: '#/components/schemas/cat._common:CatPitSegmentsRecord' cat.allocation@200: - description: '' content: text/plain: type: string @@ -23642,7 +24896,6 @@ components: items: $ref: '#/components/schemas/cat.allocation:AllocationRecord' cat.cluster_manager@200: - description: '' content: text/plain: type: string @@ -23652,7 +24905,6 @@ components: items: $ref: '#/components/schemas/cat.cluster_manager:ClusterManagerRecord' cat.count@200: - description: '' content: text/plain: type: string @@ -23662,7 +24914,6 @@ components: items: $ref: '#/components/schemas/cat.count:CountRecord' cat.fielddata@200: - description: '' content: text/plain: type: string @@ -23672,7 +24923,6 @@ components: items: $ref: '#/components/schemas/cat.fielddata:FielddataRecord' cat.health@200: - description: '' content: text/plain: type: string @@ -23697,13 +24947,11 @@ components: items: $ref: '#/components/schemas/cat.health:HealthRecord' cat.help@200: - description: '' content: text/plain: schema: type: string cat.indices@200: - description: '' content: text/plain: type: string @@ -23728,7 +24976,6 @@ components: items: $ref: '#/components/schemas/cat.indices:IndicesRecord' cat.master@200: - description: '' content: text/plain: type: string @@ -23738,7 +24985,6 @@ components: items: $ref: '#/components/schemas/cat.master:MasterRecord' cat.nodeattrs@200: - description: '' content: text/plain: type: string @@ -23748,7 +24994,6 @@ components: items: $ref: '#/components/schemas/cat.nodeattrs:NodeAttributesRecord' cat.nodes@200: - description: '' content: text/plain: type: string @@ -23758,7 +25003,6 @@ components: items: $ref: '#/components/schemas/cat.nodes:NodesRecord' cat.pending_tasks@200: - description: '' content: text/plain: type: string @@ -23768,7 +25012,6 @@ components: items: $ref: '#/components/schemas/cat.pending_tasks:PendingTasksRecord' cat.pit_segments@200: - description: '' content: text/plain: type: string @@ -23778,7 +25021,6 @@ components: items: $ref: '#/components/schemas/cat._common:CatPitSegmentsRecord' cat.plugins@200: - description: '' content: text/plain: type: string @@ -23788,7 +25030,6 @@ components: items: $ref: '#/components/schemas/cat.plugins:PluginsRecord' cat.recovery@200: - description: '' content: text/plain: type: string @@ -23798,7 +25039,6 @@ components: items: $ref: '#/components/schemas/cat.recovery:RecoveryRecord' cat.repositories@200: - description: '' content: text/plain: type: string @@ -23808,7 +25048,6 @@ components: items: $ref: '#/components/schemas/cat.repositories:RepositoriesRecord' cat.segment_replication@200: - description: '' content: text/plain: type: string @@ -23818,7 +25057,6 @@ components: items: $ref: '#/components/schemas/cat._common:CatSegmentReplicationRecord' cat.segments@200: - description: '' content: text/plain: type: string @@ -23828,7 +25066,6 @@ components: items: $ref: '#/components/schemas/cat.segments:SegmentsRecord' cat.shards@200: - description: '' content: text/plain: type: string @@ -23838,7 +25075,6 @@ components: items: $ref: '#/components/schemas/cat.shards:ShardsRecord' cat.snapshots@200: - description: '' content: text/plain: type: string @@ -23848,7 +25084,6 @@ components: items: $ref: '#/components/schemas/cat.snapshots:SnapshotsRecord' cat.tasks@200: - description: '' content: text/plain: type: string @@ -23858,7 +25093,6 @@ components: items: $ref: '#/components/schemas/cat.tasks:TasksRecord' cat.templates@200: - description: '' content: text/plain: type: string @@ -23868,7 +25102,6 @@ components: items: $ref: '#/components/schemas/cat.templates:TemplatesRecord' cat.thread_pool@200: - description: '' content: text/plain: type: string @@ -23878,7 +25111,6 @@ components: items: $ref: '#/components/schemas/cat.thread_pool:ThreadPoolRecord' clear_scroll@200: - description: '' content: application/json: schema: @@ -23892,7 +25124,6 @@ components: - num_freed - succeeded cluster.allocation_explain@200: - description: '' content: application/json: schema: @@ -23960,25 +25191,19 @@ components: - primary - shard cluster.delete_component_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' - cluster.delete_decommission_awareness@200: - description: '' + cluster.delete_decommission_awareness@200: {} cluster.delete_voting_config_exclusions@200: - description: '' content: application/json: {} - cluster.delete_weighted_routing@200: - description: '' + cluster.delete_weighted_routing@200: {} cluster.exists_component_template@200: - description: '' content: application/json: {} cluster.get_component_template@200: - description: '' content: application/json: schema: @@ -23990,10 +25215,8 @@ components: $ref: '#/components/schemas/cluster._common:ComponentTemplate' required: - component_templates - cluster.get_decommission_awareness@200: - description: '' + cluster.get_decommission_awareness@200: {} cluster.get_settings@200: - description: '' content: application/json: schema: @@ -24014,16 +25237,13 @@ components: required: - persistent - transient - cluster.get_weighted_routing@200: - description: '' + cluster.get_weighted_routing@200: {} cluster.health@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/cluster.health:HealthResponseBody' cluster.pending_tasks@200: - description: '' content: application/json: schema: @@ -24036,19 +25256,15 @@ components: required: - tasks cluster.post_voting_config_exclusions@200: - description: '' content: application/json: {} cluster.put_component_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' - cluster.put_decommission_awareness@200: - description: '' + cluster.put_decommission_awareness@200: {} cluster.put_settings@200: - description: '' content: application/json: schema: @@ -24066,10 +25282,8 @@ components: - acknowledged - persistent - transient - cluster.put_weighted_routing@200: - description: '' + cluster.put_weighted_routing@200: {} cluster.remote_info@200: - description: '' content: application/json: schema: @@ -24077,7 +25291,6 @@ components: additionalProperties: $ref: '#/components/schemas/cluster.remote_info:ClusterRemoteInfo' cluster.reroute@200: - description: '' content: application/json: schema: @@ -24098,19 +25311,16 @@ components: required: - acknowledged cluster.state@200: - description: '' content: application/json: schema: type: object cluster.stats@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/cluster.stats:StatsResponseBase' count@200: - description: '' content: application/json: schema: @@ -24124,7 +25334,6 @@ components: - _shards - count create_pit@200: - description: '' content: application/json: schema: @@ -24138,25 +25347,21 @@ components: type: integer format: int64 create@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:WriteResponseBase' dangling_indices.delete_dangling_index@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' dangling_indices.import_dangling_index@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' dangling_indices.list_dangling_indices@200: - description: '' content: application/json: schema: @@ -24173,7 +25378,6 @@ components: required: - dangling_indices delete_all_pits@200: - description: '' content: application/json: schema: @@ -24184,13 +25388,11 @@ components: items: $ref: '#/components/schemas/_core._common:PitsDetailsDeleteAll' delete_by_query_rethrottle@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/tasks._common:TaskListResponseBase' delete_by_query@200: - description: '' content: application/json: schema: @@ -24231,7 +25433,6 @@ components: version_conflicts: type: number delete_pit@200: - description: '' content: application/json: schema: @@ -24242,27 +25443,22 @@ components: items: $ref: '#/components/schemas/_core._common:DeletedPit' delete_script@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' delete@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:WriteResponseBase' exists_source@200: - description: '' content: application/json: {} exists@200: - description: '' content: application/json: {} explain@200: - description: '' content: application/json: schema: @@ -24283,7 +25479,6 @@ components: - _index - matched field_caps@200: - description: '' content: application/json: schema: @@ -24301,7 +25496,6 @@ components: - fields - indices get_all_pits@200: - description: '' content: application/json: schema: @@ -24312,7 +25506,6 @@ components: items: $ref: '#/components/schemas/_core._common:PitDetail' get_script_context@200: - description: '' content: application/json: schema: @@ -24325,7 +25518,6 @@ components: required: - contexts get_script_languages@200: - description: '' content: application/json: schema: @@ -24343,7 +25535,6 @@ components: - language_contexts - types_allowed get_script@200: - description: '' content: application/json: schema: @@ -24359,31 +25550,26 @@ components: - _id - found get_source@200: - description: '' content: application/json: schema: type: object get@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_core.get:GetResult' index@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:WriteResponseBase' index@201: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:WriteResponseBase' indices.add_block@200: - description: '' content: application/json: schema: @@ -24402,7 +25588,6 @@ components: - indices - shards_acknowledged indices.analyze@200: - description: '' content: application/json: schema: @@ -24415,13 +25600,11 @@ components: items: $ref: '#/components/schemas/indices.analyze:AnalyzeToken' indices.clear_cache@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:ShardsOperationResponseBase' indices.clone@200: - description: '' content: application/json: schema: @@ -24438,7 +25621,6 @@ components: - index - shards_acknowledged indices.close@200: - description: '' content: application/json: schema: @@ -24457,13 +25639,11 @@ components: - indices - shards_acknowledged indices.create_data_stream@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.create@200: - description: '' content: application/json: schema: @@ -24480,7 +25660,6 @@ components: - index - shards_acknowledged indices.data_streams_stats@200: - description: '' content: application/json: schema: @@ -24511,63 +25690,54 @@ components: - data_streams - total_store_size_bytes indices.delete_alias@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.delete_data_stream@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.delete_index_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.delete_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.delete@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:IndicesResponseBase' indices.exists_alias@200: - description: '' + content: + application/json: {} + indices.exists_alias@404: content: application/json: {} indices.exists_index_template@200: - description: '' content: application/json: {} indices.exists_template@200: - description: '' content: application/json: {} indices.exists@200: - description: '' content: application/json: {} indices.exists@404: - description: '' content: application/json: {} indices.flush@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:ShardsOperationResponseBase' indices.forcemerge@200: - description: '' content: application/json: schema: @@ -24581,15 +25751,16 @@ components: you can use the task_id to get the status of the task at _tasks/ type: string indices.get_alias@200: - description: '' content: application/json: schema: type: object additionalProperties: $ref: '#/components/schemas/indices.get_alias:IndexAliases' + indices.get_alias@404: + content: + application/json: {} indices.get_data_stream@200: - description: '' content: application/json: schema: @@ -24602,7 +25773,6 @@ components: required: - data_streams indices.get_field_mapping@200: - description: '' content: application/json: schema: @@ -24610,7 +25780,6 @@ components: additionalProperties: $ref: '#/components/schemas/indices.get_field_mapping:TypeFieldMappings' indices.get_index_template@200: - description: '' content: application/json: schema: @@ -24623,7 +25792,6 @@ components: required: - index_templates indices.get_mapping@200: - description: '' content: application/json: schema: @@ -24631,7 +25799,6 @@ components: additionalProperties: $ref: '#/components/schemas/indices.get_mapping:IndexMappingRecord' indices.get_settings@200: - description: '' content: application/json: schema: @@ -24639,17 +25806,14 @@ components: additionalProperties: $ref: '#/components/schemas/indices._common:IndexState' indices.get_template@200: - description: '' content: application/json: schema: type: object additionalProperties: $ref: '#/components/schemas/indices._common:TemplateMapping' - indices.get_upgrade@200: - description: '' + indices.get_upgrade@200: {} indices.get@200: - description: '' content: application/json: schema: @@ -24657,7 +25821,6 @@ components: additionalProperties: $ref: '#/components/schemas/indices._common:IndexState' indices.open@200: - description: '' content: application/json: schema: @@ -24678,37 +25841,31 @@ components: - shards_acknowledged additionalProperties: false indices.put_alias@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.put_index_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.put_mapping@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:IndicesResponseBase' indices.put_settings@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.put_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' indices.recovery@200: - description: '' content: application/json: schema: @@ -24716,13 +25873,11 @@ components: additionalProperties: $ref: '#/components/schemas/indices.recovery:RecoveryStatus' indices.refresh@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:ShardsOperationResponseBase' indices.resolve_index@200: - description: '' content: application/json: schema: @@ -24745,7 +25900,6 @@ components: - data_streams - indices indices.rollover@200: - description: '' content: application/json: schema: @@ -24776,7 +25930,6 @@ components: - rolled_over - shards_acknowledged indices.segments@200: - description: '' content: application/json: schema: @@ -24792,7 +25945,6 @@ components: - _shards - indices indices.shard_stores@200: - description: '' content: application/json: schema: @@ -24805,7 +25957,6 @@ components: required: - indices indices.shrink@200: - description: '' content: application/json: schema: @@ -24822,13 +25973,11 @@ components: - index - shards_acknowledged indices.simulate_index_template@200: - description: '' content: application/json: schema: type: object indices.simulate_template@200: - description: '' content: application/json: schema: @@ -24843,7 +25992,6 @@ components: required: - template indices.split@200: - description: '' content: application/json: schema: @@ -24860,33 +26008,29 @@ components: - index - shards_acknowledged indices.stats@200: - description: '' content: application/json: schema: type: object properties: + _shards: + $ref: '#/components/schemas/_common:ShardStatistics' + _all: + $ref: '#/components/schemas/indices.stats:AllIndicesStats' indices: type: object additionalProperties: $ref: '#/components/schemas/indices.stats:IndicesStats' - _shards: - $ref: '#/components/schemas/_common:ShardStatistics' - _all: - $ref: '#/components/schemas/indices.stats:IndicesStats' required: - _all - _shards indices.update_aliases@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' - indices.upgrade@200: - description: '' + indices.upgrade@200: {} indices.validate_query@200: - description: '' content: application/json: schema: @@ -24905,7 +26049,6 @@ components: required: - valid info@200: - description: '' content: application/json: schema: @@ -24928,13 +26071,11 @@ components: - tagline - version ingest.delete_pipeline@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' ingest.get_pipeline@200: - description: '' content: application/json: schema: @@ -24942,7 +26083,6 @@ components: additionalProperties: $ref: '#/components/schemas/ingest._common:Pipeline' ingest.processor_grok@200: - description: '' content: application/json: schema: @@ -24955,13 +26095,11 @@ components: required: - patterns ingest.put_pipeline@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' ingest.simulate@200: - description: '' content: application/json: schema: @@ -24973,20 +26111,13 @@ components: $ref: '#/components/schemas/ingest.simulate:PipelineSimulation' required: - docs - knn.delete_model@200: - description: '' - knn.get_model@200: - description: '' - knn.search_models@200: - description: '' - knn.stats@200: - description: '' - knn.train_model@200: - description: '' - knn.warmup@200: - description: '' + knn.delete_model@200: {} + knn.get_model@200: {} + knn.search_models@200: {} + knn.stats@200: {} + knn.train_model@200: {} + knn.warmup@200: {} mget@200: - description: '' content: application/json: schema: @@ -25001,45 +26132,77 @@ components: ml.delete_model_group@200: content: application/json: - $ref: '#/components/schemas/ml._common:ModelGroup' + schema: + $ref: '#/components/schemas/_common:WriteResponseBase' ml.delete_model@200: content: application/json: - $ref: '#/components/schemas/ml._common:ModelGroup' + schema: + $ref: '#/components/schemas/_common:WriteResponseBase' + ml.deploy_model@200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + task_id: + type: string + task_type: + type: string + required: + - status + - task_id ml.get_model_group@200: content: application/json: - $ref: '#/components/schemas/ml._common:ModelGroup' + schema: + $ref: '#/components/schemas/ml._common:ModelGroup' ml.get_task@200: content: application/json: - $ref: '#/components/schemas/ml._common:Task' + schema: + $ref: '#/components/schemas/ml._common:Task' ml.register_model_group@200: content: application/json: - $ref: '#/components/schemas/ml._common:ModelGroupRegistration' + schema: + $ref: '#/components/schemas/ml._common:ModelGroupRegistration' ml.register_model@200: content: application/json: - $ref: '#/components/schemas/ml._common:Task' + schema: + type: object + properties: + status: + type: string + task_id: + type: string + required: + - status + - task_id ml.search_models@200: content: application/json: - $ref: '#/components/schemas/ml._common:SearchModelsResponse' + schema: + $ref: '#/components/schemas/ml._common:SearchModelsResponse' + ml.undeploy_model@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common:UndeployModelResponse' msearch_template@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_core.msearch:MultiSearchResult' msearch@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_core.msearch:MultiSearchResult' mtermvectors@200: - description: '' content: application/json: schema: @@ -25051,34 +26214,28 @@ components: $ref: '#/components/schemas/_core.mtermvectors:TermVectorsResult' required: - docs - nodes.hot_threads@200: - description: '' + nodes.hot_threads@200: {} nodes.info@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/nodes.info:ResponseBase' nodes.reload_secure_settings@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/nodes.reload_secure_settings:ResponseBase' nodes.stats@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/nodes.stats:ResponseBase' nodes.usage@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/nodes.usage:ResponseBase' notifications.create_config@200: - description: '' content: application/json: schema: @@ -25087,31 +26244,26 @@ components: config_id: type: string notifications.delete_config@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/notifications._common:DeleteConfigsResponse' notifications.delete_configs@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/notifications._common:DeleteConfigsResponse' notifications.get_config@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/notifications._common:GetConfigsResponse' notifications.get_configs@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/notifications._common:GetConfigsResponse' notifications.list_channels@200: - description: '' content: application/json: schema: @@ -25130,7 +26282,6 @@ components: items: $ref: '#/components/schemas/notifications._common:NotificationChannel' notifications.list_features@200: - description: '' content: application/json: schema: @@ -25143,7 +26294,6 @@ components: plugin_features: $ref: '#/components/schemas/notifications._common:NotificationsPluginFeaturesMap' notifications.send_test@200: - description: '' content: application/json: schema: @@ -25156,7 +26306,6 @@ components: items: $ref: '#/components/schemas/notifications._common:EventStatus' notifications.update_config@200: - description: '' content: application/json: schema: @@ -25164,18 +26313,172 @@ components: properties: config_id: type: string + observability.create_object@200: + description: Created + content: + application/json: + schema: + type: object + properties: + objectId: + type: string + observability.delete_object@200: + description: Deleted + content: + application/json: + schema: + type: object + properties: + deleteResponseList: + type: object + additionalProperties: + type: string + example: OK + observability.delete_object@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:NotFoundResponse' + observability.delete_objects@200: + description: Deleted + content: + application/json: + schema: + type: object + properties: + deleteResponseList: + type: object + additionalProperties: + type: string + example: OK + observability.delete_objects@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:NotFoundResponse' + observability.get_localstats@200: + description: Retrieves + content: + application/json: + schema: + type: string + observability.get_object@200: + description: Successful response of retrieving specific Observability Object. + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:ObservabilityObjectList' + observability.get_object@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:NotFoundResponse' + observability.list_objects@200: + description: Successful response of retrieving all Observability Objects. + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:ObservabilityObjectList' + observability.update_object@200: + description: Updated + content: + application/json: + schema: + type: object + properties: + objectId: + type: string + observability.update_object@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/observability._common:NotFoundResponse' ping@200: - description: '' content: application/json: {} - put_script@200: + ppl.explain@200: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:ExplainResponse' + required: true + ppl.get_stats@200: + content: + text/plain: + schema: + type: string + required: true + ppl.post_stats@200: + content: + text/plain: + schema: + type: string + required: true + ppl.query@200: description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:QueryResponse' + put_script@200: content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' + query.datasource_delete@204: + description: No Content + content: + application/json: + schema: + type: object + properties: {} + query.datasource_delete@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSourceNotFound' + query.datasource_retrieve@200: + description: Successful response of retrieving Data Source. + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSourceRetrieve' + query.datasource_retrieve@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSourceNotFound' + query.datasources_create@201: + description: Created + content: + application/json: + schema: + type: string + query.datasources_list@200: + description: Successful response of retrieving all Data Sources. + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSourceList' + query.datasources_update@200: + description: Updated + content: + application/json: + schema: + type: string + query.datasources_update@404: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:DataSourceNotFound' rank_eval@200: - description: '' content: application/json: schema: @@ -25198,7 +26501,6 @@ components: - failures - metric_score reindex_rethrottle@200: - description: '' content: application/json: schema: @@ -25211,7 +26513,6 @@ components: required: - nodes reindex@200: - description: '' content: application/json: schema: @@ -25252,7 +26553,6 @@ components: version_conflicts: type: number remote_store.restore@200: - description: '' content: application/json: schema: @@ -25265,7 +26565,6 @@ components: examples: RemoteStoreRestore_example1: summary: Examples for Post Remote Storage Restore Operation. - description: '' value: remote_store: indices: @@ -25275,7 +26574,6 @@ components: failed: 0 successful: 1 render_search_template@200: - description: '' content: application/json: schema: @@ -25287,8 +26585,7 @@ components: type: object required: - template_output - rollups.delete@200: - description: '' + rollups.delete@200: {} rollups.explain@200: content: application/json: @@ -25304,12 +26601,9 @@ components: application/json: schema: $ref: '#/components/schemas/rollups._common:RollupEntity' - rollups.start@200: - description: '' - rollups.stop@200: - description: '' + rollups.start@200: {} + rollups.stop@200: {} scripts_painless_execute@200: - description: '' content: application/json: schema: @@ -25320,13 +26614,11 @@ components: required: - result scroll@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_core.search:ResponseBody' search_pipeline.delete@200: - description: '' content: application/json: schema: @@ -25335,13 +26627,11 @@ components: acknowledged: type: boolean search_pipeline.get@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/search_pipeline._common:SearchPipelineMap' search_pipeline.put@200: - description: '' content: application/json: schema: @@ -25350,7 +26640,6 @@ components: acknowledged: type: boolean search_shards@200: - description: '' content: application/json: schema: @@ -25375,7 +26664,6 @@ components: - nodes - shards search_template@200: - description: '' content: application/json: schema: @@ -25423,265 +26711,282 @@ components: - timed_out - took search@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_core.search:ResponseBody' + search@400: + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:ErrorResponse' + search@404: + content: + application/json: + schema: + $ref: '#/components/schemas/query._common:ErrorResponse' security.authinfo@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AuthInfo' security.authinfo@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.authtoken@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.cache@501: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:MethodNotImplemented' + schema: null security.change_password@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.change_password@403: + content: + application/json: + schema: null security.config_upgrade_check@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UpgradeCheck' security.config_upgrade_perform@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UpgradePerform' + security.config_upgrade_perform@400: + content: + application/json: + schema: null security.create_action_group@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.create_action_group@201: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:Created' security.create_allowlist@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AllowListConfig' + security.create_allowlist@403: + content: + application/json: + schema: null security.create_role_mapping@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.create_role_mapping@201: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:Created' security.create_role@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.create_role@201: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:Created' security.create_tenant@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' - security.create_tenant@400: - description: '' + security.create_tenant@201: content: application/json: schema: - $ref: '#/components/schemas/security._common:BadRequest' + $ref: '#/components/schemas/security._common:Created' + security.create_tenant@400: + content: + application/json: + schema: null security.create_update_tenancy_config@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:MultiTenancyConfig' security.create_update_tenancy_config@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.create_user_legacy@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.create_user_legacy@201: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:Created' security.create_user@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_action_group@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_distinguished_name@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.delete_distinguished_name@400: + content: + application/json: + schema: null security.delete_distinguished_name@403: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:Unauthorized' + schema: null security.delete_role_mapping@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_role@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_tenant@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_tenant@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.delete_user_legacy@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.delete_user@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.flush_cache@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.generate_obo_token@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:GenerateOBOToken' security.generate_obo_token@400: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' - security.generate_user_token_legacy@200: - description: '' content: + text/plain: + type: string application/json: - schema: - $ref: '#/components/schemas/security._common:Ok' - security.generate_user_token_legacy@400: - description: '' + schema: null + security.generate_user_token_legacy@501: content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.generate_user_token@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.generate_user_token@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.get_account_details@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AccountDetails' security.get_action_group@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:ActionGroupsMap' security.get_action_groups@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:ActionGroupsMap' + security.get_all_certificates@200: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:GetCertificatesNew' + security.get_all_certificates@403: + content: + application/json: + schema: null + security.get_all_certificates@500: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:InternalServerError' security.get_allowlist@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AllowListConfig' + security.get_allowlist@403: + content: + application/json: + schema: null security.get_audit_configuration@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AuditConfigWithReadOnly' security.get_certificates@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:GetCertificates' security.get_certificates@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null + security.get_certificates@403: + content: + application/json: + schema: null security.get_configuration@200: - description: '' content: application/json: schema: - $ref: '#/components/schemas/security._common:DynamicConfig' + $ref: '#/components/schemas/security._common:SecurityConfig' security.get_dashboards_info@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:DashboardsInfo' security.get_dashboards_info@500: - description: '' content: application/json: schema: @@ -25692,392 +26997,371 @@ components: application/json: schema: $ref: '#/components/schemas/security._common:DistinguishedNames' + security.get_distinguished_name@400: + content: + application/json: + schema: null security.get_distinguished_name@403: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:Unauthorized' + schema: null security.get_distinguished_names@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:DistinguishedNamesMap' + security.get_distinguished_names@400: + description: Show nodesDn setting for given cluster. + content: + application/json: + schema: null security.get_distinguished_names@403: - description: '' + content: + application/json: + schema: null + security.get_node_certificates@200: content: application/json: schema: - $ref: '#/components/schemas/security._common:Unauthorized' + $ref: '#/components/schemas/security._common:GetCertificatesNew' + security.get_node_certificates@403: + content: + application/json: + schema: null + security.get_node_certificates@500: + content: + application/json: + schema: + $ref: '#/components/schemas/security._common:InternalServerError' security.get_permissions_info@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:PermissionsInfo' security.get_permissions_info@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.get_role_mapping@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:RoleMappings' security.get_role_mappings@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:RoleMappings' security.get_role@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:RolesMap' security.get_roles@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:RolesMap' security.get_sslinfo@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:SSLInfo' security.get_sslinfo@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.get_tenancy_config@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:MultiTenancyConfig' security.get_tenancy_config@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.get_tenant@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:TenantsMap' security.get_tenants@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:TenantsMap' security.get_tenants@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.get_user_legacy@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UsersMap' security.get_user@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UsersMap' security.get_users_legacy@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UsersMap' security.get_users@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:UsersMap' security.health@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:HealthInfo' security.migrate@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.migrate@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_action_group@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_action_groups@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_allowlist@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:AllowListConfig' + security.patch_allowlist@403: + content: + application/json: + schema: null security.patch_audit_configuration@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_configuration@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.patch_configuration@403: + content: + application/json: + schema: null security.patch_distinguished_name@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.patch_distinguished_name@400: + content: + application/json: + schema: null security.patch_distinguished_name@403: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:Unauthorized' + schema: null security.patch_distinguished_names@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.patch_distinguished_names@400: + content: + application/json: + schema: null security.patch_distinguished_names@403: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:Unauthorized' + schema: null security.patch_role_mapping@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_role_mapping@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_role_mappings@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_role_mappings@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_role@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_role@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_roles@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_roles@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_tenant@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_tenant@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_tenants@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_tenants@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.patch_user@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.patch_users@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.post_dashboards_info@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:DashboardsInfo' security.post_dashboards_info@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.reload_http_certificates@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.reload_http_certificates@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null + security.reload_http_certificates@403: + content: + application/json: + schema: null security.reload_transport_certificates@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.reload_transport_certificates@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null + security.reload_transport_certificates@403: + content: + application/json: + schema: null security.tenant_info@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:TenantInfo' + security.tenant_info@403: + content: + text/plain: + type: string + application/json: + schema: null security.tenant_info@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.update_audit_configuration@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.update_configuration@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.update_configuration@403: + content: + application/json: + schema: null security.update_distinguished_name@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' + security.update_distinguished_name@400: + content: + application/json: + schema: null security.update_distinguished_name@403: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:Unauthorized' + schema: null security.validate@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:Ok' security.validate@400: - description: '' content: application/json: - schema: - $ref: '#/components/schemas/security._common:BadRequest' + schema: null security.who_am_i_protected@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:WhoAmI' security.who_am_i_protected@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' security.who_am_i@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:WhoAmI' security.who_am_i@500: - description: '' content: application/json: schema: $ref: '#/components/schemas/security._common:InternalServerError' snapshot.cleanup_repository@200: - description: '' content: application/json: schema: @@ -26088,19 +27372,16 @@ components: required: - results snapshot.clone@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' snapshot.create_repository@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' snapshot.create@200: - description: '' content: application/json: schema: @@ -26112,19 +27393,16 @@ components: snapshot: $ref: '#/components/schemas/snapshot._common:SnapshotInfo' snapshot.delete_repository@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' snapshot.delete@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' snapshot.get_repository@200: - description: '' content: application/json: schema: @@ -26132,7 +27410,6 @@ components: additionalProperties: $ref: '#/components/schemas/snapshot._common:Repository' snapshot.get@200: - description: '' content: application/json: schema: @@ -26156,7 +27433,6 @@ components: - remaining - total snapshot.restore@200: - description: '' content: application/json: schema: @@ -26167,7 +27443,6 @@ components: required: - snapshot snapshot.status@200: - description: '' content: application/json: schema: @@ -26180,7 +27455,6 @@ components: required: - snapshots snapshot.verify_repository@200: - description: '' content: application/json: schema: @@ -26202,7 +27476,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/sql._common:SqlExplainResponse' + $ref: '#/components/schemas/sql._common:ExplainResponse' required: true sql.get_stats@200: content: @@ -26217,19 +27491,21 @@ components: type: string required: true sql.query@200: - description: '' content: application/json: schema: - $ref: '#/components/schemas/sql._common:SqlQueryResponse' + $ref: '#/components/schemas/sql._common:QueryResponse' + sql.settings@200: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlSettingsResponse' tasks.cancel@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/tasks._common:TaskListResponseBase' tasks.get@200: - description: '' content: application/json: schema: @@ -26247,13 +27523,11 @@ components: - completed - task tasks.list@200: - description: '' content: application/json: schema: $ref: '#/components/schemas/tasks._common:TaskListResponseBase' termvectors@200: - description: '' content: application/json: schema: @@ -26279,8 +27553,7 @@ components: - _version - found - took - transforms.delete@200: - description: '' + transforms.delete@200: {} transforms.explain@200: content: application/json: @@ -26317,7 +27590,6 @@ components: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' update_by_query_rethrottle@200: - description: '' content: application/json: schema: @@ -26330,7 +27602,6 @@ components: required: - nodes update_by_query@200: - description: '' content: application/json: schema: @@ -26371,7 +27642,6 @@ components: throttled_until_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' update@200: - description: '' content: application/json: schema: @@ -26434,33 +27704,6 @@ components: - index - status - type - _common:BulkStats: - type: object - properties: - total_operations: - type: number - total_time: - $ref: '#/components/schemas/_common:Duration' - total_time_in_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - total_size: - $ref: '#/components/schemas/_common:ByteSize' - total_size_in_bytes: - type: number - avg_time: - $ref: '#/components/schemas/_common:Duration' - avg_time_in_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - avg_size: - $ref: '#/components/schemas/_common:ByteSize' - avg_size_in_bytes: - type: number - required: - - avg_size_in_bytes - - avg_time_in_millis - - total_operations - - total_size_in_bytes - - total_time_in_millis _common:byte: type: number _common:Bytes: @@ -26661,12 +27904,10 @@ components: description: |- A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. - pattern: ^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$ + pattern: ^([0-9\.]+)(?:d|h|m|s|ms|micros|nanos)$ type: string _common:DurationLarge: - description: |- - A date histogram interval. Similar to `Duration` with additional units: `w` (week), `M` (month), `q` (quarter) and - `y` (year) + description: 'A date histogram interval. Similar to `Duration` with additional units: `w` (week), `M` (month), `q` (quarter) and `y` (year).' type: string _common:DurationValueUnitMillis: allOf: @@ -26708,7 +27949,7 @@ components: - type additionalProperties: title: metadata - description: Additional details about the error + description: Additional details about the error. _common:ErrorResponseBase: type: object properties: @@ -26808,7 +28049,7 @@ components: - as 4 top/bottom/left/right coordinates - as 2 top_left / bottom_right points - as 2 top_right / bottom_left points - - as a WKT bounding box + - as a WKT bounding box. oneOf: - $ref: '#/components/schemas/_common:CoordsGeoBounds' - $ref: '#/components/schemas/_common:TopLeftBottomRightGeoBounds' @@ -26847,7 +28088,7 @@ components: - type: number - type: string _common:GeoHexCell: - description: A map hex cell (H3) reference + description: A map hex cell (H3) reference. type: string _common:GeoLine: type: object @@ -26871,7 +28112,7 @@ components: - as a `{lat, long}` object - as a geo hash value - as a `[lon, lat]` array - - as a string in `", "` or WKT point formats + - as a string in `", "` or WKT point formats. oneOf: - $ref: '#/components/schemas/_common:LatLonGeoLocation' - $ref: '#/components/schemas/_common:GeoHashLocation' @@ -26887,32 +28128,32 @@ components: - intersects - within _common:GeoTile: - description: A map tile reference, represented as `{zoom}/{x}/{y}` + description: A map tile reference, represented as `{zoom}/{x}/{y}`. type: string _common:GeoTilePrecision: type: number _common:GetStats: type: object properties: - current: + total: type: number - exists_time: + time: $ref: '#/components/schemas/_common:Duration' - exists_time_in_millis: + time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' exists_total: type: number - missing_time: + exists_time: $ref: '#/components/schemas/_common:Duration' - missing_time_in_millis: + exists_time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' missing_total: type: number - time: + missing_time: $ref: '#/components/schemas/_common:Duration' - time_in_millis: + missing_time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' - total: + current: type: number required: - current @@ -26981,40 +28222,39 @@ components: _common:IndexingStats: type: object properties: + index_total: + type: number + index_time: + $ref: '#/components/schemas/_common:Duration' + index_time_in_millis: + $ref: '#/components/schemas/_common:DurationValueUnitMillis' index_current: type: number - delete_current: + index_failed: + type: number + delete_total: type: number delete_time: $ref: '#/components/schemas/_common:Duration' delete_time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' - delete_total: + delete_current: type: number - doc_status: - $ref: '#/components/schemas/_common:DocStatus' - is_throttled: - type: boolean noop_update_total: type: number + is_throttled: + type: boolean throttle_time: $ref: '#/components/schemas/_common:Duration' throttle_time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' - index_time: - $ref: '#/components/schemas/_common:Duration' - index_time_in_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - index_total: - type: number - index_failed: - type: number + doc_status: + $ref: '#/components/schemas/_common:DocStatus' types: + x-version-removed: '2.0' type: object additionalProperties: $ref: '#/components/schemas/_common:IndexingStats' - write_load: - type: number required: - delete_current - delete_time_in_millis @@ -27206,7 +28446,7 @@ components: items: type: string _common:MinimumShouldMatch: - description: The minimum number of terms that should match as integer, percentage or range + description: The minimum number of terms that should match as integer, percentage or range. oneOf: - type: number - type: string @@ -27287,7 +28527,7 @@ components: - transform - voting_only _common:NodeRoles: - description: '* @doc_id node-roles' + description: Node roles. type: array items: $ref: '#/components/schemas/_common:NodeRole' @@ -27840,6 +29080,21 @@ components: _common:SearchStats: type: object properties: + open_contexts: + description: The number of open search contexts. + type: number + query_current: + description: The number of shard query operations that are currently running. + type: number + query_time: + description: The total amount of time for all shard query operations. + $ref: '#/components/schemas/_common:Duration' + query_time_in_millis: + description: The total amount of time for all shard query operations, in milliseconds. + $ref: '#/components/schemas/_common:DurationValueUnitMillis' + query_total: + description: The total number of shard query operations. + type: number concurrent_query_total: description: The total number of query operations that use concurrent segment search. type: number @@ -27866,39 +29121,6 @@ components: fetch_total: description: The total number of shard fetch operations. type: number - open_contexts: - description: The number of open search contexts. - type: number - point_in_time_total: - description: The total number of shard Point in Time (PIT) contexts that have been created (completed and active) since the node last restarted. - type: number - point_in_time_time: - $ref: '#/components/schemas/_common:Duration' - point_in_time_time_in_millis: - description: The amount of time that shard PIT contexts have been held open since the node last restarted, in milliseconds. - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - point_in_time_current: - description: The number of shard PIT contexts currently open. - type: number - query_current: - description: The number of shard query operations that are currently running. - type: number - query_time: - description: The total amount of time for all shard query operations. - $ref: '#/components/schemas/_common:Duration' - query_time_in_millis: - description: The total amount of time for all shard query operations, in milliseconds. - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - query_total: - description: The total number of shard query operations. - type: number - request: - type: object - description: Statistics about coordinator search operations for the node. - additionalProperties: - $ref: '#/components/schemas/_common:RequestStats' - search_idle_reactivate_count_total: - type: number scroll_current: description: The number of shard scroll operations that are currently running. type: number @@ -27911,6 +29133,17 @@ components: scroll_total: description: The total number of shard scroll operations. type: number + point_in_time_total: + description: The total number of shard Point in Time (PIT) contexts that have been created (completed and active) since the node last restarted. + type: number + point_in_time_time: + $ref: '#/components/schemas/_common:Duration' + point_in_time_time_in_millis: + description: The amount of time that shard PIT contexts have been held open since the node last restarted, in milliseconds. + $ref: '#/components/schemas/_common:DurationValueUnitMillis' + point_in_time_current: + description: The number of shard PIT contexts currently open. + type: number suggest_current: description: The number of shard suggest operations that are currently running. type: number @@ -27923,6 +29156,13 @@ components: suggest_total: description: The total number of shard suggest operations. type: number + search_idle_reactivate_count_total: + type: number + request: + type: object + description: Statistics about coordinator search operations for the node. + additionalProperties: + $ref: '#/components/schemas/_common:RequestStats' groups: type: object additionalProperties: @@ -28188,13 +29428,6 @@ components: reserved_in_bytes: description: A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. type: number - total_data_set_size: - $ref: '#/components/schemas/_common:ByteSize' - total_data_set_size_in_bytes: - description: |- - Total data set size, in bytes, of all shards assigned to selected nodes. - This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices. - type: number required: - reserved_in_bytes - size_in_bytes @@ -28285,7 +29518,7 @@ components: - model_id - model_text _common:TimeOfDay: - description: Time of day, expressed as HH:MM:SS + description: Time of day, expressed as HH:MM:SS. type: string _common:TimeUnit: type: string @@ -28354,14 +29587,14 @@ components: _common:ulong: type: number _common:UnitMillis: - description: Time unit for milliseconds + description: Time unit for milliseconds. type: number format: int64 _common:UnitNanos: - description: Time unit for nanoseconds + description: Time unit for nanoseconds. type: number _common:UnitSeconds: - description: Time unit for seconds + description: Time unit for seconds. type: number _common:Username: type: string @@ -28385,7 +29618,7 @@ components: Although "void" is generally used for the unit type that has only one value, this is to be interpreted as the bottom type that has no value at all. Most languages have a unit type, but few have a bottom type. - See https://en.m.wikipedia.org/wiki/Unit_type and https://en.m.wikipedia.org/wiki/Bottom_type + See https://en.m.wikipedia.org/wiki/Unit_type and https://en.m.wikipedia.org/wiki/Bottom_type. type: object _common:WaitForActiveShardOptions: type: string @@ -34463,6 +35696,41 @@ components: - keyword required: - type + _common.mapping:KnnVectorMethod: + type: object + properties: + name: + type: string + space_type: + type: string + engine: + type: string + parameters: + type: object + additionalProperties: + type: object + required: + - name + _common.mapping:KnnVectorProperty: + allOf: + - $ref: '#/components/schemas/_common.mapping:KnnVectorPropertyBase' + - type: object + properties: + type: + type: string + enum: + - knn_vector + required: + - type + _common.mapping:KnnVectorPropertyBase: + type: object + properties: + dimension: + type: number + method: + $ref: '#/components/schemas/_common.mapping:KnnVectorMethod' + required: + - dimension _common.mapping:LongNumberProperty: allOf: - $ref: '#/components/schemas/_common.mapping:NumberPropertyBase' @@ -34661,6 +35929,7 @@ components: - $ref: '#/components/schemas/_common.mapping:IntegerRangeProperty' - $ref: '#/components/schemas/_common.mapping:IpRangeProperty' - $ref: '#/components/schemas/_common.mapping:LongRangeProperty' + - $ref: '#/components/schemas/_common.mapping:KnnVectorProperty' _common.mapping:PropertyBase: type: object properties: @@ -35447,10 +36716,7 @@ components: validation_method: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: - description: |- - Set to `true` to ignore an unmapped field and not match any documents for this query. - Set to `false` to throw an exception if the field is not mapped. - type: boolean + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' _common.query_dsl:GeoDecayFunction: allOf: - $ref: '#/components/schemas/_common.query_dsl:DecayFunctionBase' @@ -35471,11 +36737,7 @@ components: validation_method: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: - description: |- - Set to `true` to ignore an unmapped field and not match any documents for this query. - Set to `false` to throw an exception if the field is not mapped. - type: boolean - default: false + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' field: type: object required: @@ -35494,17 +36756,14 @@ components: validation_method: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: - type: boolean + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' _common.query_dsl:GeoShapeQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - type: object properties: ignore_unmapped: - description: |- - Set to `true` to ignore an unmapped field and not match any documents for this query. - Set to `false` to throw an exception if the field is not mapped. - type: boolean + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' _common.query_dsl:GeoValidationMethod: type: string enum: @@ -35517,8 +36776,8 @@ components: - type: object properties: ignore_unmapped: + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' description: Indicates whether to ignore an unmapped `type` and not return any documents instead of an error. - type: boolean inner_hits: $ref: '#/components/schemas/_core.search:InnerHits' max_children: @@ -35546,10 +36805,10 @@ components: - type: object properties: ignore_unmapped: + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' description: |- Indicates whether to ignore an unmapped `parent_type` and not return any documents instead of an error. You can use this parameter to query multiple indices that may not contain the `parent_type`. - type: boolean inner_hits: $ref: '#/components/schemas/_core.search:InnerHits' parent_type: @@ -35569,6 +36828,12 @@ components: properties: values: $ref: '#/components/schemas/_common:Ids' + _common.query_dsl:IgnoreUnmapped: + type: boolean + default: false + description: |- + Set to `true` to ignore an unmapped field and not match any documents for this query. + Set to `false` to throw an exception if the field is not mapped. _common.query_dsl:IntervalsAllOf: type: object properties: @@ -36036,8 +37301,8 @@ components: - type: object properties: ignore_unmapped: + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' description: Indicates whether to ignore an unmapped path and not return any documents instead of an error. - type: boolean inner_hits: $ref: '#/components/schemas/_core.search:InnerHits' path: @@ -36049,6 +37314,30 @@ components: required: - path - query + _common.query_dsl:NeuralQuery: + allOf: + - $ref: '#/components/schemas/_common.query_dsl:QueryBase' + - type: object + additionalProperties: + $ref: '#/components/schemas/_common.query_dsl:NeuralQueryVectorField' + _common.query_dsl:NeuralQueryVectorField: + type: object + properties: + query_text: + type: string + query_image: + type: string + contentEncoding: base64 + model_id: + type: string + k: + type: integer + min_score: + type: number + max_distance: + type: number + filter: + $ref: '#/components/schemas/_common.query_dsl:QueryContainer' _common.query_dsl:NumberRangeQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:RangeQueryBase' @@ -36093,8 +37382,8 @@ components: id: $ref: '#/components/schemas/_common:Id' ignore_unmapped: + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' description: Indicates whether to ignore an unmapped `type` and not return any documents instead of an error. - type: boolean type: $ref: '#/components/schemas/_common:RelationName' _common.query_dsl:PercolateQuery: @@ -36296,6 +37585,8 @@ components: $ref: '#/components/schemas/_common.query_dsl:MultiMatchQuery' nested: $ref: '#/components/schemas/_common.query_dsl:NestedQuery' + neural: + $ref: '#/components/schemas/_common.query_dsl:NeuralQuery' parent_id: $ref: '#/components/schemas/_common.query_dsl:ParentIdQuery' percolate: @@ -36644,8 +37935,7 @@ components: - type: object properties: ignore_unmapped: - description: When set to `true` the query ignores an unmapped field and will not match any documents. - type: boolean + $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' _common.query_dsl:SimpleQueryStringFlag: type: string enum: @@ -36663,7 +37953,7 @@ components: - SLOP - WHITESPACE _common.query_dsl:SimpleQueryStringFlags: - description: Query flags can be either a single flag or a combination of flags, e.g. `OR|AND|PREFIX` + description: Query flags can be either a single flag or a combination of flags, e.g. `OR|AND|PREFIX`. allOf: - $ref: '#/components/schemas/_common:PipeSeparatedFlagsSimpleQueryStringFlag' _common.query_dsl:SimpleQueryStringQuery: @@ -42317,6 +43607,7 @@ components: $ref: '#/components/schemas/_common:Stringifiedboolean' indices._common:IndexSettings: type: object + description: The index settings to be updated. properties: index: $ref: '#/components/schemas/indices._common:IndexSettings' @@ -42447,7 +43738,6 @@ components: store: $ref: '#/components/schemas/indices._common:Storage' additionalProperties: {} - description: The index settings to be updated indices._common:IndexSettingsAnalysis: type: object properties: @@ -42561,7 +43851,7 @@ components: $ref: '#/components/schemas/indices._common:IndexTemplateDataStreamConfiguration' required: - index_patterns - description: New index template definition to be simulated, if no index template name is specified + description: New index template definition to be simulated, if no index template name is specified. indices._common:IndexTemplateDataStreamConfiguration: type: object properties: @@ -43653,83 +44943,89 @@ components: - aliases - mappings - settings - indices.stats:IndexMetadataState: - type: string - enum: - - close - - open + indices.stats:AllIndicesStats: + type: object + properties: + primaries: + $ref: '#/components/schemas/indices.stats:IndexStats' + total: + $ref: '#/components/schemas/indices.stats:IndexStats' + required: + - primaries + - total + indices.stats:IndexShardStats: + allOf: + - $ref: '#/components/schemas/indices.stats:IndexStatsBase' + - type: object + properties: + routing: + $ref: '#/components/schemas/indices.stats:ShardRouting' + commit: + $ref: '#/components/schemas/indices.stats:ShardCommit' + seq_no: + $ref: '#/components/schemas/indices.stats:ShardSequenceNumber' + retention_leases: + $ref: '#/components/schemas/indices.stats:ShardRetentionLeases' + shard_path: + $ref: '#/components/schemas/indices.stats:ShardPath' indices.stats:IndexStats: + allOf: + - $ref: '#/components/schemas/indices.stats:IndexStatsBase' + - type: object + indices.stats:IndexStatsBase: type: object properties: - completion: - $ref: '#/components/schemas/_common:CompletionStats' docs: $ref: '#/components/schemas/_common:DocStats' - fielddata: - $ref: '#/components/schemas/_common:FielddataStats' - flush: - $ref: '#/components/schemas/_common:FlushStats' - get: - $ref: '#/components/schemas/_common:GetStats' + store: + $ref: '#/components/schemas/_common:StoreStats' indexing: $ref: '#/components/schemas/_common:IndexingStats' - indices: - $ref: '#/components/schemas/indices.stats:IndicesStats' + get: + $ref: '#/components/schemas/_common:GetStats' + search: + $ref: '#/components/schemas/_common:SearchStats' merges: $ref: '#/components/schemas/_common:MergesStats' - query_cache: - $ref: '#/components/schemas/_common:QueryCacheStats' - recovery: - $ref: '#/components/schemas/_common:RecoveryStats' refresh: $ref: '#/components/schemas/_common:RefreshStats' - request_cache: - $ref: '#/components/schemas/_common:RequestCacheStats' - search: - $ref: '#/components/schemas/_common:SearchStats' + flush: + $ref: '#/components/schemas/_common:FlushStats' + warmer: + $ref: '#/components/schemas/_common:WarmerStats' + query_cache: + $ref: '#/components/schemas/_common:QueryCacheStats' + fielddata: + $ref: '#/components/schemas/_common:FielddataStats' + completion: + $ref: '#/components/schemas/_common:CompletionStats' segments: $ref: '#/components/schemas/_common:SegmentsStats' - store: - $ref: '#/components/schemas/_common:StoreStats' translog: $ref: '#/components/schemas/_common:TranslogStats' - warmer: - $ref: '#/components/schemas/_common:WarmerStats' - bulk: - $ref: '#/components/schemas/_common:BulkStats' - shard_stats: - $ref: '#/components/schemas/indices.stats:ShardsTotalStats' + request_cache: + $ref: '#/components/schemas/_common:RequestCacheStats' + recovery: + $ref: '#/components/schemas/_common:RecoveryStats' indices.stats:IndicesStats: type: object properties: + uuid: + $ref: '#/components/schemas/_common:Uuid' primaries: $ref: '#/components/schemas/indices.stats:IndexStats' + total: + $ref: '#/components/schemas/indices.stats:IndexStats' shards: type: object additionalProperties: type: array items: - $ref: '#/components/schemas/indices.stats:ShardStats' - total: - $ref: '#/components/schemas/indices.stats:IndexStats' - uuid: - $ref: '#/components/schemas/_common:Uuid' - health: - $ref: '#/components/schemas/_common:HealthStatus' - status: - $ref: '#/components/schemas/indices.stats:IndexMetadataState' - indices.stats:MappingStats: - type: object - properties: - total_count: - type: number - total_estimated_overhead: - $ref: '#/components/schemas/_common:ByteSize' - total_estimated_overhead_in_bytes: - type: number + $ref: '#/components/schemas/indices.stats:IndexShardStats' required: - - total_count - - total_estimated_overhead_in_bytes + - primaries + - total + - uuid indices.stats:ShardCommit: type: object properties: @@ -43795,31 +45091,6 @@ components: - data_path - is_custom_data_path - state_path - indices.stats:ShardQueryCache: - type: object - properties: - cache_count: - type: number - cache_size: - type: number - evictions: - type: number - hit_count: - type: number - memory_size_in_bytes: - type: number - miss_count: - type: number - total_count: - type: number - required: - - cache_count - - cache_size - - evictions - - hit_count - - memory_size_in_bytes - - miss_count - - total_count indices.stats:ShardRetentionLeases: type: object properties: @@ -43872,70 +45143,6 @@ components: - global_checkpoint - local_checkpoint - max_seq_no - indices.stats:ShardStats: - type: object - properties: - commit: - $ref: '#/components/schemas/indices.stats:ShardCommit' - completion: - $ref: '#/components/schemas/_common:CompletionStats' - docs: - $ref: '#/components/schemas/_common:DocStats' - fielddata: - $ref: '#/components/schemas/_common:FielddataStats' - flush: - $ref: '#/components/schemas/_common:FlushStats' - get: - $ref: '#/components/schemas/_common:GetStats' - indexing: - $ref: '#/components/schemas/_common:IndexingStats' - mappings: - $ref: '#/components/schemas/indices.stats:MappingStats' - merges: - $ref: '#/components/schemas/_common:MergesStats' - shard_path: - $ref: '#/components/schemas/indices.stats:ShardPath' - query_cache: - $ref: '#/components/schemas/indices.stats:ShardQueryCache' - recovery: - $ref: '#/components/schemas/_common:RecoveryStats' - refresh: - $ref: '#/components/schemas/_common:RefreshStats' - request_cache: - $ref: '#/components/schemas/_common:RequestCacheStats' - retention_leases: - $ref: '#/components/schemas/indices.stats:ShardRetentionLeases' - routing: - $ref: '#/components/schemas/indices.stats:ShardRouting' - search: - $ref: '#/components/schemas/_common:SearchStats' - segments: - $ref: '#/components/schemas/_common:SegmentsStats' - seq_no: - $ref: '#/components/schemas/indices.stats:ShardSequenceNumber' - store: - $ref: '#/components/schemas/_common:StoreStats' - translog: - $ref: '#/components/schemas/_common:TranslogStats' - warmer: - $ref: '#/components/schemas/_common:WarmerStats' - bulk: - $ref: '#/components/schemas/_common:BulkStats' - shards: - type: object - additionalProperties: - type: object - shard_stats: - $ref: '#/components/schemas/indices.stats:ShardsTotalStats' - indices: - $ref: '#/components/schemas/indices.stats:IndicesStats' - indices.stats:ShardsTotalStats: - type: object - properties: - total_count: - type: number - required: - - total_count indices.update_aliases:Action: type: object properties: @@ -45091,10 +46298,10 @@ components: properties: model_id: type: string - description: The model ID. + task_id: + type: string state: type: string - description: The state. enum: - CANCELLED - COMPLETED @@ -45107,6 +46314,7 @@ components: description: Task type. enum: - DEPLOY_MODEL + - REGISTER_MODEL function_name: type: string worker_node: @@ -45121,8 +46329,22 @@ components: format: int64 is_async: type: boolean + error: + type: string required: - state + ml._common:UndeployModelResponse: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common:UndeployModelResponseModels' + ml._common:UndeployModelResponseModels: + type: object + properties: + stats: + $ref: '#/components/schemas/ml._common:UndeployModelResponseStats' + ml._common:UndeployModelResponseStats: + type: object + additionalProperties: true nodes._common:AdaptiveSelection: type: object properties: @@ -45602,6 +46824,14 @@ components: write_operations: description: The total number of write operations for the device completed since starting OpenSearch. type: number + read_time: + type: number + write_time: + type: number + queue_size: + type: number + io_time_in_millis: + $ref: '#/components/schemas/_common:DurationValueUnitMillis' nodes._common:IoStats: type: object properties: @@ -46003,8 +47233,10 @@ components: type: boolean enforced: type: boolean + total_rejections_breakup: + $ref: '#/components/schemas/nodes._common:TotalRejectionsBreakup' total_rejections_breakup_shadow_mode: - $ref: '#/components/schemas/nodes._common:TotalRejectionsBreakupShadowMode' + $ref: '#/components/schemas/nodes._common:TotalRejectionsBreakup' nodes._common:ShardRepositoriesStats: type: array nodes._common:ShardResourceUsageStats: @@ -46049,6 +47281,10 @@ components: type: number cancellation_limit_reached_count: type: number + cancelled_task_percentage: + type: number + current_cancellation_eligible_tasks_count: + type: number nodes._common:ShardSearchBackpressureTaskResourceTrackerCpuUsageTrackerStats: type: object properties: @@ -46094,6 +47330,9 @@ components: $ref: '#/components/schemas/nodes._common:ShardSearchBackpressureTaskResourceTrackerStats' cancellation_stats: $ref: '#/components/schemas/nodes._common:ShardSearchBackpressureTaskCancellationStats' + completion_count: + x-version-added: '3.0' + type: number nodes._common:ShardSearchPipelineStats: type: object properties: @@ -46210,7 +47449,7 @@ components: indexing_pressure: $ref: '#/components/schemas/nodes._common:IndexingPressure' indices: - $ref: '#/components/schemas/indices.stats:ShardStats' + $ref: '#/components/schemas/indices.stats:IndexShardStats' shard_indexing_pressure: $ref: '#/components/schemas/nodes._common:ShardIndexingPressureStats' search_backpressure: @@ -46259,7 +47498,7 @@ components: The total amount of time that tasks spend waiting in the thread pool queue. Currently, only `search`, `search_throttled`, and `index_searcher` thread pools support this metric. type: number - nodes._common:TotalRejectionsBreakupShadowMode: + nodes._common:TotalRejectionsBreakup: type: object properties: node_limits: @@ -46423,14 +47662,10 @@ components: search_pipelines: $ref: '#/components/schemas/nodes.info:NodeInfoSearchPipelines' required: - - attributes - build_hash - build_type - - host - - ip - name - roles - - transport_address - version nodes.info:NodeInfoAction: type: object @@ -46936,7 +48171,9 @@ components: bundled_jdk: type: boolean using_bundled_jdk: - type: boolean + type: + - boolean + - 'null' using_compressed_ordinary_object_pointers: oneOf: - type: boolean @@ -46947,16 +48184,9 @@ components: type: string required: - bundled_jdk - - gc_collectors - - input_arguments - mem - - memory_pools - pid - start_time_in_millis - - version - - vm_name - - vm_vendor - - vm_version nodes.info:NodeOperatingSystemInfo: type: object properties: @@ -46984,12 +48214,8 @@ components: swap: $ref: '#/components/schemas/nodes.info:NodeInfoMemory' required: - - arch - available_processors - - name - - pretty_name - refresh_interval_in_millis - - version nodes.info:NodeProcessInfo: type: object properties: @@ -47453,6 +48679,351 @@ components: $ref: '#/components/schemas/notifications._common:HeaderParamsMap' required: - url + observability._common:ErrorResponse: + type: object + properties: + root_cause: + type: array + items: + $ref: '#/components/schemas/observability._common:RootCause' + type: + type: string + example: status_exception + reason: + type: string + example: ObservabilityObject {objectId} not found + required: + - reason + - root_cause + - type + observability._common:NotFoundResponse: + type: object + properties: + error: + $ref: '#/components/schemas/observability._common:ErrorResponse' + status: + type: integer + example: 404 + required: + - error + - status + observability._common:ObservabilityObject: + type: object + properties: + objectId: + type: string + lastUpdatedTimeMs: + type: integer + createdTimeMs: + type: integer + tenant: + type: string + operationalPanel: + $ref: '#/components/schemas/observability._common:OperationalPanel' + savedVisualization: + $ref: '#/components/schemas/observability._common:SavedVisualization' + savedQuery: + $ref: '#/components/schemas/observability._common:SavedQuery' + required: + - objectId + - tenant + observability._common:ObservabilityObjectList: + type: object + properties: + startIndex: + type: integer + totalHits: + type: integer + totalHitRelation: + type: string + observabilityObjectList: + type: array + items: + $ref: '#/components/schemas/observability._common:ObservabilityObject' + required: + - observabilityObjectList + - startIndex + - totalHitRelation + - totalHits + observability._common:OperationalPanel: + type: object + properties: + name: + type: string + visualizations: + type: array + items: + $ref: '#/components/schemas/observability._common:Visualization' + timeRange: + $ref: '#/components/schemas/observability._common:TimeRange' + queryFilter: + $ref: '#/components/schemas/observability._common:QueryFilter' + applicationId: + type: string + required: + - applicationId + - name + - queryFilter + - timeRange + - visualizations + observability._common:QueryFilter: + type: object + properties: + query: + type: string + language: + type: string + required: + - language + - query + observability._common:RootCause: + type: object + properties: + type: + type: string + example: status_exception + reason: + type: string + example: ObservabilityObject {objectId} not found + required: + - reason + - type + observability._common:SavedQuery: + type: object + properties: + name: + type: string + description: + type: string + query: + type: string + selected_date_range: + $ref: '#/components/schemas/observability._common:SelectedDateRange' + selected_timestamp: + $ref: '#/components/schemas/observability._common:SelectedTimestamp' + selected_fields: + $ref: '#/components/schemas/observability._common:SelectedFields' + required: + - description + - name + - query + - selected_date_range + - selected_fields + - selected_timestamp + observability._common:SavedVisualization: + type: object + properties: + name: + type: string + description: + type: string + query: + type: string + type: + type: string + selected_date_range: + $ref: '#/components/schemas/observability._common:SelectedDateRange' + selected_timestamp: + $ref: '#/components/schemas/observability._common:SelectedTimestamp' + selected_fields: + $ref: '#/components/schemas/observability._common:SelectedFields' + required: + - description + - name + - query + - selected_date_range + - selected_fields + - selected_timestamp + - type + observability._common:SelectedDateRange: + type: object + properties: + start: + type: string + end: + type: string + text: + type: string + required: + - end + - start + - text + observability._common:SelectedFields: + type: object + properties: + text: + type: string + tokens: + type: array + items: + $ref: '#/components/schemas/observability._common:Token' + required: + - text + - tokens + observability._common:SelectedTimestamp: + type: object + properties: + name: + type: string + type: + type: string + required: + - name + - type + observability._common:TimeRange: + type: object + properties: + to: + type: string + from: + type: string + required: + - from + - to + observability._common:Token: + type: object + properties: + name: + type: string + type: + type: string + required: + - name + - type + observability._common:Visualization: + type: object + properties: + id: + type: string + savedVisualizationId: + type: string + x: + type: integer + y: + type: integer + w: + type: integer + h: + type: integer + required: + - h + - id + - savedVisualizationId + - w + - x + - y + query._common:Credentials: + type: object + properties: + username: + type: string + password: + type: string + required: + - password + - username + query._common:DataSource: + type: object + properties: + name: + type: string + description: + type: string + connector: + type: string + allowedRoles: + type: array + items: + type: string + properties: + type: object + additionalProperties: true + resultIndex: + type: string + status: + type: string + configuration: + $ref: '#/components/schemas/query._common:DataSourceConfiguration' + required: + - connector + - name + - properties + - resultIndex + - status + query._common:DataSourceConfiguration: + type: object + properties: + endpoint: + type: string + credentials: + $ref: '#/components/schemas/query._common:Credentials' + required: + - credentials + - endpoint + query._common:DataSourceList: + type: array + items: + $ref: '#/components/schemas/query._common:DataSource' + query._common:DataSourceNotFound: + type: object + properties: + error: + $ref: '#/components/schemas/query._common:ErrorResponse' + required: + - error + query._common:DataSourceRetrieve: + type: object + properties: + name: + type: string + description: + type: string + connector: + type: string + allowedRoles: + type: array + items: + type: string + properties: + type: object + additionalProperties: true + resultIndex: + type: string + status: + type: string + configuration: + $ref: '#/components/schemas/query._common:DataSourceConfiguration' + required: + - connector + - name + - properties + - resultIndex + - status + query._common:ErrorResponse: + type: object + properties: + root_cause: + type: array + items: + $ref: '#/components/schemas/query._common:RootCause' + type: + type: string + reason: + type: string + required: + - reason + - root_cause + - type + query._common:RootCause: + type: object + properties: + type: + type: string + reason: + type: string + required: + - reason + - type remote_store._common:RemoteStoreRestoreInfo: type: object properties: @@ -47662,6 +49233,21 @@ components: type: string target_field: type: string + search_pipeline._common:CollapseResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + field: + type: string + context_prefix: + type: string + required: + - field search_pipeline._common:FilterQueryRequestProcessor: type: object properties: @@ -47673,6 +49259,13 @@ components: type: boolean query: $ref: '#/components/schemas/search_pipeline._common:UserDefinedObjectStructure' + search_pipeline._common:MLOpenSearchReranker: + type: object + properties: + model_id: + type: string + required: + - model_id search_pipeline._common:NeuralFieldMap: type: object additionalProperties: @@ -47717,6 +49310,30 @@ components: type: string required: - sample_factor + search_pipeline._common:PersonalizeSearchRankingResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + campaign_arn: + type: string + recipe: + type: string + weight: + type: number + format: float + item_id_field: + type: string + iam_role_arn: + type: string + required: + - campaign_arn + - recipe + - weight search_pipeline._common:PhaseResultsProcessor: oneOf: - type: object @@ -47726,6 +49343,22 @@ components: $ref: '#/components/schemas/search_pipeline._common:NormalizationPhaseResultsProcessor' required: - normalization-processor + search_pipeline._common:RenameFieldResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + field: + type: string + target_field: + type: string + required: + - field + - target_field search_pipeline._common:RequestProcessor: oneOf: - type: object @@ -47756,6 +49389,106 @@ components: $ref: '#/components/schemas/search_pipeline._common:OversampleRequestProcessor' required: - oversample + search_pipeline._common:RerankContext: + type: object + properties: + document_fields: + type: array + items: + type: string + required: + - document_fields + search_pipeline._common:RerankResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + ml_opensearch: + $ref: '#/components/schemas/search_pipeline._common:MLOpenSearchReranker' + context: + $ref: '#/components/schemas/search_pipeline._common:RerankContext' + search_pipeline._common:ResponseProcessor: + oneOf: + - type: object + title: personalize_search_ranking + properties: + personalize_search_ranking: + $ref: '#/components/schemas/search_pipeline._common:PersonalizeSearchRankingResponseProcessor' + required: + - personalize_search_ranking + - type: object + title: retrieval_augmented_generation + properties: + retrieval_augmented_generation: + $ref: '#/components/schemas/search_pipeline._common:RetrievalAugmentedGenerationResponseProcessor' + required: + - retrieval_augmented_generation + - type: object + title: rename_field + properties: + rename_field: + $ref: '#/components/schemas/search_pipeline._common:RenameFieldResponseProcessor' + required: + - rename_field + - type: object + title: rerank + properties: + rerank: + $ref: '#/components/schemas/search_pipeline._common:RerankResponseProcessor' + required: + - rerank + - type: object + title: collapse + properties: + collapse: + $ref: '#/components/schemas/search_pipeline._common:CollapseResponseProcessor' + required: + - collapse + - type: object + title: truncate_hits + properties: + truncate_hits: + $ref: '#/components/schemas/search_pipeline._common:TruncateHitsResponseProcessor' + required: + - truncate_hits + - type: object + title: sort + properties: + sort: + $ref: '#/components/schemas/search_pipeline._common:SortResponseProcessor' + required: + - sort + - type: object + title: split + properties: + split: + $ref: '#/components/schemas/search_pipeline._common:SplitResponseProcessor' + required: + - split + search_pipeline._common:RetrievalAugmentedGenerationResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + model_id: + type: string + context_field_list: + type: array + items: + type: string + system_prompt: + type: string + user_instructions: + type: string + required: + - context_field_list + - model_id search_pipeline._common:ScoreCombination: type: object properties: @@ -47799,7 +49532,7 @@ components: response_processors: type: array items: - $ref: '#/components/schemas/search_pipeline._common:RequestProcessor' + $ref: '#/components/schemas/search_pipeline._common:ResponseProcessor' phase_results_processors: type: array items: @@ -47819,6 +49552,57 @@ components: type: string required: - source + search_pipeline._common:SortResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + field: + type: string + order: + type: string + target_field: + type: string + required: + - field + search_pipeline._common:SplitResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + field: + type: string + separator: + type: string + preserve_trailing: + type: boolean + target_field: + type: string + required: + - field + - separator + search_pipeline._common:TruncateHitsResponseProcessor: + type: object + properties: + tag: + type: string + description: + type: string + ignore_failure: + type: boolean + target_size: + type: integer + format: int32 + context_prefix: + type: string search_pipeline._common:UserDefinedObjectStructure: type: object properties: @@ -47903,7 +49687,9 @@ components: is_internal_user: type: boolean user_requested_tenant: - type: string + type: + - 'null' + - string backend_roles: type: array items: @@ -47939,7 +49725,7 @@ components: type: object additionalProperties: $ref: '#/components/schemas/security._common:ActionGroup' - security._common:AllowConfig: + security._common:AllowListConfig: type: object properties: enabled: @@ -47947,11 +49733,6 @@ components: requests: type: object description: An object with APIs as key and array of http methods as values. - security._common:AllowListConfig: - type: object - properties: - config: - $ref: '#/components/schemas/security._common:AllowConfig' security._common:AuditConfig: type: object properties: @@ -47981,6 +49762,14 @@ components: type: array items: type: string + ignore_headers: + type: array + items: + type: string + ignore_url_params: + type: array + items: + type: string disabled_rest_categories: type: array items: @@ -48011,31 +49800,47 @@ components: type: string description: User's name. user_requested_tenant: - type: string + type: + - 'null' + - string description: Name of the tenant the user wants to switch to. remote_address: - type: string + type: + - 'null' + - string description: The IP address of remote user. backend_roles: type: array description: Backend roles associated with the user. + items: + type: string custom_attribute_names: type: array description: Name of the attributes associated with the user. + items: + type: string roles: type: array description: Roles associated with the user. + items: + type: string tenants: type: object description: Tenants the user has access to with read-write or read-only access indicator. principal: - type: string + type: + - 'null' + - string description: User principal. peer_certificates: - type: number + type: + - number + - string description: Number of peer certificates. sso_logout_url: - type: string + type: + - 'null' + - string description: Logout url. size_of_user: type: string @@ -48046,16 +49851,18 @@ components: size_of_backendroles: type: string description: Size of backend roles in bytes. - security._common:BadRequest: + security._common:CertificateCountPerNode: type: object properties: - status: - type: string - enum: - - 400 - message: - type: string - description: Message returned as part of BAD_REQUEST response. + total: + type: number + description: Total number of nodes. + successful: + type: number + description: Number of nodes for which certificates could be fetched. + failed: + type: number + description: Number of nodes for which certificates could not be fetched. security._common:CertificatesDetail: type: object properties: @@ -48069,6 +49876,31 @@ components: type: string not_after: type: string + security._common:CertificatesPerNode: + type: object + properties: + name: + type: string + description: Name of the node. + certificates: + type: object + additionalProperties: + $ref: '#/components/schemas/security._common:CertificateTypes' + security._common:CertificateTypes: + type: object + properties: + http: + type: array + items: + type: object + additionalProperties: + $ref: '#/components/schemas/security._common:CertificatesDetail' + transport: + type: array + items: + type: object + additionalProperties: + $ref: '#/components/schemas/security._common:CertificatesDetail' security._common:ChangePasswordRequestContent: type: object properties: @@ -48115,6 +49947,18 @@ components: config: type: array description: List of configs to be upgraded. + items: + type: string + security._common:Created: + type: object + properties: + status: + type: + - number + - string + message: + type: string + description: Message returned as part of CREATED response. security._common:CreateTenantParams: type: object properties: @@ -48150,6 +49994,8 @@ components: sign_in_options: type: array description: List of available sign-in options available. + items: + type: string password_validation_error_message: type: string description: Error message when password validation fails. @@ -48175,27 +50021,36 @@ components: security._common:DynamicOptions: type: object properties: - filteredAliasMode: + filtered_alias_mode: type: string - disableRestAuth: + disable_rest_auth: type: boolean - disableIntertransportAuth: + disable_intertransport_auth: type: boolean - respectRequestIndicesOptions: + respect_request_indices_options: type: boolean - kibana: {} - http: {} - authc: {} - authz: {} - authFailureListeners: {} - doNotFailOnForbidden: + opensearch-dashboards: + type: object + kibana: + type: object + http: + type: object + authc: + type: object + authz: + type: object + auth_failure_listeners: + type: object + do_not_fail_on_forbidden: type: boolean - multiRolespanEnabled: + multi_rolespan_enabled: type: boolean - hostsResolverMode: + hosts_resolver_mode: type: string - doNotFailOnForbiddenEmpty: + do_not_fail_on_forbidden_empty: type: boolean + on_behalf_of: + type: object security._common:GenerateOBOToken: type: object properties: @@ -48219,11 +50074,27 @@ components: type: array items: $ref: '#/components/schemas/security._common:CertificatesDetail' + security._common:GetCertificatesNew: + type: object + properties: + _nodes: + type: object + additionalProperties: + $ref: '#/components/schemas/security._common:CertificateCountPerNode' + cluster_name: + type: string + description: Name of this cluster. + nodes: + type: object + additionalProperties: + $ref: '#/components/schemas/security._common:CertificatesPerNode' security._common:HealthInfo: type: object properties: message: - type: string + type: + - 'null' + - string mode: type: string status: @@ -48255,16 +50126,6 @@ components: error: type: string description: Error message during request execution. - security._common:MethodNotImplemented: - type: object - properties: - status: - type: string - enum: - - 501 - message: - type: string - description: Message returned as part of NOT_IMPLEMENTED response. security._common:MultiTenancyConfig: type: object properties: @@ -48278,7 +50139,6 @@ components: type: array items: type: string - description: Value in seconds. security._common:OBOToken: type: object properties: @@ -48297,9 +50157,9 @@ components: type: object properties: status: - type: string - enum: - - 200 + type: + - number + - string message: type: string description: Message returned as part of OK response. @@ -48385,38 +50245,63 @@ components: type: object additionalProperties: $ref: '#/components/schemas/security._common:Role' + security._common:SecurityConfig: + type: object + properties: + config: + $ref: '#/components/schemas/security._common:DynamicConfig' security._common:SSLInfo: type: object properties: principal: - type: string + type: + - 'null' + - string description: User principal. peer_certificates: - type: number + type: + - number + - string description: Number of certificates. peer_certificates_list: - type: array + type: + - array + - 'null' description: List of domain names from peer certificates. + items: + type: string local_certificates_list: type: array description: List of domain names from local certificates. + items: + type: string ssl_protocol: - type: string + type: + - 'null' + - string description: Protocol for this ssl setup. ssl_cipher: - type: string + type: + - 'null' + - string description: Cipher for this ssl setup. ssl_openssl_available: type: boolean description: A boolean to indicate if OpenSSL is available. ssl_openssl_version: - type: string + type: + - number + - string description: Version of openssl. ssl_openssl_version_string: - type: string + type: + - 'null' + - string description: Full version string for openssl version. ssl_openssl_non_available_cause: - type: string + type: + - 'null' + - string description: Reason for openssl unavailability. ssl_openssl_supports_key_manager_factory: type: boolean @@ -48425,7 +50310,9 @@ components: type: boolean description: Indicates whether hostname validation is supported. ssl_provider_http: - type: string + type: + - 'null' + - string description: Returns http provider's name. ssl_provider_transport_server: type: string @@ -48433,6 +50320,20 @@ components: ssl_provider_transport_client: type: string description: Returns transport client's name. + required: + - peer_certificates + - principal + - ssl_cipher + - ssl_openssl_available + - ssl_openssl_non_available_cause + - ssl_openssl_supports_hostname_validation + - ssl_openssl_supports_key_manager_factory + - ssl_openssl_version + - ssl_openssl_version_string + - ssl_protocol + - ssl_provider_http + - ssl_provider_transport_client + - ssl_provider_transport_server security._common:Tenant: type: object properties: @@ -48463,16 +50364,6 @@ components: type: object additionalProperties: $ref: '#/components/schemas/security._common:Tenant' - security._common:Unauthorized: - type: object - properties: - status: - type: string - enum: - - 403 - message: - type: string - description: Message returned as part of FORBIDDEN response. security._common:UpgradeCheck: type: object properties: @@ -48492,6 +50383,8 @@ components: security._common:User: type: object properties: + password: + type: string hash: type: string reserved: @@ -48533,11 +50426,13 @@ components: type: object properties: dn: - type: string + type: + - 'null' + - string is_admin: - type: string + type: boolean is_node_certificate_request: - type: string + type: boolean snapshot._common:FileCountSnapshotStats: type: object properties: @@ -48861,7 +50756,21 @@ components: $ref: '#/components/schemas/_common:Name' required: - name + sql._common:Cursor: + type: object + properties: + keep_alive: + type: string sql._common:Explain: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + sql._common:ExplainBody: type: object properties: name: @@ -48871,32 +50780,38 @@ components: children: type: array items: - $ref: '#/components/schemas/sql._common:Explain' - sql._common:SqlClose: + $ref: '#/components/schemas/sql._common:ExplainBody' + sql._common:ExplainResponse: type: object properties: - cursor: - type: string - sql._common:SqlCloseResponse: + root: + $ref: '#/components/schemas/sql._common:ExplainBody' + sql._common:Plugins: type: object properties: - succeeded: - type: boolean - sql._common:SqlExplain: + ppl: + $ref: '#/components/schemas/sql._common:Ppl' + query: + $ref: '#/components/schemas/sql._common:PluginsQuery' + sql: + $ref: '#/components/schemas/sql._common:Sql' + sql._common:PluginsQuery: type: object properties: - query: + memory_limit: type: string - filter: - type: object - fetch_size: - type: integer - sql._common:SqlExplainResponse: + size_limit: + anyOf: + - type: string + - type: integer + sql._common:Ppl: type: object properties: - root: - $ref: '#/components/schemas/sql._common:Explain' - sql._common:SqlQuery: + enabled: + anyOf: + - type: boolean + - type: string + sql._common:Query: type: object properties: query: @@ -48905,7 +50820,7 @@ components: type: object fetch_size: type: integer - sql._common:SqlQueryResponse: + sql._common:QueryResponse: type: object properties: schema: @@ -48924,7 +50839,49 @@ components: type: integer status: type: integer - sql._common:SqlStats: + sql._common:Sql: + type: object + properties: + enabled: + anyOf: + - type: boolean + - type: string + slowlog: + anyOf: + - type: integer + - type: string + cursor: + $ref: '#/components/schemas/sql._common:Cursor' + sql._common:SqlClose: + type: object + properties: + cursor: + type: string + sql._common:SqlCloseResponse: + type: object + properties: + succeeded: + type: boolean + sql._common:SqlSettings: + type: object + properties: + transient: + $ref: '#/components/schemas/sql._common:Transient' + sql._common:SqlSettingsPlain: + type: object + properties: + transient: + $ref: '#/components/schemas/sql._common:TransientPlain' + sql._common:SqlSettingsResponse: + type: object + properties: + acknowledged: + type: boolean + persistent: + type: object + transient: + $ref: '#/components/schemas/sql._common:Transient' + sql._common:Stats: type: object properties: start_time: @@ -48941,6 +50898,26 @@ components: type: object execution_time: type: object + sql._common:Transient: + type: object + properties: + plugins: + $ref: '#/components/schemas/sql._common:Plugins' + sql._common:TransientPlain: + type: object + properties: + plugins.sql.enabled: + type: boolean + plugins.ppl.enabled: + type: boolean + plugins.sql.slowlog: + type: integer + plugins.sql.cursor.keep_alive: + type: string + plugins.query.memory_limit: + type: string + plugins.query.size_limit: + type: integer tasks._common:GroupBy: type: string enum: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java index 0bb7f5df46..0968bd9886 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/EnumShape.java @@ -43,9 +43,11 @@ public Collection getVariants() { public static class Variant { private final String wireName; + private final boolean deprecated; - public Variant(String wireName) { + public Variant(String wireName, boolean deprecated) { this.wireName = wireName; + this.deprecated = deprecated; } public String getWireName() { @@ -55,5 +57,9 @@ public String getWireName() { public String getName() { return Strings.toPascalCase(wireName); } + + public boolean isDeprecated() { + return deprecated; + } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index a2625fc7ce..3e332ca8b8 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -155,13 +155,22 @@ public Type getJsonEndpointType() { @Nonnull private static String requestClassName(@Nonnull OperationGroup operationGroup) { - Objects.requireNonNull(operationGroup, "operationGroup must not be null"); - return Strings.toPascalCase(operationGroup.getName()) + "Request"; + return classBaseName(operationGroup) + "Request"; } @Nonnull private static String responseClassName(@Nonnull OperationGroup operationGroup) { + return classBaseName(operationGroup) + "Response"; + } + + @Nonnull + private static String classBaseName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); - return Strings.toPascalCase(operationGroup.getName()) + "Response"; + switch (operationGroup.toString()) { + case "tasks.get": + return "GetTasks"; + default: + return Strings.toPascalCase(operationGroup.getName()); + } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index bd20d083c6..73d728a1db 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -46,7 +46,7 @@ public JavaClassKind getClassKind() { } public boolean isAbstract() { - return this.className.endsWith("Base"); + return this.className.endsWith("Base") || this.className.startsWith("Base"); } public String getTypedefName() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 91af05c63f..55e6a45609 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -20,7 +20,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; -import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; import org.apache.commons.lang3.NotImplementedException; @@ -110,7 +109,7 @@ private void visit(@Nonnull OperationGroup group, @Nonnull List k.endsWith("Base")) .orElse(false)) { return OpenApiSchema.builder().withPointer(s.getPointer()).withAllOf(s, OpenApiSchema.ANONYMOUS_OBJECT).build(); } @@ -246,15 +245,16 @@ private void visit(Namespace parent, String className, String typedefName, OpenA if (schema.isArray()) { shape = new ArrayShape(parent, className, mapType(schema), typedefName, description); - } else if (schema.isObject() || schema.hasAllOf() || schema.equals(OpenApiSchema.ANONYMOUS_OBJECT)) { + } else if (schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object) { var objShape = new ObjectShape(parent, className, typedefName, description); visitInto(schema, objShape); shape = objShape; } else if (schema.isString() && schema.hasEnums()) { + var deprecatedEnums = schema.getDeprecatedEnums().orElseGet(Collections::emptySet); shape = new EnumShape( parent, className, - Lists.map(schema.getEnums().orElseThrow(), EnumShape.Variant::new), + Lists.map(schema.getEnums().orElseThrow(), v -> new EnumShape.Variant(v, deprecatedEnums.contains(v))), typedefName, description ); @@ -280,23 +280,22 @@ private void visitInto(OpenApiSchema schema, ObjectShape shape) { schema = allOf.get().get(1); } - final var required = schema.getRequired().orElse(Collections.emptySet()); - schema.getProperties() - .ifPresent( - props -> props.forEach( - (k, v) -> shape.addBodyField(new Field(k, mapType(v), required.contains(k), v.getDescription().orElse(null), null)) - ) - ); + final var properties = new HashMap(); + final var additionalProperties = new ArrayList(); + final var required = collectObjectProperties(schema, properties, additionalProperties); - var additionalProperties = schema.getAdditionalProperties().orElse(null); - if (additionalProperties != null) { - var valueType = mapType(additionalProperties); + properties.forEach( + (k, v) -> { shape.addBodyField(new Field(k, mapType(v), required.contains(k), v.getDescription().orElse(null), null)); } + ); + + if (!additionalProperties.isEmpty()) { + var valueSchema = additionalProperties.size() == 1 ? additionalProperties.get(0) : OpenApiSchema.ANONYMOUS_UNTYPED; shape.setAdditionalPropertiesField( new Field( - additionalProperties.getTitle().orElseThrow(), - Types.Java.Util.Map(Types.Java.Lang.String, valueType), + valueSchema.getTitle().orElseThrow(), + Types.Java.Util.Map(Types.Java.Lang.String, mapType(valueSchema)), false, - additionalProperties.getDescription().orElse(null), + valueSchema.getDescription().orElse(null), null, true ) @@ -304,6 +303,54 @@ private void visitInto(OpenApiSchema schema, ObjectShape shape) { } } + private Set collectObjectProperties( + OpenApiSchema schema, + Map properties, + List additionalProperties + ) { + if (schema.has$ref()) { + return collectObjectProperties(schema.resolve(), properties, additionalProperties); + } + + if (schema.hasAllOf()) { + var required = new HashSet(); + for (var component : schema.getAllOf().orElseThrow()) { + required.addAll(collectObjectProperties(component, properties, additionalProperties)); + } + return required; + } + + if (schema.hasAnyOf() || schema.hasOneOf()) { + Set required = null; + for (var component : schema.getAnyOf().or(schema::getOneOf).orElseThrow()) { + var componentRequired = collectObjectProperties(component, properties, additionalProperties); + if (required == null) { + required = new HashSet<>(componentRequired); + } else { + required.retainAll(componentRequired); + } + } + return required; + } + + schema.getProperties().ifPresent(props -> props.forEach((k, v) -> { + var existing = properties.get(k); + if (existing != null) { + var existingType = existing.determineSingleType().orElse(null); + var newType = v.determineSingleType().orElse(null); + if (existingType != null + && (existingType == OpenApiSchemaType.Object || existingType == OpenApiSchemaType.Array || existingType != newType)) { + v = OpenApiSchema.ANONYMOUS_UNTYPED; + } + } + properties.put(k, v); + })); + + schema.getAdditionalProperties().ifPresent(additionalProperties::add); + + return schema.getRequired().orElseGet(Collections::emptySet); + } + private Type mapType(OpenApiSchema schema) { return mapType(schema, false); } @@ -356,8 +403,7 @@ private Type mapTypeInner(OpenApiSchema schema) { case Array: return mapArray(schema); case String: - if (schema.getPattern().map("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$"::equals).orElse(false)) - return Types.Client.OpenSearch._Types.Time; + if ("_common:Duration".equals(schema.getPointer().getLastKey().orElse(null))) return Types.Client.OpenSearch._Types.Time; return Types.Java.Lang.String; case Boolean: return Types.Primitive.Boolean; @@ -374,7 +420,7 @@ private Type mapOneOf(List oneOf) { return mapType(oneOf.get(1)); } - var types = oneOf.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); + var types = OpenApiSchema.determineTypes(oneOf); if (types.size() == 2 && types.contains(OpenApiSchemaType.String) @@ -420,7 +466,7 @@ private Type mapNumber(OpenApiSchema schema) { } private boolean shouldKeepRef(OpenApiSchema schema) { - if (schema.isNumber()) { + if (schema.isNumber() || schema.isArray()) { return false; } if (schema.isString() && schema.getEnums().isEmpty()) { @@ -430,8 +476,7 @@ private boolean shouldKeepRef(OpenApiSchema schema) { return schema.getOneOf().orElseThrow().stream().allMatch(s -> s.getTitle().isPresent()); } if (schema.getAllOf().isPresent()) { - var types = schema.determineTypes(); - return types.size() == 1 && types.iterator().next().equals(OpenApiSchemaType.Object); + return schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object; } return true; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index ca4d27a0a3..89fc45d044 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -15,6 +15,7 @@ import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; +import org.opensearch.client.codegen.renderer.lambdas.TypeIsDefinedLambda; import org.opensearch.client.codegen.renderer.lambdas.TypeQueryParamifyLambda; import org.opensearch.client.codegen.renderer.lambdas.TypeSerializerLambda; @@ -201,6 +202,10 @@ public Mustache.Lambda queryParamify() { return new TypeQueryParamifyLambda(this); } + public Mustache.Lambda isDefined() { + return new TypeIsDefinedLambda(this); + } + public static final class Builder { private String pkg; private String name; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java index bf69e82fcf..11e57a1b7b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java @@ -15,6 +15,7 @@ public enum HttpStatusCode { Ok("200"), Created("201"), + NoContent("204"), BadRequest("400"), Forbidden("403"), NotFound("404"), diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index 4d12ae2659..5928c63fce 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -11,6 +11,7 @@ import static org.opensearch.client.codegen.utils.Functional.ifNonnull; import io.swagger.v3.oas.models.media.Schema; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -27,6 +28,7 @@ public class OpenApiSchema extends OpenApiRefElement { private static final JsonPointer ANONYMOUS = JsonPointer.of(""); + public static final OpenApiSchema ANONYMOUS_UNTYPED = builder().withPointer(ANONYMOUS.append("untyped")).build(); public static final OpenApiSchema ANONYMOUS_OBJECT = builder().withPointer(ANONYMOUS.append("object")) .withTypes(OpenApiSchemaType.Object) .build(); @@ -44,10 +46,14 @@ public class OpenApiSchema extends OpenApiRefElement { @Nullable private final List allOf; @Nullable + private final List anyOf; + @Nullable private final List oneOf; @Nullable private final List enums; @Nullable + private final Set deprecatedEnums; + @Nullable private final OpenApiSchema items; @Nullable private final OpenApiSchema additionalProperties; @@ -68,8 +74,10 @@ private OpenApiSchema(@Nonnull Builder builder) { types = builder.types; format = builder.format; allOf = builder.allOf; + anyOf = builder.anyOf; oneOf = builder.oneOf; enums = builder.enums; + deprecatedEnums = builder.deprecatedEnums; items = builder.items; additionalProperties = builder.additionalProperties; properties = builder.properties; @@ -107,6 +115,7 @@ protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer format = ifNonnull(schema.getFormat(), OpenApiSchemaFormat::from); allOf = children("allOf", schema.getAllOf(), OpenApiSchema::new); + anyOf = children("anyOf", schema.getAnyOf(), OpenApiSchema::new); oneOf = children("oneOf", schema.getOneOf(), OpenApiSchema::new); enums = ifNonnull(schema.getEnum(), e -> Lists.map(e, String::valueOf)); @@ -121,6 +130,11 @@ protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer title = schema.getTitle(); pattern = schema.getPattern(); + + var extensions = schema.getExtensions(); + + // noinspection unchecked + deprecatedEnums = Maps.tryGet(extensions, "x-deprecated-enums").map(e -> (Collection) e).map(HashSet::new).orElse(null); } @Nonnull @@ -182,6 +196,15 @@ public Optional> getAllOf() { return Lists.unmodifiableOpt(allOf); } + public boolean hasAnyOf() { + return anyOf != null && !anyOf.isEmpty(); + } + + @Nonnull + public Optional> getAnyOf() { + return Lists.unmodifiableOpt(anyOf); + } + public boolean hasOneOf() { return oneOf != null && !oneOf.isEmpty(); } @@ -200,6 +223,11 @@ public Optional> getEnums() { return Lists.unmodifiableOpt(enums); } + @Nonnull + public Optional> getDeprecatedEnums() { + return Sets.unmodifiableOpt(deprecatedEnums); + } + @Nonnull public Optional getItems() { return Optional.ofNullable(items); @@ -230,6 +258,14 @@ public Optional getPattern() { return Optional.ofNullable(pattern); } + public static Set determineTypes(List schemas) { + return schemas.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); + } + + private static String schemaTypeString(Set types) { + return types.stream().map(OpenApiSchemaType::toString).collect(Collectors.joining(", ")); + } + @Nonnull public Set determineTypes() { if (types != null) { @@ -237,19 +273,27 @@ public Set determineTypes() { } else if (has$ref()) { return resolve().determineTypes(); } else if (allOf != null) { - var types = allOf.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); + var types = determineTypes(allOf); if (types.size() > 1) { - var typeString = types.stream().map(OpenApiSchemaType::toString).collect(Collectors.joining(", ")); - throw new IllegalStateException("allOf schema must have a uniform type [" + getPointer() + "]: " + typeString); + throw new IllegalStateException("allOf schema must have a uniform type [" + getPointer() + "]: " + schemaTypeString(types)); } return types; + } else if (anyOf != null) { + return determineTypes(anyOf); } else if (oneOf != null) { - return oneOf.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); + return determineTypes(oneOf); } throw new IllegalStateException("Cannot determine type for schema: " + getPointer()); } + @Nonnull + public Optional determineSingleType() { + var types = determineTypes(); + if (types.size() != 1) return Optional.empty(); + return Optional.of(types.iterator().next()); + } + @Nonnull public static Builder builder() { return new Builder(); @@ -275,10 +319,14 @@ public static class Builder { @Nullable private List allOf; @Nullable + private List anyOf; + @Nullable private List oneOf; @Nullable private List enums; @Nullable + private Set deprecatedEnums; + @Nullable private OpenApiSchema items; @Nullable private OpenApiSchema additionalProperties; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java index b9b467a68f..f3bd8fa731 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java @@ -17,7 +17,8 @@ public enum OpenApiSchemaFormat { Float, Double, Int32, - Int64; + Int64, + Binary; private static final Map VALUES = Maps.createLookupOf(values(), OpenApiSchemaFormat::toString); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TemplateRenderingLambda.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TemplateRenderingLambda.java index 18df162e4e..160e35480d 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TemplateRenderingLambda.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TemplateRenderingLambda.java @@ -31,7 +31,8 @@ public void execute(Template.Fragment fragment, Writer out) throws IOException { var renderer = TemplateFragmentUtils.findParentContext(fragment, TemplateGlobalContext.class).orElseThrow().getRenderer(); try { - renderer.render(templateName, getContext(fragment), out); + var content = renderer.render(templateName, getContext(fragment)); + out.write(content.strip()); } catch (RenderException e) { throw new RuntimeException(e); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TypeIsDefinedLambda.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TypeIsDefinedLambda.java new file mode 100644 index 0000000000..6ccbbcdb8c --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/lambdas/TypeIsDefinedLambda.java @@ -0,0 +1,52 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.renderer.lambdas; + +import com.samskivert.mustache.Template; +import java.util.Objects; +import javax.annotation.Nonnull; +import org.opensearch.client.codegen.model.Type; +import org.opensearch.client.codegen.utils.Strings; + +public final class TypeIsDefinedLambda extends TemplateRenderingLambda { + @Nonnull + private final Type type; + + public TypeIsDefinedLambda(Type type) { + super("Type/isDefined"); + this.type = Objects.requireNonNull(type, "type must not be null"); + } + + @Override + public Object getContext(Template.Fragment fragment) { + return new Context(type, fragment.execute()); + } + + public static final class Context { + @Nonnull + private final Type type; + @Nonnull + private final String value; + + private Context(@Nonnull Type type, @Nonnull String value) { + this.type = Objects.requireNonNull(type, "type must not be null"); + this.value = Strings.requireNonBlank(value, "value must not be blank"); + } + + @Nonnull + public Type getType() { + return type; + } + + @Nonnull + public String getValue() { + return value; + } + } +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/EnumShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/EnumShape.mustache index 78c5bfc7fa..a9a14284f0 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/EnumShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/EnumShape.mustache @@ -1,8 +1,13 @@ {{>Partials/ClassDeclaration}} { - {{#variants}} - {{name}}({{#quoted}}{{wireName}}{{/quoted}}){{^-last}},{{/-last}} - {{/variants}} - ; +{{#variants}} +{{^-first}} + +{{/-first}} +{{#deprecated}} + @Deprecated +{{/deprecated}} + {{name}}({{#quoted}}{{wireName}}{{/quoted}}){{#-last}};{{/-last}}{{^-last}},{{/-last}} +{{/variants}} private final String jsonValue; diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache index 2ef354df7a..26d308c6a5 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache @@ -26,19 +26,27 @@ {{#fields}} {{#type.isMap}} - {{>ObjectShape/FieldDoc/Basic}} + {{>ObjectShape/FieldDoc/MapAddAll}} {{#deprecation}}@Deprecated{{/deprecation}} public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type}} map) { this.{{name}} = _mapPutAll(this.{{name}}, map); return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } - {{>ObjectShape/FieldDoc/Basic}} + {{>ObjectShape/FieldDoc/MapAdd}} {{#deprecation}}@Deprecated{{/deprecation}} public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.mapKeyType}} key, {{type.mapValueType}} value) { this.{{name}} = _mapPut(this.{{name}}, key, value); return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } + {{#type.mapValueType.hasBuilder}} + + {{>ObjectShape/FieldDoc/MapAddBuilderFn}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#abstract}}T{{/abstract}} {{name}}(String key, {{type.mapValueType.builderFnType}} fn) { + return {{name}}(key, fn.apply(new {{type.mapValueType.builderType}}()).build()); + } + {{/type.mapValueType.hasBuilder}} {{/type.isMap}} {{#type.isList}} {{>ObjectShape/FieldDoc/ListAddAll}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache index 851ccc468e..76f88b51f5 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache @@ -2,5 +2,7 @@ * {{#required}}Required - {{/required}}{{#description}}{{.}}

{{/description}}API name: {@code {{wireName}}}{{#description}}

{{/description}} {{/isAdditionalProperties}} {{#isAdditionalProperties}} -* {{description}} +{{#description}} +* {{.}} +{{/description}} {{/isAdditionalProperties}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAdd.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAdd.mustache new file mode 100644 index 0000000000..a6cc4e3a25 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAdd.mustache @@ -0,0 +1,5 @@ +/** +{{>ObjectShape/FieldDoc/BasicInner}} + +*

Adds an entry to {{name}}.

+*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddAll.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddAll.mustache new file mode 100644 index 0000000000..2d457b87df --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddAll.mustache @@ -0,0 +1,5 @@ +/** +{{>ObjectShape/FieldDoc/BasicInner}} + +*

Adds all elements of map to {{name}}.

+*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddBuilderFn.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddBuilderFn.mustache new file mode 100644 index 0000000000..867d0eca28 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/MapAddBuilderFn.mustache @@ -0,0 +1,5 @@ +/** +{{>ObjectShape/FieldDoc/BasicInner}} + +*

Adds a value to {{name}} using a builder lambda.

+*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache index 8c40ad79d8..bd320a391b 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache @@ -1,10 +1,12 @@ {{#fields}} +{{^-first}} +{{/-first}} {{#deprecation}}@Deprecated{{/deprecation}} - {{^required}} - {{^type.isListOrMap}} +{{^required}} +{{^type.isListOrMap}} @{{TYPES.Javax.Annotation.Nullable}} - {{/type.isListOrMap}} - {{/required}} +{{/type.isListOrMap}} +{{/required}} private final {{type}} {{name}}; {{/fields}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache index 56e993fa67..e40f75049e 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache @@ -1,4 +1,4 @@ -{{^extendsOtherType}} +{{^extendsOtherShape}} /** * Serialize this object to JSON. */ @@ -9,25 +9,25 @@ generator.writeEnd(); } -{{/extendsOtherType}} +{{/extendsOtherShape}} protected void serializeInternal({{TYPES.Jakarta.Json.Stream.JsonGenerator}} generator, {{TYPES.Client.Json.JsonpMapper}} mapper) { +{{#extendsOtherShape}} + super.serializeInternal(generator, mapper); +{{/extendsOtherShape}} {{#additionalPropertiesField}} {{#type.directSerializer}}this.{{name}}{{/type.directSerializer}} {{/additionalPropertiesField}} {{#bodyFields}} - {{^required}} - {{#type.isListOrMap}} - if ({{TYPES.Client.Util.ApiTypeHelper}}.isDefined(this.{{name}})) { - {{/type.isListOrMap}} - {{^type.isListOrMap}} - if (this.{{name}} != null) { - {{/type.isListOrMap}} - {{/required}} +{{^required}} + if ({{#type.isDefined}}this.{{name}}{{/type.isDefined}}) { +{{/required}} generator.writeKey({{#quoted}}{{wireName}}{{/quoted}}); {{#type.serializer}}this.{{name}}{{/type.serializer}} - {{^required}} +{{^required}} } - {{/required}} +{{/required}} +{{^-last}} +{{/-last}} {{/bodyFields}} } \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache index 3b21b2216e..73c0960fea 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache @@ -61,7 +61,7 @@ int propsSet = 0; {{#pathParams}} - if ({{TYPES.Client.Util.ApiTypeHelper}}.isDefined(request.{{name}}())) propsSet |= _{{name}}; + {{^required}}if ({{#type.isDefined}}request.{{name}}(){{/type.isDefined}}) {{/required}}propsSet |= _{{name}}; {{/pathParams}} {{#httpPaths}} @@ -79,12 +79,7 @@ {{TYPES.Java.Util.Map}} params = new {{TYPES.Java.Util.HashMap}}<>(); {{#queryParams}} {{^required}} - {{#type.isListOrMap}} - if ({{TYPES.Client.Util.ApiTypeHelper}}.isDefined(request.{{name}})) { - {{/type.isListOrMap}} - {{^type.isListOrMap}} - if (request.{{name}} != null) { - {{/type.isListOrMap}} + if ({{#type.isDefined}}request.{{name}}{{/type.isDefined}}) { {{/required}} params.put({{#quoted}}{{wireName}}{{/quoted}}, {{#type.queryParamify}}request.{{name}}{{/type.queryParamify}}); {{^required}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index b324c9a454..65bb3b6360 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -30,6 +30,7 @@ return fn.apply(new Builder()).build(); } +{{#false}} public String _toJsonString() { switch (_kind) { {{#variants}} @@ -41,6 +42,7 @@ } } +{{/false}} {{#variants}} /** * Is this variant instance of kind {@code {{name}}}? diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/isDefined.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/isDefined.mustache new file mode 100644 index 0000000000..f000d39991 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/isDefined.mustache @@ -0,0 +1,6 @@ +{{#type.isListOrMap}} +{{TYPES.Client.Util.ApiTypeHelper}}.isDefined({{value}}) +{{/type.isListOrMap}} +{{^type.isListOrMap}} +{{value}} != null +{{/type.isListOrMap}} \ No newline at end of file From 46a007e6e224f4d87124219f741db27a7ff8f9b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 07:55:22 -0400 Subject: [PATCH 12/37] Bump io.github.classgraph:classgraph from 4.8.174 to 4.8.175 (#1154) * Bump io.github.classgraph:classgraph from 4.8.174 to 4.8.175 Bumps [io.github.classgraph:classgraph](https://github.com/classgraph/classgraph) from 4.8.174 to 4.8.175. - [Release notes](https://github.com/classgraph/classgraph/releases) - [Commits](https://github.com/classgraph/classgraph/compare/classgraph-4.8.174...classgraph-4.8.175) --- updated-dependencies: - dependency-name: io.github.classgraph:classgraph dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aefa38cbbc..3cf10593d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 +- Bumps `io.github.classgraph:classgraph` from 4.8.174 to 4.8.175 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 42c019b852..7d65ac37f9 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -229,7 +229,7 @@ dependencies { implementation("org.eclipse", "yasson", "2.0.2") // https://github.com/classgraph/classgraph - testImplementation("io.github.classgraph:classgraph:4.8.174") + testImplementation("io.github.classgraph:classgraph:4.8.175") // Eclipse 1.0 testImplementation("junit", "junit" , "4.13.2") { From eb14e3f1f6e65ec6f73da7f1726e1c7dd1c7b7a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:32:04 -0400 Subject: [PATCH 13/37] Bump commons-logging:commons-logging from 1.3.3 to 1.3.4 in /java-client (#1155) * Bump commons-logging:commons-logging from 1.3.3 to 1.3.4 in /java-client Bumps commons-logging:commons-logging from 1.3.3 to 1.3.4. --- updated-dependencies: - dependency-name: commons-logging:commons-logging dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf10593d3..49e11a53cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 - Bumps `io.github.classgraph:classgraph` from 4.8.174 to 4.8.175 +- Bumps `commons-logging:commons-logging` from 1.3.3 to 1.3.4 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 7d65ac37f9..73ca0807f4 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -177,7 +177,7 @@ dependencies { val jacksonDatabindVersion = "2.17.0" // Apache 2.0 - api("commons-logging:commons-logging:1.3.3") + api("commons-logging:commons-logging:1.3.4") compileOnly("org.opensearch.client", "opensearch-rest-client", opensearchVersion) testImplementation("org.hamcrest:hamcrest:3.0") testImplementation("com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.1") { From c6e61e1b559cc7e26b1e65765440c02192e44180 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 27 Aug 2024 09:16:30 +1200 Subject: [PATCH 14/37] Generate the ml namespace (#1158) * Generate ml.register_model_group Signed-off-by: Thomas Farr * Start neural search sample Signed-off-by: Thomas Farr * Re-generate ShardStatistics Signed-off-by: Thomas Farr * Re-generate ShardFailure Signed-off-by: Thomas Farr * Re-generate Result Signed-off-by: Thomas Farr * Re-generate WriteResponseBase Signed-off-by: Thomas Farr * Generate ml.delete_model_group Signed-off-by: Thomas Farr * Generate ml.register_model Signed-off-by: Thomas Farr * Exclude legacy license from ml namespace Signed-off-by: Thomas Farr * Generate ml.get_task Signed-off-by: Thomas Farr * Generate ml.delete_task Signed-off-by: Thomas Farr * Generate ml.delete_model Signed-off-by: Thomas Farr * Generate ml.deploy_model Signed-off-by: Thomas Farr * Generate ml.undeploy_model Signed-off-by: Thomas Farr * Complete neural search sample Signed-off-by: Thomas Farr * Generate ml.get_model Signed-off-by: Thomas Farr * Add changelog entry Signed-off-by: Thomas Farr * note Signed-off-by: Thomas Farr * Fix tests Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- CHANGELOG.md | 6 +- UPGRADING.md | 6 +- .../opensearch/OpenSearchAsyncClient.java | 5 + .../client/opensearch/OpenSearchClient.java | 5 + .../client/opensearch/_types/Result.java | 16 +- .../opensearch/_types/ShardFailure.java | 33 +- .../opensearch/_types/ShardStatistics.java | 144 ++++--- .../opensearch/_types/WriteResponseBase.java | 81 ++-- .../ml/DeleteModelGroupRequest.java | 101 +++++ .../ml/DeleteModelGroupResponse.java | 75 ++++ .../opensearch/ml/DeleteModelRequest.java | 101 +++++ .../opensearch/ml/DeleteModelResponse.java | 75 ++++ .../opensearch/ml/DeleteTaskRequest.java | 101 +++++ .../opensearch/ml/DeleteTaskResponse.java | 75 ++++ .../opensearch/ml/DeployModelRequest.java | 102 +++++ .../opensearch/ml/DeployModelResponse.java | 160 +++++++ .../opensearch/ml/GetModelGroupRequest.java | 101 +++++ .../opensearch/ml/GetModelGroupResponse.java | 258 ++++++++++++ .../client/opensearch/ml/GetTaskRequest.java | 101 +++++ .../client/opensearch/ml/GetTaskResponse.java | 394 ++++++++++++++++++ .../ml/OpenSearchMlAsyncClient.java | 279 +++++++++++++ .../opensearch/ml/OpenSearchMlClient.java | 271 ++++++++++++ .../ml/RegisterModelGroupRequest.java | 296 +++++++++++++ .../ml/RegisterModelGroupResponse.java | 145 +++++++ .../opensearch/ml/RegisterModelRequest.java | 264 ++++++++++++ .../opensearch/ml/RegisterModelResponse.java | 131 ++++++ .../opensearch/ml/UndeployModelNode.java | 135 ++++++ .../opensearch/ml/UndeployModelRequest.java | 102 +++++ .../opensearch/ml/UndeployModelResponse.java | 142 +++++++ .../json/PlainJsonSerializableTest.java | 2 +- .../opensearch/model/TypedKeysTest.java | 4 +- java-codegen/build.gradle.kts | 3 + java-codegen/opensearch-openapi.yaml | 43 +- .../client/codegen/CodeGenerator.java | 10 +- .../client/codegen/model/Deprecation.java | 7 +- .../client/codegen/model/Namespace.java | 7 +- .../client/codegen/model/OperationGroup.java | 59 --- .../codegen/model/OperationGroupMatcher.java | 61 +++ .../client/codegen/model/RequestShape.java | 6 + .../client/codegen/model/Shape.java | 4 + .../client/codegen/model/SpecTransformer.java | 35 +- .../codegen/openapi/OpenApiOperation.java | 6 +- .../codegen/openapi/OpenApiParameter.java | 6 +- .../client/codegen/openapi/OpenApiSchema.java | 14 + .../client/codegen/utils/Strings.java | 12 + .../client/codegen/utils/Versions.java | 25 ++ .../templates/Partials/ClassHeader.mustache | 2 + .../client/samples/neural/NeuralSearch.java | 333 +++++++++++++++ 48 files changed, 4110 insertions(+), 234 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/Result.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ShardFailure.java (92%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ShardStatistics.java (79%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java (94%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/utils/Versions.java create mode 100644 samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e11a53cb..d3ec2058b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This section is for maintaining a changelog for all breaking changes for the cli - Migrate client transports to Apache HttpClient / Core 5.x ([#246](https://github.com/opensearch-project/opensearch-java/pull/246)) - Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769)) - Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124)) +- Changed type of `ShardStatistics`'s `total`, `successful`, `failed` & `skipped` fields from `Number` to `int/Integer` ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) ### Deprecated - Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536)) @@ -36,8 +37,9 @@ This section is for maintaining a changelog for all breaking changes for the cli ## [Unreleased 2.x] ### Added -- Adds `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) -- Adds `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) +- Added `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) +- Added `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) +- Added the `ml` namespace operations ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) ### Dependencies diff --git a/UPGRADING.md b/UPGRADING.md index 4764e323bf..194fd82ae4 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -23,4 +23,8 @@ After: ``` ### DanglingIndex creationDateMillis type -- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`. \ No newline at end of file +- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`. + +### ShardStatistics properties types +- The type of the `total`, `successful` and `failed` fields has been corrected from `Number` to `int`. +- The type of the `skipped` field has been corrected from `Number` to `Integer`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 3c2dbdd206..d962a97b6a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -44,6 +44,7 @@ import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; +import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -71,6 +72,10 @@ public OpenSearchDanglingIndicesAsyncClient danglingIndices() { return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); } + public OpenSearchMlAsyncClient ml() { + return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java index d797bf2b54..84fd03d645 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -43,6 +43,7 @@ import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; +import org.opensearch.client.opensearch.ml.OpenSearchMlClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -70,6 +71,10 @@ public OpenSearchDanglingIndicesClient danglingIndices() { return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); } + public OpenSearchMlClient ml() { + return new OpenSearchMlClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Result.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/Result.java index 54b408cf76..651f561ce3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Result.java @@ -30,24 +30,30 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.Result + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum Result implements JsonEnum { Created("created"), - Updated("updated"), - Deleted("deleted"), - NotFound("not_found"), - NoOp("noop"), - ; + NotFound("not_found"), + + Updated("updated"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java similarity index 92% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardFailure.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index cf142da1d5..76397fa257 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -48,7 +53,9 @@ // typedef: _types.ShardFailure @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ShardFailure implements PlainJsonSerializable { + @Nullable private final String index; @@ -65,16 +72,14 @@ public class ShardFailure implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ShardFailure(Builder builder) { - this.index = builder.index; this.node = builder.node; this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); this.status = builder.status; - } - public static ShardFailure of(Function> fn) { + public static ShardFailure of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -119,6 +124,7 @@ public final String status() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -126,17 +132,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.node != null) { generator.writeKey("node"); generator.write(this.node); - } + generator.writeKey("reason"); this.reason.serialize(generator, mapper); @@ -146,9 +151,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.status != null) { generator.writeKey("status"); generator.write(this.status); - } - } // --------------------------------------------------------------------------------------------- @@ -156,18 +159,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ShardFailure}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private String index; - @Nullable private String node; - private ErrorCause reason; - private Integer shard; - @Nullable private String status; @@ -199,7 +197,7 @@ public final Builder reason(ErrorCause value) { * Required - API name: {@code reason} */ public final Builder reason(Function> fn) { - return this.reason(fn.apply(new ErrorCause.Builder()).build()); + return reason(fn.apply(new ErrorCause.Builder()).build()); } /** @@ -221,8 +219,7 @@ public final Builder status(@Nullable String value) { /** * Builds a {@link ShardFailure}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ShardFailure build() { _checkSingleUse(); @@ -230,7 +227,6 @@ public ShardFailure build() { return new ShardFailure(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -242,13 +238,10 @@ public ShardFailure build() { ); protected static void setupShardFailureDeserializer(ObjectDeserializer op) { - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardStatistics.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 5a335c7a83..04e9e5f14a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -49,73 +54,74 @@ // typedef: _types.ShardStatistics @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ShardStatistics implements PlainJsonSerializable { - private final Number failed; - - private final Number successful; - private final Number total; + private final int failed; private final List failures; @Nullable - private final Number skipped; + private final Integer skipped; + + private final int successful; + + private final int total; // --------------------------------------------------------------------------------------------- private ShardStatistics(Builder builder) { - this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); - this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.failures = ApiTypeHelper.unmodifiable(builder.failures); this.skipped = builder.skipped; - + this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); } - public static ShardStatistics of(Function> fn) { + public static ShardStatistics of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code failed} */ - public final Number failed() { + public final int failed() { return this.failed; } /** - * Required - API name: {@code successful} + * API name: {@code failures} */ - public final Number successful() { - return this.successful; + public final List failures() { + return this.failures; } /** - * Required - API name: {@code total} + * API name: {@code skipped} */ - public final Number total() { - return this.total; + @Nullable + public final Integer skipped() { + return this.skipped; } /** - * API name: {@code failures} + * Required - API name: {@code successful} */ - public final List failures() { - return this.failures; + public final int successful() { + return this.successful; } /** - * API name: {@code skipped} + * Required - API name: {@code total} */ - @Nullable - public final Number skipped() { - return this.skipped; + public final int total() { + return this.total; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -123,32 +129,28 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("failed"); - generator.write(this.failed.doubleValue()); - - generator.writeKey("successful"); - generator.write(this.successful.doubleValue()); - - generator.writeKey("total"); - generator.write(this.total.doubleValue()); + generator.write(this.failed); if (ApiTypeHelper.isDefined(this.failures)) { generator.writeKey("failures"); generator.writeStartArray(); for (ShardFailure item0 : this.failures) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.skipped != null) { generator.writeKey("skipped"); - generator.write(this.skipped.doubleValue()); - + generator.write(this.skipped); } + generator.writeKey("successful"); + generator.write(this.successful); + + generator.writeKey("total"); + generator.write(this.total); } // --------------------------------------------------------------------------------------------- @@ -156,48 +158,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ShardStatistics}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Number failed; - - private Number successful; - - private Number total; - + private Integer failed; @Nullable private List failures; - @Nullable - private Number skipped; + private Integer skipped; + private Integer successful; + private Integer total; /** * Required - API name: {@code failed} */ - public final Builder failed(Number value) { + public final Builder failed(int value) { this.failed = value; return this; } - /** - * Required - API name: {@code successful} - */ - public final Builder successful(Number value) { - this.successful = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(Number value) { - this.total = value; - return this; - } - /** * API name: {@code failures} + * *

* Adds all elements of list to failures. + *

*/ public final Builder failures(List list) { this.failures = _listAddAll(this.failures, list); @@ -206,8 +189,10 @@ public final Builder failures(List list) { /** * API name: {@code failures} + * *

* Adds one or more values to failures. + *

*/ public final Builder failures(ShardFailure value, ShardFailure... values) { this.failures = _listAdd(this.failures, value, values); @@ -216,8 +201,10 @@ public final Builder failures(ShardFailure value, ShardFailure... values) { /** * API name: {@code failures} + * *

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

*/ public final Builder failures(Function> fn) { return failures(fn.apply(new ShardFailure.Builder()).build()); @@ -226,16 +213,31 @@ public final Builder failures(Function op) { - - op.add(Builder::failed, JsonpDeserializer.numberDeserializer(), "failed"); - op.add(Builder::successful, JsonpDeserializer.numberDeserializer(), "successful"); - op.add(Builder::total, JsonpDeserializer.numberDeserializer(), "total"); + op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); - op.add(Builder::skipped, JsonpDeserializer.numberDeserializer(), "skipped"); - + op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); + op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java similarity index 94% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index 27244d3539..83a031739d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -45,7 +50,12 @@ // typedef: _types.WriteResponseBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class WriteResponseBase implements PlainJsonSerializable { + + @Nullable + private final Boolean forcedRefresh; + private final String id; private final String index; @@ -60,13 +70,10 @@ public abstract class WriteResponseBase implements PlainJsonSerializable { private final long version; - @Nullable - private final Boolean forcedRefresh; - // --------------------------------------------------------------------------------------------- protected WriteResponseBase(AbstractBuilder builder) { - + this.forcedRefresh = builder.forcedRefresh; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.primaryTerm = ApiTypeHelper.requireNonNull(builder.primaryTerm, this, "primaryTerm"); @@ -74,8 +81,14 @@ protected WriteResponseBase(AbstractBuilder builder) { this.seqNo = ApiTypeHelper.requireNonNull(builder.seqNo, this, "seqNo"); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - this.forcedRefresh = builder.forcedRefresh; + } + /** + * API name: {@code forced_refresh} + */ + @Nullable + public final Boolean forcedRefresh() { + return this.forcedRefresh; } /** @@ -127,17 +140,10 @@ public final long version() { return this.version; } - /** - * API name: {@code forced_refresh} - */ - @Nullable - public final Boolean forcedRefresh() { - return this.forcedRefresh; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -145,6 +151,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.forcedRefresh != null) { + generator.writeKey("forced_refresh"); + generator.write(this.forcedRefresh); + } generator.writeKey("_id"); generator.write(this.id); @@ -157,6 +167,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("result"); this.result.serialize(generator, mapper); + generator.writeKey("_seq_no"); generator.write(this.seqNo); @@ -165,32 +176,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("_version"); generator.write(this.version); - - if (this.forcedRefresh != null) { - generator.writeKey("forced_refresh"); - generator.write(this.forcedRefresh); - - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable + private Boolean forcedRefresh; private String id; - private String index; - private Long primaryTerm; - private Result result; - private Long seqNo; - private ShardStatistics shards; - private Long version; - @Nullable - private Boolean forcedRefresh; + /** + * API name: {@code forced_refresh} + */ + public final BuilderT forcedRefresh(@Nullable Boolean value) { + this.forcedRefresh = value; + return self(); + } /** * Required - API name: {@code _id} @@ -244,7 +251,7 @@ public final BuilderT shards(ShardStatistics value) { * Required - API name: {@code _shards} */ public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } /** @@ -255,21 +262,12 @@ public final BuilderT version(long value) { return self(); } - /** - * API name: {@code forced_refresh} - */ - public final BuilderT forcedRefresh(@Nullable Boolean value) { - this.forcedRefresh = value; - return self(); - } - protected abstract BuilderT self(); - } - // --------------------------------------------------------------------------------------------- - protected static > void setupWriteResponseBaseDeserializer(ObjectDeserializer op) { + protected static > void setupWriteResponseBaseDeserializer(ObjectDeserializer op) { + op.add(AbstractBuilder::forcedRefresh, JsonpDeserializer.booleanDeserializer(), "forced_refresh"); op.add(AbstractBuilder::id, JsonpDeserializer.stringDeserializer(), "_id"); op.add(AbstractBuilder::index, JsonpDeserializer.stringDeserializer(), "_index"); op.add(AbstractBuilder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); @@ -277,8 +275,5 @@ protected static > void setupWriteRes op.add(AbstractBuilder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(AbstractBuilder::version, JsonpDeserializer.longDeserializer(), "_version"); - op.add(AbstractBuilder::forcedRefresh, JsonpDeserializer.booleanDeserializer(), "forced_refresh"); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java new file mode 100644 index 0000000000..181a605275 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.delete_model_group.Request + +/** + * Deletes a model group. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteModelGroupRequest extends RequestBase { + + private final String modelGroupId; + + // --------------------------------------------------------------------------------------------- + + private DeleteModelGroupRequest(Builder builder) { + this.modelGroupId = ApiTypeHelper.requireNonNull(builder.modelGroupId, this, "modelGroupId"); + } + + public static DeleteModelGroupRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_group_id} + */ + public final String modelGroupId() { + return this.modelGroupId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelGroupRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelGroupId; + + /** + * Required - API name: {@code model_group_id} + */ + public final Builder modelGroupId(String value) { + this.modelGroupId = value; + return this; + } + + /** + * Builds a {@link DeleteModelGroupRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteModelGroupRequest build() { + _checkSingleUse(); + + return new DeleteModelGroupRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_model_group}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/model_groups/"); + SimpleEndpoint.pathEncode(request.modelGroupId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteModelGroupResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java new file mode 100644 index 0000000000..d46916f638 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java @@ -0,0 +1,75 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: ml.delete_model_group.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteModelGroupResponse extends WriteResponseBase { + + // --------------------------------------------------------------------------------------------- + + private DeleteModelGroupResponse(Builder builder) { + super(builder); + } + + public static DeleteModelGroupResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelGroupResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteModelGroupResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteModelGroupResponse build() { + _checkSingleUse(); + + return new DeleteModelGroupResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteModelGroupResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteModelGroupResponse::setupDeleteModelGroupResponseDeserializer + ); + + protected static void setupDeleteModelGroupResponseDeserializer(ObjectDeserializer op) { + WriteResponseBase.setupWriteResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java new file mode 100644 index 0000000000..f9be99c118 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.delete_model.Request + +/** + * Deletes a model. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteModelRequest extends RequestBase { + + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private DeleteModelRequest(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static DeleteModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelId; + + /** + * Required - API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link DeleteModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteModelRequest build() { + _checkSingleUse(); + + return new DeleteModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteModelResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java new file mode 100644 index 0000000000..dcf77c93aa --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java @@ -0,0 +1,75 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: ml.delete_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteModelResponse extends WriteResponseBase { + + // --------------------------------------------------------------------------------------------- + + private DeleteModelResponse(Builder builder) { + super(builder); + } + + public static DeleteModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteModelResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteModelResponse build() { + _checkSingleUse(); + + return new DeleteModelResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteModelResponse::setupDeleteModelResponseDeserializer + ); + + protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer op) { + WriteResponseBase.setupWriteResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java new file mode 100644 index 0000000000..a378f83fde --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.delete_task.Request + +/** + * Deletes a task. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteTaskRequest extends RequestBase { + + private final String taskId; + + // --------------------------------------------------------------------------------------------- + + private DeleteTaskRequest(Builder builder) { + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + } + + public static DeleteTaskRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code task_id} + */ + public final String taskId() { + return this.taskId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteTaskRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String taskId; + + /** + * Required - API name: {@code task_id} + */ + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * Builds a {@link DeleteTaskRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteTaskRequest build() { + _checkSingleUse(); + + return new DeleteTaskRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_task}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/tasks/"); + SimpleEndpoint.pathEncode(request.taskId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteTaskResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java new file mode 100644 index 0000000000..f6d5e8c95d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java @@ -0,0 +1,75 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: ml.delete_task.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteTaskResponse extends WriteResponseBase { + + // --------------------------------------------------------------------------------------------- + + private DeleteTaskResponse(Builder builder) { + super(builder); + } + + public static DeleteTaskResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteTaskResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteTaskResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteTaskResponse build() { + _checkSingleUse(); + + return new DeleteTaskResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteTaskResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteTaskResponse::setupDeleteTaskResponseDeserializer + ); + + protected static void setupDeleteTaskResponseDeserializer(ObjectDeserializer op) { + WriteResponseBase.setupWriteResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java new file mode 100644 index 0000000000..2230cb1d82 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java @@ -0,0 +1,102 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.deploy_model.Request + +/** + * Deploys a model. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeployModelRequest extends RequestBase { + + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private DeployModelRequest(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static DeployModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeployModelRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelId; + + /** + * Required - API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link DeployModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeployModelRequest build() { + _checkSingleUse(); + + return new DeployModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.deploy_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_deploy"); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeployModelResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java new file mode 100644 index 0000000000..6ba333cde4 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -0,0 +1,160 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.deploy_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeployModelResponse implements PlainJsonSerializable { + + private final String status; + + private final String taskId; + + @Nullable + private final String taskType; + + // --------------------------------------------------------------------------------------------- + + private DeployModelResponse(Builder builder) { + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + this.taskType = builder.taskType; + } + + public static DeployModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + public final String status() { + return this.status; + } + + /** + * Required - API name: {@code task_id} + */ + public final String taskId() { + return this.taskId; + } + + /** + * API name: {@code task_type} + */ + @Nullable + public final String taskType() { + return this.taskType; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("status"); + generator.write(this.status); + + generator.writeKey("task_id"); + generator.write(this.taskId); + + if (this.taskType != null) { + generator.writeKey("task_type"); + generator.write(this.taskType); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeployModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String status; + private String taskId; + @Nullable + private String taskType; + + /** + * Required - API name: {@code status} + */ + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code task_id} + */ + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * API name: {@code task_type} + */ + public final Builder taskType(@Nullable String value) { + this.taskType = value; + return this; + } + + /** + * Builds a {@link DeployModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeployModelResponse build() { + _checkSingleUse(); + + return new DeployModelResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeployModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeployModelResponse::setupDeployModelResponseDeserializer + ); + + protected static void setupDeployModelResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + op.add(Builder::taskType, JsonpDeserializer.stringDeserializer(), "task_type"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java new file mode 100644 index 0000000000..92c6537dc9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.get_model_group.Request + +/** + * Retrieves a model group. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetModelGroupRequest extends RequestBase { + + private final String modelGroupId; + + // --------------------------------------------------------------------------------------------- + + private GetModelGroupRequest(Builder builder) { + this.modelGroupId = ApiTypeHelper.requireNonNull(builder.modelGroupId, this, "modelGroupId"); + } + + public static GetModelGroupRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_group_id} + */ + public final String modelGroupId() { + return this.modelGroupId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelGroupRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelGroupId; + + /** + * Required - API name: {@code model_group_id} + */ + public final Builder modelGroupId(String value) { + this.modelGroupId = value; + return this; + } + + /** + * Builds a {@link GetModelGroupRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public GetModelGroupRequest build() { + _checkSingleUse(); + + return new GetModelGroupRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_model_group}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/model_groups/"); + SimpleEndpoint.pathEncode(request.modelGroupId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + GetModelGroupResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java new file mode 100644 index 0000000000..4a8321c607 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -0,0 +1,258 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.get_model_group.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetModelGroupResponse implements PlainJsonSerializable { + + private final String access; + + @Nullable + private final Long createdTime; + + private final String description; + + @Nullable + private final Long lastUpdatedTime; + + private final int latestVersion; + + private final String name; + + // --------------------------------------------------------------------------------------------- + + private GetModelGroupResponse(Builder builder) { + this.access = ApiTypeHelper.requireNonNull(builder.access, this, "access"); + this.createdTime = builder.createdTime; + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.lastUpdatedTime = builder.lastUpdatedTime; + this.latestVersion = ApiTypeHelper.requireNonNull(builder.latestVersion, this, "latestVersion"); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + } + + public static GetModelGroupResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The model group access. + *

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

+ */ + public final String access() { + return this.access; + } + + /** + * API name: {@code created_time} + */ + @Nullable + public final Long createdTime() { + return this.createdTime; + } + + /** + * Required - The model group description. + *

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

+ */ + public final String description() { + return this.description; + } + + /** + * API name: {@code last_updated_time} + */ + @Nullable + public final Long lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Required - The latest version. + *

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

+ */ + public final int latestVersion() { + return this.latestVersion; + } + + /** + * Required - The model group name. + *

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

+ */ + public final String name() { + return this.name; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("access"); + generator.write(this.access); + + if (this.createdTime != null) { + generator.writeKey("created_time"); + generator.write(this.createdTime); + } + + generator.writeKey("description"); + generator.write(this.description); + + if (this.lastUpdatedTime != null) { + generator.writeKey("last_updated_time"); + generator.write(this.lastUpdatedTime); + } + + generator.writeKey("latest_version"); + generator.write(this.latestVersion); + + generator.writeKey("name"); + generator.write(this.name); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelGroupResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String access; + @Nullable + private Long createdTime; + private String description; + @Nullable + private Long lastUpdatedTime; + private Integer latestVersion; + private String name; + + /** + * Required - The model group access. + *

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

+ */ + public final Builder access(String value) { + this.access = value; + return this; + } + + /** + * API name: {@code created_time} + */ + public final Builder createdTime(@Nullable Long value) { + this.createdTime = value; + return this; + } + + /** + * Required - The model group description. + *

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

+ */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * API name: {@code last_updated_time} + */ + public final Builder lastUpdatedTime(@Nullable Long value) { + this.lastUpdatedTime = value; + return this; + } + + /** + * Required - The latest version. + *

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

+ */ + public final Builder latestVersion(int value) { + this.latestVersion = value; + return this; + } + + /** + * Required - The model group name. + *

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

+ */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link GetModelGroupResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public GetModelGroupResponse build() { + _checkSingleUse(); + + return new GetModelGroupResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetModelGroupResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetModelGroupResponse::setupGetModelGroupResponseDeserializer + ); + + protected static void setupGetModelGroupResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::access, JsonpDeserializer.stringDeserializer(), "access"); + op.add(Builder::createdTime, JsonpDeserializer.longDeserializer(), "created_time"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::lastUpdatedTime, JsonpDeserializer.longDeserializer(), "last_updated_time"); + op.add(Builder::latestVersion, JsonpDeserializer.integerDeserializer(), "latest_version"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java new file mode 100644 index 0000000000..55f09a5df6 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.get_task.Request + +/** + * Retrieves a task. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetTaskRequest extends RequestBase { + + private final String taskId; + + // --------------------------------------------------------------------------------------------- + + private GetTaskRequest(Builder builder) { + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + } + + public static GetTaskRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code task_id} + */ + public final String taskId() { + return this.taskId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetTaskRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String taskId; + + /** + * Required - API name: {@code task_id} + */ + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * Builds a {@link GetTaskRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public GetTaskRequest build() { + _checkSingleUse(); + + return new GetTaskRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_task}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/tasks/"); + SimpleEndpoint.pathEncode(request.taskId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + GetTaskResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java new file mode 100644 index 0000000000..610b2c1cb4 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -0,0 +1,394 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.get_task.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetTaskResponse implements PlainJsonSerializable { + + @Nullable + private final Long createTime; + + @Nullable + private final String error; + + @Nullable + private final String functionName; + + @Nullable + private final Boolean isAsync; + + @Nullable + private final Long lastUpdateTime; + + @Nullable + private final String modelId; + + private final String state; + + @Nullable + private final String taskId; + + @Nullable + private final String taskType; + + private final List> workerNode; + + // --------------------------------------------------------------------------------------------- + + private GetTaskResponse(Builder builder) { + this.createTime = builder.createTime; + this.error = builder.error; + this.functionName = builder.functionName; + this.isAsync = builder.isAsync; + this.lastUpdateTime = builder.lastUpdateTime; + this.modelId = builder.modelId; + this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.taskId = builder.taskId; + this.taskType = builder.taskType; + this.workerNode = ApiTypeHelper.unmodifiable(builder.workerNode); + } + + public static GetTaskResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code create_time} + */ + @Nullable + public final Long createTime() { + return this.createTime; + } + + /** + * API name: {@code error} + */ + @Nullable + public final String error() { + return this.error; + } + + /** + * API name: {@code function_name} + */ + @Nullable + public final String functionName() { + return this.functionName; + } + + /** + * API name: {@code is_async} + */ + @Nullable + public final Boolean isAsync() { + return this.isAsync; + } + + /** + * API name: {@code last_update_time} + */ + @Nullable + public final Long lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * Required - API name: {@code state} + */ + public final String state() { + return this.state; + } + + /** + * API name: {@code task_id} + */ + @Nullable + public final String taskId() { + return this.taskId; + } + + /** + * Task type. + *

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

+ */ + @Nullable + public final String taskType() { + return this.taskType; + } + + /** + * API name: {@code worker_node} + */ + public final List> workerNode() { + return this.workerNode; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.error != null) { + generator.writeKey("error"); + generator.write(this.error); + } + + if (this.functionName != null) { + generator.writeKey("function_name"); + generator.write(this.functionName); + } + + if (this.isAsync != null) { + generator.writeKey("is_async"); + generator.write(this.isAsync); + } + + if (this.lastUpdateTime != null) { + generator.writeKey("last_update_time"); + generator.write(this.lastUpdateTime); + } + + if (this.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + generator.writeKey("state"); + generator.write(this.state); + + if (this.taskId != null) { + generator.writeKey("task_id"); + generator.write(this.taskId); + } + + if (this.taskType != null) { + generator.writeKey("task_type"); + generator.write(this.taskType); + } + + if (ApiTypeHelper.isDefined(this.workerNode)) { + generator.writeKey("worker_node"); + generator.writeStartArray(); + for (List item0 : this.workerNode) { + generator.writeStartArray(); + for (String item1 : item0) { + generator.write(item1); + } + generator.writeEnd(); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetTaskResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Long createTime; + @Nullable + private String error; + @Nullable + private String functionName; + @Nullable + private Boolean isAsync; + @Nullable + private Long lastUpdateTime; + @Nullable + private String modelId; + private String state; + @Nullable + private String taskId; + @Nullable + private String taskType; + @Nullable + private List> workerNode; + + /** + * API name: {@code create_time} + */ + public final Builder createTime(@Nullable Long value) { + this.createTime = value; + return this; + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable String value) { + this.error = value; + return this; + } + + /** + * API name: {@code function_name} + */ + public final Builder functionName(@Nullable String value) { + this.functionName = value; + return this; + } + + /** + * API name: {@code is_async} + */ + public final Builder isAsync(@Nullable Boolean value) { + this.isAsync = value; + return this; + } + + /** + * API name: {@code last_update_time} + */ + public final Builder lastUpdateTime(@Nullable Long value) { + this.lastUpdateTime = value; + return this; + } + + /** + * API name: {@code model_id} + */ + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * Required - API name: {@code state} + */ + public final Builder state(String value) { + this.state = value; + return this; + } + + /** + * API name: {@code task_id} + */ + public final Builder taskId(@Nullable String value) { + this.taskId = value; + return this; + } + + /** + * Task type. + *

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

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

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

+ */ + public final Builder workerNode(List> list) { + this.workerNode = _listAddAll(this.workerNode, list); + return this; + } + + /** + * API name: {@code worker_node} + * + *

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

+ */ + public final Builder workerNode(List value, List... values) { + this.workerNode = _listAdd(this.workerNode, value, values); + return this; + } + + /** + * Builds a {@link GetTaskResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public GetTaskResponse build() { + _checkSingleUse(); + + return new GetTaskResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetTaskResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetTaskResponse::setupGetTaskResponseDeserializer + ); + + protected static void setupGetTaskResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::createTime, JsonpDeserializer.longDeserializer(), "create_time"); + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + op.add(Builder::functionName, JsonpDeserializer.stringDeserializer(), "function_name"); + op.add(Builder::isAsync, JsonpDeserializer.booleanDeserializer(), "is_async"); + op.add(Builder::lastUpdateTime, JsonpDeserializer.longDeserializer(), "last_update_time"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + op.add(Builder::taskType, JsonpDeserializer.stringDeserializer(), "task_type"); + op.add( + Builder::workerNode, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), + "worker_node" + ); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java new file mode 100644 index 0000000000..8f2ab231ba --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java @@ -0,0 +1,279 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.JsonEndpoint; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the ml namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenSearchMlAsyncClient extends ApiClient { + public OpenSearchMlAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchMlAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchMlAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchMlAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: ml.delete_model + + /** + * Deletes a model. + */ + public CompletableFuture deleteModel(DeleteModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteModelRequest, + DeleteModelResponse, + ErrorResponse>) DeleteModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes a model. + * + * @param fn a function that initializes a builder to create the {@link DeleteModelRequest} + */ + public final CompletableFuture deleteModel( + Function> fn + ) throws IOException, OpenSearchException { + return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_model_group + + /** + * Deletes a model group. + */ + public CompletableFuture deleteModelGroup(DeleteModelGroupRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteModelGroupRequest, + DeleteModelGroupResponse, + ErrorResponse>) DeleteModelGroupRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes a model group. + * + * @param fn a function that initializes a builder to create the {@link DeleteModelGroupRequest} + */ + public final CompletableFuture deleteModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return deleteModelGroup(fn.apply(new DeleteModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_task + + /** + * Deletes a task. + */ + public CompletableFuture deleteTask(DeleteTaskRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteTaskRequest, + DeleteTaskResponse, + ErrorResponse>) DeleteTaskRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes a task. + * + * @param fn a function that initializes a builder to create the {@link DeleteTaskRequest} + */ + public final CompletableFuture deleteTask(Function> fn) + throws IOException, OpenSearchException { + return deleteTask(fn.apply(new DeleteTaskRequest.Builder()).build()); + } + + // ----- Endpoint: ml.deploy_model + + /** + * Deploys a model. + */ + public CompletableFuture deployModel(DeployModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeployModelRequest, + DeployModelResponse, + ErrorResponse>) DeployModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deploys a model. + * + * @param fn a function that initializes a builder to create the {@link DeployModelRequest} + */ + public final CompletableFuture deployModel( + Function> fn + ) throws IOException, OpenSearchException { + return deployModel(fn.apply(new DeployModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_model_group + + /** + * Retrieves a model group. + */ + public CompletableFuture getModelGroup(GetModelGroupRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetModelGroupRequest, + GetModelGroupResponse, + ErrorResponse>) GetModelGroupRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieves a model group. + * + * @param fn a function that initializes a builder to create the {@link GetModelGroupRequest} + */ + public final CompletableFuture getModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return getModelGroup(fn.apply(new GetModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_task + + /** + * Retrieves a task. + */ + public CompletableFuture getTask(GetTaskRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetTaskRequest, + GetTaskResponse, + ErrorResponse>) GetTaskRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieves a task. + * + * @param fn a function that initializes a builder to create the {@link GetTaskRequest} + */ + public final CompletableFuture getTask(Function> fn) + throws IOException, OpenSearchException { + return getTask(fn.apply(new GetTaskRequest.Builder()).build()); + } + + // ----- Endpoint: ml.register_model + + /** + * Registers a model. + */ + public CompletableFuture registerModel(RegisterModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RegisterModelRequest, + RegisterModelResponse, + ErrorResponse>) RegisterModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Registers a model. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelRequest} + */ + public final CompletableFuture registerModel( + Function> fn + ) throws IOException, OpenSearchException { + return registerModel(fn.apply(new RegisterModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.register_model_group + + /** + * Registers a model group. + */ + public CompletableFuture registerModelGroup(RegisterModelGroupRequest request) throws IOException, + OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RegisterModelGroupRequest, + RegisterModelGroupResponse, + ErrorResponse>) RegisterModelGroupRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Registers a model group. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelGroupRequest} + */ + public final CompletableFuture registerModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return registerModelGroup(fn.apply(new RegisterModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.undeploy_model + + /** + * Undeploys a model. + */ + public CompletableFuture undeployModel(UndeployModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UndeployModelRequest, + UndeployModelResponse, + ErrorResponse>) UndeployModelRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Undeploys a model. + * + * @param fn a function that initializes a builder to create the {@link UndeployModelRequest} + */ + public final CompletableFuture undeployModel( + Function> fn + ) throws IOException, OpenSearchException { + return undeployModel(fn.apply(new UndeployModelRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java new file mode 100644 index 0000000000..d3aba915be --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java @@ -0,0 +1,271 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.io.IOException; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.JsonEndpoint; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the ml namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenSearchMlClient extends ApiClient { + public OpenSearchMlClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchMlClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchMlClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchMlClient(this.transport, transportOptions); + } + + // ----- Endpoint: ml.delete_model + + /** + * Deletes a model. + */ + public DeleteModelResponse deleteModel(DeleteModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteModelRequest, + DeleteModelResponse, + ErrorResponse>) DeleteModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes a model. + * + * @param fn a function that initializes a builder to create the {@link DeleteModelRequest} + */ + public final DeleteModelResponse deleteModel(Function> fn) + throws IOException, OpenSearchException { + return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_model_group + + /** + * Deletes a model group. + */ + public DeleteModelGroupResponse deleteModelGroup(DeleteModelGroupRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteModelGroupRequest, + DeleteModelGroupResponse, + ErrorResponse>) DeleteModelGroupRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes a model group. + * + * @param fn a function that initializes a builder to create the {@link DeleteModelGroupRequest} + */ + public final DeleteModelGroupResponse deleteModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return deleteModelGroup(fn.apply(new DeleteModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_task + + /** + * Deletes a task. + */ + public DeleteTaskResponse deleteTask(DeleteTaskRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeleteTaskRequest, + DeleteTaskResponse, + ErrorResponse>) DeleteTaskRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes a task. + * + * @param fn a function that initializes a builder to create the {@link DeleteTaskRequest} + */ + public final DeleteTaskResponse deleteTask(Function> fn) throws IOException, + OpenSearchException { + return deleteTask(fn.apply(new DeleteTaskRequest.Builder()).build()); + } + + // ----- Endpoint: ml.deploy_model + + /** + * Deploys a model. + */ + public DeployModelResponse deployModel(DeployModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + DeployModelRequest, + DeployModelResponse, + ErrorResponse>) DeployModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deploys a model. + * + * @param fn a function that initializes a builder to create the {@link DeployModelRequest} + */ + public final DeployModelResponse deployModel(Function> fn) + throws IOException, OpenSearchException { + return deployModel(fn.apply(new DeployModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_model_group + + /** + * Retrieves a model group. + */ + public GetModelGroupResponse getModelGroup(GetModelGroupRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetModelGroupRequest, + GetModelGroupResponse, + ErrorResponse>) GetModelGroupRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieves a model group. + * + * @param fn a function that initializes a builder to create the {@link GetModelGroupRequest} + */ + public final GetModelGroupResponse getModelGroup(Function> fn) + throws IOException, OpenSearchException { + return getModelGroup(fn.apply(new GetModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_task + + /** + * Retrieves a task. + */ + public GetTaskResponse getTask(GetTaskRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + GetTaskRequest, + GetTaskResponse, + ErrorResponse>) GetTaskRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieves a task. + * + * @param fn a function that initializes a builder to create the {@link GetTaskRequest} + */ + public final GetTaskResponse getTask(Function> fn) throws IOException, + OpenSearchException { + return getTask(fn.apply(new GetTaskRequest.Builder()).build()); + } + + // ----- Endpoint: ml.register_model + + /** + * Registers a model. + */ + public RegisterModelResponse registerModel(RegisterModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RegisterModelRequest, + RegisterModelResponse, + ErrorResponse>) RegisterModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Registers a model. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelRequest} + */ + public final RegisterModelResponse registerModel(Function> fn) + throws IOException, OpenSearchException { + return registerModel(fn.apply(new RegisterModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.register_model_group + + /** + * Registers a model group. + */ + public RegisterModelGroupResponse registerModelGroup(RegisterModelGroupRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + RegisterModelGroupRequest, + RegisterModelGroupResponse, + ErrorResponse>) RegisterModelGroupRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Registers a model group. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelGroupRequest} + */ + public final RegisterModelGroupResponse registerModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return registerModelGroup(fn.apply(new RegisterModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.undeploy_model + + /** + * Undeploys a model. + */ + public UndeployModelResponse undeployModel(UndeployModelRequest request) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint< + UndeployModelRequest, + UndeployModelResponse, + ErrorResponse>) UndeployModelRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Undeploys a model. + * + * @param fn a function that initializes a builder to create the {@link UndeployModelRequest} + */ + public final UndeployModelResponse undeployModel(Function> fn) + throws IOException, OpenSearchException { + return undeployModel(fn.apply(new UndeployModelRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java new file mode 100644 index 0000000000..ca633f61e5 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java @@ -0,0 +1,296 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_model_group.Request + +/** + * Registers a model group. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterModelGroupRequest extends RequestBase implements PlainJsonSerializable { + + @Nullable + private final String accessMode; + + @Nullable + private final Boolean addAllBackendRoles; + + private final List backendRoles; + + @Nullable + private final String description; + + private final String name; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelGroupRequest(Builder builder) { + this.accessMode = builder.accessMode; + this.addAllBackendRoles = builder.addAllBackendRoles; + this.backendRoles = ApiTypeHelper.unmodifiable(builder.backendRoles); + this.description = builder.description; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + } + + public static RegisterModelGroupRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model group access mode. + *

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

+ */ + @Nullable + public final String accessMode() { + return this.accessMode; + } + + /** + * The add all backend roles. + *

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

+ */ + @Nullable + public final Boolean addAllBackendRoles() { + return this.addAllBackendRoles; + } + + /** + * The backend roles. + *

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

+ */ + public final List backendRoles() { + return this.backendRoles; + } + + /** + * The model group description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - The model group name. + *

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

+ */ + public final String name() { + return this.name; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.accessMode != null) { + generator.writeKey("access_mode"); + generator.write(this.accessMode); + } + + if (this.addAllBackendRoles != null) { + generator.writeKey("add_all_backend_roles"); + generator.write(this.addAllBackendRoles); + } + + if (ApiTypeHelper.isDefined(this.backendRoles)) { + generator.writeKey("backend_roles"); + generator.writeStartArray(); + for (String item0 : this.backendRoles) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("name"); + generator.write(this.name); + } + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterModelGroupRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String accessMode; + @Nullable + private Boolean addAllBackendRoles; + @Nullable + private List backendRoles; + @Nullable + private String description; + private String name; + + /** + * The model group access mode. + *

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

+ */ + public final Builder accessMode(@Nullable String value) { + this.accessMode = value; + return this; + } + + /** + * The add all backend roles. + *

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

+ */ + public final Builder addAllBackendRoles(@Nullable Boolean value) { + this.addAllBackendRoles = value; + return this; + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + public final Builder backendRoles(List list) { + this.backendRoles = _listAddAll(this.backendRoles, list); + return this; + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + public final Builder backendRoles(String value, String... values) { + this.backendRoles = _listAdd(this.backendRoles, value, values); + return this; + } + + /** + * The model group description. + *

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

+ */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - The model group name. + *

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

+ */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link RegisterModelGroupRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterModelGroupRequest build() { + _checkSingleUse(); + + return new RegisterModelGroupRequest(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelGroupRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelGroupRequest::setupRegisterModelGroupRequestDeserializer + ); + + protected static void setupRegisterModelGroupRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::accessMode, JsonpDeserializer.stringDeserializer(), "access_mode"); + op.add(Builder::addAllBackendRoles, JsonpDeserializer.booleanDeserializer(), "add_all_backend_roles"); + op.add(Builder::backendRoles, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "backend_roles"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.register_model_group}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/model_groups/_register", + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + true, + RegisterModelGroupResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java new file mode 100644 index 0000000000..6a04cf66ad --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -0,0 +1,145 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_model_group.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterModelGroupResponse implements PlainJsonSerializable { + + private final String modelGroupId; + + private final String status; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelGroupResponse(Builder builder) { + this.modelGroupId = ApiTypeHelper.requireNonNull(builder.modelGroupId, this, "modelGroupId"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + } + + public static RegisterModelGroupResponse of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The model group ID. + *

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

+ */ + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The status. + *

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

+ */ + public final String status() { + return this.status; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + + generator.writeKey("status"); + generator.write(this.status); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterModelGroupResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelGroupId; + private String status; + + /** + * Required - The model group ID. + *

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

+ */ + public final Builder modelGroupId(String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The status. + *

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

+ */ + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Builds a {@link RegisterModelGroupResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterModelGroupResponse build() { + _checkSingleUse(); + + return new RegisterModelGroupResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelGroupResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelGroupResponse::setupRegisterModelGroupResponseDeserializer + ); + + protected static void setupRegisterModelGroupResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java new file mode 100644 index 0000000000..c94be40813 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -0,0 +1,264 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_model.Request + +/** + * Registers a model. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterModelRequest extends RequestBase implements PlainJsonSerializable { + + @Nullable + private final String description; + + private final String modelFormat; + + @Nullable + private final String modelGroupId; + + private final String name; + + private final String version; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelRequest(Builder builder) { + this.description = builder.description; + this.modelFormat = ApiTypeHelper.requireNonNull(builder.modelFormat, this, "modelFormat"); + this.modelGroupId = builder.modelGroupId; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + } + + public static RegisterModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - The portable format of the model file. + *

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

+ */ + public final String modelFormat() { + return this.modelFormat; + } + + /** + * The ID of the model group to which to register the model. + *

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

+ */ + @Nullable + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The model name. + *

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

+ */ + public final String name() { + return this.name; + } + + /** + * Required - The model version. + *

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

+ */ + public final String version() { + return this.version; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("model_format"); + generator.write(this.modelFormat); + + if (this.modelGroupId != null) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + } + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("version"); + generator.write(this.version); + } + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterModelRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String description; + private String modelFormat; + @Nullable + private String modelGroupId; + private String name; + private String version; + + /** + * The model description. + *

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

+ */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - The portable format of the model file. + *

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

+ */ + public final Builder modelFormat(String value) { + this.modelFormat = value; + return this; + } + + /** + * The ID of the model group to which to register the model. + *

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

+ */ + public final Builder modelGroupId(@Nullable String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The model name. + *

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

+ */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The model version. + *

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

+ */ + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link RegisterModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterModelRequest build() { + _checkSingleUse(); + + return new RegisterModelRequest(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelRequest::setupRegisterModelRequestDeserializer + ); + + protected static void setupRegisterModelRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelFormat, JsonpDeserializer.stringDeserializer(), "model_format"); + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.register_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/models/_register", + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + true, + RegisterModelResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java new file mode 100644 index 0000000000..3b42ed8903 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -0,0 +1,131 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterModelResponse implements PlainJsonSerializable { + + private final String status; + + private final String taskId; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelResponse(Builder builder) { + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + } + + public static RegisterModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + public final String status() { + return this.status; + } + + /** + * Required - API name: {@code task_id} + */ + public final String taskId() { + return this.taskId; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("status"); + generator.write(this.status); + + generator.writeKey("task_id"); + generator.write(this.taskId); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String status; + private String taskId; + + /** + * Required - API name: {@code status} + */ + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code task_id} + */ + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * Builds a {@link RegisterModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterModelResponse build() { + _checkSingleUse(); + + return new RegisterModelResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelResponse::setupRegisterModelResponseDeserializer + ); + + protected static void setupRegisterModelResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java new file mode 100644 index 0000000000..6ba10b82ca --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -0,0 +1,135 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.UndeployModelNode + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UndeployModelNode implements PlainJsonSerializable { + + private final Map stats; + + // --------------------------------------------------------------------------------------------- + + private UndeployModelNode(Builder builder) { + this.stats = ApiTypeHelper.unmodifiable(builder.stats); + } + + public static UndeployModelNode of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code stats} + */ + public final Map stats() { + return this.stats; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.stats)) { + generator.writeKey("stats"); + generator.writeStartObject(); + for (Map.Entry item0 : this.stats.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UndeployModelNode}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map stats; + + /** + * API name: {@code stats} + * + *

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

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

+ * Adds an entry to stats. + *

+ */ + public final Builder stats(String key, JsonData value) { + this.stats = _mapPut(this.stats, key, value); + return this; + } + + /** + * Builds a {@link UndeployModelNode}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public UndeployModelNode build() { + _checkSingleUse(); + + return new UndeployModelNode(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UndeployModelNode} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UndeployModelNode::setupUndeployModelNodeDeserializer + ); + + protected static void setupUndeployModelNodeDeserializer(ObjectDeserializer op) { + op.add(Builder::stats, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "stats"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java new file mode 100644 index 0000000000..4ae83cb5b5 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java @@ -0,0 +1,102 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.undeploy_model.Request + +/** + * Undeploys a model. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UndeployModelRequest extends RequestBase { + + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private UndeployModelRequest(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static UndeployModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UndeployModelRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String modelId; + + /** + * Required - API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link UndeployModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public UndeployModelRequest build() { + _checkSingleUse(); + + return new UndeployModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.undeploy_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_undeploy"); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + UndeployModelResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java new file mode 100644 index 0000000000..f7cdfea593 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -0,0 +1,142 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.undeploy_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UndeployModelResponse implements PlainJsonSerializable { + + private final Map nodes; + + // --------------------------------------------------------------------------------------------- + + private UndeployModelResponse(Builder builder) { + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + } + + public static UndeployModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + */ + public final Map nodes() { + return this.nodes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UndeployModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map nodes; + + /** + * + *

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

+ */ + public final Builder nodes(Map map) { + this.nodes = _mapPutAll(this.nodes, map); + return this; + } + + /** + * + *

+ * Adds an entry to nodes. + *

+ */ + public final Builder nodes(String key, UndeployModelNode value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + + /** + * + *

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

+ */ + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new UndeployModelNode.Builder()).build()); + } + + /** + * Builds a {@link UndeployModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public UndeployModelResponse build() { + _checkSingleUse(); + + return new UndeployModelResponse(this); + } + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UndeployModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UndeployModelResponse::setupUndeployModelResponseDeserializer + ); + + protected static void setupUndeployModelResponseDeserializer(ObjectDeserializer op) { + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.nodes == null) { + builder.nodes = new HashMap<>(); + } + builder.nodes.put(name, UndeployModelNode._DESERIALIZER.deserialize(parser, mapper)); + }); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java index c0af29e51b..7fbf6ec61c 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java @@ -23,7 +23,7 @@ public class PlainJsonSerializableTest extends Assert { public void testIndexResponse() { String expectedStringValue = - "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1.0,\"successful\":1.0,\"total\":3.0,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"reason\":{\"reason\":\"Failed to create query.\",\"type\":\"query_shard_exception\"},\"shard\":1,\"status\":\"Failed\"}],\"skipped\":1.0},\"_version\":3}"; + "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"reason\":{\"reason\":\"Failed to create query.\",\"type\":\"query_shard_exception\"},\"shard\":1,\"status\":\"Failed\"}],\"skipped\":1,\"successful\":1,\"total\":3},\"_version\":3}"; IndexResponse indexResponse = IndexResponse.of( response -> response.result(Result.Created) .index("index") diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java index df69bc98a7..3472db587c 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java @@ -57,7 +57,7 @@ public void testMapProperty() { .timedOut(false) .build(); - String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0.0,\"successful\":1.0,\"total\":1.0}," + String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0,\"successful\":1,\"total\":1}," + "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]},\"aggregations\":{\"avg#foo\":{\"value\":3.14}}}"; assertEquals(json, toJson(resp)); @@ -95,7 +95,7 @@ public void testAdditionalProperties() { .timedOut(false) .build(); - String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0.0,\"successful\":1.0,\"total\":1.0}," + String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0,\"successful\":1,\"total\":1}," + "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]}," + "\"aggregations\":{\"sterms#foo\":{\"buckets\":[" + "{\"avg#bar\":{\"value\":1.0},\"doc_count\":1,\"key\":\"key_1\"}," diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index c5f1933713..49aa5ec3f5 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -167,6 +167,9 @@ dependencies { implementation("org.apache.maven.resolver", "maven-resolver-api", "1.9.20") implementation("org.apache.maven.resolver", "maven-resolver-supplier", "1.9.20") + // MIT + implementation("org.semver4j", "semver4j", "5.3.0") + // EPL-2.0 testImplementation(platform("org.junit:junit-bom:5.10.3")) testImplementation("org.junit.jupiter", "junit-jupiter") diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index fc23f29fe3..889bedbbdf 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -3887,6 +3887,20 @@ paths: '200': $ref: '#/components/responses/ml.undeploy_model@200' /_plugins/_ml/tasks/{task_id}: + delete: + operationId: ml.delete_task.0 + x-operation-group: ml.delete_task + description: Deletes a task. + parameters: + - $ref: '#/components/parameters/ml.delete_task::path.task_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.delete_task@200' get: operationId: ml.get_task.0 x-operation-group: ml.get_task @@ -20036,6 +20050,12 @@ components: required: true schema: type: string + ml.delete_task::path.task_id: + name: task_id + in: path + required: true + schema: + type: string ml.deploy_model::path.model_id: name: model_id in: path @@ -26139,6 +26159,11 @@ components: application/json: schema: $ref: '#/components/schemas/_common:WriteResponseBase' + ml.delete_task@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:WriteResponseBase' ml.deploy_model@200: content: application/json: @@ -29286,6 +29311,7 @@ components: - version_map_memory_in_bytes _common:SequenceNumber: type: number + format: int64 _common:ShardFailure: type: object properties: @@ -29602,6 +29628,7 @@ components: type: string _common:VersionNumber: type: number + format: int64 _common:VersionString: type: string _common:VersionType: @@ -29671,6 +29698,7 @@ components: $ref: '#/components/schemas/_common:IndexName' _primary_term: type: number + format: int64 result: $ref: '#/components/schemas/_common:Result' _seq_no: @@ -46333,18 +46361,19 @@ components: type: string required: - state - ml._common:UndeployModelResponse: - type: object - additionalProperties: - $ref: '#/components/schemas/ml._common:UndeployModelResponseModels' - ml._common:UndeployModelResponseModels: + ml._common:UndeployModelNode: type: object properties: stats: - $ref: '#/components/schemas/ml._common:UndeployModelResponseStats' - ml._common:UndeployModelResponseStats: + $ref: '#/components/schemas/ml._common:UndeployModelNodeStats' + ml._common:UndeployModelNodeStats: type: object additionalProperties: true + ml._common:UndeployModelResponse: + type: object + additionalProperties: + title: nodes + $ref: '#/components/schemas/ml._common:UndeployModelNode' nodes._common:AdaptiveSelection: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 457bc38f80..210079ccc2 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -8,6 +8,8 @@ package org.opensearch.client.codegen; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.*; + import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -26,14 +28,18 @@ import org.opensearch.client.codegen.exceptions.ApiSpecificationParseException; import org.opensearch.client.codegen.exceptions.RenderException; import org.opensearch.client.codegen.model.Namespace; -import org.opensearch.client.codegen.model.OperationGroup; +import org.opensearch.client.codegen.model.OperationGroupMatcher; import org.opensearch.client.codegen.model.ShapeRenderingContext; import org.opensearch.client.codegen.model.SpecTransformer; import org.opensearch.client.codegen.openapi.OpenApiSpecification; public class CodeGenerator { private static final Logger LOGGER = LogManager.getLogger(); - private static final OperationGroup.Matcher OPERATION_MATCHER = OperationGroup.matcher().add(null, "info").add("dangling_indices"); + private static final OperationGroupMatcher OPERATION_MATCHER = or( + and(namespace(""), named("info")), + namespace("dangling_indices"), + and(namespace("ml"), not(named("search_models"))) // TODO: search_models is complex and ideally should re-use the search structures + ); public static void main(String[] args) { var inputOpt = Option.builder("i") diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java index 9b1818a852..8f965bb14f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Deprecation.java @@ -11,14 +11,15 @@ import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.semver4j.Semver; public class Deprecation { @Nullable private final String description; @Nullable - private final String version; + private final Semver version; - public Deprecation(@Nullable String description, @Nullable String version) { + public Deprecation(@Nullable String description, @Nullable Semver version) { this.description = description; this.version = version; } @@ -29,7 +30,7 @@ public Optional getDescription() { } @Nonnull - public Optional getVersion() { + public Optional getVersion() { return Optional.ofNullable(version); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index 1f455426a3..e0f52eb63d 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -47,10 +47,11 @@ public void addShape(Shape shape) { } public String getPackageName() { - return parent != null ? parent.getPackageName() + "." + getPackageNamePart() : "org.opensearch.client.opensearch"; + return parent != null ? parent.getPackageName() + "." + getName() : "org.opensearch.client.opensearch"; } - private String getPackageNamePart() { + @Nonnull + public String getName() { return name; } @@ -70,7 +71,7 @@ public Namespace child(@Nullable String name) { public void render(ShapeRenderingContext ctx) throws RenderException { for (Namespace child : children.values()) { - child.render(ctx.forSubDir(child.getPackageNamePart())); + child.render(ctx.forSubDir(child.getName())); } for (Shape shape : shapes) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroup.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroup.java index 818a4acd40..0d8dd650d9 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroup.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroup.java @@ -8,12 +8,7 @@ package org.opensearch.client.codegen.model; -import java.util.Collection; -import java.util.HashSet; -import java.util.Objects; import java.util.Optional; -import java.util.Set; -import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -76,58 +71,4 @@ public boolean equals(Object o) { public int hashCode() { return new HashCodeBuilder(17, 37).append(namespace).append(name).toHashCode(); } - - @Nonnull - public static Matcher matcher() { - return new Matcher(); - } - - public static class Matcher { - private final Set namespaces = new HashSet<>(); - private final Set operations = new HashSet<>(); - private final Collection patterns = new HashSet<>(); - - private Matcher() {} - - @Nonnull - public Matcher add(@Nullable String namespace, @Nullable String... operations) { - if (operations == null || operations.length == 0) { - namespaces.add(Strings.requireNonBlank(namespace, "namespace must not be blank")); - } else { - for (String operation : operations) { - add(new OperationGroup(namespace, operation)); - } - } - return this; - } - - @Nonnull - public Matcher add(@Nonnull OperationGroup operation) { - operations.add(Objects.requireNonNull(operation, "operation must not be null")); - return this; - } - - @Nonnull - public Matcher add(@Nonnull Pattern pattern) { - patterns.add(Objects.requireNonNull(pattern, "pattern must not be null")); - return this; - } - - public boolean matches(@Nonnull OperationGroup operation) { - Objects.requireNonNull(operation, "operation must not be null"); - if (operation.getNamespace().map(namespaces::contains).orElse(false)) { - return true; - } - if (operations.contains(operation)) { - return true; - } - var str = operation.toString(); - for (Pattern pattern : patterns) { - if (pattern.matcher(str).matches()) { - return true; - } - } - return false; - } - } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.java new file mode 100644 index 0000000000..6a33bf3f81 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.java @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model; + +import java.util.Arrays; +import java.util.HashSet; +import javax.annotation.Nonnull; + +@FunctionalInterface +public interface OperationGroupMatcher { + boolean matches(OperationGroup group); + + static OperationGroupMatcher all() { + return group -> true; + } + + static OperationGroupMatcher none() { + return group -> false; + } + + static OperationGroupMatcher not(OperationGroupMatcher matcher) { + return group -> !matcher.matches(group); + } + + static OperationGroupMatcher or(OperationGroupMatcher... matchers) { + return group -> { + for (OperationGroupMatcher matcher : matchers) { + if (matcher.matches(group)) { + return true; + } + } + return false; + }; + } + + static OperationGroupMatcher and(OperationGroupMatcher... matchers) { + return group -> { + for (OperationGroupMatcher matcher : matchers) { + if (!matcher.matches(group)) { + return false; + } + } + return true; + }; + } + + static OperationGroupMatcher named(String... names) { + var set = new HashSet<>(Arrays.asList(names)); + return group -> set.contains(group.getName()); + } + + static OperationGroupMatcher namespace(@Nonnull String namespace) { + return group -> namespace.equals(group.getNamespace().orElse("")); + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 3e332ca8b8..53972b826c 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -136,6 +136,12 @@ public Collection getPathParams() { return pathParams.values(); } + @Override + public void addBodyField(Field field) { + super.addBodyField(field); + addField(field); + } + private void addField(Field field) { fields.put(field.getName(), field); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index 73d728a1db..bb59217c11 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -94,4 +94,8 @@ public Set getImports() { } return imports; } + + public boolean needsLegacyLicense() { + return !"ml".equals(parent.getName()); + } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 55e6a45609..72527200ff 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -41,11 +41,12 @@ import org.opensearch.client.codegen.openapi.OpenApiSchemaType; import org.opensearch.client.codegen.openapi.OpenApiSpecification; import org.opensearch.client.codegen.utils.Lists; +import org.opensearch.client.codegen.utils.Versions; public class SpecTransformer { private static final Logger LOGGER = LogManager.getLogger(); @Nonnull - private final OperationGroup.Matcher matcher; + private final OperationGroupMatcher matcher; @Nonnull private final Namespace root = new Namespace(); @Nonnull @@ -53,7 +54,7 @@ public class SpecTransformer { @Nonnull private final Map schemaToType = new ConcurrentHashMap<>(); - public SpecTransformer(@Nonnull OperationGroup.Matcher matcher) { + public SpecTransformer(@Nonnull OperationGroupMatcher matcher) { this.matcher = Objects.requireNonNull(matcher, "matcher must not be null"); } @@ -285,14 +286,14 @@ private void visitInto(OpenApiSchema schema, ObjectShape shape) { final var required = collectObjectProperties(schema, properties, additionalProperties); properties.forEach( - (k, v) -> { shape.addBodyField(new Field(k, mapType(v), required.contains(k), v.getDescription().orElse(null), null)); } + (k, v) -> shape.addBodyField(new Field(k, mapType(v), required.contains(k), v.getDescription().orElse(null), null)) ); if (!additionalProperties.isEmpty()) { var valueSchema = additionalProperties.size() == 1 ? additionalProperties.get(0) : OpenApiSchema.ANONYMOUS_UNTYPED; shape.setAdditionalPropertiesField( new Field( - valueSchema.getTitle().orElseThrow(), + valueSchema.getTitle().orElse("metadata"), Types.Java.Util.Map(Types.Java.Lang.String, mapType(valueSchema)), false, valueSchema.getDescription().orElse(null), @@ -333,17 +334,28 @@ private Set collectObjectProperties( return required; } - schema.getProperties().ifPresent(props -> props.forEach((k, v) -> { - var existing = properties.get(k); + schema.getProperties().ifPresent(props -> props.forEach((propName, propSchema) -> { + var resolvedPropSchema = propSchema.resolve(); + var isRemoved = propSchema.getVersionRemoved() + .or(resolvedPropSchema::getVersionRemoved) + .map(ver -> ver.isLowerThanOrEqualTo(Versions.V2_0_0)) + .orElse(false); + + if (isRemoved) { + return; + } + + var existing = properties.get(propName); if (existing != null) { var existingType = existing.determineSingleType().orElse(null); - var newType = v.determineSingleType().orElse(null); + var newType = propSchema.determineSingleType().orElse(null); if (existingType != null && (existingType == OpenApiSchemaType.Object || existingType == OpenApiSchemaType.Array || existingType != newType)) { - v = OpenApiSchema.ANONYMOUS_UNTYPED; + propSchema = OpenApiSchema.ANONYMOUS_UNTYPED; } } - properties.put(k, v); + + properties.put(propName, propSchema); })); schema.getAdditionalProperties().ifPresent(additionalProperties::add); @@ -472,6 +484,11 @@ private boolean shouldKeepRef(OpenApiSchema schema) { if (schema.isString() && schema.getEnums().isEmpty()) { return false; } + if (schema.isObject() + && schema.getProperties().map(Map::isEmpty).orElse(true) + && schema.getAdditionalProperties().map(s -> s.getTitle().isEmpty()).orElse(false)) { + return false; + } if (schema.getOneOf().isPresent()) { return schema.getOneOf().orElseThrow().stream().allMatch(s -> s.getTitle().isPresent()); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java index 34b2f4be9b..0489c44bd4 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiOperation.java @@ -20,6 +20,8 @@ import javax.annotation.Nullable; import org.opensearch.client.codegen.model.Deprecation; import org.opensearch.client.codegen.model.OperationGroup; +import org.opensearch.client.codegen.utils.Versions; +import org.semver4j.Semver; public class OpenApiOperation extends OpenApiElement { @Nonnull @@ -43,7 +45,7 @@ public class OpenApiOperation extends OpenApiElement { @Nullable private final String versionAdded; @Nullable - private final String versionDeprecated; + private final Semver versionDeprecated; @Nullable private final String deprecationMessage; @@ -61,7 +63,7 @@ protected OpenApiOperation(@Nonnull OpenApiPath parent, @Nonnull JsonPointer poi this.requestBody = child("requestBody", operation.getRequestBody(), OpenApiRequestBody::new); this.responses = child("responses", operation.getResponses(), OpenApiResponses::new); this.versionAdded = ifNonnull(extensions.get("x-version-added"), String::valueOf); - this.versionDeprecated = ifNonnull(extensions.get("x-version-deprecated"), String::valueOf); + this.versionDeprecated = ifNonnull(extensions.get("x-version-deprecated"), v -> Versions.coerce((String) v)); this.deprecationMessage = ifNonnull(extensions.get("x-deprecation-message"), String::valueOf); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java index 442873eab7..45e0178b46 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java @@ -16,6 +16,8 @@ import javax.annotation.Nullable; import org.opensearch.client.codegen.model.Deprecation; import org.opensearch.client.codegen.utils.Maps; +import org.opensearch.client.codegen.utils.Versions; +import org.semver4j.Semver; public class OpenApiParameter extends OpenApiRefElement { @Nullable @@ -31,7 +33,7 @@ public class OpenApiParameter extends OpenApiRefElement { @Nullable private final Boolean isDeprecated; @Nullable - private final String versionDeprecated; + private final Semver versionDeprecated; @Nullable private final String deprecationMessage; @Nullable @@ -46,7 +48,7 @@ protected OpenApiParameter(@Nullable OpenApiElement parent, @Nonnull JsonPoin this.schema = child("schema", parameter.getSchema(), OpenApiSchema::new); this.isDeprecated = parameter.getDeprecated(); var extensions = parameter.getExtensions(); - this.versionDeprecated = Maps.tryGet(extensions, "x-version-deprecated").map(String::valueOf).orElse(null); + this.versionDeprecated = Maps.tryGet(extensions, "x-version-deprecated").map(v -> Versions.coerce((String) v)).orElse(null); this.deprecationMessage = Maps.tryGet(extensions, "x-deprecation-message").map(String::valueOf).orElse(null); this.isGlobal = (Boolean) Maps.tryGet(extensions, "x-global").orElse(null); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index 5928c63fce..d48d1140e7 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -24,6 +24,8 @@ import org.opensearch.client.codegen.utils.Lists; import org.opensearch.client.codegen.utils.Maps; import org.opensearch.client.codegen.utils.Sets; +import org.opensearch.client.codegen.utils.Versions; +import org.semver4j.Semver; public class OpenApiSchema extends OpenApiRefElement { private static final JsonPointer ANONYMOUS = JsonPointer.of(""); @@ -65,6 +67,8 @@ public class OpenApiSchema extends OpenApiRefElement { private final String title; @Nullable private final String pattern; + @Nullable + private final Semver versionRemoved; private OpenApiSchema(@Nonnull Builder builder) { super(builder.parent, Objects.requireNonNull(builder.pointer, "pointer must not be null"), builder.$ref, OpenApiSchema.class); @@ -84,6 +88,7 @@ private OpenApiSchema(@Nonnull Builder builder) { required = builder.required; title = builder.title; pattern = builder.pattern; + versionRemoved = builder.versionRemoved; } protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer pointer, @Nonnull Schema schema) { @@ -135,6 +140,8 @@ protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer // noinspection unchecked deprecatedEnums = Maps.tryGet(extensions, "x-deprecated-enums").map(e -> (Collection) e).map(HashSet::new).orElse(null); + + versionRemoved = Maps.tryGet(extensions, "x-version-removed").map(v -> Versions.coerce((String) v)).orElse(null); } @Nonnull @@ -258,6 +265,11 @@ public Optional getPattern() { return Optional.ofNullable(pattern); } + @Nonnull + public Optional getVersionRemoved() { + return Optional.ofNullable(versionRemoved); + } + public static Set determineTypes(List schemas) { return schemas.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); } @@ -338,6 +350,8 @@ public static class Builder { private String title; @Nullable private String pattern; + @Nullable + private Semver versionRemoved; @Nonnull public Builder withPointer(@Nonnull JsonPointer pointer) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Strings.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Strings.java index a8afed9249..d6a751a84f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Strings.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Strings.java @@ -8,7 +8,9 @@ package org.opensearch.client.codegen.utils; +import java.util.HashMap; import java.util.Locale; +import java.util.Map; import java.util.Objects; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -35,12 +37,22 @@ public static String requireNonBlank(@Nullable String str, @Nullable String mess return str; } + private static final Map SPECIAL_CASE_SNAKE_CASE_CONVERSION = new HashMap<>() { + { + put("noop", "no_op"); + } + }; + @Nonnull public static String toSnakeCase(@Nonnull String str) { Objects.requireNonNull(str, "str must not be null"); if (str.isEmpty()) { return str; } + + var specialCase = SPECIAL_CASE_SNAKE_CASE_CONVERSION.get(str); + if (specialCase != null) return specialCase; + return str.replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2") .replaceAll("([a-z\\d])([A-Z])", "$1_$2") .replaceAll("(\\s|[-:.])", "_") diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Versions.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Versions.java new file mode 100644 index 0000000000..288c1bac88 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Versions.java @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.utils; + +import javax.annotation.Nonnull; +import org.semver4j.Semver; + +public final class Versions { + private Versions() {} + + public static final Semver V2_0_0 = Semver.of(2, 0, 0); + + @Nonnull + public static Semver coerce(String str) { + var version = Semver.coerce(str); + if (version == null) throw new IllegalArgumentException("Unable to coerce `" + str + "` to semver"); + return version; + } +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassHeader.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassHeader.mustache index b04007b760..04f604493e 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassHeader.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassHeader.mustache @@ -5,6 +5,7 @@ * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ +{{#needsLegacyLicense}} /* * Licensed to Elasticsearch B.V. under one or more contributor @@ -29,6 +30,7 @@ * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ +{{/needsLegacyLicense}} //---------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. diff --git a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java new file mode 100644 index 0000000000..263adb1475 --- /dev/null +++ b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java @@ -0,0 +1,333 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.samples.neural; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; +import java.util.stream.Collectors; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch.OpenSearchClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.opensearch._types.Refresh; +import org.opensearch.client.opensearch._types.query_dsl.NeuralQuery; +import org.opensearch.client.opensearch._types.query_dsl.Query; +import org.opensearch.client.opensearch.core.SearchRequest; +import org.opensearch.client.opensearch.core.bulk.BulkOperation; +import org.opensearch.client.opensearch.ingest.Processor; +import org.opensearch.client.opensearch.ingest.PutPipelineRequest; +import org.opensearch.client.opensearch.ingest.TextEmbeddingProcessor; +import org.opensearch.client.opensearch.ml.DeleteModelGroupRequest; +import org.opensearch.client.opensearch.ml.DeleteModelRequest; +import org.opensearch.client.opensearch.ml.DeleteTaskRequest; +import org.opensearch.client.opensearch.ml.DeployModelRequest; +import org.opensearch.client.opensearch.ml.GetTaskRequest; +import org.opensearch.client.opensearch.ml.RegisterModelRequest; +import org.opensearch.client.opensearch.ml.UndeployModelRequest; +import org.opensearch.client.samples.SampleClient; + +/** + * Run with: ./gradlew :samples:run -Dsamples.mainClass=neural.NeuralSearch + */ +public class NeuralSearch { + private static final String SAMPLE_NAME = "neural-search"; + private static final String RESOURCE_NAME_PREFIX = "csharp-" + SAMPLE_NAME; + private static final String ML_MODEL_GROUP_NAME = RESOURCE_NAME_PREFIX + "-model-group"; + private static final String INGEST_PIPELINE_NAME = RESOURCE_NAME_PREFIX + "-ingest-pipeline"; + private static final String INDEX_NAME = RESOURCE_NAME_PREFIX + "-index"; + + private static final Logger LOGGER = LogManager.getLogger(NeuralSearch.class); + + public static void main(String[] args) { + OpenSearchClient client = null; + String modelGroupId = null; + String modelRegistrationTaskId = null; + String modelId = null; + String modelDeployTaskId = null; + boolean createdIngestPipeline = false; + boolean createdIndex = false; + + try { + client = SampleClient.create(); + + var version = client.info().version(); + LOGGER.info("Server: {}@{}", version.distribution(), version.number()); + + LOGGER.info("Temporarily configuring the cluster to allow local running of the ML model"); + client.cluster() + .putSettings( + p -> p.transient_("plugins.ml_commons.only_run_on_ml_node", JsonData.of(false)) + .transient_("plugins.ml_commons.model_access_control_enabled", JsonData.of(true)) + .transient_("plugins.ml_commons.native_memory_threshold", JsonData.of(99)) + ); + + LOGGER.info("Registering ML model group"); + var groupRegistration = client.ml() + .registerModelGroup( + r -> r.name(ML_MODEL_GROUP_NAME) + .description("A model group for the opensearch-java " + SAMPLE_NAME + " sample") + .accessMode("public") + ); + if (!"CREATED".equals(groupRegistration.status())) throw new Exception( + "Expected ML model group to be CREATED, was: " + groupRegistration.status() + ); + modelGroupId = groupRegistration.modelGroupId(); + LOGGER.info("ML model group `{}` id: {}", ML_MODEL_GROUP_NAME, modelGroupId); + + LOGGER.info("Registering ML model"); + var modelRegistration = client.ml() + .registerModel( + new RegisterModelRequest.Builder().name("huggingface/sentence-transformers/msmarco-distilbert-base-tas-b") + .version("1.0.1") + .modelGroupId(modelGroupId) + .modelFormat("TORCH_SCRIPT") + .build() + ); + if (!"CREATED".equals(modelRegistration.status())) throw new Exception( + "Expected ML model registration task to be CREATED, was: " + modelRegistration.status() + ); + modelRegistrationTaskId = modelRegistration.taskId(); + LOGGER.info("ML model registration task: {}", modelRegistrationTaskId); + + LOGGER.info("Waiting for ML model registration to complete"); + registerWait: while (true) { + var modelRegistrationTask = client.ml().getTask(new GetTaskRequest.Builder().taskId(modelRegistrationTaskId).build()); + LOGGER.info("ML model registration: {}", modelRegistrationTask.state()); + switch (modelRegistrationTask.state()) { + case "COMPLETED": + modelId = modelRegistrationTask.modelId(); + break registerWait; + case "FAILED": + throw new Exception("ML model registration failed: " + modelRegistrationTask.error()); + default: + // noinspection BusyWait + Thread.sleep(10_000); + } + } + LOGGER.info("ML model registered: {}", modelId); + + LOGGER.info("Deploying ML model"); + var modelDeploy = client.ml().deployModel(new DeployModelRequest.Builder().modelId(modelId).build()); + if (!"CREATED".equals(modelDeploy.status())) throw new Exception( + "Expected ML model deploy task to be CREATED, was: " + modelDeploy.status() + ); + modelDeployTaskId = modelDeploy.taskId(); + LOGGER.info("ML model deploy task: {}", modelDeployTaskId); + + LOGGER.info("Waiting for ML model deployment to complete"); + deployWait: while (true) { + var modelDeployTask = client.ml().getTask(new GetTaskRequest.Builder().taskId(modelDeployTaskId).build()); + LOGGER.info("ML model deployment: {}", modelDeployTask.state()); + switch (modelDeployTask.state()) { + case "COMPLETED": + break deployWait; + case "FAILED": + throw new Exception("ML model deployment failed: " + modelDeployTask.error()); + default: + // noinspection BusyWait + Thread.sleep(10_000); + } + } + LOGGER.info("ML model deployed"); + + LOGGER.info("Creating ingest pipeline: {}", INGEST_PIPELINE_NAME); + client.ingest() + .putPipeline( + new PutPipelineRequest.Builder().id(INGEST_PIPELINE_NAME) + .description("A test_embedding ingest pipeline for the opensearch-java " + SAMPLE_NAME + " sample") + .processors( + new Processor.Builder().textEmbedding( + new TextEmbeddingProcessor.Builder().modelId(modelId).fieldMap("text", "passageEmbedding").build() + ).build() + ) + .build() + ); + createdIngestPipeline = true; + LOGGER.info("Created ingest pipeline"); + + LOGGER.info("Creating index: {}", INDEX_NAME); + client.indices() + .create( + i -> i.index(INDEX_NAME) + .settings(s -> s.index(is -> is.knn(true)).defaultPipeline(INGEST_PIPELINE_NAME)) + .mappings( + m -> m.properties("id", p -> p.text(t -> t)) + .properties("text", p -> p.text(t -> t)) + .properties( + "passageEmbedding", + p -> p.knnVector( + kv -> kv.dimension(768).method(kvm -> kvm.engine("lucene").spaceType("l2").name("hnsw")) + ) + ) + ) + ); + createdIndex = true; + LOGGER.info("Created index"); + + LOGGER.info("Indexing documents"); + var documents = new NeuralSearchDoc[] { + new NeuralSearchDoc( + "4319130149.jpg", + "A West Virginia university women 's basketball team , officials , and a small gathering of fans are in a West Virginia arena ." + ), + new NeuralSearchDoc("1775029934.jpg", "A wild animal races across an uncut field with a minimal amount of trees ."), + new NeuralSearchDoc( + "2664027527.jpg", + "People line the stands which advertise Freemont 's orthopedics , a cowboy rides a light brown bucking bronco ." + ), + new NeuralSearchDoc("4427058951.jpg", "A man who is riding a wild horse in the rodeo is very near to falling off ."), + new NeuralSearchDoc( + "2691147709.jpg", + "A rodeo cowboy , wearing a cowboy hat , is being thrown off of a wild white horse ." + ) }; + var bulk = client.bulk( + b -> b.index(INDEX_NAME) + .operations( + Arrays.stream(documents) + .map(d -> new BulkOperation.Builder().index(i -> i.id(d.getId()).document(d)).build()) + .collect(Collectors.toList()) + ) + .refresh(Refresh.WaitFor) + ); + LOGGER.info("Indexed {} documents", bulk.items().stream().filter(i -> i.error() == null).count()); + + LOGGER.info("Performing neural search for text 'wild west'"); + var search = client.search( + new SearchRequest.Builder().index(INDEX_NAME) + .source(sc -> sc.filter(sf -> sf.excludes("passageEmbedding"))) + .query( + new Query.Builder().neural( + new NeuralQuery.Builder().field("passageEmbedding").queryText("wild west").modelId(modelId).k(5).build() + ).build() + ) + .build(), + NeuralSearchDoc.class + ); + LOGGER.info("Found {} documents", search.hits().hits().size()); + for (var hit : search.hits().hits()) { + LOGGER.info( + "- Document id: {}, score: {}, text: {}", + hit.id(), + hit.score(), + Objects.requireNonNull(hit.source()).getText() + ); + } + } catch (Exception e) { + LOGGER.error("Unexpected exception", e); + } finally { + LOGGER.info("-- CLEANING UP --"); + + if (createdIndex) { + try { + LOGGER.info("Deleting index: {}", INDEX_NAME); + client.indices().delete(d -> d.index(INDEX_NAME)); + LOGGER.info("Deleted index"); + } catch (Exception ignored) {} + } + + if (createdIngestPipeline) { + try { + LOGGER.info("Deleting ingest pipeline: {}", INGEST_PIPELINE_NAME); + client.ingest().deletePipeline(d -> d.id(INGEST_PIPELINE_NAME)); + LOGGER.info("Deleted ingest pipeline"); + } catch (Exception ignored) {} + } + + if (modelDeployTaskId != null) { + try { + LOGGER.info("Deleting ML model deploy task: {}", modelDeployTaskId); + var taskDeleted = client.ml().deleteTask(new DeleteTaskRequest.Builder().taskId(modelDeployTaskId).build()); + LOGGER.info("Deleted ML model deploy task: {}", taskDeleted.result()); + } catch (Exception ignored) {} + } + + if (modelId != null) { + while (true) { + try { + LOGGER.info("Deleting ML model: {}", modelId); + var modelDeleted = client.ml().deleteModel(new DeleteModelRequest.Builder().modelId(modelId).build()); + LOGGER.info("Deleted ML model: {}", modelDeleted.result()); + break; + } catch (OpenSearchException ex) { + var reason = ex.error() != null ? ex.error().reason() : null; + + if (reason == null || !reason.contains("Try undeploy")) break; + + try { + LOGGER.info("Un-deploying ML model: {}", modelId); + client.ml().undeployModel(new UndeployModelRequest.Builder().modelId(modelId).build()); + LOGGER.info("Un-deployed ML model"); + } catch (Exception ignored) {} + + try { + // noinspection BusyWait + Thread.sleep(10_000); + } catch (InterruptedException ignored) {} + } catch (IOException ignored) {} + } + } + + if (modelRegistrationTaskId != null) { + try { + LOGGER.info("Deleting ML model registration task: {}", modelRegistrationTaskId); + var taskDeleted = client.ml().deleteTask(new DeleteTaskRequest.Builder().taskId(modelRegistrationTaskId).build()); + LOGGER.info("Deleted ML model registration task: {}", taskDeleted.result()); + } catch (Exception ignored) {} + } + + if (modelGroupId != null) { + try { + LOGGER.info("Deleting ML model group: {}", modelGroupId); + var groupDeleted = client.ml() + .deleteModelGroup(new DeleteModelGroupRequest.Builder().modelGroupId(modelGroupId).build()); + LOGGER.info("Deleted ML model group: {}", groupDeleted.result()); + } catch (Exception ignored) {} + } + } + } + + private static class NeuralSearchDoc { + private String id; + private String text; + private float[] passageEmbedding; + + public NeuralSearchDoc() {} + + public NeuralSearchDoc(String id, String text) { + this.id = id; + this.text = text; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public float[] getPassageEmbedding() { + return passageEmbedding; + } + + public void setPassageEmbedding(float[] passageEmbedding) { + this.passageEmbedding = passageEmbedding; + } + } +} From 5bb15f27623b9316c31ceb6820da7ee524dc631d Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 27 Aug 2024 11:20:46 +1200 Subject: [PATCH 15/37] Fix copy-paste mistake in NeuralSearch sample (#1161) Signed-off-by: Thomas Farr --- .../java/org/opensearch/client/samples/neural/NeuralSearch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java index 263adb1475..3036ef2c89 100644 --- a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java +++ b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java @@ -39,7 +39,7 @@ */ public class NeuralSearch { private static final String SAMPLE_NAME = "neural-search"; - private static final String RESOURCE_NAME_PREFIX = "csharp-" + SAMPLE_NAME; + private static final String RESOURCE_NAME_PREFIX = "java-" + SAMPLE_NAME; private static final String ML_MODEL_GROUP_NAME = RESOURCE_NAME_PREFIX + "-model-group"; private static final String INGEST_PIPELINE_NAME = RESOURCE_NAME_PREFIX + "-ingest-pipeline"; private static final String INDEX_NAME = RESOURCE_NAME_PREFIX + "-index"; From b8a673c704908f2a9d394033f3fb0a58fbbf699f Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 28 Aug 2024 09:42:00 +1200 Subject: [PATCH 16/37] Update changelog post releasing 2.14.0 (#1162) (#1167) Signed-off-by: Thomas Farr (cherry picked from commit 2a362a62455115ad6f47fe1790ddbddc0fe32eb5) --- CHANGELOG.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ec2058b2..6f62a80dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 -- Bumps `io.github.classgraph:classgraph` from 4.8.174 to 4.8.175 -- Bumps `commons-logging:commons-logging` from 1.3.3 to 1.3.4 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. @@ -37,9 +35,6 @@ This section is for maintaining a changelog for all breaking changes for the cli ## [Unreleased 2.x] ### Added -- Added `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) -- Added `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) -- Added the `ml` namespace operations ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) ### Dependencies @@ -50,10 +45,22 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed ### Fixed -- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1132](https://github.com/opensearch-project/opensearch-java/pull/1132)) ### Security +## [2.14.0] - 08/27/2024 +### Added +- Added `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) +- Added `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) +- Added the `ml` namespace operations ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) + +### Dependencies +- Bumps `commons-logging:commons-logging` from 1.3.3 to 1.3.4 +- Bumps `io.github.classgraph:classgraph` from 4.8.174 to 4.8.175 + +### Fixed +- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1132](https://github.com/opensearch-project/opensearch-java/pull/1132)) + ## [2.13.0] - 08/01/2024 ### Added - Added `searchAfterVals` to `SearchRequest` to allow passing arbitrary `FieldValue`s to `search_after` ([#1105](https://github.com/opensearch-project/opensearch-java/pull/1105)) @@ -513,7 +520,9 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Security [Unreleased 3.0]: https://github.com/opensearch-project/opensearch-java/compare/2.x...HEAD -[Unreleased 2.x]: https://github.com/opensearch-project/opensearch-java/compare/v2.12.0...2.x +[Unreleased 2.x]: https://github.com/opensearch-project/opensearch-java/compare/v2.14.0...2.x +[2.14.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.13.0...v2.14.0 +[2.13.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.12.0...v2.13.0 [2.12.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.11.1...v2.12.0 [2.11.1]: https://github.com/opensearch-project/opensearch-java/compare/v2.11.0...v2.11.1 [2.11.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.10.4...v2.11.0 @@ -534,4 +543,4 @@ This section is for maintaining a changelog for all breaking changes for the cli [2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0 [2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0 [2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0 -[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 \ No newline at end of file +[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 From eb5ba5f28fe87eeb5baff37094655f5604c61055 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 28 Aug 2024 10:57:12 +1200 Subject: [PATCH 17/37] Reduce required release approvals (#1168) Signed-off-by: Thomas Farr --- .github/workflows/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 0fc73da10d..46f768cafc 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -20,7 +20,7 @@ jobs: with: secret: ${{ github.TOKEN }} approvers: ${{ steps.get_data.outputs.approvers }} - minimum-approvals: 2 + minimum-approvals: 1 issue-title: 'Release opensearch-java : ${{ steps.get_data.outputs.version }}' issue-body: "Please approve or deny the release of opensearch-java. **VERSION**: ${{ steps.get_data.outputs.version }} **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}" exclude-workflow-initiator-as-approver: true From 42e2928e3edb8aceded93a9ff9e5b21dd2cbbd70 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 30 Aug 2024 12:13:45 +1200 Subject: [PATCH 18/37] Invert abstractness of generated vs "handwritten" client classes (#1170) * Invert abstractness of generated vs "handwritten" client classes Signed-off-by: Thomas Farr * Address review comments Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- ...nt.java => OpenSearchAsyncClientBase.java} | 14 +-- ...hClient.java => OpenSearchClientBase.java} | 14 +-- ...ntBase.java => OpenSearchAsyncClient.java} | 13 ++- ...hClientBase.java => OpenSearchClient.java} | 13 ++- .../client/codegen/model/Namespace.java | 45 +++++--- .../client/codegen/model/RequestShape.java | 2 +- .../client/codegen/model/Shape.java | 6 +- .../codegen/model/ShapeRenderingContext.java | 17 ++- .../client/codegen/model/SpecTransformer.java | 4 +- .../opensearch/client/codegen/model/Type.java | 69 +++++++----- .../model/TypeParameterDefinition.java | 71 ++++++++++++ .../codegen/model/TypeParameterDiamond.java | 78 +++++++++++++ .../client/codegen/model/Types.java | 105 +++++++++--------- .../client/codegen/openapi/OpenApiSchema.java | 17 ++- .../codegen/renderer/JavaCodeFormatter.java | 17 ++- .../renderer/TemplateGlobalContext.java | 17 ++- .../codegen/renderer/TemplateLoader.java | 17 ++- .../codegen/renderer/TemplateRenderer.java | 17 ++- .../renderer/TemplateValueFormatter.java | 16 ++- .../client/codegen/utils/ObjectBuilder.java | 16 +++ .../codegen/utils/ObjectBuilderBase.java | 34 ++++++ .../client/codegen/templates/Client.mustache | 4 + .../Partials/ClassDeclaration.mustache | 2 +- 23 files changed, 439 insertions(+), 169 deletions(-) rename java-client/src/generated/java/org/opensearch/client/opensearch/{OpenSearchAsyncClient.java => OpenSearchAsyncClientBase.java} (84%) rename java-client/src/generated/java/org/opensearch/client/opensearch/{OpenSearchClient.java => OpenSearchClientBase.java} (84%) rename java-client/src/main/java/org/opensearch/client/opensearch/{OpenSearchAsyncClientBase.java => OpenSearchAsyncClient.java} (99%) rename java-client/src/main/java/org/opensearch/client/opensearch/{OpenSearchClientBase.java => OpenSearchClient.java} (99%) create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDiamond.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilder.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java similarity index 84% rename from java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index d962a97b6a..bbcfd5d125 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -40,6 +40,7 @@ import java.util.concurrent.CompletableFuture; import javax.annotation.Generated; import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; @@ -52,20 +53,11 @@ * Client for the namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public class OpenSearchAsyncClient extends OpenSearchAsyncClientBase { - public OpenSearchAsyncClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public abstract class OpenSearchAsyncClientBase> extends ApiClient { + public OpenSearchAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } - @Override - public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchAsyncClient(this.transport, transportOptions); - } - // ----- Child clients public OpenSearchDanglingIndicesAsyncClient danglingIndices() { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java similarity index 84% rename from java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index 84fd03d645..c6f6b4f877 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -39,6 +39,7 @@ import java.io.IOException; import javax.annotation.Generated; import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; @@ -51,20 +52,11 @@ * Client for the namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public class OpenSearchClient extends OpenSearchClientBase { - public OpenSearchClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public abstract class OpenSearchClientBase> extends ApiClient { + public OpenSearchClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } - @Override - public OpenSearchClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchClient(this.transport, transportOptions); - } - // ----- Child clients public OpenSearchDanglingIndicesClient danglingIndices() { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java similarity index 99% rename from java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java rename to java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 3326baa189..d3bac0d575 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -36,7 +36,6 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.cat.OpenSearchCatAsyncClient; @@ -137,12 +136,20 @@ /** * Client for the namespace. */ -public abstract class OpenSearchAsyncClientBase> extends ApiClient { +public class OpenSearchAsyncClient extends OpenSearchAsyncClientBase { + public OpenSearchAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } - public OpenSearchAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + public OpenSearchAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchAsyncClient(this.transport, transportOptions); + } + // ----- Child clients public OpenSearchCatAsyncClient cat() { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java similarity index 99% rename from java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java rename to java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java index 3c361c66fc..56653330c1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -35,7 +35,6 @@ import java.io.IOException; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.cat.OpenSearchCatClient; @@ -137,12 +136,20 @@ /** * Client for the namespace. */ -public abstract class OpenSearchClientBase> extends ApiClient { +public class OpenSearchClient extends OpenSearchClientBase { + public OpenSearchClient(OpenSearchTransport transport) { + super(transport, null); + } - public OpenSearchClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + public OpenSearchClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchClient(this.transport, transportOptions); + } + // ----- Child clients public OpenSearchGenericClient generic() { return new OpenSearchGenericClient(this.transport, this.transportOptions); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index e0f52eb63d..68c6a4feb5 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -82,8 +82,10 @@ public void render(ShapeRenderingContext ctx) throws RenderException { if (operations.isEmpty()) return; - new Client(this, false, operations).render(ctx); - new Client(this, true, operations).render(ctx); + var asBaseClass = "".equals(name); + + new Client(this, false, asBaseClass, operations).render(ctx); + new Client(this, true, asBaseClass, operations).render(ctx); } private Collection getOperationsForClient() { @@ -95,32 +97,37 @@ private String getClientClassName(boolean async, boolean base) { return "OpenSearch" + Strings.toPascalCase(name) + (async ? "Async" : "") + "Client" + (base ? "Base" : ""); } - private Type getClientType(boolean async, boolean base) { - var type = Type.builder().pkg(getPackageName()).name(getClientClassName(async, base)); - if (base) { - type.typeParams(getClientType(async, false)); - } - return type.build(); + private Type getClientType(boolean async) { + return Type.builder().withPackage(getPackageName()).withName(getClientClassName(async, false)).build(); } private static class Client extends Shape { private final boolean async; + private final boolean base; private final Collection operations; - private Client(Namespace parent, boolean async, Collection operations) { - super(parent, parent.getClientClassName(async, false), null, "Client for the " + parent.name + " namespace."); + private Client(Namespace parent, boolean async, boolean base, Collection operations) { + super(parent, parent.getClientClassName(async, base), null, "Client for the " + parent.name + " namespace."); this.async = async; + this.base = base; this.operations = operations; } + @Override + public TypeParameterDiamond getTypeParameters() { + if (!base) return null; + var thisType = getType().withTypeParams(Type.builder().withName("Self").build()); + return TypeParameterDiamond.builder() + .withParams(TypeParameterDefinition.builder().withName("Self").withExtends(thisType).build()) + .build(); + } + @Override public Type getExtendsType() { - switch (parent.name) { - case "": - return parent.getClientType(async, true); - default: - return Types.Client.ApiClient(Types.Client.Transport.OpenSearchTransport, getType()); - } + return Types.Client.ApiClient( + Types.Client.Transport.OpenSearchTransport, + !base ? getType() : Type.builder().withName("Self").build() + ); } public String getName() { @@ -139,6 +146,10 @@ public boolean isAsync() { return this.async; } + public boolean isBase() { + return this.base; + } + @Override public String toString() { return new ToStringBuilder(this).append("type", getType()).toString(); @@ -149,7 +160,7 @@ private static class ClientRef { private final String name; public ClientRef(Namespace namespace, boolean async) { - this.type = namespace.getClientType(async, false); + this.type = namespace.getClientType(async); this.name = namespace.name; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 53972b826c..2de1320733 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -78,7 +78,7 @@ public void addSupportedHttpMethod(String method) { } public Type getResponseType() { - return Type.builder().pkg(getPackageName()).name(responseClassName(operationGroup)).build(); + return Type.builder().withPackage(getPackageName()).withName(responseClassName(operationGroup)).build(); } public boolean canBeSingleton() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index bb59217c11..8f6eaa5c04 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -61,6 +61,10 @@ public Collection getAnnotations() { return Collections.emptyList(); } + public TypeParameterDiamond getTypeParameters() { + return null; + } + public Type getExtendsType() { return null; } @@ -70,7 +74,7 @@ public Collection getImplementsTypes() { } public Type getType() { - return Type.builder().pkg(getPackageName()).name(className).build(); + return Type.builder().withPackage(getPackageName()).withName(className).build(); } public Namespace getParent() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java index 0a99f20042..097dee806c 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java @@ -16,6 +16,7 @@ import org.opensearch.client.codegen.renderer.TemplateLoader; import org.opensearch.client.codegen.renderer.TemplateRenderer; import org.opensearch.client.codegen.renderer.TemplateValueFormatter; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; import org.opensearch.client.codegen.utils.Strings; public final class ShapeRenderingContext implements AutoCloseable { @@ -71,12 +72,21 @@ public static Builder builder() { return new Builder(); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private File outputDir; private TemplateLoader templateLoader; private JavaCodeFormatter javaCodeFormatter; private boolean ownedJavaCodeFormatter; + private Builder() { + super(ShapeRenderingContext::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withOutputDir(@Nonnull File outputDir) { this.outputDir = Objects.requireNonNull(outputDir, "outputDir must not be null"); @@ -118,10 +128,5 @@ public Builder withJavaCodeFormatter(@Nonnull Function PRIMITIVES = Set.of( @@ -44,37 +46,41 @@ public static Builder builder() { return new Builder(); } - private final String pkg; + @Nullable + private final String packageName; + @Nonnull private final String name; + @Nullable private final Type[] typeParams; private final boolean isEnum; private Type(Builder builder) { - this.pkg = builder.pkg; - this.name = builder.name; + this.packageName = builder.packageName; + this.name = Strings.requireNonBlank(builder.name, "name must not be blank"); this.typeParams = builder.typeParams; this.isEnum = builder.isEnum; } public Builder toBuilder() { - return new Builder().pkg(pkg).name(name).typeParams(typeParams).isEnum(isEnum); + return new Builder().withPackage(packageName).withName(name).withTypeParameters(typeParams).isEnum(isEnum); } @Override public String toString() { - String str = name; - if (typeParams != null && typeParams.length > 0) { - str += "<"; - str += Arrays.stream(typeParams).map(Type::toString).collect(Collectors.joining(", ")); - str += ">"; + var out = new StringBuilder(); + out.append(name); + if (typeParams != null) { + TypeParameterDiamond.builder().withParams(typeParams).build().toString(out); } - return str; + return out.toString(); } + @Nonnull public String getName() { return name; } + @Nonnull public Type getBoxed() { switch (name) { case "char": @@ -171,7 +177,7 @@ public Type getBuilderFnType() { } public Type getNestedType(String name) { - return builder().pkg(pkg).name(this.name + "." + name).build(); + return builder().withPackage(packageName).withName(this.name + "." + name).build(); } public Mustache.Lambda serializer() { @@ -183,9 +189,9 @@ public Mustache.Lambda directSerializer() { } public void getRequiredImports(Set imports, String currentPkg) { - if (pkg != null && !pkg.equals(Java.Lang.PACKAGE) && !pkg.equals(currentPkg)) { + if (packageName != null && !packageName.equals(Java.Lang.PACKAGE) && !packageName.equals(currentPkg)) { var dotIdx = name.indexOf('.'); - imports.add(pkg + '.' + (dotIdx > 0 ? name.substring(0, dotIdx) : name)); + imports.add(packageName + '.' + (dotIdx > 0 ? name.substring(0, dotIdx) : name)); } if (typeParams != null) { for (Type arg : typeParams) { @@ -195,7 +201,7 @@ public void getRequiredImports(Set imports, String currentPkg) { } public Type withTypeParams(Type... typeParams) { - return toBuilder().typeParams(typeParams).build(); + return toBuilder().withTypeParameters(typeParams).build(); } public Mustache.Lambda queryParamify() { @@ -206,34 +212,43 @@ public Mustache.Lambda isDefined() { return new TypeIsDefinedLambda(this); } - public static final class Builder { - private String pkg; + public static final class Builder extends ObjectBuilderBase { + private String packageName; private String name; private Type[] typeParams; private boolean isEnum; - public Builder pkg(String pkg) { - this.pkg = pkg; + private Builder() { + super(Type::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + + @Nonnull + public Builder withPackage(@Nullable String packageName) { + this.packageName = packageName; return this; } - public Builder name(String name) { - this.name = name; + @Nonnull + public Builder withName(@Nonnull String name) { + this.name = Strings.requireNonBlank(name, "name must not be blank"); return this; } - public Builder typeParams(Type... typeParams) { + @Nonnull + public Builder withTypeParameters(@Nullable Type... typeParams) { this.typeParams = typeParams; return this; } + @Nonnull public Builder isEnum(boolean isEnum) { this.isEnum = isEnum; return this; } - - public Type build() { - return new Type(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java new file mode 100644 index 0000000000..1fb3e9d656 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java @@ -0,0 +1,71 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; +import org.opensearch.client.codegen.utils.Strings; + +public final class TypeParameterDefinition { + @Nonnull + private final String name; + @Nullable + private final Type extendsType; + + private TypeParameterDefinition(Builder builder) { + this.name = Strings.requireNonBlank(builder.name, "name must not be blank"); + this.extendsType = builder.extendsType; + } + + @Nonnull + public String getName() { + return name; + } + + @Nullable + public Type getExtends() { + return extendsType; + } + + @Override + public String toString() { + return name + (extendsType != null ? " extends " + extendsType : ""); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder extends ObjectBuilderBase { + private String name; + private Type extendsType; + + private Builder() { + super(TypeParameterDefinition::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + + @Nonnull + public Builder withName(@Nonnull String name) { + this.name = Strings.requireNonBlank(name, "name must not be blank"); + return this; + } + + @Nonnull + public Builder withExtends(@Nullable Type type) { + this.extendsType = type; + return this; + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDiamond.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDiamond.java new file mode 100644 index 0000000000..94885e5831 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDiamond.java @@ -0,0 +1,78 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model; + +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nonnull; +import org.opensearch.client.codegen.utils.Either; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; + +public final class TypeParameterDiamond { + @Nonnull + private final Either params; + + private TypeParameterDiamond(Builder builder) { + this.params = Objects.requireNonNull(builder.params, "params must not be null"); + } + + public void toString(@Nonnull StringBuilder out) { + Objects.requireNonNull(out, "out must not be null"); + var params = this.params.fold(Function.identity(), Function.identity()); + out.append("<"); + for (var i = 0; i < params.length; i++) { + if (i > 0) { + out.append(", "); + } + out.append(params[i].toString()); + } + out.append(">"); + } + + public Type[] getParamTypes() { + return params.getLeft(); + } + + @Override + public @Nonnull String toString() { + var out = new StringBuilder(); + toString(out); + return out.toString(); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends ObjectBuilderBase { + private Either params; + + private Builder() { + super(TypeParameterDiamond::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + + @Nonnull + public Builder withParams(@Nonnull Type... params) { + this.params = Either.left(Objects.requireNonNull(params, "params must not be null")); + return this; + } + + @Nonnull + public Builder withParams(@Nonnull TypeParameterDefinition... params) { + this.params = Either.right(Objects.requireNonNull(params, "params must not be null")); + return this; + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index 1ce5a4806f..a0c3af44b0 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -40,11 +40,11 @@ private static Map asMap(Class clazz) { } public static final class Primitive { - public static final Type Boolean = Type.builder().name("boolean").build(); - public static final Type Int = Type.builder().name("int").build(); - public static final Type Long = Type.builder().name("long").build(); - public static final Type Float = Type.builder().name("float").build(); - public static final Type Double = Type.builder().name("double").build(); + public static final Type Boolean = Type.builder().withName("boolean").build(); + public static final Type Int = Type.builder().withName("int").build(); + public static final Type Long = Type.builder().withName("long").build(); + public static final Type Float = Type.builder().withName("float").build(); + public static final Type Double = Type.builder().withName("double").build(); } public static final class Java { @@ -52,57 +52,57 @@ public static final class Java { public static final class Io { public static final String PACKAGE = Java.PACKAGE + ".io"; - public static final Type IOException = Type.builder().pkg(PACKAGE).name("IOException").build(); + public static final Type IOException = Type.builder().withPackage(PACKAGE).withName("IOException").build(); } public static final class Lang { public static final String PACKAGE = Java.PACKAGE + ".lang"; - public static final Type String = Type.builder().pkg(PACKAGE).name("String").build(); - public static final Type Character = Type.builder().pkg(PACKAGE).name("Character").build(); - public static final Type Boolean = Type.builder().pkg(PACKAGE).name("Boolean").build(); - public static final Type Byte = Type.builder().pkg(PACKAGE).name("Byte").build(); - public static final Type Short = Type.builder().pkg(PACKAGE).name("Short").build(); - public static final Type Integer = Type.builder().pkg(PACKAGE).name("Integer").build(); - public static final Type Long = Type.builder().pkg(PACKAGE).name("Long").build(); - public static final Type Float = Type.builder().pkg(PACKAGE).name("Float").build(); - public static final Type Double = Type.builder().pkg(PACKAGE).name("Double").build(); - public static final Type Object = Type.builder().pkg(PACKAGE).name("Object").build(); + public static final Type String = Type.builder().withPackage(PACKAGE).withName("String").build(); + public static final Type Character = Type.builder().withPackage(PACKAGE).withName("Character").build(); + public static final Type Boolean = Type.builder().withPackage(PACKAGE).withName("Boolean").build(); + public static final Type Byte = Type.builder().withPackage(PACKAGE).withName("Byte").build(); + public static final Type Short = Type.builder().withPackage(PACKAGE).withName("Short").build(); + public static final Type Integer = Type.builder().withPackage(PACKAGE).withName("Integer").build(); + public static final Type Long = Type.builder().withPackage(PACKAGE).withName("Long").build(); + public static final Type Float = Type.builder().withPackage(PACKAGE).withName("Float").build(); + public static final Type Double = Type.builder().withPackage(PACKAGE).withName("Double").build(); + public static final Type Object = Type.builder().withPackage(PACKAGE).withName("Object").build(); } public static final class Util { public static final String PACKAGE = Java.PACKAGE + ".util"; - public static final Type HashMap = Type.builder().pkg(PACKAGE).name("HashMap").build(); + public static final Type HashMap = Type.builder().withPackage(PACKAGE).withName("HashMap").build(); public static Type Map(Type keyType, Type valueType) { return Map.withTypeParams(keyType, valueType); } - public static final Type Map = Type.builder().pkg(PACKAGE).name("Map").build(); + public static final Type Map = Type.builder().withPackage(PACKAGE).withName("Map").build(); public static Type MapEntry(Type keyType, Type valueType) { - return Type.builder().pkg(PACKAGE).name("Map.Entry").typeParams(keyType, valueType).build(); + return Type.builder().withPackage(PACKAGE).withName("Map.Entry").withTypeParameters(keyType, valueType).build(); } public static Type List(Type valueType) { - return Type.builder().pkg(PACKAGE).name("List").typeParams(valueType).build(); + return Type.builder().withPackage(PACKAGE).withName("List").withTypeParameters(valueType).build(); } public static final class Concurrent { public static final String PACKAGE = Util.PACKAGE + ".concurrent"; - public static final Type CompletableFuture = Type.builder().pkg(PACKAGE).name("CompletableFuture").build(); + public static final Type CompletableFuture = Type.builder().withPackage(PACKAGE).withName("CompletableFuture").build(); } public static final class Function { public static final String PACKAGE = Util.PACKAGE + ".function"; public static Type Function(Type argType, Type returnType) { - return Type.builder().pkg(PACKAGE).name("Function").typeParams(argType, returnType).build(); + return Type.builder().withPackage(PACKAGE).withName("Function").withTypeParameters(argType, returnType).build(); } } public static final class Stream { public static final String PACKAGE = Util.PACKAGE + ".stream"; - public static final Type Collectors = Type.builder().pkg(PACKAGE).name("Collectors").build(); + public static final Type Collectors = Type.builder().withPackage(PACKAGE).withName("Collectors").build(); } } } @@ -112,8 +112,8 @@ public static final class Javax { public static final class Annotation { public static final String PACKAGE = Javax.PACKAGE + ".annotation"; - public static final Type Generated = Type.builder().pkg(PACKAGE).name("Generated").build(); - public static final Type Nullable = Type.builder().pkg(PACKAGE).name("Nullable").build(); + public static final Type Generated = Type.builder().withPackage(PACKAGE).withName("Generated").build(); + public static final Type Nullable = Type.builder().withPackage(PACKAGE).withName("Nullable").build(); } } @@ -124,20 +124,23 @@ public static Type ApiClient(Type transport, Type client) { return ApiClient.withTypeParams(transport, client); } - public static final Type ApiClient = Type.builder().pkg(PACKAGE).name("ApiClient").build(); + public static final Type ApiClient = Type.builder().withPackage(PACKAGE).withName("ApiClient").build(); public static final class Json { public static final String PACKAGE = Client.PACKAGE + ".json"; - public static final Type JsonData = Type.builder().pkg(PACKAGE).name("JsonData").build(); - public static final Type JsonpDeserializable = Type.builder().pkg(PACKAGE).name("JsonpDeserializable").build(); - public static final Type JsonpDeserializer = Type.builder().pkg(PACKAGE).name("JsonpDeserializer").build(); - public static final Type JsonEnum = Type.builder().pkg(PACKAGE).name("JsonEnum").build(); - public static final Type JsonpMapper = Type.builder().pkg(PACKAGE).name("JsonpMapper").build(); - public static final Type JsonpSerializable = Type.builder().pkg(PACKAGE).name("JsonpSerializable").build(); - public static final Type ObjectBuilderDeserializer = Type.builder().pkg(PACKAGE).name("ObjectBuilderDeserializer").build(); - public static final Type ObjectDeserializer = Type.builder().pkg(PACKAGE).name("ObjectDeserializer").build(); - public static final Type PlainJsonSerializable = Type.builder().pkg(PACKAGE).name("PlainJsonSerializable").build(); - public static final Type UnionDeserializer = Type.builder().pkg(PACKAGE).name("UnionDeserializer").build(); + public static final Type JsonData = Type.builder().withPackage(PACKAGE).withName("JsonData").build(); + public static final Type JsonpDeserializable = Type.builder().withPackage(PACKAGE).withName("JsonpDeserializable").build(); + public static final Type JsonpDeserializer = Type.builder().withPackage(PACKAGE).withName("JsonpDeserializer").build(); + public static final Type JsonEnum = Type.builder().withPackage(PACKAGE).withName("JsonEnum").build(); + public static final Type JsonpMapper = Type.builder().withPackage(PACKAGE).withName("JsonpMapper").build(); + public static final Type JsonpSerializable = Type.builder().withPackage(PACKAGE).withName("JsonpSerializable").build(); + public static final Type ObjectBuilderDeserializer = Type.builder() + .withPackage(PACKAGE) + .withName("ObjectBuilderDeserializer") + .build(); + public static final Type ObjectDeserializer = Type.builder().withPackage(PACKAGE).withName("ObjectDeserializer").build(); + public static final Type PlainJsonSerializable = Type.builder().withPackage(PACKAGE).withName("PlainJsonSerializable").build(); + public static final Type UnionDeserializer = Type.builder().withPackage(PACKAGE).withName("UnionDeserializer").build(); } public static final class OpenSearch { @@ -145,48 +148,48 @@ public static final class OpenSearch { public static final class _Types { public static final String PACKAGE = OpenSearch.PACKAGE + "._types"; - public static final Type ErrorResponse = Type.builder().pkg(PACKAGE).name("ErrorResponse").build(); - public static final Type OpenSearchException = Type.builder().pkg(PACKAGE).name("OpenSearchException").build(); - public static final Type RequestBase = Type.builder().pkg(PACKAGE).name("RequestBase").build(); - public static final Type Time = Type.builder().pkg(PACKAGE).name("Time").build(); + public static final Type ErrorResponse = Type.builder().withPackage(PACKAGE).withName("ErrorResponse").build(); + public static final Type OpenSearchException = Type.builder().withPackage(PACKAGE).withName("OpenSearchException").build(); + public static final Type RequestBase = Type.builder().withPackage(PACKAGE).withName("RequestBase").build(); + public static final Type Time = Type.builder().withPackage(PACKAGE).withName("Time").build(); } } public static final class Transport { public static final String PACKAGE = Client.PACKAGE + ".transport"; - public static final Type Endpoint = Type.builder().pkg(PACKAGE).name("Endpoint").build(); + public static final Type Endpoint = Type.builder().withPackage(PACKAGE).withName("Endpoint").build(); public static Type JsonEndpoint(Type requestType, Type responseType, Type errorType) { return JsonEndpoint.withTypeParams(requestType, responseType, errorType); } - public static final Type JsonEndpoint = Type.builder().pkg(PACKAGE).name("JsonEndpoint").build(); - public static final Type OpenSearchTransport = Type.builder().pkg(PACKAGE).name("OpenSearchTransport").build(); - public static final Type TransportOptions = Type.builder().pkg(PACKAGE).name("TransportOptions").build(); + public static final Type JsonEndpoint = Type.builder().withPackage(PACKAGE).withName("JsonEndpoint").build(); + public static final Type OpenSearchTransport = Type.builder().withPackage(PACKAGE).withName("OpenSearchTransport").build(); + public static final Type TransportOptions = Type.builder().withPackage(PACKAGE).withName("TransportOptions").build(); public static final class Endpoints { public static final String PACKAGE = Transport.PACKAGE + ".endpoints"; - public static final Type SimpleEndpoint = Type.builder().pkg(PACKAGE).name("SimpleEndpoint").build(); + public static final Type SimpleEndpoint = Type.builder().withPackage(PACKAGE).withName("SimpleEndpoint").build(); } } public static final class Util { public static final String PACKAGE = Client.PACKAGE + ".util"; - public static final Type ApiTypeHelper = Type.builder().pkg(PACKAGE).name("ApiTypeHelper").build(); + public static final Type ApiTypeHelper = Type.builder().withPackage(PACKAGE).withName("ApiTypeHelper").build(); public static Type ObjectBuilder(Type type) { return ObjectBuilder.withTypeParams(type); } - public static final Type ObjectBuilder = Type.builder().pkg(PACKAGE).name("ObjectBuilder").build(); - public static final Type ObjectBuilderBase = Type.builder().pkg(PACKAGE).name("ObjectBuilderBase").build(); + public static final Type ObjectBuilder = Type.builder().withPackage(PACKAGE).withName("ObjectBuilder").build(); + public static final Type ObjectBuilderBase = Type.builder().withPackage(PACKAGE).withName("ObjectBuilderBase").build(); public static Type TaggedUnion(Type tagType, Type baseType) { return TaggedUnion.withTypeParams(tagType, baseType); } - public static final Type TaggedUnion = Type.builder().pkg(PACKAGE).name("TaggedUnion").build(); - public static final Type TaggedUnionUtils = Type.builder().pkg(PACKAGE).name("TaggedUnionUtils").build(); + public static final Type TaggedUnion = Type.builder().withPackage(PACKAGE).withName("TaggedUnion").build(); + public static final Type TaggedUnionUtils = Type.builder().withPackage(PACKAGE).withName("TaggedUnionUtils").build(); } } @@ -198,7 +201,7 @@ public static final class Json { public static final class Stream { public static final String PACKAGE = Json.PACKAGE + ".stream"; - public static final Type JsonGenerator = Type.builder().pkg(PACKAGE).name("JsonGenerator").build(); + public static final Type JsonGenerator = Type.builder().withPackage(PACKAGE).withName("JsonGenerator").build(); } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index d48d1140e7..b301160c53 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -23,6 +23,7 @@ import javax.annotation.Nullable; import org.opensearch.client.codegen.utils.Lists; import org.opensearch.client.codegen.utils.Maps; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; import org.opensearch.client.codegen.utils.Sets; import org.opensearch.client.codegen.utils.Versions; import org.semver4j.Semver; @@ -311,7 +312,7 @@ public static Builder builder() { return new Builder(); } - public static class Builder { + public static class Builder extends ObjectBuilderBase { @Nullable private OpenApiElement parent; @Nullable @@ -353,6 +354,15 @@ public static class Builder { @Nullable private Semver versionRemoved; + private Builder() { + super(OpenApiSchema::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withPointer(@Nonnull JsonPointer pointer) { this.pointer = Objects.requireNonNull(pointer, "pointer must not be null"); @@ -380,10 +390,5 @@ public Builder withAllOf(@Nullable List allOf) { this.allOf = allOf; return this; } - - @Nonnull - public OpenApiSchema build() { - return new OpenApiSchema(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java index 6f5421627f..f4589c7ec7 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java @@ -25,6 +25,7 @@ import javax.annotation.Nonnull; import org.opensearch.client.codegen.exceptions.JavaFormatterException; import org.opensearch.client.codegen.utils.MavenArtifactResolver; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; public class JavaCodeFormatter implements AutoCloseable { private final Formatter formatter; @@ -75,10 +76,19 @@ public static Builder builder() { return new Builder(); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private Path rootDir; private File eclipseFormatterConfig; + private Builder() { + super(JavaCodeFormatter::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withRootDir(@Nonnull Path rootDir) { this.rootDir = Objects.requireNonNull(rootDir, "rootDir must not be null"); @@ -90,10 +100,5 @@ public Builder withEclipseFormatterConfig(@Nonnull File eclipseFormatterConfig) this.eclipseFormatterConfig = Objects.requireNonNull(eclipseFormatterConfig, "eclipseFormatterConfig must not be null"); return this; } - - @Nonnull - public JavaCodeFormatter build() { - return new JavaCodeFormatter(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateGlobalContext.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateGlobalContext.java index 69e121a2fa..745d5680fe 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateGlobalContext.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateGlobalContext.java @@ -17,6 +17,7 @@ import org.apache.commons.text.StringEscapeUtils; import org.opensearch.client.codegen.model.Types; import org.opensearch.client.codegen.renderer.lambdas.TemplateStringLambda; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; import org.opensearch.client.codegen.utils.Strings; public final class TemplateGlobalContext implements Mustache.CustomContext { @@ -53,10 +54,19 @@ public static Builder builder() { .withValue("TYPES", Types.TYPES_MAP); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private final Map values = new HashMap<>(); private TemplateRenderer renderer; + private Builder() { + super(TemplateGlobalContext::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withLambda(@Nonnull String name, @Nonnull TemplateStringLambda lambda) { return withLambda(name, TemplateStringLambda.asMustacheLambda(lambda)); @@ -80,10 +90,5 @@ public Builder withRenderer(@Nonnull TemplateRenderer renderer) { this.renderer = Objects.requireNonNull(renderer, "renderer must not be null"); return this; } - - @Nonnull - public TemplateGlobalContext build() { - return new TemplateGlobalContext(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java index 5bff6f12fd..7988c6219a 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java @@ -17,6 +17,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nonnull; import org.apache.commons.io.IOUtils; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; import org.opensearch.client.codegen.utils.Strings; public final class TemplateLoader implements Mustache.TemplateLoader { @@ -57,9 +58,18 @@ public static Builder builder() { return new Builder(); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private String templatesResourceSubPath; + private Builder() { + super(TemplateLoader::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withTemplatesResourceSubPath(@Nonnull String templatesResourceSubPath) { Strings.requireNonBlank(templatesResourceSubPath, "templatesResourceSubPath must not be blank"); @@ -72,10 +82,5 @@ public Builder withTemplatesResourceSubPath(@Nonnull String templatesResourceSub this.templatesResourceSubPath = templatesResourceSubPath; return this; } - - @Nonnull - public TemplateLoader build() { - return new TemplateLoader(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java index e957c528d9..1b22b4ede1 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java @@ -23,6 +23,7 @@ import org.opensearch.client.codegen.exceptions.JavaFormatterException; import org.opensearch.client.codegen.exceptions.RenderException; import org.opensearch.client.codegen.model.Shape; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; public final class TemplateRenderer { @Nonnull @@ -82,11 +83,20 @@ public static Builder builder() { return new Builder(); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private TemplateValueFormatter valueFormatter; private TemplateLoader templateLoader; private JavaCodeFormatter javaCodeFormatter; + private Builder() { + super(TemplateRenderer::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withValueFormatter(@Nonnull Function configurator) { this.valueFormatter = Objects.requireNonNull(configurator, "configurator must not be null") @@ -106,10 +116,5 @@ public Builder withJavaCodeFormatter(@Nonnull JavaCodeFormatter javaCodeFormatte this.javaCodeFormatter = Objects.requireNonNull(javaCodeFormatter, "javaCodeFormatter must not be null"); return this; } - - @Nonnull - public TemplateRenderer build() { - return new TemplateRenderer(this); - } } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateValueFormatter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateValueFormatter.java index 26e75de95a..12a41d10f4 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateValueFormatter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateValueFormatter.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Objects; import javax.annotation.Nonnull; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; public final class TemplateValueFormatter implements Mustache.Formatter { @Nonnull @@ -50,9 +51,18 @@ public static Builder builder() { return new Builder(); } - public static final class Builder { + public static final class Builder extends ObjectBuilderBase { private final Map, Formatter> formatters = new HashMap<>(); + private Builder() { + super(TemplateValueFormatter::new); + } + + @Override + protected @Nonnull Builder self() { + return this; + } + @Nonnull public Builder withFormatter(@Nonnull Class clazz, @Nonnull Formatter formatter) { Objects.requireNonNull(clazz, "clazz must not be null"); @@ -60,9 +70,5 @@ public Builder withFormatter(@Nonnull Class clazz, @Nonnull Formatter { + @Nonnull + T build(); +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java new file mode 100644 index 0000000000..31955ba570 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java @@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.utils; + +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nonnull; + +public abstract class ObjectBuilderBase> implements ObjectBuilder { + private final Function ctor; + private boolean _used = false; + + protected ObjectBuilderBase(Function ctor) { + this.ctor = Objects.requireNonNull(ctor, "ctor must not be null"); + } + + @Nonnull + protected abstract Self self(); + + @Override + public @Nonnull T build() { + if (this._used) { + throw new IllegalStateException("Object builders can only be used once"); + } + this._used = true; + return ctor.apply(self()); + } +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache index 54b946985c..8547a4e05e 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache @@ -1,16 +1,20 @@ {{>Partials/ClassDeclaration}} { +{{^base}} public {{className}}({{TYPES.Client.Transport.OpenSearchTransport}} transport) { super(transport, null); } +{{/base}} public {{className}}({{TYPES.Client.Transport.OpenSearchTransport}} transport, @{{TYPES.Javax.Annotation.Nullable}} {{TYPES.Client.Transport.TransportOptions}} transportOptions) { super(transport, transportOptions); } +{{^base}} @Override public {{className}} withTransportOptions(@{{TYPES.Javax.Annotation.Nullable}} {{TYPES.Client.Transport.TransportOptions}} transportOptions) { return new {{className}}(this.transport, transportOptions); } +{{/base}} {{#children}} {{#-first}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache index fdb7a05eea..5fa66eb9ee 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache @@ -11,4 +11,4 @@ @{{.}} {{/annotations}} @{{TYPES.Javax.Annotation.Generated}}("org.opensearch.client.codegen.CodeGenerator") -public {{#abstract}}abstract {{/abstract}}{{classKind}} {{className}}{{#extendsType}} extends {{.}}{{/extendsType}}{{#implementsTypes}}{{#-first}} implements{{/-first}} {{.}}{{^-last}},{{/-last}}{{/implementsTypes}} +public {{#abstract}}abstract {{/abstract}}{{classKind}} {{className}}{{#typeParameters}}{{.}}{{/typeParameters}}{{#extendsType}} extends {{.}}{{/extendsType}}{{#implementsTypes}}{{#-first}} implements{{/-first}} {{.}}{{^-last}},{{/-last}}{{/implementsTypes}} From 5a9ea74b15a23c59a4ad75c6845dc3907992049b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:05:39 -0400 Subject: [PATCH 19/37] Bump org.junit:junit-bom from 5.10.3 to 5.11.0 (#1176) * Bump org.junit:junit-bom from 5.10.3 to 5.11.0 Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.10.3 to 5.11.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.3...r5.11.0) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 4 ++-- java-codegen/build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f62a80dbc..4ece8b4d62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 3.0] ### Dependencies -- Bumps `org.junit:junit-bom` from 5.10.2 to 5.10.3 +- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0 - Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 @@ -543,4 +543,4 @@ This section is for maintaining a changelog for all breaking changes for the cli [2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0 [2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0 [2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0 -[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 +[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 \ No newline at end of file diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index 49aa5ec3f5..dbae78b0d9 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -171,7 +171,7 @@ dependencies { implementation("org.semver4j", "semver4j", "5.3.0") // EPL-2.0 - testImplementation(platform("org.junit:junit-bom:5.10.3")) + testImplementation(platform("org.junit:junit-bom:5.11.0")) testImplementation("org.junit.jupiter", "junit-jupiter") testRuntimeOnly("org.junit.platform", "junit-platform-launcher") } From b4f49c0679818f0df1fd2b39caeefac8c8e30fb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:16:28 -0400 Subject: [PATCH 20/37] Bump org.owasp.dependencycheck from 10.0.3 to 10.0.4 in /java-client (#1175) * Bump org.owasp.dependencycheck from 10.0.3 to 10.0.4 in /java-client Bumps org.owasp.dependencycheck from 10.0.3 to 10.0.4. --- updated-dependencies: - dependency-name: org.owasp.dependencycheck dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 2 +- java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ece8b4d62..661fe4f9be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 3.0] ### Dependencies - Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0 -- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 +- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.4 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 73ca0807f4..5aeb1ffcde 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -52,7 +52,7 @@ plugins { `java-library` `maven-publish` id("com.github.jk1.dependency-license-report") version "2.9" - id("org.owasp.dependencycheck") version "10.0.3" + id("org.owasp.dependencycheck") version "10.0.4" id("com.diffplug.spotless") version "6.25.0" } apply(plugin = "opensearch.repositories") From 17c94e078190407896c2499ae1e5cb832ea35b6f Mon Sep 17 00:00:00 2001 From: Jai Date: Tue, 3 Sep 2024 23:18:26 +0530 Subject: [PATCH 21/37] support for withJson-618 (#1148) * support for withJson-618 Signed-off-by: Jai2305 * added code samples and documentation demonstrating the use of withJson Signed-off-by: Jai2305 --------- Signed-off-by: Jai2305 --- CHANGELOG.md | 1 + guides/json.md | 43 +++++++++++++ .../client/json/PlainDeserializable.java | 57 +++++++++++++++++ .../_types/mapping/SourceField.java | 8 ++- .../_types/mapping/TypeMapping.java | 8 ++- .../opensearch/indices/IndexSettings.java | 7 ++- .../IndexTemplateMapping.java | 8 ++- .../json/PlainDeserializableTest.java | 44 +++++++++++++ .../json/PlainJsonSerializableTest.java | 2 +- .../samples/json/DeserializationBasics.java | 61 +++++++++++++++++++ 10 files changed, 234 insertions(+), 5 deletions(-) create mode 100644 java-client/src/main/java/org/opensearch/client/json/PlainDeserializable.java create mode 100644 java-client/src/test/java/org/opensearch/client/opensearch/json/PlainDeserializableTest.java create mode 100644 samples/src/main/java/org/opensearch/client/samples/json/DeserializationBasics.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 661fe4f9be..18febac54f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ This section is for maintaining a changelog for all breaking changes for the cli - Added `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138)) - Added `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147)) - Added the `ml` namespace operations ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) +- Added `IndexTemplateMapping.Builder#withJson`, `SourceField.Builder#withJson` and `IndexSettings.Builder#withJson` for streamlining deserialization ([#1148](https://github.com/opensearch-project/opensearch-java/pull/1148)) ### Dependencies - Bumps `commons-logging:commons-logging` from 1.3.3 to 1.3.4 diff --git a/guides/json.md b/guides/json.md index 3f4acd42c8..74cbf826be 100644 --- a/guides/json.md +++ b/guides/json.md @@ -2,6 +2,9 @@ - [Serialization](#serialization) - [Using toJsonString](#using-tojsonstring) - [Manual Serialization](#manual-serialization) + - [Deserialization](#deserialization) + - [Using withJson](#using-withjson) + - [Using static _DESERIALIZER](#using-static-_deserializer) # Working With JSON @@ -50,4 +53,44 @@ private String toJson(JsonpSerializable object) { throw new UncheckedIOException(ex); } } +``` + +## Deserialization + +For demonstration let's consider an IndexTemplateMapping JSON String. + +```java + +String stringTemplate = + "{\"mappings\":{\"properties\":{\"age\":{\"type\":\"integer\"}}},\"settings\":{\"number_of_shards\":\"2\",\"number_of_replicas\":\"1\"}}"; +``` +### Using withJson +For classes, Builders of which implements `PlainDeserializable` interface, a default `withJson` method is provided. +The withJson method returns the Builder enabling you to chain Builder methods for additional configuration. +This implementation uses `jakarta.json.spi.JsonProvider` SPI to discover the available JSON provider instance +from the classpath and to create a new mapper. The `JsonpUtils` utility class streamlines this deserialization process. +The following code example demonstrates how to use the `withJson` method to deserialize objects: + +```java +InputStream inputStream = new ByteArrayInputStream(stringTemplate.getBytes(StandardCharsets.UTF_8)); +IndexTemplateMapping indexTemplateMapping = new IndexTemplateMapping.Builder().withJson(inputStream).build(); +``` + + +### Using static _DESERIALIZER +For classes annotated with `@JsonpDeserializable`, a static field _DESERIALIZER is provided, +which takes a mapper and a parser as arguments and returns the instance of the json value passed in the parser. +Notice that this way you cannot further customize the instance, the state of which will solely depend on the json value parsed. + +The following sample code demonstrates how to serialize an instance of a Java class: + +```java +private IndexTemplateMapping getInstance(String templateJsonString) { + InputStream inputStream = new ByteArrayInputStream(templateJsonString.getBytes(StandardCharsets.UTF_8)); + JsonbJsonpMapper mapper = new JsonbJsonpMapper(); + try (JsonParser parser = mapper.jsonProvider().createParser(inputStream)) { + IndexTemplateMapping indexTemplateMapping = new IndexTemplateMapping._DESERIALIZER.deserialize(parser, mapper); + return indexTemplateMapping; + } +} ``` \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/json/PlainDeserializable.java b/java-client/src/main/java/org/opensearch/client/json/PlainDeserializable.java new file mode 100644 index 0000000000..d8890e2913 --- /dev/null +++ b/java-client/src/main/java/org/opensearch/client/json/PlainDeserializable.java @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.json; + +import jakarta.json.stream.JsonParser; +import java.io.InputStream; +import java.io.Reader; + +/** Base interface to set JSON properties **/ + +public interface PlainDeserializable { + + B self(); + + /** Updates object with newly provided JSON properties + @param parser the JsonParser parser + @param mapper the JsonpMapper mapper used to deserialize values + @return this object + **/ + + default B withJson(JsonParser parser, JsonpMapper mapper) { + JsonpDeserializer deserializer = JsonpMapperBase.findDeserializer(this.getClass().getEnclosingClass()); + @SuppressWarnings("unchecked") + ObjectDeserializer objectDeserializer = (ObjectDeserializer) DelegatingDeserializer.unwrap(deserializer); + assert objectDeserializer != null; + return objectDeserializer.deserialize(self(), parser, mapper, parser.next()); + } + + /** Updates object with newly provided JSON properties + @param inputStream the stream to read from + @return this object + * **/ + default B withJson(InputStream inputStream) { + JsonpMapper defaultMapper = JsonpUtils.DEFAULT_JSONP_MAPPER; + try (JsonParser parser = defaultMapper.jsonProvider().createParser(inputStream)) { + return withJson(parser, defaultMapper); + } + } + + /** Updates object with newly provided JSON properties + @param reader the stream to read from + @return this object + * **/ + default B withJson(Reader reader) { + JsonpMapper defaultMapper = JsonpUtils.DEFAULT_JSONP_MAPPER; + try (JsonParser parser = defaultMapper.jsonProvider().createParser(reader)) { + return withJson(parser, defaultMapper); + } + } + +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SourceField.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SourceField.java index 0fcaf11cf3..6ff76552f3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SourceField.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/SourceField.java @@ -41,6 +41,7 @@ import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainDeserializable; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -172,7 +173,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link SourceField}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder, PlainDeserializable { @Nullable private Boolean compress; @@ -263,6 +264,11 @@ public SourceField build() { return new SourceField(this); } + + @Override + public Builder self() { + return this; + } } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TypeMapping.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TypeMapping.java index 7d8adceabf..cbc74c0013 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TypeMapping.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/TypeMapping.java @@ -43,6 +43,7 @@ import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainDeserializable; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -363,7 +364,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link TypeMapping}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder, PlainDeserializable { @Nullable private AllField allField; @@ -660,6 +661,11 @@ public TypeMapping build() { return new TypeMapping(this); } + + @Override + public Builder self() { + return this; + } } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettings.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettings.java index 9e68b6fbcc..12cdd73aa0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettings.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndexSettings.java @@ -41,6 +41,7 @@ import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainDeserializable; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; @@ -1108,7 +1109,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link IndexSettings}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder, PlainDeserializable { @Nullable private IndexSettings index; @@ -1919,6 +1920,10 @@ public final Builder knnAlgoParamEfSearch(@Nullable Integer value) { return this; } + @Override + public Builder self() { + return this; + } } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/put_index_template/IndexTemplateMapping.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/put_index_template/IndexTemplateMapping.java index a32aac2ad9..638b5e8afa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/put_index_template/IndexTemplateMapping.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/put_index_template/IndexTemplateMapping.java @@ -41,6 +41,7 @@ import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainDeserializable; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.opensearch.indices.Alias; @@ -139,7 +140,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { * Builder for {@link IndexTemplateMapping}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements ObjectBuilder, PlainDeserializable { @Nullable private Map aliases; @@ -219,6 +220,11 @@ public IndexTemplateMapping build() { return new IndexTemplateMapping(this); } + + @Override + public Builder self() { + return this; + } } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainDeserializableTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainDeserializableTest.java new file mode 100644 index 0000000000..d1f1faafc7 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainDeserializableTest.java @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.json; + +import static org.junit.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.indices.PutIndexTemplateRequest; +import org.opensearch.client.opensearch.indices.put_index_template.IndexTemplateMapping; + +public class PlainDeserializableTest { + @Test + public void testWithJsonPutIndexTemplateRequest() { + + String stringTemplate = + "{\"mappings\":{\"properties\":{\"age\":{\"type\":\"integer\"}}},\"settings\":{\"number_of_shards\":\"2\",\"number_of_replicas\":\"1\"}}"; + InputStream inputStream = new ByteArrayInputStream(stringTemplate.getBytes(StandardCharsets.UTF_8)); + + PutIndexTemplateRequest indexTemplateRequest = new PutIndexTemplateRequest.Builder().name("My index") + .indexPatterns("index_pattern1") + .template(new IndexTemplateMapping.Builder().withJson(inputStream).build()) + .build(); + + String expectedName = "My index"; + List expectedIndexPatterns = Arrays.asList("index_pattern1"); + String expectedNumberOfShards = "2"; + + assertEquals(indexTemplateRequest.name(), expectedName); + assertEquals(expectedIndexPatterns, indexTemplateRequest.indexPatterns()); + assertEquals(expectedNumberOfShards, indexTemplateRequest.template().settings().numberOfShards()); + + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java index 7fbf6ec61c..8386dc04d5 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java @@ -52,7 +52,7 @@ public void testIndexResponse() { // Test SearchRequest which implements PlainJsonSerializable @Test - public void testSearchResponse() { + public void testSearchRequest() { String expectedStringValue = "{\"aggregations\":{},\"query\":{\"match\":{\"name\":{\"query\":\"OpenSearch\"}}},\"terminate_after\":5}"; diff --git a/samples/src/main/java/org/opensearch/client/samples/json/DeserializationBasics.java b/samples/src/main/java/org/opensearch/client/samples/json/DeserializationBasics.java new file mode 100644 index 0000000000..b541369478 --- /dev/null +++ b/samples/src/main/java/org/opensearch/client/samples/json/DeserializationBasics.java @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.samples.json; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensearch.client.opensearch.OpenSearchClient; +import org.opensearch.client.opensearch.indices.PutIndexTemplateRequest; +import org.opensearch.client.opensearch.indices.PutIndexTemplateResponse; +import org.opensearch.client.opensearch.indices.put_index_template.IndexTemplateMapping; +import org.opensearch.client.samples.SampleClient; +import org.opensearch.client.samples.Search; + +public class DeserializationBasics { + private static final Logger LOGGER = LogManager.getLogger(Search.class); + + private static OpenSearchClient client; + + public static void main(String[] args) { + try { + client = SampleClient.create(); + + var version = client.info().version(); + LOGGER.info("Server: {}@{}.", version.distribution(), version.number()); + + final var indexTemplateName = "my-index"; + + // Use Json String/File for storing template. + String stringTemplate = + "{\"mappings\":{\"properties\":{\"age\":{\"type\":\"integer\"}}},\"settings\":{\"number_of_shards\":\"2\",\"number_of_replicas\":\"1\"}}"; + // Create Input Stream for the above json template + InputStream inputStream = new ByteArrayInputStream(stringTemplate.getBytes(StandardCharsets.UTF_8)); + + // Create Index Template Request for index 'my-index'. + PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest.Builder().name(indexTemplateName) + .template(new IndexTemplateMapping.Builder().withJson(inputStream).build()) // Use the Builder.withJson method to + // deserialize the inputStream into an instance + // of the IndexTemplateMapping class. + .build(); + + LOGGER.info("Creating index template {}.", indexTemplateName); + + // Use toJsonString method to log Request and Response string. + LOGGER.debug("Index Template Request: {}.", putIndexTemplateRequest.toJsonString()); + PutIndexTemplateResponse response = client.indices().putIndexTemplate(putIndexTemplateRequest); + LOGGER.info("Index Template Response: {}.", response.toJsonString()); + + } catch (Exception e) { + LOGGER.error("Exception occurred.", e); + } + } +} From e856ecb4657eb40e40b5e6f6d658bb1f4b646012 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 5 Sep 2024 00:48:52 +1200 Subject: [PATCH 22/37] Forbid wildcard imports (#1180) * Forbid wildcard imports Needs to be implemented as an throwing custom step as Spotless doesn't have built in support to remove/deny wildcards: https://github.com/diffplug/spotless/issues/649 Signed-off-by: Thomas Farr * Make conventions plugin Signed-off-by: Thomas Farr * Fix wildcard imports Signed-off-by: Thomas Farr * Allow overriding eclipse formatter config file Signed-off-by: Thomas Farr * Fix message formatting Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- build.gradle.kts | 2 +- buildSrc/build.gradle.kts | 12 +++- ...earch-java.spotless-conventions.gradle.kts | 58 +++++++++++++++++++ java-client/build.gradle.kts | 30 +--------- .../mapping/IcuCollationKeywordProperty.java | 6 +- .../integTest/aws/AwsSdk2GetRequestIT.java | 3 +- java-codegen/build.gradle.kts | 22 ++----- .../client/codegen/CodeGenerator.java | 6 +- samples/build.gradle.kts | 19 +----- .../client/samples/FlatObjectBasics.java | 8 +++ .../client/samples/IndexTemplates.java | 9 ++- .../client/samples/util/IssueDocument.java | 8 +++ 12 files changed, 114 insertions(+), 69 deletions(-) create mode 100644 buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 7779a42fd3..7e8dd668d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,7 +40,7 @@ allprojects { mavenLocal() maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots") mavenCentral() - maven(url = "https://plugins.gradle.org/m2/") + gradlePluginPortal() } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1d4c7ce452..19190b03bd 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -30,13 +30,19 @@ * GitHub history for details. */ -dependencies { - implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2") +plugins { + `kotlin-dsl` } repositories { mavenLocal() maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots") mavenCentral() - maven(url = "https://plugins.gradle.org/m2/") + gradlePluginPortal() } + +dependencies { + implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2") + implementation("com.diffplug.spotless", "spotless-plugin-gradle", "6.25.0") +} + diff --git a/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts b/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts new file mode 100644 index 0000000000..8f03e2d995 --- /dev/null +++ b/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts @@ -0,0 +1,58 @@ +plugins { + id("com.diffplug.spotless") +} + +interface SpotlessConventionsPluginExtension { + val eclipseFormatterConfigFile: RegularFileProperty +} + +val extension = project.extensions.create("spotlessConventions") + +extension.eclipseFormatterConfigFile.convention(rootProject.layout.projectDirectory.file("buildSrc/formatterConfig.xml")) + +spotless { + java { + target("**/*.java") + + licenseHeaderFile(rootProject.file("LICENSE_HEADER.txt")) + .named("PrimaryLicenseHeader") + .onlyIfContentMatches("^((?!Licensed to Elasticsearch)[\\s\\S])*$") + .delimiter("(package |//-----)") + + licenseHeaderFile(rootProject.file("LICENSE_HEADER_FORKED.txt")) + .named("ForkedLicenseHeader") + .onlyIfContentMatches("Licensed to Elasticsearch") + .delimiter("(package |//-----)") + + // Use the default importOrder configuration + importOrder() + removeUnusedImports() + + eclipse().configFile(extension.eclipseFormatterConfigFile) + + trimTrailingWhitespace() + endWithNewline() + + // NOTE: Any time a custom step below is modified, bump this number. + // Allows up-to-date checks to work correctly with custom steps. + bumpThisNumberIfACustomStepChanges(1) + + val wildcardImportRegex = Regex("""^import\s+(?:static\s+)?[^*\s]+\.\*;$""", RegexOption.MULTILINE) + custom("Refuse wildcard imports") { contents -> + // Wildcard imports can't be resolved by spotless itself. + // This will require the developer themselves to adhere to best practices. + val wildcardImports = wildcardImportRegex.findAll(contents) + if (wildcardImports.any()) { + var msg = """ + Please replace the following wildcard imports with explicit imports ('spotlessApply' cannot resolve this issue): + """.trimIndent() + wildcardImports.forEach { + msg += "\n\t- ${it.value}" + } + msg += "\n" + throw AssertionError(msg) + } + contents + } + } +} \ No newline at end of file diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 5aeb1ffcde..7744fea2d7 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -40,7 +40,7 @@ buildscript { mavenLocal() maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots") mavenCentral() - maven(url = "https://plugins.gradle.org/m2/") + gradlePluginPortal() } dependencies { "classpath"(group = "org.opensearch.gradle", name = "build-tools", version = "3.0.0-SNAPSHOT") @@ -53,7 +53,8 @@ plugins { `maven-publish` id("com.github.jk1.dependency-license-report") version "2.9" id("org.owasp.dependencycheck") version "10.0.4" - id("com.diffplug.spotless") version "6.25.0" + + id("opensearch-java.spotless-conventions") } apply(plugin = "opensearch.repositories") apply(plugin = "org.owasp.dependencycheck") @@ -299,31 +300,6 @@ tasks.withType { } } -spotless { - java { - target("**/*.java") - - licenseHeaderFile("../LICENSE_HEADER.txt") - .named("PrimaryLicenseHeader") - .onlyIfContentMatches("^((?!Licensed to Elasticsearch)[\\s\\S])*$") - .delimiter("(package |//-----)") - - licenseHeaderFile("../LICENSE_HEADER_FORKED.txt") - .named("ForkedLicenseHeader") - .onlyIfContentMatches("Licensed to Elasticsearch") - .delimiter("(package |//-----)") - - // Use the default importOrder configuration - importOrder() - removeUnusedImports() - - eclipse().configFile("../buildSrc/formatterConfig.xml") - - trimTrailingWhitespace() - endWithNewline() - } -} - publishing { repositories{ if (version.toString().endsWith("SNAPSHOT")) { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java index 17f3928655..0876e46265 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java @@ -11,7 +11,11 @@ import jakarta.json.stream.JsonGenerator; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.json.*; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.analysis.IcuCollationAlternate; import org.opensearch.client.opensearch._types.analysis.IcuCollationCaseFirst; import org.opensearch.client.opensearch._types.analysis.IcuCollationDecomposition; diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2GetRequestIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2GetRequestIT.java index 03dc5afb16..90f0a8841a 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2GetRequestIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2GetRequestIT.java @@ -13,7 +13,8 @@ import org.junit.Test; import org.opensearch.client.opensearch.OpenSearchAsyncClient; import org.opensearch.client.opensearch.OpenSearchClient; -import org.opensearch.client.opensearch.core.*; +import org.opensearch.client.opensearch.core.GetRequest; +import org.opensearch.client.opensearch.core.GetResponse; public class AwsSdk2GetRequestIT extends AwsSdk2TransportTestCase { @Test diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index dbae78b0d9..c95fe1be78 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -21,7 +21,7 @@ buildscript { mavenLocal() maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots") mavenCentral() - maven(url = "https://plugins.gradle.org/m2/") + gradlePluginPortal() } dependencies { "classpath"(group = "org.opensearch.gradle", name = "build-tools", version = "3.0.0-SNAPSHOT") @@ -32,8 +32,9 @@ plugins { application id("com.github.jk1.dependency-license-report") version "2.9" id("org.owasp.dependencycheck") version "10.0.2" - id("com.diffplug.spotless") version "6.25.0" id("de.undercouch.download") version "5.6.0" + + id("opensearch-java.spotless-conventions") } apply(plugin = "opensearch.repositories") apply(plugin = "org.owasp.dependencycheck") @@ -259,19 +260,6 @@ tasks.withType { } } -spotless { - java { - target("**/*.java") - - licenseHeaderFile("../LICENSE_HEADER.txt") - - // Use the default importOrder configuration - importOrder() - removeUnusedImports() - - eclipse().configFile("../buildSrc/formatterConfig-generated.xml") - - trimTrailingWhitespace() - endWithNewline() - } +spotlessConventions { + eclipseFormatterConfigFile = rootProject.file("buildSrc/formatterConfig-generated.xml") } \ No newline at end of file diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 210079ccc2..9d59d803e1 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -8,7 +8,11 @@ package org.opensearch.client.codegen; -import static org.opensearch.client.codegen.model.OperationGroupMatcher.*; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.and; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.named; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.namespace; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.not; +import static org.opensearch.client.codegen.model.OperationGroupMatcher.or; import java.io.File; import java.io.IOException; diff --git a/samples/build.gradle.kts b/samples/build.gradle.kts index 0d9577107e..1ca5c814c9 100644 --- a/samples/build.gradle.kts +++ b/samples/build.gradle.kts @@ -9,7 +9,8 @@ plugins { java application - id("com.diffplug.spotless") version "6.25.0" + + id("opensearch-java.spotless-conventions") } java { @@ -26,22 +27,6 @@ dependencies { implementation("com.fasterxml.jackson.core", "jackson-databind", "2.15.2") } -spotless { - java { - - target("**/*.java") - - // Use the default importOrder configuration - importOrder() - removeUnusedImports() - - eclipse().configFile("../buildSrc/formatterConfig.xml") - - trimTrailingWhitespace() - endWithNewline() - } -} - application { mainClass.set("org.opensearch.client.samples.Main") } diff --git a/samples/src/main/java/org/opensearch/client/samples/FlatObjectBasics.java b/samples/src/main/java/org/opensearch/client/samples/FlatObjectBasics.java index 240e53c67e..41c8a0615b 100644 --- a/samples/src/main/java/org/opensearch/client/samples/FlatObjectBasics.java +++ b/samples/src/main/java/org/opensearch/client/samples/FlatObjectBasics.java @@ -1,3 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + package org.opensearch.client.samples; import java.util.List; diff --git a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java index e086652f7a..3f43a07048 100644 --- a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java +++ b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java @@ -13,7 +13,14 @@ import org.apache.logging.log4j.Logger; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch.cluster.PutComponentTemplateRequest; -import org.opensearch.client.opensearch.indices.*; +import org.opensearch.client.opensearch.indices.CreateIndexRequest; +import org.opensearch.client.opensearch.indices.DeleteIndexRequest; +import org.opensearch.client.opensearch.indices.DeleteIndexTemplateRequest; +import org.opensearch.client.opensearch.indices.GetIndicesSettingsRequest; +import org.opensearch.client.opensearch.indices.GetIndicesSettingsResponse; +import org.opensearch.client.opensearch.indices.GetMappingRequest; +import org.opensearch.client.opensearch.indices.GetMappingResponse; +import org.opensearch.client.opensearch.indices.PutIndexTemplateRequest; /** * Run with: ./gradlew :samples:run -Dsamples.mainClass=IndexTemplates diff --git a/samples/src/main/java/org/opensearch/client/samples/util/IssueDocument.java b/samples/src/main/java/org/opensearch/client/samples/util/IssueDocument.java index 45e212ed1f..db3077d551 100644 --- a/samples/src/main/java/org/opensearch/client/samples/util/IssueDocument.java +++ b/samples/src/main/java/org/opensearch/client/samples/util/IssueDocument.java @@ -1,3 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + package org.opensearch.client.samples.util; import java.util.List; From 020e0b053cb0d33ec44a8692a3ae558178ecc160 Mon Sep 17 00:00:00 2001 From: Chris Danisch Date: Wed, 4 Sep 2024 14:09:38 -0700 Subject: [PATCH 23/37] Fix queries losing inherited data when toBuilder is called. (#1181) * Fixes https://github.com/opensearch-project/opensearch-java/issues/1172 Calling `toBuilder` on classes which implement `QueryBase` will now preserve `boost` and `queryName`. Signed-off-by: Chris Danisch * Updated changelog Signed-off-by: Chris Danisch * Added toBuilder to QueryBase instead. Signed-off-by: Chris Danisch --------- Signed-off-by: Chris Danisch --- CHANGELOG.md | 1 + .../client/opensearch/_types/query_dsl/BoolQuery.java | 2 +- .../client/opensearch/_types/query_dsl/BoostingQuery.java | 2 +- .../opensearch/_types/query_dsl/CombinedFieldsQuery.java | 2 +- .../opensearch/_types/query_dsl/CommonTermsQuery.java | 2 +- .../opensearch/_types/query_dsl/ConstantScoreQuery.java | 2 +- .../client/opensearch/_types/query_dsl/DisMaxQuery.java | 2 +- .../opensearch/_types/query_dsl/DistanceFeatureQuery.java | 2 +- .../client/opensearch/_types/query_dsl/ExistsQuery.java | 2 +- .../opensearch/_types/query_dsl/FunctionScoreQuery.java | 2 +- .../client/opensearch/_types/query_dsl/FuzzyQuery.java | 2 +- .../opensearch/_types/query_dsl/GeoBoundingBoxQuery.java | 2 +- .../opensearch/_types/query_dsl/GeoDistanceQuery.java | 2 +- .../client/opensearch/_types/query_dsl/GeoShapeQuery.java | 2 +- .../client/opensearch/_types/query_dsl/HasChildQuery.java | 2 +- .../client/opensearch/_types/query_dsl/HasParentQuery.java | 6 +++++- .../client/opensearch/_types/query_dsl/HybridQuery.java | 2 +- .../client/opensearch/_types/query_dsl/IdsQuery.java | 2 +- .../client/opensearch/_types/query_dsl/IntervalsQuery.java | 2 +- .../client/opensearch/_types/query_dsl/KnnQuery.java | 2 +- .../opensearch/_types/query_dsl/MatchBoolPrefixQuery.java | 2 +- .../_types/query_dsl/MatchPhrasePrefixQuery.java | 2 +- .../opensearch/_types/query_dsl/MatchPhraseQuery.java | 2 +- .../client/opensearch/_types/query_dsl/MatchQuery.java | 2 +- .../opensearch/_types/query_dsl/MoreLikeThisQuery.java | 2 +- .../opensearch/_types/query_dsl/MultiMatchQuery.java | 2 +- .../client/opensearch/_types/query_dsl/NestedQuery.java | 2 +- .../client/opensearch/_types/query_dsl/NeuralQuery.java | 2 +- .../client/opensearch/_types/query_dsl/ParentIdQuery.java | 2 +- .../client/opensearch/_types/query_dsl/PercolateQuery.java | 2 +- .../client/opensearch/_types/query_dsl/PinnedQuery.java | 2 +- .../client/opensearch/_types/query_dsl/PrefixQuery.java | 2 +- .../client/opensearch/_types/query_dsl/QueryBase.java | 4 ++++ .../opensearch/_types/query_dsl/QueryStringQuery.java | 2 +- .../client/opensearch/_types/query_dsl/RangeQuery.java | 2 +- .../opensearch/_types/query_dsl/RankFeatureQuery.java | 2 +- .../client/opensearch/_types/query_dsl/RegexpQuery.java | 2 +- .../client/opensearch/_types/query_dsl/ScriptQuery.java | 2 +- .../opensearch/_types/query_dsl/ScriptScoreQuery.java | 2 +- .../_types/query_dsl/SimpleQueryStringQuery.java | 2 +- .../opensearch/_types/query_dsl/SpanContainingQuery.java | 2 +- .../opensearch/_types/query_dsl/SpanFieldMaskingQuery.java | 2 +- .../client/opensearch/_types/query_dsl/SpanFirstQuery.java | 2 +- .../opensearch/_types/query_dsl/SpanMultiTermQuery.java | 2 +- .../client/opensearch/_types/query_dsl/SpanNearQuery.java | 2 +- .../client/opensearch/_types/query_dsl/SpanNotQuery.java | 2 +- .../client/opensearch/_types/query_dsl/SpanOrQuery.java | 2 +- .../client/opensearch/_types/query_dsl/SpanTermQuery.java | 2 +- .../opensearch/_types/query_dsl/SpanWithinQuery.java | 2 +- .../client/opensearch/_types/query_dsl/TermQuery.java | 2 +- .../client/opensearch/_types/query_dsl/TermsQuery.java | 2 +- .../client/opensearch/_types/query_dsl/TermsSetQuery.java | 2 +- .../client/opensearch/_types/query_dsl/TypeQuery.java | 2 +- .../client/opensearch/_types/query_dsl/WildcardQuery.java | 7 ++++++- .../client/opensearch/_types/query_dsl/WrapperQuery.java | 2 +- .../client/opensearch/_types/query_dsl/XyShapeQuery.java | 2 +- .../{BoostringQueryTest.java => BoostingQueryTest.java} | 2 +- .../client/opensearch/_types/query_dsl/MatchQueryTest.java | 2 +- 58 files changed, 70 insertions(+), 56 deletions(-) rename java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/{BoostringQueryTest.java => BoostingQueryTest.java} (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18febac54f..12fdec3acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Fixed - Fix version and build ([#254](https://github.com/opensearch-project/opensearch-java/pull/254)) +- Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java index d8d4a6f915..8127122be3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java @@ -172,7 +172,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().filter(filter).minimumShouldMatch(minimumShouldMatch).must(must).mustNot(mustNot).should(should); + return toBuilder(new Builder()).filter(filter).minimumShouldMatch(minimumShouldMatch).must(must).mustNot(mustNot).should(should); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java index 4aa7ed3a2a..93bf82624c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java @@ -111,7 +111,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().negativeBoost(negativeBoost).negative(negative).positive(positive); + return toBuilder(new Builder()).negativeBoost(negativeBoost).negative(negative).positive(positive); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java index 35c8571c36..88a966ff2b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java @@ -174,7 +174,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().fields(fields) + return toBuilder(new Builder()).fields(fields) .query(query) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .operator(operator) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java index e0bd23f71d..cb9bd377b9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java @@ -183,7 +183,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .cutoffFrequency(cutoffFrequency) .highFreqOperator(highFreqOperator) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java index a958275eb5..544e9ade3b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().filter(filter); + return toBuilder(new Builder()).filter(filter); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java index f03de385e9..24cba1c8c5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queries(queries).tieBreaker(tieBreaker); + return toBuilder(new Builder()).queries(queries).tieBreaker(tieBreaker); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java index 781c750ebf..3995f165d9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().origin(origin).pivot(pivot).field(field); + return toBuilder(new Builder()).origin(origin).pivot(pivot).field(field); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java index 1a5b8f0e8c..a05229cab5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field); + return toBuilder(new Builder()).field(field); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java index 34124bbaa8..84f23d80e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java @@ -178,7 +178,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().boostMode(boostMode) + return toBuilder(new Builder()).boostMode(boostMode) .functions(functions) .maxBoost(maxBoost) .minScore(minScore) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java index 91fc3b1a66..295ea1143b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java @@ -186,7 +186,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .value(value) .maxExpansions(maxExpansions) .prefixLength(prefixLength) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java index 272ab31a7e..2525c26185 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java @@ -149,7 +149,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .boundingBox(boundingBox) .type(type) .validationMethod(validationMethod) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java index 31b14157bb..2fc92cf470 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java @@ -147,7 +147,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).location(location); + return toBuilder(new Builder()).field(field).location(location); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java index 0047aaac67..daae1138b8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java @@ -113,7 +113,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).shape(shape); + return toBuilder(new Builder()).field(field).shape(shape); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java index 2e2cdd1cf1..a89a2b19e7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java @@ -184,7 +184,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().ignoreUnmapped(ignoreUnmapped) + return toBuilder(new Builder()).ignoreUnmapped(ignoreUnmapped) .innerHits(innerHits) .maxChildren(maxChildren) .minChildren(minChildren) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java index 4019246161..755ad185b8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java @@ -152,7 +152,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().ignoreUnmapped(ignoreUnmapped).innerHits(innerHits).parentType(parentType).query(query).score(score); + return toBuilder(new Builder()).ignoreUnmapped(ignoreUnmapped) + .innerHits(innerHits) + .parentType(parentType) + .query(query) + .score(score); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java index 932cbb93d6..1f3048504a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java @@ -56,7 +56,7 @@ public Query.Kind _queryKind() { } public HybridQuery.Builder toBuilder() { - return new HybridQuery.Builder().queries(queries); + return toBuilder(new Builder()).queries(queries); } public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java index 687158d529..74e9cb02d1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java @@ -95,7 +95,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().values(values); + return toBuilder(new Builder()).values(values); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java index d5c655db15..1386e77ef7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java @@ -252,7 +252,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder()._kind(_kind)._value(_value).field(field); + return toBuilder(new Builder())._kind(_kind)._value(_value).field(field); } public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java index 175fe6e11a..596752f47c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java @@ -108,7 +108,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).vector(vector).k(k).filter(filter); + return toBuilder(new Builder()).field(field).vector(vector).k(k).filter(filter); } /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java index b370342728..fbd877201f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java @@ -235,7 +235,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .fuzziness(fuzziness) .fuzzyRewrite(fuzzyRewrite) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java index bba0cf42f7..b275eb5a27 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java @@ -168,7 +168,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .maxExpansions(maxExpansions) .query(query) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java index 2e7ac94bec..c6c68dcd54 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java @@ -151,7 +151,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).analyzer(analyzer).query(query).slop(slop).zeroTermsQuery(zeroTermsQuery); + return toBuilder(new Builder()).field(field).analyzer(analyzer).query(query).slop(slop).zeroTermsQuery(zeroTermsQuery); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java index cab702a5b2..750c5d2948 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java @@ -307,7 +307,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .cutoffFrequency(cutoffFrequency) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java index f75d0dce97..18a28faa79 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java @@ -415,7 +415,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .boostTerms(boostTerms) .failOnUnsupportedField(failOnUnsupportedField) .fields(fields) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java index 192fbc5b70..fcab41899e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java @@ -363,7 +363,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .cutoffFrequency(cutoffFrequency) .fields(fields) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java index 997d553728..e3e6fc8e49 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java @@ -151,7 +151,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().ignoreUnmapped(ignoreUnmapped).innerHits(innerHits).path(path).query(query).scoreMode(scoreMode); + return toBuilder(new Builder()).ignoreUnmapped(ignoreUnmapped).innerHits(innerHits).path(path).query(query).scoreMode(scoreMode); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java index baadf3e849..9984f912d0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java @@ -152,7 +152,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).queryText(queryText).queryImage(queryImage).k(k).modelId(modelId).filter(filter); + return toBuilder(new Builder()).field(field).queryText(queryText).queryImage(queryImage).k(k).modelId(modelId).filter(filter); } /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java index 62d0212560..7664f45ed1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java @@ -124,7 +124,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().id(id).ignoreUnmapped(ignoreUnmapped).type(type); + return toBuilder(new Builder()).id(id).ignoreUnmapped(ignoreUnmapped).type(type); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java index 947b08889a..b224ff47b6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java @@ -228,7 +228,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().document(document) + return toBuilder(new Builder()).document(document) .documents(documents) .field(field) .id(id) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java index eabd1d8222..04a710c1c5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java @@ -197,7 +197,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder()._kind(_kind)._value(_value).organic(organic); + return toBuilder(new Builder())._kind(_kind)._value(_value).organic(organic); } public static class Builder extends QueryBase.AbstractBuilder { diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java index b64fbd5328..c7efcc35f3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java @@ -135,7 +135,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).value(value).rewrite(rewrite).value(value).caseInsensitive(caseInsensitive); + return toBuilder(new Builder()).field(field).value(value).rewrite(rewrite).value(value).caseInsensitive(caseInsensitive); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java index b08abdbd6a..90b788fca2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java @@ -98,6 +98,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + protected > BuilderT toBuilder(BuilderT builder) { + return builder.queryName(queryName).boost(boost); + } + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private Float boost; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java index d1c074b648..05e5c8165a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java @@ -497,7 +497,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().allowLeadingWildcard(allowLeadingWildcard) + return toBuilder(new Builder()).allowLeadingWildcard(allowLeadingWildcard) .analyzer(analyzer) .analyzeWildcard(analyzeWildcard) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java index 60e85dc4c3..ec3dda228f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java @@ -225,7 +225,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).gt(gt).gte(gte).lt(lt).lte(lte).from(from).to(to).format(format).timeZone(timeZone); + return toBuilder(new Builder()).field(field).gt(gt).gte(gte).lt(lt).lte(lte).from(from).to(to).format(format).timeZone(timeZone); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java index c2d01d2e80..8614fb3082 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java @@ -155,7 +155,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).saturation(saturation).log(log).linear(linear).sigmoid(sigmoid); + return toBuilder(new Builder()).field(field).saturation(saturation).log(log).linear(linear).sigmoid(sigmoid); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java index 25c9b0445f..fdcef27d76 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java @@ -168,7 +168,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .value(value) .caseInsensitive(caseInsensitive) .flags(flags) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java index 252d6a3217..ec16228cd6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java @@ -86,7 +86,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().script(script); + return toBuilder(new Builder()).script(script); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java index 126309de89..6db3199f5f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java @@ -117,7 +117,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().minScore(minScore).query(query).script(script); + return toBuilder(new Builder()).minScore(minScore).query(query).script(script); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java index 803230a525..bb7c894fc0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java @@ -294,7 +294,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .analyzeWildcard(analyzeWildcard) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .defaultOperator(defaultOperator) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java index 0a24e78415..130e867453 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().big(big).little(little); + return toBuilder(new Builder()).big(big).little(little); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java index 3908eb21a4..61db26c521 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).query(query); + return toBuilder(new Builder()).field(field).query(query); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java index 0f7646a8de..214712a6e7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().end(end).match(match); + return toBuilder(new Builder()).end(end).match(match); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java index be51d14fc4..f29bfd9889 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java @@ -96,7 +96,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().match(match); + return toBuilder(new Builder()).match(match); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java index 69ce1fc39f..4f87b7893d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java @@ -137,7 +137,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().clauses(clauses).inOrder(inOrder).slop(slop); + return toBuilder(new Builder()).clauses(clauses).inOrder(inOrder).slop(slop); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java index a37941b53f..13e3f36e66 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java @@ -159,7 +159,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().dist(dist).exclude(exclude).include(include).post(post).pre(pre); + return toBuilder(new Builder()).dist(dist).exclude(exclude).include(include).post(post).pre(pre); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java index a38b1b9159..ad3ae45559 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java @@ -102,7 +102,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().clauses(clauses); + return toBuilder(new Builder()).clauses(clauses); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java index 0d8772fe3c..adfcf813ea 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java @@ -107,7 +107,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).value(value); + return toBuilder(new Builder()).field(field).value(value); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java index 3a1c6a8cf4..66a3df46ce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().big(big).little(little); + return toBuilder(new Builder()).big(big).little(little); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java index 589ec8da8b..a14ae01a10 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java @@ -119,7 +119,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).value(value).caseInsensitive(caseInsensitive); + return toBuilder(new Builder()).field(field).value(value).caseInsensitive(caseInsensitive); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java index 0319969897..284e6e7c46 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java @@ -94,7 +94,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).terms(terms); + return toBuilder(new Builder()).field(field).terms(terms); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java index 78e365173e..1351aa9e5d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java @@ -144,7 +144,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field) + return toBuilder(new Builder()).field(field) .minimumShouldMatchField(minimumShouldMatchField) .minimumShouldMatchScript(minimumShouldMatchScript) .terms(terms); diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java index 215eccca14..ac334bcdc2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().value(value); + return toBuilder(new Builder()).value(value); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java index 724f933829..d03d9cad3a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java @@ -168,7 +168,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().field(field).value(value).caseInsensitive(caseInsensitive).rewrite(rewrite).value(value).wildcard(wildcard); + return toBuilder(new Builder()).field(field) + .value(value) + .caseInsensitive(caseInsensitive) + .rewrite(rewrite) + .value(value) + .wildcard(wildcard); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java index b87ea9b3fc..d4d7c2ecc2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java @@ -88,7 +88,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().query(query); + return toBuilder(new Builder()).query(query); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java index 279b59563f..46d3bad07e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public XyShapeQuery.Builder toBuilder() { - return new XyShapeQuery.Builder().field(field).xyShape(xyShape); + return toBuilder(new Builder()).field(field).xyShape(xyShape); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQueryTest.java similarity index 94% rename from java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java rename to java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQueryTest.java index 3f954491b8..93535d7cb7 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQueryTest.java @@ -12,7 +12,7 @@ import org.opensearch.client.opensearch._types.FieldValue; import org.opensearch.client.opensearch.model.ModelTestCase; -public class BoostringQueryTest extends ModelTestCase { +public class BoostingQueryTest extends ModelTestCase { @Test public void toBuilder() { BoostingQuery origin = new BoostingQuery.Builder().negativeBoost(1.0f) diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java index c0aa2f49f1..6e942f3806 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java @@ -15,7 +15,7 @@ public class MatchQueryTest extends ModelTestCase { @Test public void toBuilder() { - MatchQuery origin = new MatchQuery.Builder().field("field").query(FieldValue.of("1")).build(); + MatchQuery origin = new MatchQuery.Builder().field("field").query(FieldValue.of("1")).queryName("name").boost(5f).build(); MatchQuery copied = origin.toBuilder().build(); assertEquals(toJson(copied), toJson(origin)); From 43c1299acb505171417103a625e4b4c575b410b8 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 5 Sep 2024 22:58:42 +1200 Subject: [PATCH 24/37] [Backport main] Add support for codegen overrides (#1185) * Add support for codegen overrides * Implement ability to override property type mappings Signed-off-by: Thomas Farr * Ensure generated code is up-to-date Signed-off-by: Thomas Farr * Fix license header Signed-off-by: Thomas Farr * Fix tests Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr (cherry picked from commit 9c5d9c1f0ba20bdc85d0c5d48706ae02a33901a1) * spotlessApply Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- .../client/codegen/CodeGenerator.java | 3 +- .../codegen/model/ShapeRenderingContext.java | 9 +- .../client/codegen/model/SpecTransformer.java | 16 +++- .../opensearch/client/codegen/model/Type.java | 16 ++-- .../model/TypeParameterDefinition.java | 9 +- .../codegen/model/TypeParameterDiamond.java | 9 +- .../client/codegen/model/Types.java | 1 + .../codegen/model/overrides/Overrides.java | 60 +++++++++++++ .../model/overrides/PropertyOverride.java | 69 +++++++++++++++ .../model/overrides/SchemaOverride.java | 74 ++++++++++++++++ .../client/codegen/openapi/OpenApiSchema.java | 9 +- .../codegen/renderer/JavaCodeFormatter.java | 9 +- .../renderer/TemplateGlobalContext.java | 9 +- .../codegen/renderer/TemplateLoader.java | 9 +- .../codegen/renderer/TemplateRenderer.java | 9 +- .../renderer/TemplateValueFormatter.java | 9 +- .../client/codegen/utils/MapBuilderBase.java | 45 ++++++++++ .../codegen/utils/ObjectBuilderBase.java | 88 +++++++++++++++++-- .../templates/Type/directSerializer.mustache | 7 +- 19 files changed, 394 insertions(+), 66 deletions(-) create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PropertyOverride.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/SchemaOverride.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/utils/MapBuilderBase.java diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 9d59d803e1..86c3b198fd 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -35,6 +35,7 @@ import org.opensearch.client.codegen.model.OperationGroupMatcher; import org.opensearch.client.codegen.model.ShapeRenderingContext; import org.opensearch.client.codegen.model.SpecTransformer; +import org.opensearch.client.codegen.model.overrides.Overrides; import org.opensearch.client.codegen.openapi.OpenApiSpecification; public class CodeGenerator { @@ -121,7 +122,7 @@ public static void main(String[] args) { private static Namespace parseSpec(URI location) throws ApiSpecificationParseException { var spec = OpenApiSpecification.retrieve(location); - var transformer = new SpecTransformer(OPERATION_MATCHER); + var transformer = new SpecTransformer(OPERATION_MATCHER, Overrides.OVERRIDES); transformer.visit(spec); return transformer.getRoot(); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java index 097dee806c..72a163ea3b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ShapeRenderingContext.java @@ -78,13 +78,12 @@ public static final class Builder extends ObjectBuilderBase visitedSchemas = new HashSet<>(); @Nonnull private final Map schemaToType = new ConcurrentHashMap<>(); - public SpecTransformer(@Nonnull OperationGroupMatcher matcher) { + public SpecTransformer(@Nonnull OperationGroupMatcher matcher, @Nonnull Overrides overrides) { this.matcher = Objects.requireNonNull(matcher, "matcher must not be null"); + this.overrides = Objects.requireNonNull(overrides, "overrides must not be null"); } @Nonnull @@ -285,9 +290,12 @@ private void visitInto(OpenApiSchema schema, ObjectShape shape) { final var additionalProperties = new ArrayList(); final var required = collectObjectProperties(schema, properties, additionalProperties); - properties.forEach( - (k, v) -> shape.addBodyField(new Field(k, mapType(v), required.contains(k), v.getDescription().orElse(null), null)) - ); + final var overrides = this.overrides.getSchema(schema.getPointer()); + + properties.forEach((k, v) -> { + var type = overrides.flatMap(so -> so.getProperty(k)).flatMap(PropertyOverride::getMappedType).orElseGet(() -> mapType(v)); + shape.addBodyField(new Field(k, type, required.contains(k), v.getDescription().orElse(null), null)); + }); if (!additionalProperties.isEmpty()) { var valueSchema = additionalProperties.size() == 1 ? additionalProperties.get(0) : OpenApiSchema.ANONYMOUS_UNTYPED; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index 18f5eee2d1..b8e3585151 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -39,7 +39,8 @@ public class Type { "float", "Float", "double", - "Double" + "Double", + "Number" ); public static Builder builder() { @@ -148,6 +149,10 @@ public boolean isPrimitive() { return PRIMITIVES.contains(name); } + public boolean isNumber() { + return "Number".equals(name); + } + public boolean isEnum() { return isEnum; } @@ -218,13 +223,12 @@ public static final class Builder extends ObjectBuilderBase { private Type[] typeParams; private boolean isEnum; - private Builder() { - super(Type::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected Type construct() { + return new Type(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java index 1fb3e9d656..76935c0273 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TypeParameterDefinition.java @@ -47,13 +47,12 @@ public static final class Builder extends ObjectBuilderBase { private Either params; - private Builder() { - super(TypeParameterDiamond::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected TypeParameterDiamond construct() { + return new TypeParameterDiamond(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index a0c3af44b0..be82acb55f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -67,6 +67,7 @@ public static final class Lang { public static final Type Float = Type.builder().withPackage(PACKAGE).withName("Float").build(); public static final Type Double = Type.builder().withPackage(PACKAGE).withName("Double").build(); public static final Type Object = Type.builder().withPackage(PACKAGE).withName("Object").build(); + public static final Type Number = Type.builder().withPackage(PACKAGE).withName("Number").build(); } public static final class Util { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java new file mode 100644 index 0000000000..e4c9759ca2 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -0,0 +1,60 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model.overrides; + +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.openapi.JsonPointer; +import org.opensearch.client.codegen.utils.ObjectBuilder; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; + +public class Overrides { + public static final Overrides OVERRIDES = builder().build(); + + @Nonnull + private final Map schemas; + + private Overrides(Builder builder) { + this.schemas = builder.schemas != null ? Collections.unmodifiableMap(builder.schemas) : Collections.emptyMap(); + } + + @Nonnull + public Optional getSchema(@Nonnull JsonPointer pointer) { + return Optional.ofNullable(schemas.get(pointer)); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static final class Builder extends ObjectBuilderBase { + @Nullable + private Map schemas; + + private Builder() {} + + @Nonnull + @Override + protected Overrides construct() { + return new Overrides(this); + } + + @Nonnull + public Builder withSchemas(@Nonnull Function>> fn) { + this.schemas = Objects.requireNonNull(fn, "fn must not be null").apply(SchemaOverride.mapBuilder()).build(); + return this; + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PropertyOverride.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PropertyOverride.java new file mode 100644 index 0000000000..c7e01d10a8 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PropertyOverride.java @@ -0,0 +1,69 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model.overrides; + +import java.util.Optional; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.model.Type; +import org.opensearch.client.codegen.utils.MapBuilderBase; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; + +public final class PropertyOverride { + @Nullable + private final Type mappedType; + + private PropertyOverride(Builder builder) { + this.mappedType = builder.mappedType; + } + + @Nonnull + public Optional getMappedType() { + return Optional.ofNullable(mappedType); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + @Nonnull + public static MapBuilder mapBuilder() { + return new MapBuilder(); + } + + public static final class Builder extends ObjectBuilderBase { + @Nullable + private Type mappedType; + + private Builder() {} + + @Nonnull + @Override + protected PropertyOverride construct() { + return new PropertyOverride(this); + } + + @Nonnull + public Builder withMappedType(@Nullable Type mappedType) { + this.mappedType = mappedType; + return this; + } + } + + public static final class MapBuilder extends MapBuilderBase { + private MapBuilder() {} + + @Nonnull + @Override + protected Builder valueBuilder() { + return builder(); + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/SchemaOverride.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/SchemaOverride.java new file mode 100644 index 0000000000..d8359b11ff --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/SchemaOverride.java @@ -0,0 +1,74 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model.overrides; + +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.openapi.JsonPointer; +import org.opensearch.client.codegen.utils.MapBuilderBase; +import org.opensearch.client.codegen.utils.ObjectBuilder; +import org.opensearch.client.codegen.utils.ObjectBuilderBase; + +public final class SchemaOverride { + @Nonnull + private final Map properties; + + private SchemaOverride(Builder builder) { + this.properties = builder.properties != null ? Collections.unmodifiableMap(builder.properties) : Collections.emptyMap(); + } + + @Nonnull + public Optional getProperty(@Nonnull String key) { + return Optional.ofNullable(properties.get(key)); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + @Nonnull + public static MapBuilder mapBuilder() { + return new MapBuilder(); + } + + public static final class Builder extends ObjectBuilderBase { + @Nullable + private Map properties; + + private Builder() {} + + @Nonnull + @Override + protected SchemaOverride construct() { + return new SchemaOverride(this); + } + + @Nonnull + public Builder withProperties(@Nonnull Function>> fn) { + this.properties = Objects.requireNonNull(fn, "fn must not be null").apply(PropertyOverride.mapBuilder()).build(); + return this; + } + } + + public static final class MapBuilder extends MapBuilderBase { + private MapBuilder() {} + + @Nonnull + @Override + protected Builder valueBuilder() { + return builder(); + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index b301160c53..88f5d28779 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -354,13 +354,12 @@ public static class Builder extends ObjectBuilderBase { @Nullable private Semver versionRemoved; - private Builder() { - super(OpenApiSchema::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected OpenApiSchema construct() { + return new OpenApiSchema(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java index f4589c7ec7..8f2717a120 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/JavaCodeFormatter.java @@ -80,13 +80,12 @@ public static final class Builder extends ObjectBuilderBase values = new HashMap<>(); private TemplateRenderer renderer; - private Builder() { - super(TemplateGlobalContext::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected TemplateGlobalContext construct() { + return new TemplateGlobalContext(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java index 7988c6219a..6a6583125b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateLoader.java @@ -61,13 +61,12 @@ public static Builder builder() { public static final class Builder extends ObjectBuilderBase { private String templatesResourceSubPath; - private Builder() { - super(TemplateLoader::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected TemplateLoader construct() { + return new TemplateLoader(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java index 1b22b4ede1..32daa020c2 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/renderer/TemplateRenderer.java @@ -88,13 +88,12 @@ public static final class Builder extends ObjectBuilderBase { private final Map, Formatter> formatters = new HashMap<>(); - private Builder() { - super(TemplateValueFormatter::new); - } + private Builder() {} + @Nonnull @Override - protected @Nonnull Builder self() { - return this; + protected TemplateValueFormatter construct() { + return new TemplateValueFormatter(this); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MapBuilderBase.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MapBuilderBase.java new file mode 100644 index 0000000000..221d434d16 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MapBuilderBase.java @@ -0,0 +1,45 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.utils; + +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class MapBuilderBase, Self extends MapBuilderBase> extends + ObjectBuilderBase, Self> { + @Nullable + private Map map; + + protected MapBuilderBase() {} + + protected abstract @Nonnull VBuilder valueBuilder(); + + @Override + protected @Nonnull Map construct() { + return map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap(); + } + + public @Nonnull Self with(@Nonnull Map map) { + this.map = _mapPutAll(this.map, map); + return self(); + } + + public @Nonnull Self with(@Nonnull K key, @Nonnull V value) { + this.map = _mapPut(this.map, key, value); + return self(); + } + + public @Nonnull Self with(@Nonnull K key, @Nonnull Function> fn) { + return with(key, Objects.requireNonNull(fn, "fn must not be null").apply(valueBuilder()).build()); + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java index 31955ba570..8e71c9da70 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/ObjectBuilderBase.java @@ -6,29 +6,99 @@ * compatible open source license. */ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + package org.opensearch.client.codegen.utils; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; -import java.util.function.Function; import javax.annotation.Nonnull; public abstract class ObjectBuilderBase> implements ObjectBuilder { - private final Function ctor; private boolean _used = false; - protected ObjectBuilderBase(Function ctor) { - this.ctor = Objects.requireNonNull(ctor, "ctor must not be null"); + protected ObjectBuilderBase() {} + + protected @Nonnull Self self() { + // noinspection unchecked + return (Self) this; } - @Nonnull - protected abstract Self self(); + protected abstract @Nonnull T construct(); - @Override - public @Nonnull T build() { + protected final void _ensureSingleUse() { if (this._used) { throw new IllegalStateException("Object builders can only be used once"); } this._used = true; - return ctor.apply(self()); + } + + @Override + public final @Nonnull T build() { + var self = self(); + self._ensureSingleUse(); + return self.construct(); + } + + // ----- Map utilities + + private static final class OwnedMap extends HashMap { + OwnedMap() {} + + OwnedMap(Map m) { + super(m); + } + } + + private static Map _mutableMap(Map map) { + if (map == null) { + return new OwnedMap<>(); + } else if (map instanceof ObjectBuilderBase.OwnedMap) { + return map; + } else { + // Adding to a map we don't own: make a defensive copy, also ensuring it is mutable. + return new OwnedMap<>(map); + } + } + + protected static Map _mapPut(Map map, K key, V value) { + map = _mutableMap(map); + map.put(key, value); + return map; + } + + protected static Map _mapPutAll(Map map, Map entries) { + if (map == null) { + // Keep the original map to avoid an unnecessary copy. + // It will be copied if we add more entries. + return Objects.requireNonNull(entries); + } else { + map = _mutableMap(map); + map.putAll(entries); + return map; + } } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache index 66ba3e4dd6..f8c2fb10cd 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache @@ -11,7 +11,12 @@ {{/type.isList}} {{^type.isListOrMap}} {{#type.isPrimitive}} - generator.write({{value}}); + {{#type.isNumber}} + generator.write({{value}}.doubleValue()); + {{/type.isNumber}} + {{^type.isNumber}} + generator.write({{value}}); + {{/type.isNumber}} {{/type.isPrimitive}} {{^type.isPrimitive}} {{value}}.serialize(generator, mapper); From 4133a94d9e0e9ab8d0d4d9ce574cbac7ccfb277b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 07:51:48 -0400 Subject: [PATCH 25/37] Bump org.owasp.dependencycheck from 10.0.2 to 10.0.4 (#1188) Bumps org.owasp.dependencycheck from 10.0.2 to 10.0.4. --- updated-dependencies: - dependency-name: org.owasp.dependencycheck dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- java-codegen/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index c95fe1be78..e7d138b968 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -31,7 +31,7 @@ buildscript { plugins { application id("com.github.jk1.dependency-license-report") version "2.9" - id("org.owasp.dependencycheck") version "10.0.2" + id("org.owasp.dependencycheck") version "10.0.4" id("de.undercouch.download") version "5.6.0" id("opensearch-java.spotless-conventions") From cb89246e16e13947ca4250c39a27394c0c3662bb Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 10 Sep 2024 08:03:29 +1200 Subject: [PATCH 26/37] Regenerate tasks namespace (#1187) * Fix codegen integer handling Signed-off-by: Thomas Farr * Add failing tests Signed-off-by: Thomas Farr * Begin re-generating `tasks.ListRequest` and `TaskExecutingNode` renaming `State` to `TaskInfo` Signed-off-by: Thomas Farr * Simplify client request methods Signed-off-by: Thomas Farr * Re-generate _types.Retries Signed-off-by: Thomas Farr * Handle types that are used in both abstract and concrete contexts Signed-off-by: Thomas Farr * Re-generate tasks.ListResponse Signed-off-by: Thomas Farr * Regenerate tasks.cancel Signed-off-by: Thomas Farr * Regenerate tasks.get Signed-off-by: Thomas Farr * spotless Signed-off-by: Thomas Farr * Fixes Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- CHANGELOG.md | 6 +- UPGRADING.md | 17 +- .../opensearch/OpenSearchAsyncClientBase.java | 5 + .../opensearch/OpenSearchClientBase.java | 5 + .../_types/AcknowledgedResponseBase.java | 1 + .../client/opensearch/_types/BaseNode.java | 74 +- .../_types/BulkByScrollFailure.java | 316 ++ .../_types/BulkByScrollTaskStatus.java} | 379 ++- .../BulkByScrollTaskStatusOrException.java | 178 + .../client/opensearch/_types/ErrorCause.java | 1 + .../client/opensearch/_types/NodeRole.java | 26 +- .../opensearch/_types/NodeStatistics.java | 1 + .../_types/OpenSearchVersionInfo.java | 1 + .../client/opensearch/_types/Retries.java | 22 +- .../opensearch/_types/ShardFailure.java | 1 + .../opensearch/_types/ShardStatistics.java | 1 + .../client/opensearch/_types/TaskFailure.java | 209 ++ .../opensearch/_types/WriteResponseBase.java | 1 + .../client/opensearch/core/InfoResponse.java | 1 + .../DeleteDanglingIndexResponse.java | 1 + .../ImportDanglingIndexResponse.java | 1 + .../ListDanglingIndicesResponse.java | 1 + .../OpenSearchDanglingIndicesAsyncClient.java | 18 +- .../OpenSearchDanglingIndicesClient.java | 18 +- .../list_dangling_indices/DanglingIndex.java | 1 + .../ml/DeleteModelGroupResponse.java | 1 + .../opensearch/ml/DeleteModelResponse.java | 1 + .../opensearch/ml/DeleteTaskResponse.java | 1 + .../opensearch/ml/DeployModelResponse.java | 1 + .../opensearch/ml/GetModelGroupResponse.java | 1 + .../client/opensearch/ml/GetTaskResponse.java | 1 + .../ml/OpenSearchMlAsyncClient.java | 74 +- .../opensearch/ml/OpenSearchMlClient.java | 74 +- .../ml/RegisterModelGroupRequest.java | 1 + .../ml/RegisterModelGroupResponse.java | 1 + .../opensearch/ml/RegisterModelRequest.java | 1 + .../opensearch/ml/RegisterModelResponse.java | 1 + .../opensearch/ml/UndeployModelNode.java | 1 + .../opensearch/ml/UndeployModelResponse.java | 1 + .../opensearch/tasks/CancelRequest.java | 106 +- .../opensearch/tasks/CancelResponse.java | 99 + .../opensearch/tasks/GetTasksRequest.java | 76 +- .../opensearch/tasks/GetTasksResponse.java | 105 +- .../client/opensearch/tasks/GroupBy.java | 12 +- .../client/opensearch/tasks/ListRequest.java | 131 +- .../client/opensearch/tasks/ListResponse.java | 99 + .../tasks/OpenSearchTasksAsyncClient.java | 75 +- .../tasks/OpenSearchTasksClient.java | 75 +- .../client/opensearch/tasks/Status.java | 770 +++++ .../opensearch/tasks/TaskExecutingNode.java | 73 +- .../client/opensearch/tasks/TaskGroup.java | 165 + .../client/opensearch/tasks/TaskInfo.java} | 340 +- .../client/opensearch/tasks/TaskInfos.java | 163 + .../tasks/TaskListResponseBase.java} | 185 +- .../client/opensearch/tasks/TaskResponse.java | 721 ++++ .../opensearch/OpenSearchAsyncClient.java | 5 - .../client/opensearch/OpenSearchClient.java | 5 - .../core/DeleteByQueryRethrottleResponse.java | 10 +- .../UpdateByQueryRethrottleNode.java | 20 +- .../opensearch/tasks/CancelResponse.java | 221 -- .../client/opensearch/tasks/State.java | 430 --- .../opensearch/tasks/ListResponseTest.java | 218 ++ .../integTest/AbstractTasksClientIT.java | 39 + .../OpenSearchJavaClientTestCase.java | 8 +- .../integTest/httpclient5/TasksClientIT.java | 13 + .../integTest/restclient/TasksClientIT.java | 24 + java-codegen/opensearch-openapi.yaml | 2942 ++++++++++++----- .../client/codegen/CodeGenerator.java | 3 +- .../client/codegen/model/Namespace.java | 12 +- .../client/codegen/model/ObjectShape.java | 21 +- .../client/codegen/model/ReferenceKind.java | 25 + .../client/codegen/model/RequestShape.java | 6 +- .../client/codegen/model/Shape.java | 47 +- .../client/codegen/model/SpecTransformer.java | 68 +- .../codegen/model/TaggedUnionShape.java | 1 + .../opensearch/client/codegen/model/Type.java | 24 +- .../client/codegen/model/Types.java | 20 +- .../client/codegen/openapi/OpenApiSchema.java | 4 + .../client/codegen/templates/Client.mustache | 9 +- .../templates/ObjectShape/Builder.mustache | 133 +- .../ObjectShape/Builder/BuildImpl.mustache | 10 + .../ObjectShape/Builder/Fields.mustache | 69 + .../ObjectShape/Builder/SelfImpl.mustache | 4 + .../ObjectShape/Constructor.mustache | 10 +- .../ObjectShape/Deserialize.mustache | 10 +- .../templates/TaggedUnionShape.mustache | 10 +- 86 files changed, 6283 insertions(+), 2778 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/BaseNode.java (83%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java rename java-client/src/{main/java/org/opensearch/client/opensearch/tasks/Status.java => generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java} (62%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/NodeRole.java (86%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/Retries.java (91%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/CancelRequest.java (76%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java (78%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/GroupBy.java (84%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/ListRequest.java (74%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java (65%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java (73%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java rename java-client/src/{main/java/org/opensearch/client/opensearch/tasks/Info.java => generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java} (59%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java rename java-client/src/{main/java/org/opensearch/client/opensearch/tasks/ListResponse.java => generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java} (64%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/tasks/State.java create mode 100644 java-client/src/test/java/org/opensearch/client/opensearch/tasks/ListResponseTest.java create mode 100644 java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractTasksClientIT.java create mode 100644 java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/TasksClientIT.java create mode 100644 java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/TasksClientIT.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/ReferenceKind.java create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/BuildImpl.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Fields.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/SelfImpl.mustache diff --git a/CHANGELOG.md b/CHANGELOG.md index 12fdec3acd..1489b7d53c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 3.0] ### Dependencies -- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0 - Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.4 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 @@ -21,6 +20,7 @@ This section is for maintaining a changelog for all breaking changes for the cli - Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769)) - Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124)) - Changed type of `ShardStatistics`'s `total`, `successful`, `failed` & `skipped` fields from `Number` to `int/Integer` ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158)) +- Unified `tasks.Info` and `tasks.State` classes into `tasks.TaskInfo` ([#1187](https://github.com/opensearch-project/opensearch-java/pull/1187)) ### Deprecated - Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536)) @@ -29,7 +29,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Fixed - Fix version and build ([#254](https://github.com/opensearch-project/opensearch-java/pull/254)) -- Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181)) +- Fixed deserializing `tasks.ListResponse` when using `GroupBy.None` ([#1187](https://github.com/opensearch-project/opensearch-java/pull/1187)) ### Security @@ -38,6 +38,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Added ### Dependencies +- Bumps `org.junit:junit-bom` from 5.10.3 to 5.11.0 ### Changed @@ -46,6 +47,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed ### Fixed +- Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181)) ### Security diff --git a/UPGRADING.md b/UPGRADING.md index 194fd82ae4..e59cba1254 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -27,4 +27,19 @@ After: ### ShardStatistics properties types - The type of the `total`, `successful` and `failed` fields has been corrected from `Number` to `int`. -- The type of the `skipped` field has been corrected from `Number` to `Integer`. \ No newline at end of file +- The type of the `skipped` field has been corrected from `Number` to `Integer`. + +### Unified tasks.Info & tasks.State classes into tasks.TaskInfo +- The `tasks.Info` and `tasks.State` classes have been unified into `tasks.TaskInfo`, this affects: + - `TaskExecutingNode`'s `tasks` field. + - `GetTasksResponse`'s `task` field. + - `core.update_by_query_rethrottle.UpdateByQueryRethrottleNode`'s `tasks` field. +- The `headers` field is now a `Map` instead of a `Map>`. + +### tasks.ListResponse properties lifted to tasks.TaskListResponseBase +- All fields previously defined on `tasks.ListResponse` have been lifted to `tasks.TaskListResponseBase`. +- `DeleteByQueryRethrottleResponse` now extends `tasks.TaskListResponseBase` instead of `tasks.ListResponse`. +- The `tasks` field is now a `TaskInfos` union type instead of a `Map` to correctly handle `groupBy` parents or none. + +### GetTasksResponse response type +- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index bbcfd5d125..cc9296ed41 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -46,6 +46,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; +import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -68,6 +69,10 @@ public OpenSearchMlAsyncClient ml() { return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); } + public OpenSearchTasksAsyncClient tasks() { + return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index c6f6b4f877..7e09f00916 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -45,6 +45,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.opensearch.ml.OpenSearchMlClient; +import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -67,6 +68,10 @@ public OpenSearchMlClient ml() { return new OpenSearchMlClient(this.transport, this.transportOptions); } + public OpenSearchTasksClient tasks() { + return new OpenSearchTasksClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index ee2f0572f9..d955102ca7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -101,6 +101,7 @@ public final BuilderT acknowledged(boolean value) { protected abstract BuilderT self(); } + // --------------------------------------------------------------------------------------------- protected static > void setupAcknowledgedResponseBaseDeserializer( diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 4494087382..8726abe2e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,32 +48,35 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: _spec_utils.BaseNode +// typedef: _types.BaseNode +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class BaseNode implements PlainJsonSerializable { + private final Map attributes; + @Nullable private final String host; + @Nullable private final String ip; private final String name; private final List roles; + @Nullable private final String transportAddress; // --------------------------------------------------------------------------------------------- protected BaseNode(AbstractBuilder builder) { - this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); this.host = builder.host; this.ip = builder.ip; - this.name = builder.name; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.roles = ApiTypeHelper.unmodifiable(builder.roles); this.transportAddress = builder.transportAddress; - } /** @@ -81,6 +89,7 @@ public final Map attributes() { /** * API name: {@code host} */ + @Nullable public final String host() { return this.host; } @@ -88,12 +97,13 @@ public final String host() { /** * API name: {@code ip} */ + @Nullable public final String ip() { return this.ip; } /** - * API name: {@code name} + * Required - API name: {@code name} */ public final String name() { return this.name; @@ -109,6 +119,7 @@ public final List roles() { /** * API name: {@code transport_address} */ + @Nullable public final String transportAddress() { return this.transportAddress; } @@ -116,6 +127,7 @@ public final String transportAddress() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -123,23 +135,25 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.attributes)) { generator.writeKey("attributes"); generator.writeStartObject(); for (Map.Entry item0 : this.attributes.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); + } + if (this.host != null) { + generator.writeKey("host"); + generator.write(this.host); } - generator.writeKey("host"); - generator.write(this.host); - generator.writeKey("ip"); - generator.write(this.ip); + if (this.ip != null) { + generator.writeKey("ip"); + generator.write(this.ip); + } generator.writeKey("name"); generator.write(this.name); @@ -151,36 +165,35 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { item0.serialize(generator, mapper); } generator.writeEnd(); - } - generator.writeKey("transport_address"); - generator.write(this.transportAddress); + if (this.transportAddress != null) { + generator.writeKey("transport_address"); + generator.write(this.transportAddress); + } } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private Map attributes; - @Nullable private String host; - @Nullable private String ip; - - @Nullable private String name; - @Nullable private List roles; - @Nullable private String transportAddress; /** * API name: {@code attributes} + * *

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

*/ public final BuilderT attributes(Map map) { this.attributes = _mapPutAll(this.attributes, map); @@ -189,8 +202,10 @@ public final BuilderT attributes(Map map) { /** * API name: {@code attributes} + * *

* Adds an entry to attributes. + *

*/ public final BuilderT attributes(String key, String value) { this.attributes = _mapPut(this.attributes, key, value); @@ -200,7 +215,7 @@ public final BuilderT attributes(String key, String value) { /** * API name: {@code host} */ - public final BuilderT host(String value) { + public final BuilderT host(@Nullable String value) { this.host = value; return self(); } @@ -208,13 +223,13 @@ public final BuilderT host(String value) { /** * API name: {@code ip} */ - public final BuilderT ip(String value) { + public final BuilderT ip(@Nullable String value) { this.ip = value; return self(); } /** - * API name: {@code name} + * Required - API name: {@code name} */ public final BuilderT name(String value) { this.name = value; @@ -223,8 +238,10 @@ public final BuilderT name(String value) { /** * API name: {@code roles} + * *

* Adds all elements of list to roles. + *

*/ public final BuilderT roles(List list) { this.roles = _listAddAll(this.roles, list); @@ -233,8 +250,10 @@ public final BuilderT roles(List list) { /** * API name: {@code roles} + * *

* Adds one or more values to roles. + *

*/ public final BuilderT roles(NodeRole value, NodeRole... values) { this.roles = _listAdd(this.roles, value, values); @@ -244,25 +263,22 @@ public final BuilderT roles(NodeRole value, NodeRole... values) { /** * API name: {@code transport_address} */ - public final BuilderT transportAddress(String value) { + public final BuilderT transportAddress(@Nullable String value) { this.transportAddress = value; return self(); } protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- - protected static > void setupBaseNodeDeserializer(ObjectDeserializer op) { + protected static > void setupBaseNodeDeserializer(ObjectDeserializer op) { op.add(AbstractBuilder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host"); op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip"); op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java new file mode 100644 index 0000000000..a31cc9741a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -0,0 +1,316 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: _types.BulkByScrollFailure + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BulkByScrollFailure implements PlainJsonSerializable { + + @Nullable + private final ErrorCause cause; + + @Nullable + private final String id; + + @Nullable + private final String index; + + @Nullable + private final String node; + + @Nullable + private final ErrorCause reason; + + @Nullable + private final Integer shard; + + private final int status; + + // --------------------------------------------------------------------------------------------- + + private BulkByScrollFailure(Builder builder) { + this.cause = builder.cause; + this.id = builder.id; + this.index = builder.index; + this.node = builder.node; + this.reason = builder.reason; + this.shard = builder.shard; + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + } + + public static BulkByScrollFailure of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code cause} + */ + @Nullable + public final ErrorCause cause() { + return this.cause; + } + + /** + * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + + /** + * API name: {@code index} + */ + @Nullable + public final String index() { + return this.index; + } + + /** + * API name: {@code node} + */ + @Nullable + public final String node() { + return this.node; + } + + /** + * API name: {@code reason} + */ + @Nullable + public final ErrorCause reason() { + return this.reason; + } + + /** + * API name: {@code shard} + */ + @Nullable + public final Integer shard() { + return this.shard; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.cause != null) { + generator.writeKey("cause"); + this.cause.serialize(generator, mapper); + } + + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + } + + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + } + + if (this.node != null) { + generator.writeKey("node"); + generator.write(this.node); + } + + if (this.reason != null) { + generator.writeKey("reason"); + this.reason.serialize(generator, mapper); + } + + if (this.shard != null) { + generator.writeKey("shard"); + generator.write(this.shard); + } + + generator.writeKey("status"); + generator.write(this.status); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkByScrollFailure}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private ErrorCause cause; + @Nullable + private String id; + @Nullable + private String index; + @Nullable + private String node; + @Nullable + private ErrorCause reason; + @Nullable + private Integer shard; + private Integer status; + + /** + * API name: {@code cause} + */ + public final Builder cause(@Nullable ErrorCause value) { + this.cause = value; + return this; + } + + /** + * API name: {@code cause} + */ + public final Builder cause(Function> fn) { + return cause(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * API name: {@code index} + */ + public final Builder index(@Nullable String value) { + this.index = value; + return this; + } + + /** + * API name: {@code node} + */ + public final Builder node(@Nullable String value) { + this.node = value; + return this; + } + + /** + * API name: {@code reason} + */ + public final Builder reason(@Nullable ErrorCause value) { + this.reason = value; + return this; + } + + /** + * API name: {@code reason} + */ + public final Builder reason(Function> fn) { + return reason(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code shard} + */ + public final Builder shard(@Nullable Integer value) { + this.shard = value; + return this; + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Builds a {@link BulkByScrollFailure}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public BulkByScrollFailure build() { + _checkSingleUse(); + + return new BulkByScrollFailure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkByScrollFailure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + BulkByScrollFailure::setupBulkByScrollFailureDeserializer + ); + + protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer op) { + op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/Status.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java index 264dbf04d7..5d3a9500db 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatus.java @@ -30,11 +30,16 @@ * GitHub history for details. */ -package org.opensearch.client.opensearch.tasks; +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,33 +47,37 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.Retries; -import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: tasks._types.Status +// typedef: _types.BulkByScrollTaskStatus @JsonpDeserializable -public class Status implements PlainJsonSerializable { - private final long batches; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BulkByScrollTaskStatus implements PlainJsonSerializable { + + private final int batches; @Nullable private final String canceled; - private final long created; + @Nullable + private final Long created; private final long deleted; private final long noops; - private final List failures; - private final float requestsPerSecond; private final Retries retries; + @Nullable + private final Integer sliceId; + + private final List slices; + @Nullable private final Time throttled; @@ -79,50 +88,45 @@ public class Status implements PlainJsonSerializable { private final long throttledUntilMillis; - @Nullable - private final Boolean timedOut; - - @Nullable - private final Long took; - private final long total; - private final long updated; + @Nullable + private final Long updated; private final long versionConflicts; // --------------------------------------------------------------------------------------------- - private Status(Builder builder) { - + private BulkByScrollTaskStatus(Builder builder) { this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches"); this.canceled = builder.canceled; - this.created = ApiTypeHelper.requireNonNull(builder.created, this, "created"); + this.created = builder.created; this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops"); - this.failures = ApiTypeHelper.unmodifiable(builder.failures); this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond"); this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); + this.sliceId = builder.sliceId; + this.slices = ApiTypeHelper.unmodifiable(builder.slices); this.throttled = builder.throttled; this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); this.throttledUntil = builder.throttledUntil; this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, "throttledUntilMillis"); - this.timedOut = builder.timedOut; - this.took = builder.took; this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.updated = ApiTypeHelper.requireNonNull(builder.updated, this, "updated"); + this.updated = builder.updated; this.versionConflicts = ApiTypeHelper.requireNonNull(builder.versionConflicts, this, "versionConflicts"); - } - public static Status of(Function> fn) { + public static BulkByScrollTaskStatus of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code batches} + * Required - The number of scroll responses pulled back by the reindex. + *

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

*/ - public final long batches() { + public final int batches() { return this.batches; } @@ -135,35 +139,41 @@ public final String canceled() { } /** - * Required - API name: {@code created} + * The number of documents that were successfully created. + *

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

*/ - public final long created() { + @Nullable + public final Long created() { return this.created; } /** - * Required - API name: {@code deleted} + * Required - The number of documents that were successfully deleted. + *

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

*/ public final long deleted() { return this.deleted; } /** - * Required - API name: {@code noops} + * Required - The number of documents that were ignored. + *

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

*/ public final long noops() { return this.noops; } /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - API name: {@code requests_per_second} + * Required - The number of requests per second effectively executed during the reindex. + *

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

*/ public final float requestsPerSecond() { return this.requestsPerSecond; @@ -176,6 +186,21 @@ public final Retries retries() { return this.retries; } + /** + * API name: {@code slice_id} + */ + @Nullable + public final Integer sliceId() { + return this.sliceId; + } + + /** + * API name: {@code slices} + */ + public final List slices() { + return this.slices; + } + /** * API name: {@code throttled} */ @@ -207,37 +232,32 @@ public final long throttledUntilMillis() { } /** - * API name: {@code timed_out} - */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; - } - - /** - * API name: {@code took} - */ - @Nullable - public final Long took() { - return this.took; - } - - /** - * Required - API name: {@code total} + * Required - The number of documents that were successfully processed. + *

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

*/ public final long total() { return this.total; } /** - * Required - API name: {@code updated} + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

*/ - public final long updated() { + @Nullable + public final Long updated() { return this.updated; } /** - * Required - API name: {@code version_conflicts} + * Required - The number of version conflicts that reindex hits. + *

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

*/ public final long versionConflicts() { return this.versionConflicts; @@ -246,6 +266,7 @@ public final long versionConflicts() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -253,17 +274,18 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("batches"); generator.write(this.batches); if (this.canceled != null) { generator.writeKey("canceled"); generator.write(this.canceled); + } + if (this.created != null) { + generator.writeKey("created"); + generator.write(this.created); } - generator.writeKey("created"); - generator.write(this.created); generator.writeKey("deleted"); generator.write(this.deleted); @@ -271,110 +293,91 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("noops"); generator.write(this.noops); - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (String item0 : this.failures) { - generator.write(item0); - - } - generator.writeEnd(); - - } generator.writeKey("requests_per_second"); generator.write(this.requestsPerSecond); generator.writeKey("retries"); this.retries.serialize(generator, mapper); + if (this.sliceId != null) { + generator.writeKey("slice_id"); + generator.write(this.sliceId); + } + + if (ApiTypeHelper.isDefined(this.slices)) { + generator.writeKey("slices"); + generator.writeStartArray(); + for (BulkByScrollTaskStatusOrException item0 : this.slices) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + if (this.throttled != null) { generator.writeKey("throttled"); this.throttled.serialize(generator, mapper); - } + generator.writeKey("throttled_millis"); generator.write(this.throttledMillis); if (this.throttledUntil != null) { generator.writeKey("throttled_until"); this.throttledUntil.serialize(generator, mapper); - } + generator.writeKey("throttled_until_millis"); generator.write(this.throttledUntilMillis); - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - - } generator.writeKey("total"); generator.write(this.total); - generator.writeKey("updated"); - generator.write(this.updated); + if (this.updated != null) { + generator.writeKey("updated"); + generator.write(this.updated); + } generator.writeKey("version_conflicts"); generator.write(this.versionConflicts); - } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Status}. + * Builder for {@link BulkByScrollTaskStatus}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long batches; - + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer batches; @Nullable private String canceled; - + @Nullable private Long created; - private Long deleted; - private Long noops; - - @Nullable - private List failures; - private Float requestsPerSecond; - private Retries retries; - + @Nullable + private Integer sliceId; + @Nullable + private List slices; @Nullable private Time throttled; - private Long throttledMillis; - @Nullable private Time throttledUntil; - private Long throttledUntilMillis; - - @Nullable - private Boolean timedOut; - - @Nullable - private Long took; - private Long total; - + @Nullable private Long updated; - private Long versionConflicts; /** - * Required - API name: {@code batches} + * Required - The number of scroll responses pulled back by the reindex. + *

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

*/ - public final Builder batches(long value) { + public final Builder batches(int value) { this.batches = value; return this; } @@ -388,15 +391,21 @@ public final Builder canceled(@Nullable String value) { } /** - * Required - API name: {@code created} + * The number of documents that were successfully created. + *

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

*/ - public final Builder created(long value) { + public final Builder created(@Nullable Long value) { this.created = value; return this; } /** - * Required - API name: {@code deleted} + * Required - The number of documents that were successfully deleted. + *

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

*/ public final Builder deleted(long value) { this.deleted = value; @@ -404,7 +413,10 @@ public final Builder deleted(long value) { } /** - * Required - API name: {@code noops} + * Required - The number of documents that were ignored. + *

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

*/ public final Builder noops(long value) { this.noops = value; @@ -412,46 +424,74 @@ public final Builder noops(long value) { } /** - * API name: {@code failures} + * Required - The number of requests per second effectively executed during the reindex. *

- * Adds all elements of list to failures. + * API name: {@code requests_per_second} + *

*/ - public final Builder failures(List list) { - this.failures = _listAddAll(this.failures, list); + public final Builder requestsPerSecond(float value) { + this.requestsPerSecond = value; return this; } /** - * API name: {@code failures} - *

- * Adds one or more values to failures. + * Required - API name: {@code retries} */ - public final Builder failures(String value, String... values) { - this.failures = _listAdd(this.failures, value, values); + public final Builder retries(Retries value) { + this.retries = value; return this; } /** - * Required - API name: {@code requests_per_second} + * Required - API name: {@code retries} */ - public final Builder requestsPerSecond(float value) { - this.requestsPerSecond = value; + public final Builder retries(Function> fn) { + return retries(fn.apply(new Retries.Builder()).build()); + } + + /** + * API name: {@code slice_id} + */ + public final Builder sliceId(@Nullable Integer value) { + this.sliceId = value; return this; } /** - * Required - API name: {@code retries} + * API name: {@code slices} + * + *

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

*/ - public final Builder retries(Retries value) { - this.retries = value; + public final Builder slices(List list) { + this.slices = _listAddAll(this.slices, list); return this; } /** - * Required - API name: {@code retries} + * API name: {@code slices} + * + *

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

*/ - public final Builder retries(Function> fn) { - return this.retries(fn.apply(new Retries.Builder()).build()); + public final Builder slices(BulkByScrollTaskStatusOrException value, BulkByScrollTaskStatusOrException... values) { + this.slices = _listAdd(this.slices, value, values); + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices( + Function> fn + ) { + return slices(fn.apply(new BulkByScrollTaskStatusOrException.Builder()).build()); } /** @@ -466,7 +506,7 @@ public final Builder throttled(@Nullable Time value) { * API name: {@code throttled} */ public final Builder throttled(Function> fn) { - return this.throttled(fn.apply(new Time.Builder()).build()); + return throttled(fn.apply(new Time.Builder()).build()); } /** @@ -489,7 +529,7 @@ public final Builder throttledUntil(@Nullable Time value) { * API name: {@code throttled_until} */ public final Builder throttledUntil(Function> fn) { - return this.throttledUntil(fn.apply(new Time.Builder()).build()); + return throttledUntil(fn.apply(new Time.Builder()).build()); } /** @@ -501,23 +541,10 @@ public final Builder throttledUntilMillis(long value) { } /** - * API name: {@code timed_out} - */ - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; - return this; - } - - /** - * API name: {@code took} - */ - public final Builder took(@Nullable Long value) { - this.took = value; - return this; - } - - /** - * Required - API name: {@code total} + * Required - The number of documents that were successfully processed. + *

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

*/ public final Builder total(long value) { this.total = value; @@ -525,15 +552,22 @@ public final Builder total(long value) { } /** - * Required - API name: {@code updated} + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

*/ - public final Builder updated(long value) { + public final Builder updated(@Nullable Long value) { this.updated = value; return this; } /** - * Required - API name: {@code version_conflicts} + * Required - The number of version conflicts that reindex hits. + *

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

*/ public final Builder versionConflicts(long value) { this.versionConflicts = value; @@ -541,48 +575,43 @@ public final Builder versionConflicts(long value) { } /** - * Builds a {@link Status}. + * Builds a {@link BulkByScrollTaskStatus}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ - public Status build() { + public BulkByScrollTaskStatus build() { _checkSingleUse(); - return new Status(this); + return new BulkByScrollTaskStatus(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Status} + * Json deserializer for {@link BulkByScrollTaskStatus} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - Status::setupStatusDeserializer + BulkByScrollTaskStatus::setupBulkByScrollTaskStatusDeserializer ); - protected static void setupStatusDeserializer(ObjectDeserializer op) { - - op.add(Builder::batches, JsonpDeserializer.longDeserializer(), "batches"); + protected static void setupBulkByScrollTaskStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::batches, JsonpDeserializer.integerDeserializer(), "batches"); op.add(Builder::canceled, JsonpDeserializer.stringDeserializer(), "canceled"); op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "failures"); op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); op.add(Builder::retries, Retries._DESERIALIZER, "retries"); + op.add(Builder::sliceId, JsonpDeserializer.integerDeserializer(), "slice_id"); + op.add(Builder::slices, JsonpDeserializer.arrayDeserializer(BulkByScrollTaskStatusOrException._DESERIALIZER), "slices"); op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); - op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java new file mode 100644 index 0000000000..10d8cd24cb --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollTaskStatusOrException.java @@ -0,0 +1,178 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.UnionDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: _types.BulkByScrollTaskStatusOrException + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class BulkByScrollTaskStatusOrException + implements + TaggedUnion, + PlainJsonSerializable { + public enum Kind { + Status, + Exception + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private BulkByScrollTaskStatusOrException(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private BulkByScrollTaskStatusOrException(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static BulkByScrollTaskStatusOrException of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code status}? + */ + public boolean isStatus() { + return _kind == Kind.Status; + } + + /** + * Get the {@code status} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code status} kind. + */ + public BulkByScrollTaskStatus status() { + return TaggedUnionUtils.get(this, Kind.Status); + } + + /** + * Is this variant instance of kind {@code exception}? + */ + public boolean isException() { + return _kind == Kind.Exception; + } + + /** + * Get the {@code exception} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code exception} kind. + */ + public ErrorCause exception() { + return TaggedUnionUtils.get(this, Kind.Exception); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder status(BulkByScrollTaskStatus v) { + this._kind = Kind.Status; + this._value = v; + return this; + } + + public ObjectBuilder status( + Function> fn + ) { + return this.status(fn.apply(new BulkByScrollTaskStatus.Builder()).build()); + } + + public ObjectBuilder exception(ErrorCause v) { + this._kind = Kind.Exception; + this._value = v; + return this; + } + + public ObjectBuilder exception(Function> fn) { + return this.exception(fn.apply(new ErrorCause.Builder()).build()); + } + + @Override + public BulkByScrollTaskStatusOrException build() { + _checkSingleUse(); + return new BulkByScrollTaskStatusOrException(this); + } + } + + private static JsonpDeserializer buildBulkByScrollTaskStatusOrExceptionDeserializer() { + return new UnionDeserializer.Builder(BulkByScrollTaskStatusOrException::new, false) + .addMember(Kind.Status, BulkByScrollTaskStatus._DESERIALIZER) + .addMember(Kind.Exception, ErrorCause._DESERIALIZER) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( + BulkByScrollTaskStatusOrException::buildBulkByScrollTaskStatusOrExceptionDeserializer + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index 5184be7b16..c029456c39 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -379,6 +379,7 @@ public ErrorCause build() { return new ErrorCause(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeRole.java similarity index 86% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeRole.java index 530603353f..d948d93a3a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeRole.java @@ -30,18 +30,27 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.NodeRole + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum NodeRole implements JsonEnum { - @Deprecated - Master("master"), + Client("client"), ClusterManager("cluster_manager"), + CoordinatingOnly("coordinating_only"), + Data("data"), DataCold("data_cold"), @@ -54,21 +63,18 @@ public enum NodeRole implements JsonEnum { DataWarm("data_warm"), - Client("client"), - Ingest("ingest"), - Ml("ml"), - - VotingOnly("voting_only"), + @Deprecated + Master("master"), - Transform("transform"), + Ml("ml"), RemoteClusterClient("remote_cluster_client"), - CoordinatingOnly("coordinating_only"), + Transform("transform"), - ; + VotingOnly("voting_only"); private final String jsonValue; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index 098d4aa483..8f785bbccd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -238,6 +238,7 @@ public NodeStatistics build() { return new NodeStatistics(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 1a168dc946..bcba2bafb9 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -328,6 +328,7 @@ public OpenSearchVersionInfo build() { return new OpenSearchVersionInfo(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java similarity index 91% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java index 0b4984e238..034115ce2b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/Retries.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,7 +52,9 @@ // typedef: _types.Retries @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class Retries implements PlainJsonSerializable { + private final long bulk; private final long search; @@ -55,13 +62,11 @@ public class Retries implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private Retries(Builder builder) { - this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); - } - public static Retries of(Function> fn) { + public static Retries of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -82,6 +87,7 @@ public final long search() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,13 +95,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("bulk"); generator.write(this.bulk); generator.writeKey("search"); generator.write(this.search); - } // --------------------------------------------------------------------------------------------- @@ -103,10 +107,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link Retries}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Long bulk; - private Long search; /** @@ -128,8 +130,7 @@ public final Builder search(long value) { /** * Builds a {@link Retries}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public Retries build() { _checkSingleUse(); @@ -149,10 +150,7 @@ public Retries build() { ); protected static void setupRetriesDeserializer(ObjectDeserializer op) { - op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index 76397fa257..2d45c839e0 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -227,6 +227,7 @@ public ShardFailure build() { return new ShardFailure(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 04e9e5f14a..4c479c16e1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -245,6 +245,7 @@ public ShardStatistics build() { return new ShardStatistics(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java new file mode 100644 index 0000000000..ad679c5cbd --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/TaskFailure.java @@ -0,0 +1,209 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch._types; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: _types.TaskFailure + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TaskFailure implements PlainJsonSerializable { + + private final String nodeId; + + private final ErrorCause reason; + + private final String status; + + private final int taskId; + + // --------------------------------------------------------------------------------------------- + + private TaskFailure(Builder builder) { + this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); + this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + } + + public static TaskFailure of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code node_id} + */ + public final String nodeId() { + return this.nodeId; + } + + /** + * Required - API name: {@code reason} + */ + public final ErrorCause reason() { + return this.reason; + } + + /** + * Required - API name: {@code status} + */ + public final String status() { + return this.status; + } + + /** + * Required - API name: {@code task_id} + */ + public final int taskId() { + return this.taskId; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("node_id"); + generator.write(this.nodeId); + + generator.writeKey("reason"); + this.reason.serialize(generator, mapper); + + generator.writeKey("status"); + generator.write(this.status); + + generator.writeKey("task_id"); + generator.write(this.taskId); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TaskFailure}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String nodeId; + private ErrorCause reason; + private String status; + private Integer taskId; + + /** + * Required - API name: {@code node_id} + */ + public final Builder nodeId(String value) { + this.nodeId = value; + return this; + } + + /** + * Required - API name: {@code reason} + */ + public final Builder reason(ErrorCause value) { + this.reason = value; + return this; + } + + /** + * Required - API name: {@code reason} + */ + public final Builder reason(Function> fn) { + return reason(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code task_id} + */ + public final Builder taskId(int value) { + this.taskId = value; + return this; + } + + /** + * Builds a {@link TaskFailure}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public TaskFailure build() { + _checkSingleUse(); + + return new TaskFailure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TaskFailure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + TaskFailure::setupTaskFailureDeserializer + ); + + protected static void setupTaskFailureDeserializer(ObjectDeserializer op) { + op.add(Builder::nodeId, JsonpDeserializer.stringDeserializer(), "node_id"); + op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason"); + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::taskId, JsonpDeserializer.integerDeserializer(), "task_id"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index 83a031739d..10fc56bb6b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -264,6 +264,7 @@ public final BuilderT version(long value) { protected abstract BuilderT self(); } + // --------------------------------------------------------------------------------------------- protected static > void setupWriteResponseBaseDeserializer(ObjectDeserializer op) { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index f3c81d7cc6..8f48dfd984 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -212,6 +212,7 @@ public InfoResponse build() { return new InfoResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java index 72f04f6cb1..16feb43b56 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java @@ -87,6 +87,7 @@ public DeleteDanglingIndexResponse build() { return new DeleteDanglingIndexResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java index 90b180798e..eaef581983 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java @@ -87,6 +87,7 @@ public ImportDanglingIndexResponse build() { return new ImportDanglingIndexResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 989611ecb7..54acd845ff 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -214,6 +214,7 @@ public ListDanglingIndicesResponse build() { return new ListDanglingIndicesResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java index dc7158198f..baa2fe8c98 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java @@ -42,9 +42,7 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -74,13 +72,7 @@ public OpenSearchDanglingIndicesAsyncClient withTransportOptions(@Nullable Trans */ public CompletableFuture deleteDanglingIndex(DeleteDanglingIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteDanglingIndexRequest, - DeleteDanglingIndexResponse, - ErrorResponse>) DeleteDanglingIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteDanglingIndexRequest._ENDPOINT, this.transportOptions); } /** @@ -101,13 +93,7 @@ public final CompletableFuture deleteDanglingIndex( */ public CompletableFuture importDanglingIndex(ImportDanglingIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ImportDanglingIndexRequest, - ImportDanglingIndexResponse, - ErrorResponse>) ImportDanglingIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, ImportDanglingIndexRequest._ENDPOINT, this.transportOptions); } /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java index c4ebd9da0e..da55534bb5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java @@ -41,9 +41,7 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -72,13 +70,7 @@ public OpenSearchDanglingIndicesClient withTransportOptions(@Nullable TransportO * Deletes the specified dangling index. */ public DeleteDanglingIndexResponse deleteDanglingIndex(DeleteDanglingIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteDanglingIndexRequest, - DeleteDanglingIndexResponse, - ErrorResponse>) DeleteDanglingIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteDanglingIndexRequest._ENDPOINT, this.transportOptions); } /** @@ -98,13 +90,7 @@ public final DeleteDanglingIndexResponse deleteDanglingIndex( * Imports the specified dangling index. */ public ImportDanglingIndexResponse importDanglingIndex(ImportDanglingIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ImportDanglingIndexRequest, - ImportDanglingIndexResponse, - ErrorResponse>) ImportDanglingIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, ImportDanglingIndexRequest._ENDPOINT, this.transportOptions); } /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index 914101a624..c18d275f82 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -231,6 +231,7 @@ public DanglingIndex build() { return new DanglingIndex(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java index d46916f638..742257bf99 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java @@ -59,6 +59,7 @@ public DeleteModelGroupResponse build() { return new DeleteModelGroupResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java index dcf77c93aa..1395e93e08 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java @@ -59,6 +59,7 @@ public DeleteModelResponse build() { return new DeleteModelResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java index f6d5e8c95d..93e33ffd2c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java @@ -59,6 +59,7 @@ public DeleteTaskResponse build() { return new DeleteTaskResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index 6ba333cde4..23b01f8025 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -142,6 +142,7 @@ public DeployModelResponse build() { return new DeployModelResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java index 4a8321c607..9ca56a1e29 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelGroupResponse.java @@ -237,6 +237,7 @@ public GetModelGroupResponse build() { return new GetModelGroupResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java index 610b2c1cb4..6e0f7522e2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskResponse.java @@ -365,6 +365,7 @@ public GetTaskResponse build() { return new GetTaskResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java index 8f2ab231ba..e4199fca36 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java @@ -18,9 +18,7 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -49,13 +47,7 @@ public OpenSearchMlAsyncClient withTransportOptions(@Nullable TransportOptions t * Deletes a model. */ public CompletableFuture deleteModel(DeleteModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteModelRequest, - DeleteModelResponse, - ErrorResponse>) DeleteModelRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteModelRequest._ENDPOINT, this.transportOptions); } /** @@ -76,13 +68,7 @@ public final CompletableFuture deleteModel( */ public CompletableFuture deleteModelGroup(DeleteModelGroupRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteModelGroupRequest, - DeleteModelGroupResponse, - ErrorResponse>) DeleteModelGroupRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -102,13 +88,7 @@ public final CompletableFuture deleteModelGroup( * Deletes a task. */ public CompletableFuture deleteTask(DeleteTaskRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteTaskRequest, - DeleteTaskResponse, - ErrorResponse>) DeleteTaskRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteTaskRequest._ENDPOINT, this.transportOptions); } /** @@ -127,13 +107,7 @@ public final CompletableFuture deleteTask(Function deployModel(DeployModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeployModelRequest, - DeployModelResponse, - ErrorResponse>) DeployModelRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeployModelRequest._ENDPOINT, this.transportOptions); } /** @@ -153,13 +127,7 @@ public final CompletableFuture deployModel( * Retrieves a model group. */ public CompletableFuture getModelGroup(GetModelGroupRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetModelGroupRequest, - GetModelGroupResponse, - ErrorResponse>) GetModelGroupRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -179,13 +147,7 @@ public final CompletableFuture getModelGroup( * Retrieves a task. */ public CompletableFuture getTask(GetTaskRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetTaskRequest, - GetTaskResponse, - ErrorResponse>) GetTaskRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetTaskRequest._ENDPOINT, this.transportOptions); } /** @@ -204,13 +166,7 @@ public final CompletableFuture getTask(Function registerModel(RegisterModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RegisterModelRequest, - RegisterModelResponse, - ErrorResponse>) RegisterModelRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, RegisterModelRequest._ENDPOINT, this.transportOptions); } /** @@ -231,13 +187,7 @@ public final CompletableFuture registerModel( */ public CompletableFuture registerModelGroup(RegisterModelGroupRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RegisterModelGroupRequest, - RegisterModelGroupResponse, - ErrorResponse>) RegisterModelGroupRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, RegisterModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -257,13 +207,7 @@ public final CompletableFuture registerModelGroup( * Undeploys a model. */ public CompletableFuture undeployModel(UndeployModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - UndeployModelRequest, - UndeployModelResponse, - ErrorResponse>) UndeployModelRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, UndeployModelRequest._ENDPOINT, this.transportOptions); } /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java index d3aba915be..7e6fa317c2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java @@ -17,9 +17,7 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -48,13 +46,7 @@ public OpenSearchMlClient withTransportOptions(@Nullable TransportOptions transp * Deletes a model. */ public DeleteModelResponse deleteModel(DeleteModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteModelRequest, - DeleteModelResponse, - ErrorResponse>) DeleteModelRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteModelRequest._ENDPOINT, this.transportOptions); } /** @@ -73,13 +65,7 @@ public final DeleteModelResponse deleteModel(Function endpoint = (JsonEndpoint< - DeleteModelGroupRequest, - DeleteModelGroupResponse, - ErrorResponse>) DeleteModelGroupRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -99,13 +85,7 @@ public final DeleteModelGroupResponse deleteModelGroup( * Deletes a task. */ public DeleteTaskResponse deleteTask(DeleteTaskRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteTaskRequest, - DeleteTaskResponse, - ErrorResponse>) DeleteTaskRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteTaskRequest._ENDPOINT, this.transportOptions); } /** @@ -124,13 +104,7 @@ public final DeleteTaskResponse deleteTask(Function endpoint = (JsonEndpoint< - DeployModelRequest, - DeployModelResponse, - ErrorResponse>) DeployModelRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeployModelRequest._ENDPOINT, this.transportOptions); } /** @@ -149,13 +123,7 @@ public final DeployModelResponse deployModel(Function endpoint = (JsonEndpoint< - GetModelGroupRequest, - GetModelGroupResponse, - ErrorResponse>) GetModelGroupRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -174,13 +142,7 @@ public final GetModelGroupResponse getModelGroup(Function endpoint = (JsonEndpoint< - GetTaskRequest, - GetTaskResponse, - ErrorResponse>) GetTaskRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetTaskRequest._ENDPOINT, this.transportOptions); } /** @@ -199,13 +161,7 @@ public final GetTaskResponse getTask(Function endpoint = (JsonEndpoint< - RegisterModelRequest, - RegisterModelResponse, - ErrorResponse>) RegisterModelRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, RegisterModelRequest._ENDPOINT, this.transportOptions); } /** @@ -224,13 +180,7 @@ public final RegisterModelResponse registerModel(Function endpoint = (JsonEndpoint< - RegisterModelGroupRequest, - RegisterModelGroupResponse, - ErrorResponse>) RegisterModelGroupRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, RegisterModelGroupRequest._ENDPOINT, this.transportOptions); } /** @@ -250,13 +200,7 @@ public final RegisterModelGroupResponse registerModelGroup( * Undeploys a model. */ public UndeployModelResponse undeployModel(UndeployModelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - UndeployModelRequest, - UndeployModelResponse, - ErrorResponse>) UndeployModelRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, UndeployModelRequest._ENDPOINT, this.transportOptions); } /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java index ca633f61e5..2cf102fca7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java @@ -259,6 +259,7 @@ public RegisterModelGroupRequest build() { return new RegisterModelGroupRequest(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index 6a04cf66ad..240993a8c8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -128,6 +128,7 @@ public RegisterModelGroupResponse build() { return new RegisterModelGroupResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java index c94be40813..98fb7909fd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -227,6 +227,7 @@ public RegisterModelRequest build() { return new RegisterModelRequest(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java index 3b42ed8903..af781c3769 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -114,6 +114,7 @@ public RegisterModelResponse build() { return new RegisterModelResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java index 6ba10b82ca..18b66b4dc3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -119,6 +119,7 @@ public UndeployModelNode build() { return new UndeployModelNode(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index f7cdfea593..83128a460a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -121,6 +121,7 @@ public UndeployModelResponse build() { return new UndeployModelResponse(this); } } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java similarity index 76% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java index 7f23b42031..44b99ef7a0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java @@ -30,13 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -50,10 +54,10 @@ /** * Cancels a task, if it can be cancelled through an API. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CancelRequest extends RequestBase { + private final List actions; private final List nodes; @@ -70,45 +74,42 @@ public class CancelRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private CancelRequest(Builder builder) { - this.actions = ApiTypeHelper.unmodifiable(builder.actions); this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); this.parentTaskId = builder.parentTaskId; this.taskId = builder.taskId; this.waitForCompletion = builder.waitForCompletion; - } - public static CancelRequest of(Function> fn) { + public static CancelRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

*/ public final List actions() { return this.actions; } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} + *

*/ public final List nodes() { return this.nodes; } /** - * Cancel tasks with specified parent task id (node_id:task_number). Set to -1 - * to cancel all. + * Parent task ID used to limit the tasks. *

* API name: {@code parent_task_id} + *

*/ @Nullable public final String parentTaskId() { @@ -116,9 +117,10 @@ public final String parentTaskId() { } /** - * Cancel the task with specified task id (node_id:task_number) + * ID of the task. *

* API name: {@code task_id} + *

*/ @Nullable public final String taskId() { @@ -126,10 +128,10 @@ public final String taskId() { } /** - * Should the request block until the cancellation of the task and its - * descendant tasks is completed. Defaults to false + * Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false *

* API name: {@code wait_for_completion} + *

*/ @Nullable public final Boolean waitForCompletion() { @@ -141,30 +143,27 @@ public final Boolean waitForCompletion() { /** * Builder for {@link CancelRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List actions; - @Nullable private List nodes; - @Nullable private String parentTaskId; - @Nullable private String taskId; - @Nullable private Boolean waitForCompletion; /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

+ * *

* Adds all elements of list to actions. + *

*/ public final Builder actions(List list) { this.actions = _listAddAll(this.actions, list); @@ -172,12 +171,14 @@ public final Builder actions(List list) { } /** - * A comma-separated list of actions that should be cancelled. Leave empty to - * cancel all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

+ * *

* Adds one or more values to actions. + *

*/ public final Builder actions(String value, String... values) { this.actions = _listAdd(this.actions, value, values); @@ -185,13 +186,14 @@ public final Builder actions(String value, String... values) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} + *

+ * *

* Adds all elements of list to nodes. + *

*/ public final Builder nodes(List list) { this.nodes = _listAddAll(this.nodes, list); @@ -199,13 +201,14 @@ public final Builder nodes(List list) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names used to limit the request. *

* API name: {@code nodes} + *

+ * *

* Adds one or more values to nodes. + *

*/ public final Builder nodes(String value, String... values) { this.nodes = _listAdd(this.nodes, value, values); @@ -213,10 +216,10 @@ public final Builder nodes(String value, String... values) { } /** - * Cancel tasks with specified parent task id (node_id:task_number). Set to -1 - * to cancel all. + * Parent task ID used to limit the tasks. *

* API name: {@code parent_task_id} + *

*/ public final Builder parentTaskId(@Nullable String value) { this.parentTaskId = value; @@ -224,9 +227,10 @@ public final Builder parentTaskId(@Nullable String value) { } /** - * Cancel the task with specified task id (node_id:task_number) + * ID of the task. *

* API name: {@code task_id} + *

*/ public final Builder taskId(@Nullable String value) { this.taskId = value; @@ -234,10 +238,10 @@ public final Builder taskId(@Nullable String value) { } /** - * Should the request block until the cancellation of the task and its - * descendant tasks is completed. Defaults to false + * Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false *

* API name: {@code wait_for_completion} + *

*/ public final Builder waitForCompletion(@Nullable Boolean value) { this.waitForCompletion = value; @@ -247,8 +251,7 @@ public final Builder waitForCompletion(@Nullable Boolean value) { /** * Builds a {@link CancelRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CancelRequest build() { _checkSingleUse(); @@ -263,13 +266,8 @@ public CancelRequest build() { * Endpoint "{@code tasks.cancel}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _taskId = 1 << 0; @@ -279,40 +277,34 @@ public CancelRequest build() { if (request.taskId() != null) propsSet |= _taskId; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_tasks"); - buf.append("/_cancel"); - return buf.toString(); + return "/_tasks/_cancel"; } if (propsSet == (_taskId)) { StringBuilder buf = new StringBuilder(); - buf.append("/_tasks"); - buf.append("/"); + buf.append("/_tasks/"); SimpleEndpoint.pathEncode(request.taskId, buf); buf.append("/_cancel"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); + if (ApiTypeHelper.isDefined(request.actions)) { + params.put("actions", String.join(",", request.actions)); + } if (ApiTypeHelper.isDefined(request.nodes)) { - params.put("nodes", request.nodes.stream().map(v -> v).collect(Collectors.joining(","))); + params.put("nodes", String.join(",", request.nodes)); } if (request.parentTaskId != null) { params.put("parent_task_id", request.parentTaskId); } - if (ApiTypeHelper.isDefined(request.actions)) { - params.put("actions", request.actions.stream().map(v -> v).collect(Collectors.joining(","))); - } if (request.waitForCompletion != null) { params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java new file mode 100644 index 0000000000..c8b3e3f539 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java @@ -0,0 +1,99 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: tasks.cancel.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CancelResponse extends TaskListResponseBase { + + // --------------------------------------------------------------------------------------------- + + private CancelResponse(Builder builder) { + super(builder); + } + + public static CancelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CancelResponse}. + */ + public static class Builder extends TaskListResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link CancelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public CancelResponse build() { + _checkSingleUse(); + + return new CancelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CancelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CancelResponse::setupCancelResponseDeserializer + ); + + protected static void setupCancelResponseDeserializer(ObjectDeserializer op) { + TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java index 1dd8575647..7f120b8d9e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -49,10 +54,10 @@ /** * Returns information about a task. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetTasksRequest extends RequestBase { + private final String taskId; @Nullable @@ -64,30 +69,30 @@ public class GetTasksRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private GetTasksRequest(Builder builder) { - this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); this.timeout = builder.timeout; this.waitForCompletion = builder.waitForCompletion; - } - public static GetTasksRequest of(Function> fn) { + public static GetTasksRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - Return the task with specified id (node_id:task_number) + * Required - ID of the task. *

* API name: {@code task_id} + *

*/ public final String taskId() { return this.taskId; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -95,9 +100,10 @@ public final Time timeout() { } /** - * Wait for the matching tasks to complete (default: false) + * If `true`, the request blocks until the task has completed. *

* API name: {@code wait_for_completion} + *

*/ @Nullable public final Boolean waitForCompletion() { @@ -109,20 +115,18 @@ public final Boolean waitForCompletion() { /** * Builder for {@link GetTasksRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String taskId; - @Nullable private Time timeout; - @Nullable private Boolean waitForCompletion; /** - * Required - Return the task with specified id (node_id:task_number) + * Required - ID of the task. *

* API name: {@code task_id} + *

*/ public final Builder taskId(String value) { this.taskId = value; @@ -130,9 +134,10 @@ public final Builder taskId(String value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -140,18 +145,20 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Wait for the matching tasks to complete (default: false) + * If `true`, the request blocks until the task has completed. *

* API name: {@code wait_for_completion} + *

*/ public final Builder waitForCompletion(@Nullable Boolean value) { this.waitForCompletion = value; @@ -161,8 +168,7 @@ public final Builder waitForCompletion(@Nullable Boolean value) { /** * Builds a {@link GetTasksRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetTasksRequest build() { _checkSingleUse(); @@ -177,43 +183,25 @@ public GetTasksRequest build() { * Endpoint "{@code tasks.get}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { - final int _taskId = 1 << 0; - - int propsSet = 0; - - propsSet |= _taskId; - - if (propsSet == (_taskId)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_tasks"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.taskId, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_tasks/"); + SimpleEndpoint.pathEncode(request.taskId, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.waitForCompletion != null) { - params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); - } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 00b4878d81..929d2ebbf0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -49,29 +54,29 @@ // typedef: tasks.get.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetTasksResponse implements PlainJsonSerializable { - private final boolean completed; - private final Info task; + private final boolean completed; @Nullable - private final Status response; + private final ErrorCause error; @Nullable - private final ErrorCause error; + private final TaskResponse response; + + private final TaskInfo task; // --------------------------------------------------------------------------------------------- private GetTasksResponse(Builder builder) { - this.completed = ApiTypeHelper.requireNonNull(builder.completed, this, "completed"); - this.task = ApiTypeHelper.requireNonNull(builder.task, this, "task"); - this.response = builder.response; this.error = builder.error; - + this.response = builder.response; + this.task = ApiTypeHelper.requireNonNull(builder.task, this, "task"); } - public static GetTasksResponse of(Function> fn) { + public static GetTasksResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -83,31 +88,32 @@ public final boolean completed() { } /** - * Required - API name: {@code task} + * API name: {@code error} */ - public final Info task() { - return this.task; + @Nullable + public final ErrorCause error() { + return this.error; } /** * API name: {@code response} */ @Nullable - public final Status response() { + public final TaskResponse response() { return this.response; } /** - * API name: {@code error} + * Required - API name: {@code task} */ - @Nullable - public final ErrorCause error() { - return this.error; + public final TaskInfo task() { + return this.task; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -115,24 +121,21 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("completed"); generator.write(this.completed); - generator.writeKey("task"); - this.task.serialize(generator, mapper); - - if (this.response != null) { - generator.writeKey("response"); - this.response.serialize(generator, mapper); - - } if (this.error != null) { generator.writeKey("error"); this.error.serialize(generator, mapper); + } + if (this.response != null) { + generator.writeKey("response"); + this.response.serialize(generator, mapper); } + generator.writeKey("task"); + this.task.serialize(generator, mapper); } // --------------------------------------------------------------------------------------------- @@ -140,17 +143,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link GetTasksResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Boolean completed; - - private Info task; - - @Nullable - private Status response; - @Nullable private ErrorCause error; + @Nullable + private TaskResponse response; + private TaskInfo task; /** * Required - API name: {@code completed} @@ -161,24 +160,24 @@ public final Builder completed(boolean value) { } /** - * Required - API name: {@code task} + * API name: {@code error} */ - public final Builder task(Info value) { - this.task = value; + public final Builder error(@Nullable ErrorCause value) { + this.error = value; return this; } /** - * Required - API name: {@code task} + * API name: {@code error} */ - public final Builder task(Function> fn) { - return this.task(fn.apply(new Info.Builder()).build()); + public final Builder error(Function> fn) { + return error(fn.apply(new ErrorCause.Builder()).build()); } /** * API name: {@code response} */ - public final Builder response(@Nullable Status value) { + public final Builder response(@Nullable TaskResponse value) { this.response = value; return this; } @@ -186,30 +185,29 @@ public final Builder response(@Nullable Status value) { /** * API name: {@code response} */ - public final Builder response(Function> fn) { - return this.response(fn.apply(new Status.Builder()).build()); + public final Builder response(Function> fn) { + return response(fn.apply(new TaskResponse.Builder()).build()); } /** - * API name: {@code error} + * Required - API name: {@code task} */ - public final Builder error(@Nullable ErrorCause value) { - this.error = value; + public final Builder task(TaskInfo value) { + this.task = value; return this; } /** - * API name: {@code error} + * Required - API name: {@code task} */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); + public final Builder task(Function> fn) { + return task(fn.apply(new TaskInfo.Builder()).build()); } /** * Builds a {@link GetTasksResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetTasksResponse build() { _checkSingleUse(); @@ -229,12 +227,9 @@ public GetTasksResponse build() { ); protected static void setupGetTasksResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::completed, JsonpDeserializer.booleanDeserializer(), "completed"); - op.add(Builder::task, Info._DESERIALIZER, "task"); - op.add(Builder::response, Status._DESERIALIZER, "response"); op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); - + op.add(Builder::response, TaskResponse._DESERIALIZER, "response"); + op.add(Builder::task, TaskInfo._DESERIALIZER, "task"); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GroupBy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GroupBy.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/GroupBy.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GroupBy.java index 97e40d2b95..a592c3274a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/GroupBy.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GroupBy.java @@ -30,20 +30,26 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: tasks.GroupBy + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum GroupBy implements JsonEnum { Nodes("nodes"), - Parents("parents"), - None("none"), - ; + Parents("parents"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java similarity index 74% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java index 19a18cebd9..94b1650945 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListRequest.java @@ -30,13 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -51,10 +55,10 @@ /** * Returns a list of tasks. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ListRequest extends RequestBase { + private final List actions; @Nullable @@ -77,7 +81,6 @@ public class ListRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private ListRequest(Builder builder) { - this.actions = ApiTypeHelper.unmodifiable(builder.actions); this.detailed = builder.detailed; this.groupBy = builder.groupBy; @@ -85,27 +88,27 @@ private ListRequest(Builder builder) { this.parentTaskId = builder.parentTaskId; this.timeout = builder.timeout; this.waitForCompletion = builder.waitForCompletion; - } - public static ListRequest of(Function> fn) { + public static ListRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * A comma-separated list of actions that should be returned. Leave empty to - * return all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

*/ public final List actions() { return this.actions; } /** - * Return detailed task information (default: false) + * If `true`, the response includes detailed information about shard recoveries. *

* API name: {@code detailed} + *

*/ @Nullable public final Boolean detailed() { @@ -113,9 +116,10 @@ public final Boolean detailed() { } /** - * Group tasks by nodes or parent/child relationships + * Key used to group tasks in the response. *

* API name: {@code group_by} + *

*/ @Nullable public final GroupBy groupBy() { @@ -123,21 +127,21 @@ public final GroupBy groupBy() { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're + * connecting to, leave empty to get information from all nodes. *

* API name: {@code nodes} + *

*/ public final List nodes() { return this.nodes; } /** - * Return tasks with specified parent task id (node_id:task_number). Set to -1 - * to return all. + * Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. *

* API name: {@code parent_task_id} + *

*/ @Nullable public final String parentTaskId() { @@ -145,9 +149,10 @@ public final String parentTaskId() { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -155,9 +160,10 @@ public final Time timeout() { } /** - * Wait for the matching tasks to complete (default: false) + * If `true`, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} + *

*/ @Nullable public final Boolean waitForCompletion() { @@ -169,36 +175,31 @@ public final Boolean waitForCompletion() { /** * Builder for {@link ListRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private List actions; - @Nullable private Boolean detailed; - @Nullable private GroupBy groupBy; - @Nullable private List nodes; - @Nullable private String parentTaskId; - @Nullable private Time timeout; - @Nullable private Boolean waitForCompletion; /** - * A comma-separated list of actions that should be returned. Leave empty to - * return all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

+ * *

* Adds all elements of list to actions. + *

*/ public final Builder actions(List list) { this.actions = _listAddAll(this.actions, list); @@ -206,12 +207,14 @@ public final Builder actions(List list) { } /** - * A comma-separated list of actions that should be returned. Leave empty to - * return all. + * Comma-separated list or wildcard expression of actions used to limit the request. *

* API name: {@code actions} + *

+ * *

* Adds one or more values to actions. + *

*/ public final Builder actions(String value, String... values) { this.actions = _listAdd(this.actions, value, values); @@ -219,9 +222,10 @@ public final Builder actions(String value, String... values) { } /** - * Return detailed task information (default: false) + * If `true`, the response includes detailed information about shard recoveries. *

* API name: {@code detailed} + *

*/ public final Builder detailed(@Nullable Boolean value) { this.detailed = value; @@ -229,9 +233,10 @@ public final Builder detailed(@Nullable Boolean value) { } /** - * Group tasks by nodes or parent/child relationships + * Key used to group tasks in the response. *

* API name: {@code group_by} + *

*/ public final Builder groupBy(@Nullable GroupBy value) { this.groupBy = value; @@ -239,13 +244,15 @@ public final Builder groupBy(@Nullable GroupBy value) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node + * you're connecting to, leave empty to get information from all nodes. *

* API name: {@code nodes} + *

+ * *

* Adds all elements of list to nodes. + *

*/ public final Builder nodes(List list) { this.nodes = _listAddAll(this.nodes, list); @@ -253,13 +260,15 @@ public final Builder nodes(List list) { } /** - * A comma-separated list of node IDs or names to limit the returned - * information; use _local to return information from the node - * you're connecting to, leave empty to get information from all nodes + * Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node + * you're connecting to, leave empty to get information from all nodes. *

* API name: {@code nodes} + *

+ * *

* Adds one or more values to nodes. + *

*/ public final Builder nodes(String value, String... values) { this.nodes = _listAdd(this.nodes, value, values); @@ -267,10 +276,10 @@ public final Builder nodes(String value, String... values) { } /** - * Return tasks with specified parent task id (node_id:task_number). Set to -1 - * to return all. + * Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. *

* API name: {@code parent_task_id} + *

*/ public final Builder parentTaskId(@Nullable String value) { this.parentTaskId = value; @@ -278,9 +287,10 @@ public final Builder parentTaskId(@Nullable String value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -288,18 +298,20 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * Wait for the matching tasks to complete (default: false) + * If `true`, the request blocks until the operation is complete. *

* API name: {@code wait_for_completion} + *

*/ public final Builder waitForCompletion(@Nullable Boolean value) { this.waitForCompletion = value; @@ -309,8 +321,7 @@ public final Builder waitForCompletion(@Nullable Boolean value) { /** * Builds a {@link ListRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ListRequest build() { _checkSingleUse(); @@ -325,27 +336,15 @@ public ListRequest build() { * Endpoint "{@code tasks.list}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path - request -> { - return "/_tasks"; - - }, - + request -> "/_tasks", // Request parameters request -> { Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.nodes)) { - params.put("nodes", request.nodes.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (request.parentTaskId != null) { - params.put("parent_task_id", request.parentTaskId); + if (ApiTypeHelper.isDefined(request.actions)) { + params.put("actions", String.join(",", request.actions)); } if (request.detailed != null) { params.put("detailed", String.valueOf(request.detailed)); @@ -353,17 +352,19 @@ public ListRequest build() { if (request.groupBy != null) { params.put("group_by", request.groupBy.jsonValue()); } - if (ApiTypeHelper.isDefined(request.actions)) { - params.put("actions", request.actions.stream().map(v -> v).collect(Collectors.joining(","))); + if (ApiTypeHelper.isDefined(request.nodes)) { + params.put("nodes", String.join(",", request.nodes)); } - if (request.waitForCompletion != null) { - params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + if (request.parentTaskId != null) { + params.put("parent_task_id", request.parentTaskId); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java new file mode 100644 index 0000000000..906b8da91c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/ListResponse.java @@ -0,0 +1,99 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: tasks.list.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ListResponse extends TaskListResponseBase { + + // --------------------------------------------------------------------------------------------- + + private ListResponse(Builder builder) { + super(builder); + } + + public static ListResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ListResponse}. + */ + public static class Builder extends TaskListResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ListResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public ListResponse build() { + _checkSingleUse(); + + return new ListResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ListResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ListResponse::setupListResponseDeserializer + ); + + protected static void setupListResponseDeserializer(ObjectDeserializer op) { + TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java index a37ffb494f..520cc219e7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksAsyncClient.java @@ -30,16 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -47,8 +50,8 @@ /** * Client for the tasks namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchTasksAsyncClient extends ApiClient { - public OpenSearchTasksAsyncClient(OpenSearchTransport transport) { super(transport, null); } @@ -66,29 +69,16 @@ public OpenSearchTasksAsyncClient withTransportOptions(@Nullable TransportOption /** * Cancels a task, if it can be cancelled through an API. - * - * */ - public CompletableFuture cancel(CancelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CancelRequest, - CancelResponse, - ErrorResponse>) CancelRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, CancelRequest._ENDPOINT, this.transportOptions); } /** * Cancels a task, if it can be cancelled through an API. * - * @param fn - * a function that initializes a builder to create the - * {@link CancelRequest} - * + * @param fn a function that initializes a builder to create the {@link CancelRequest} */ - public final CompletableFuture cancel(Function> fn) throws IOException, OpenSearchException { return cancel(fn.apply(new CancelRequest.Builder()).build()); @@ -96,41 +86,25 @@ public final CompletableFuture cancel(Function cancel() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new CancelRequest.Builder().build(), CancelRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture cancel() throws IOException, OpenSearchException { + return cancel(new CancelRequest.Builder().build()); } // ----- Endpoint: tasks.get /** * Returns information about a task. - * - * */ - public CompletableFuture get(GetTasksRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetTasksRequest, - GetTasksResponse, - ErrorResponse>) GetTasksRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetTasksRequest._ENDPOINT, this.transportOptions); } /** * Returns information about a task. * - * @param fn - * a function that initializes a builder to create the - * {@link GetTasksRequest} - * + * @param fn a function that initializes a builder to create the {@link GetTasksRequest} */ - public final CompletableFuture get(Function> fn) throws IOException, OpenSearchException { return get(fn.apply(new GetTasksRequest.Builder()).build()); @@ -140,29 +114,16 @@ public final CompletableFuture get(Function list(ListRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ListRequest, - ListResponse, - ErrorResponse>) ListRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, ListRequest._ENDPOINT, this.transportOptions); } /** * Returns a list of tasks. * - * @param fn - * a function that initializes a builder to create the - * {@link ListRequest} - * + * @param fn a function that initializes a builder to create the {@link ListRequest} */ - public final CompletableFuture list(Function> fn) throws IOException, OpenSearchException { return list(fn.apply(new ListRequest.Builder()).build()); @@ -170,12 +131,8 @@ public final CompletableFuture list(Function list() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new ListRequest.Builder().build(), ListRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture list() throws IOException, OpenSearchException { + return list(new ListRequest.Builder().build()); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java index 163c83465b..3ee39153a4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/OpenSearchTasksClient.java @@ -30,15 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import java.io.IOException; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.util.ObjectBuilder; @@ -46,8 +49,8 @@ /** * Client for the tasks namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchTasksClient extends ApiClient { - public OpenSearchTasksClient(OpenSearchTransport transport) { super(transport, null); } @@ -65,29 +68,16 @@ public OpenSearchTasksClient withTransportOptions(@Nullable TransportOptions tra /** * Cancels a task, if it can be cancelled through an API. - * - * */ - public CancelResponse cancel(CancelRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CancelRequest, - CancelResponse, - ErrorResponse>) CancelRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, CancelRequest._ENDPOINT, this.transportOptions); } /** * Cancels a task, if it can be cancelled through an API. * - * @param fn - * a function that initializes a builder to create the - * {@link CancelRequest} - * + * @param fn a function that initializes a builder to create the {@link CancelRequest} */ - public final CancelResponse cancel(Function> fn) throws IOException, OpenSearchException { return cancel(fn.apply(new CancelRequest.Builder()).build()); @@ -95,41 +85,25 @@ public final CancelResponse cancel(Function endpoint = (JsonEndpoint< - GetTasksRequest, - GetTasksResponse, - ErrorResponse>) GetTasksRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetTasksRequest._ENDPOINT, this.transportOptions); } /** * Returns information about a task. * - * @param fn - * a function that initializes a builder to create the - * {@link GetTasksRequest} - * + * @param fn a function that initializes a builder to create the {@link GetTasksRequest} */ - public final GetTasksResponse get(Function> fn) throws IOException, OpenSearchException { return get(fn.apply(new GetTasksRequest.Builder()).build()); @@ -139,41 +113,24 @@ public final GetTasksResponse get(Function endpoint = (JsonEndpoint< - ListRequest, - ListResponse, - ErrorResponse>) ListRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, ListRequest._ENDPOINT, this.transportOptions); } /** * Returns a list of tasks. * - * @param fn - * a function that initializes a builder to create the - * {@link ListRequest} - * + * @param fn a function that initializes a builder to create the {@link ListRequest} */ - public final ListResponse list(Function> fn) throws IOException, OpenSearchException { return list(fn.apply(new ListRequest.Builder()).build()); } /** * Returns a list of tasks. - * - * */ - - public ListResponse list() throws IOException, OpenSearchException { - return this.transport.performRequest(new ListRequest.Builder().build(), ListRequest._ENDPOINT, this.transportOptions); + public final ListResponse list() throws IOException, OpenSearchException { + return list(new ListRequest.Builder().build()); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java new file mode 100644 index 0000000000..743796d107 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -0,0 +1,770 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.BulkByScrollTaskStatusOrException; +import org.opensearch.client.opensearch._types.Retries; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: tasks.Status + +/** + * Task status information can vary wildly from task to task. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Status implements PlainJsonSerializable { + + @Nullable + private final Integer batches; + + @Nullable + private final String canceled; + + @Nullable + private final Long created; + + @Nullable + private final Long deleted; + + @Nullable + private final Long noops; + + @Nullable + private final String phase; + + @Nullable + private final Float requestsPerSecond; + + @Nullable + private final Retries retries; + + @Nullable + private final Integer sliceId; + + private final List slices; + + @Nullable + private final String state; + + @Nullable + private final Time throttled; + + @Nullable + private final Long throttledMillis; + + @Nullable + private final Time throttledUntil; + + @Nullable + private final Long throttledUntilMillis; + + @Nullable + private final Long total; + + @Nullable + private final Long updated; + + @Nullable + private final Long versionConflicts; + + private final Map metadata; + + // --------------------------------------------------------------------------------------------- + + private Status(Builder builder) { + this.batches = builder.batches; + this.canceled = builder.canceled; + this.created = builder.created; + this.deleted = builder.deleted; + this.noops = builder.noops; + this.phase = builder.phase; + this.requestsPerSecond = builder.requestsPerSecond; + this.retries = builder.retries; + this.sliceId = builder.sliceId; + this.slices = ApiTypeHelper.unmodifiable(builder.slices); + this.state = builder.state; + this.throttled = builder.throttled; + this.throttledMillis = builder.throttledMillis; + this.throttledUntil = builder.throttledUntil; + this.throttledUntilMillis = builder.throttledUntilMillis; + this.total = builder.total; + this.updated = builder.updated; + this.versionConflicts = builder.versionConflicts; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + } + + public static Status of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The number of scroll responses pulled back by the reindex. + *

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

+ */ + @Nullable + public final Integer batches() { + return this.batches; + } + + /** + * API name: {@code canceled} + */ + @Nullable + public final String canceled() { + return this.canceled; + } + + /** + * The number of documents that were successfully created. + *

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

+ */ + @Nullable + public final Long created() { + return this.created; + } + + /** + * The number of documents that were successfully deleted. + *

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

+ */ + @Nullable + public final Long deleted() { + return this.deleted; + } + + /** + * The number of documents that were ignored. + *

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

+ */ + @Nullable + public final Long noops() { + return this.noops; + } + + /** + * API name: {@code phase} + */ + @Nullable + public final String phase() { + return this.phase; + } + + /** + * The number of requests per second effectively executed during the reindex. + *

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

+ */ + @Nullable + public final Float requestsPerSecond() { + return this.requestsPerSecond; + } + + /** + * API name: {@code retries} + */ + @Nullable + public final Retries retries() { + return this.retries; + } + + /** + * API name: {@code slice_id} + */ + @Nullable + public final Integer sliceId() { + return this.sliceId; + } + + /** + * API name: {@code slices} + */ + public final List slices() { + return this.slices; + } + + /** + * API name: {@code state} + */ + @Nullable + public final String state() { + return this.state; + } + + /** + * API name: {@code throttled} + */ + @Nullable + public final Time throttled() { + return this.throttled; + } + + /** + * API name: {@code throttled_millis} + */ + @Nullable + public final Long throttledMillis() { + return this.throttledMillis; + } + + /** + * API name: {@code throttled_until} + */ + @Nullable + public final Time throttledUntil() { + return this.throttledUntil; + } + + /** + * API name: {@code throttled_until_millis} + */ + @Nullable + public final Long throttledUntilMillis() { + return this.throttledUntilMillis; + } + + /** + * The number of documents that were successfully processed. + *

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

+ */ + @Nullable + public final Long total() { + return this.total; + } + + /** + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

+ */ + @Nullable + public final Long updated() { + return this.updated; + } + + /** + * The number of version conflicts that reindex hits. + *

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

+ */ + @Nullable + public final Long versionConflicts() { + return this.versionConflicts; + } + + /** + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + if (this.batches != null) { + generator.writeKey("batches"); + generator.write(this.batches); + } + + if (this.canceled != null) { + generator.writeKey("canceled"); + generator.write(this.canceled); + } + + if (this.created != null) { + generator.writeKey("created"); + generator.write(this.created); + } + + if (this.deleted != null) { + generator.writeKey("deleted"); + generator.write(this.deleted); + } + + if (this.noops != null) { + generator.writeKey("noops"); + generator.write(this.noops); + } + + if (this.phase != null) { + generator.writeKey("phase"); + generator.write(this.phase); + } + + if (this.requestsPerSecond != null) { + generator.writeKey("requests_per_second"); + generator.write(this.requestsPerSecond); + } + + if (this.retries != null) { + generator.writeKey("retries"); + this.retries.serialize(generator, mapper); + } + + if (this.sliceId != null) { + generator.writeKey("slice_id"); + generator.write(this.sliceId); + } + + if (ApiTypeHelper.isDefined(this.slices)) { + generator.writeKey("slices"); + generator.writeStartArray(); + for (BulkByScrollTaskStatusOrException item0 : this.slices) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.state != null) { + generator.writeKey("state"); + generator.write(this.state); + } + + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); + } + + if (this.throttledMillis != null) { + generator.writeKey("throttled_millis"); + generator.write(this.throttledMillis); + } + + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); + } + + if (this.throttledUntilMillis != null) { + generator.writeKey("throttled_until_millis"); + generator.write(this.throttledUntilMillis); + } + + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + + if (this.updated != null) { + generator.writeKey("updated"); + generator.write(this.updated); + } + + if (this.versionConflicts != null) { + generator.writeKey("version_conflicts"); + generator.write(this.versionConflicts); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Status}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer batches; + @Nullable + private String canceled; + @Nullable + private Long created; + @Nullable + private Long deleted; + @Nullable + private Long noops; + @Nullable + private String phase; + @Nullable + private Float requestsPerSecond; + @Nullable + private Retries retries; + @Nullable + private Integer sliceId; + @Nullable + private List slices; + @Nullable + private String state; + @Nullable + private Time throttled; + @Nullable + private Long throttledMillis; + @Nullable + private Time throttledUntil; + @Nullable + private Long throttledUntilMillis; + @Nullable + private Long total; + @Nullable + private Long updated; + @Nullable + private Long versionConflicts; + @Nullable + private Map metadata; + + /** + * The number of scroll responses pulled back by the reindex. + *

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

+ */ + public final Builder batches(@Nullable Integer value) { + this.batches = value; + return this; + } + + /** + * API name: {@code canceled} + */ + public final Builder canceled(@Nullable String value) { + this.canceled = value; + return this; + } + + /** + * The number of documents that were successfully created. + *

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

+ */ + public final Builder created(@Nullable Long value) { + this.created = value; + return this; + } + + /** + * The number of documents that were successfully deleted. + *

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

+ */ + public final Builder deleted(@Nullable Long value) { + this.deleted = value; + return this; + } + + /** + * The number of documents that were ignored. + *

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

+ */ + public final Builder noops(@Nullable Long value) { + this.noops = value; + return this; + } + + /** + * API name: {@code phase} + */ + public final Builder phase(@Nullable String value) { + this.phase = value; + return this; + } + + /** + * The number of requests per second effectively executed during the reindex. + *

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

+ */ + public final Builder requestsPerSecond(@Nullable Float value) { + this.requestsPerSecond = value; + return this; + } + + /** + * API name: {@code retries} + */ + public final Builder retries(@Nullable Retries value) { + this.retries = value; + return this; + } + + /** + * API name: {@code retries} + */ + public final Builder retries(Function> fn) { + return retries(fn.apply(new Retries.Builder()).build()); + } + + /** + * API name: {@code slice_id} + */ + public final Builder sliceId(@Nullable Integer value) { + this.sliceId = value; + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices(List list) { + this.slices = _listAddAll(this.slices, list); + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices(BulkByScrollTaskStatusOrException value, BulkByScrollTaskStatusOrException... values) { + this.slices = _listAdd(this.slices, value, values); + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices( + Function> fn + ) { + return slices(fn.apply(new BulkByScrollTaskStatusOrException.Builder()).build()); + } + + /** + * API name: {@code state} + */ + public final Builder state(@Nullable String value) { + this.state = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return throttled(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code throttled_millis} + */ + public final Builder throttledMillis(@Nullable Long value) { + this.throttledMillis = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return throttledUntil(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code throttled_until_millis} + */ + public final Builder throttledUntilMillis(@Nullable Long value) { + this.throttledUntilMillis = value; + return this; + } + + /** + * The number of documents that were successfully processed. + *

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

+ */ + public final Builder total(@Nullable Long value) { + this.total = value; + return this; + } + + /** + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

+ */ + public final Builder updated(@Nullable Long value) { + this.updated = value; + return this; + } + + /** + * The number of version conflicts that reindex hits. + *

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

+ */ + public final Builder versionConflicts(@Nullable Long value) { + this.versionConflicts = value; + return this; + } + + /** + * + *

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

+ */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * + *

+ * Adds an entry to metadata. + *

+ */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * Builds a {@link Status}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public Status build() { + _checkSingleUse(); + + return new Status(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Status} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Status::setupStatusDeserializer + ); + + protected static void setupStatusDeserializer(ObjectDeserializer op) { + op.add(Builder::batches, JsonpDeserializer.integerDeserializer(), "batches"); + op.add(Builder::canceled, JsonpDeserializer.stringDeserializer(), "canceled"); + op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); + op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); + op.add(Builder::phase, JsonpDeserializer.stringDeserializer(), "phase"); + op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); + op.add(Builder::retries, Retries._DESERIALIZER, "retries"); + op.add(Builder::sliceId, JsonpDeserializer.integerDeserializer(), "slice_id"); + op.add(Builder::slices, JsonpDeserializer.arrayDeserializer(BulkByScrollTaskStatusOrException._DESERIALIZER), "slices"); + op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); + op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); + op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); + op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); + op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); + op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 3decbb9016..3f4c19e178 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -44,47 +49,41 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; -// typedef: tasks._types.TaskExecutingNode +// typedef: tasks.TaskExecutingNode @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class TaskExecutingNode extends BaseNode { - private final Map tasks; + + private final Map tasks; // --------------------------------------------------------------------------------------------- private TaskExecutingNode(Builder builder) { super(builder); - this.tasks = ApiTypeHelper.unmodifiableRequired(builder.tasks, this, "tasks"); - } - public static TaskExecutingNode of(Function> fn) { + public static TaskExecutingNode of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code tasks} */ - public final Map tasks() { + public final Map tasks() { return this.tasks; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.tasks)) { - generator.writeKey("tasks"); - generator.writeStartObject(); - for (Map.Entry item0 : this.tasks.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("tasks"); + generator.writeStartObject(); + for (Map.Entry item0 : this.tasks.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- @@ -92,49 +91,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link TaskExecutingNode}. */ - public static class Builder extends BaseNode.AbstractBuilder implements ObjectBuilder { - private Map tasks; + @Override + protected Builder self() { + return this; + } + + private Map tasks; /** * Required - API name: {@code tasks} + * *

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

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

* Adds an entry to tasks. + *

*/ - public final Builder tasks(String key, State value) { + public final Builder tasks(String key, TaskInfo value) { this.tasks = _mapPut(this.tasks, key, value); return this; } /** * Required - API name: {@code tasks} + * *

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

*/ - public final Builder tasks(String key, Function> fn) { - return tasks(key, fn.apply(new State.Builder()).build()); - } - - @Override - protected Builder self() { - return this; + public final Builder tasks(String key, Function> fn) { + return tasks(key, fn.apply(new TaskInfo.Builder()).build()); } /** * Builds a {@link TaskExecutingNode}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public TaskExecutingNode build() { _checkSingleUse(); @@ -155,8 +158,6 @@ public TaskExecutingNode build() { protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer op) { BaseNode.setupBaseNodeDeserializer(op); - op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(State._DESERIALIZER), "tasks"); - + op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(TaskInfo._DESERIALIZER), "tasks"); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java new file mode 100644 index 0000000000..d1650b85b3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskGroup.java @@ -0,0 +1,165 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: tasks.TaskGroup + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TaskGroup extends TaskInfo { + + private final List children; + + // --------------------------------------------------------------------------------------------- + + private TaskGroup(Builder builder) { + super(builder); + this.children = ApiTypeHelper.unmodifiable(builder.children); + } + + public static TaskGroup of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code children} + */ + public final List children() { + return this.children; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.children)) { + generator.writeKey("children"); + generator.writeStartArray(); + for (TaskGroup item0 : this.children) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TaskGroup}. + */ + public static class Builder extends TaskInfo.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + @Nullable + private List children; + + /** + * API name: {@code children} + * + *

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

+ */ + public final Builder children(List list) { + this.children = _listAddAll(this.children, list); + return this; + } + + /** + * API name: {@code children} + * + *

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

+ */ + public final Builder children(TaskGroup value, TaskGroup... values) { + this.children = _listAdd(this.children, value, values); + return this; + } + + /** + * API name: {@code children} + * + *

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

+ */ + public final Builder children(Function> fn) { + return children(fn.apply(new TaskGroup.Builder()).build()); + } + + /** + * Builds a {@link TaskGroup}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public TaskGroup build() { + _checkSingleUse(); + + return new TaskGroup(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TaskGroup} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + TaskGroup::setupTaskGroupDeserializer + ); + + protected static void setupTaskGroupDeserializer(ObjectDeserializer op) { + TaskInfo.setupTaskInfoDeserializer(op); + op.add(Builder::children, JsonpDeserializer.arrayDeserializer(TaskGroup._DESERIALIZER), "children"); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/Info.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/Info.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java index d2f72fff0d..dca26f3627 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/Info.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfo.java @@ -30,12 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import jakarta.json.stream.JsonGenerator; -import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,29 +47,39 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: tasks._types.Info +// typedef: tasks.TaskInfo @JsonpDeserializable -public class Info implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TaskInfo implements PlainJsonSerializable { + private final String action; private final boolean cancellable; - private final List children; + @Nullable + private final Boolean cancelled; @Nullable private final String description; - private final Map> headers; + private final Map headers; private final long id; private final String node; + @Nullable + private final String parentTaskId; + + @Nullable + private final Time runningTime; + private final long runningTimeInNanos; private final long startTimeInMillis; @@ -75,29 +89,25 @@ public class Info implements PlainJsonSerializable { private final String type; - @Nullable - private final String parentTaskId; - // --------------------------------------------------------------------------------------------- - private Info(Builder builder) { - + protected TaskInfo(AbstractBuilder builder) { this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); this.cancellable = ApiTypeHelper.requireNonNull(builder.cancellable, this, "cancellable"); - this.children = ApiTypeHelper.unmodifiable(builder.children); + this.cancelled = builder.cancelled; this.description = builder.description; this.headers = ApiTypeHelper.unmodifiableRequired(builder.headers, this, "headers"); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); + this.parentTaskId = builder.parentTaskId; + this.runningTime = builder.runningTime; this.runningTimeInNanos = ApiTypeHelper.requireNonNull(builder.runningTimeInNanos, this, "runningTimeInNanos"); this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); this.status = builder.status; this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.parentTaskId = builder.parentTaskId; - } - public static Info of(Function> fn) { + public static TaskInfo taskInfoOf(Function> fn) { return fn.apply(new Builder()).build(); } @@ -116,10 +126,11 @@ public final boolean cancellable() { } /** - * API name: {@code children} + * API name: {@code cancelled} */ - public final List children() { - return this.children; + @Nullable + public final Boolean cancelled() { + return this.cancelled; } /** @@ -133,7 +144,7 @@ public final String description() { /** * Required - API name: {@code headers} */ - public final Map> headers() { + public final Map headers() { return this.headers; } @@ -151,6 +162,22 @@ public final String node() { return this.node; } + /** + * API name: {@code parent_task_id} + */ + @Nullable + public final String parentTaskId() { + return this.parentTaskId; + } + + /** + * API name: {@code running_time} + */ + @Nullable + public final Time runningTime() { + return this.runningTime; + } + /** * Required - API name: {@code running_time_in_nanos} */ @@ -180,17 +207,10 @@ public final String type() { return this.type; } - /** - * API name: {@code parent_task_id} - */ - @Nullable - public final String parentTaskId() { - return this.parentTaskId; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -198,52 +218,46 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("action"); generator.write(this.action); generator.writeKey("cancellable"); generator.write(this.cancellable); - if (ApiTypeHelper.isDefined(this.children)) { - generator.writeKey("children"); - generator.writeStartArray(); - for (Info item0 : this.children) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + if (this.cancelled != null) { + generator.writeKey("cancelled"); + generator.write(this.cancelled); } + if (this.description != null) { generator.writeKey("description"); generator.write(this.description); - } - if (ApiTypeHelper.isDefined(this.headers)) { - generator.writeKey("headers"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.headers.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (String item1 : item0.getValue()) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); + generator.writeKey("headers"); + generator.writeStartObject(); + for (Map.Entry item0 : this.headers.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } + generator.writeEnd(); + generator.writeKey("id"); generator.write(this.id); generator.writeKey("node"); generator.write(this.node); + if (this.parentTaskId != null) { + generator.writeKey("parent_task_id"); + generator.write(this.parentTaskId); + } + + if (this.runningTime != null) { + generator.writeKey("running_time"); + this.runningTime.serialize(generator, mapper); + } + generator.writeKey("running_time_in_nanos"); generator.write(this.runningTimeInNanos); @@ -253,229 +267,215 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.status != null) { generator.writeKey("status"); this.status.serialize(generator, mapper); - } + generator.writeKey("type"); generator.write(this.type); - - if (this.parentTaskId != null) { - generator.writeKey("parent_task_id"); - generator.write(this.parentTaskId); - - } - } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Info}. + * Builder for {@link TaskInfo}. */ + public static class Builder extends TaskInfo.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String action; + /** + * Builds a {@link TaskInfo}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public TaskInfo build() { + _checkSingleUse(); - private Boolean cancellable; + return new TaskInfo(this); + } + } + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + private String action; + private Boolean cancellable; @Nullable - private List children; - + private Boolean cancelled; @Nullable private String description; - - private Map> headers; - + private Map headers; private Long id; - private String node; - + @Nullable + private String parentTaskId; + @Nullable + private Time runningTime; private Long runningTimeInNanos; - private Long startTimeInMillis; - @Nullable private Status status; - private String type; - @Nullable - private String parentTaskId; - /** * Required - API name: {@code action} */ - public final Builder action(String value) { + public final BuilderT action(String value) { this.action = value; - return this; + return self(); } /** * Required - API name: {@code cancellable} */ - public final Builder cancellable(boolean value) { + public final BuilderT cancellable(boolean value) { this.cancellable = value; - return this; + return self(); } /** - * API name: {@code children} - *

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

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

- * Adds a value to children using a builder lambda. + * API name: {@code cancelled} */ - public final Builder children(Function> fn) { - return children(fn.apply(new Info.Builder()).build()); + public final BuilderT cancelled(@Nullable Boolean value) { + this.cancelled = value; + return self(); } /** * API name: {@code description} */ - public final Builder description(@Nullable String value) { + public final BuilderT description(@Nullable String value) { this.description = value; - return this; + return self(); } /** * Required - API name: {@code headers} + * *

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

*/ - public final Builder headers(Map> map) { + public final BuilderT headers(Map map) { this.headers = _mapPutAll(this.headers, map); - return this; + return self(); } /** * Required - API name: {@code headers} + * *

* Adds an entry to headers. + *

*/ - public final Builder headers(String key, List value) { + public final BuilderT headers(String key, String value) { this.headers = _mapPut(this.headers, key, value); - return this; + return self(); } /** * Required - API name: {@code id} */ - public final Builder id(long value) { + public final BuilderT id(long value) { this.id = value; - return this; + return self(); } /** * Required - API name: {@code node} */ - public final Builder node(String value) { + public final BuilderT node(String value) { this.node = value; - return this; + return self(); + } + + /** + * API name: {@code parent_task_id} + */ + public final BuilderT parentTaskId(@Nullable String value) { + this.parentTaskId = value; + return self(); + } + + /** + * API name: {@code running_time} + */ + public final BuilderT runningTime(@Nullable Time value) { + this.runningTime = value; + return self(); + } + + /** + * API name: {@code running_time} + */ + public final BuilderT runningTime(Function> fn) { + return runningTime(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code running_time_in_nanos} */ - public final Builder runningTimeInNanos(long value) { + public final BuilderT runningTimeInNanos(long value) { this.runningTimeInNanos = value; - return this; + return self(); } /** * Required - API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(long value) { + public final BuilderT startTimeInMillis(long value) { this.startTimeInMillis = value; - return this; + return self(); } /** * API name: {@code status} */ - public final Builder status(@Nullable Status value) { + public final BuilderT status(@Nullable Status value) { this.status = value; - return this; + return self(); } /** * API name: {@code status} */ - public final Builder status(Function> fn) { - return this.status(fn.apply(new Status.Builder()).build()); + public final BuilderT status(Function> fn) { + return status(fn.apply(new Status.Builder()).build()); } /** * Required - API name: {@code type} */ - public final Builder type(String value) { + public final BuilderT type(String value) { this.type = value; - return this; - } - - /** - * API name: {@code parent_task_id} - */ - public final Builder parentTaskId(@Nullable String value) { - this.parentTaskId = value; - return this; + return self(); } - /** - * Builds a {@link Info}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Info build() { - _checkSingleUse(); - - return new Info(this); - } + protected abstract BuilderT self(); } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Info} + * Json deserializer for {@link TaskInfo} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Info::setupInfoDeserializer); - - protected static void setupInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::action, JsonpDeserializer.stringDeserializer(), "action"); - op.add(Builder::cancellable, JsonpDeserializer.booleanDeserializer(), "cancellable"); - op.add(Builder::children, JsonpDeserializer.arrayDeserializer(Info._DESERIALIZER), "children"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add( - Builder::headers, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), - "headers" - ); - op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(Builder::status, Status._DESERIALIZER, "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::parentTaskId, JsonpDeserializer.stringDeserializer(), "parent_task_id"); - + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + TaskInfo::setupTaskInfoDeserializer + ); + + protected static > void setupTaskInfoDeserializer(ObjectDeserializer op) { + op.add(AbstractBuilder::action, JsonpDeserializer.stringDeserializer(), "action"); + op.add(AbstractBuilder::cancellable, JsonpDeserializer.booleanDeserializer(), "cancellable"); + op.add(AbstractBuilder::cancelled, JsonpDeserializer.booleanDeserializer(), "cancelled"); + op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(AbstractBuilder::headers, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "headers"); + op.add(AbstractBuilder::id, JsonpDeserializer.longDeserializer(), "id"); + op.add(AbstractBuilder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(AbstractBuilder::parentTaskId, JsonpDeserializer.stringDeserializer(), "parent_task_id"); + op.add(AbstractBuilder::runningTime, Time._DESERIALIZER, "running_time"); + op.add(AbstractBuilder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); + op.add(AbstractBuilder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); + op.add(AbstractBuilder::status, Status._DESERIALIZER, "status"); + op.add(AbstractBuilder::type, JsonpDeserializer.stringDeserializer(), "type"); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java new file mode 100644 index 0000000000..9e394d3d7a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java @@ -0,0 +1,163 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.UnionDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: tasks.TaskInfos + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TaskInfos implements TaggedUnion, PlainJsonSerializable { + public enum Kind { + GroupedByNone, + GroupedByParents + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private TaskInfos(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private TaskInfos(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static TaskInfos of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code grouped_by_none}? + */ + public boolean isGroupedByNone() { + return _kind == Kind.GroupedByNone; + } + + /** + * Get the {@code grouped_by_none} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code grouped_by_none} kind. + */ + public List groupedByNone() { + return TaggedUnionUtils.get(this, Kind.GroupedByNone); + } + + /** + * Is this variant instance of kind {@code grouped_by_parents}? + */ + public boolean isGroupedByParents() { + return _kind == Kind.GroupedByParents; + } + + /** + * Get the {@code grouped_by_parents} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code grouped_by_parents} kind. + */ + public Map groupedByParents() { + return TaggedUnionUtils.get(this, Kind.GroupedByParents); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder groupedByNone(List v) { + this._kind = Kind.GroupedByNone; + this._value = v; + return this; + } + + public ObjectBuilder groupedByParents(Map v) { + this._kind = Kind.GroupedByParents; + this._value = v; + return this; + } + + @Override + public TaskInfos build() { + _checkSingleUse(); + return new TaskInfos(this); + } + } + + private static JsonpDeserializer buildTaskInfosDeserializer() { + return new UnionDeserializer.Builder(TaskInfos::new, false).addMember( + Kind.GroupedByNone, + JsonpDeserializer.arrayDeserializer(TaskInfo._DESERIALIZER) + ).addMember(Kind.GroupedByParents, JsonpDeserializer.stringMapDeserializer(TaskGroup._DESERIALIZER)).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(TaskInfos::buildTaskInfosDeserializer); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index 8f63dbea1f..b67eb2965d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/ListResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -30,46 +30,49 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.tasks; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ErrorCause; +import org.opensearch.client.opensearch._types.TaskFailure; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: tasks.list.Response +// typedef: tasks.TaskListResponseBase + +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class TaskListResponseBase implements PlainJsonSerializable { -@JsonpDeserializable -public class ListResponse implements PlainJsonSerializable { private final List nodeFailures; private final Map nodes; - private final Map tasks; + private final List taskFailures; - // --------------------------------------------------------------------------------------------- + @Nullable + private final TaskInfos tasks; - protected ListResponse(AbstractBuilder builder) { + // --------------------------------------------------------------------------------------------- + protected TaskListResponseBase(AbstractBuilder builder) { this.nodeFailures = ApiTypeHelper.unmodifiable(builder.nodeFailures); this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); - this.tasks = ApiTypeHelper.unmodifiable(builder.tasks); - - } - - public static ListResponse listResponseOf(Function> fn) { - return fn.apply(new Builder()).build(); + this.taskFailures = ApiTypeHelper.unmodifiable(builder.taskFailures); + this.tasks = builder.tasks; } /** @@ -80,22 +83,34 @@ public final List nodeFailures() { } /** + * Task information grouped by node, if `group_by` was set to `node` (the default). + *

* API name: {@code nodes} + *

*/ public final Map nodes() { return this.nodes; } + /** + * API name: {@code task_failures} + */ + public final List taskFailures() { + return this.taskFailures; + } + /** * API name: {@code tasks} */ - public final Map tasks() { + @Nullable + public final TaskInfos tasks() { return this.tasks; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -103,81 +118,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.nodeFailures)) { generator.writeKey("node_failures"); generator.writeStartArray(); for (ErrorCause item0 : this.nodeFailures) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.nodes)) { generator.writeKey("nodes"); generator.writeStartObject(); for (Map.Entry item0 : this.nodes.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - if (ApiTypeHelper.isDefined(this.tasks)) { - generator.writeKey("tasks"); - generator.writeStartObject(); - for (Map.Entry item0 : this.tasks.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.taskFailures)) { + generator.writeKey("task_failures"); + generator.writeStartArray(); + for (TaskFailure item0 : this.taskFailures) { + item0.serialize(generator, mapper); } generator.writeEnd(); - } + if (this.tasks != null) { + generator.writeKey("tasks"); + this.tasks.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- - /** - * Builder for {@link ListResponse}. - */ - - public static class Builder extends ListResponse.AbstractBuilder implements ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ListResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ListResponse build() { - _checkSingleUse(); - - return new ListResponse(this); - } - } - protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private List nodeFailures; - @Nullable private Map nodes; - @Nullable - private Map tasks; + private List taskFailures; + @Nullable + private TaskInfos tasks; /** * API name: {@code node_failures} + * *

* Adds all elements of list to nodeFailures. + *

*/ public final BuilderT nodeFailures(List list) { this.nodeFailures = _listAddAll(this.nodeFailures, list); @@ -186,8 +178,10 @@ public final BuilderT nodeFailures(List list) { /** * API name: {@code node_failures} + * *

* Adds one or more values to nodeFailures. + *

*/ public final BuilderT nodeFailures(ErrorCause value, ErrorCause... values) { this.nodeFailures = _listAdd(this.nodeFailures, value, values); @@ -196,17 +190,24 @@ public final BuilderT nodeFailures(ErrorCause value, ErrorCause... values) { /** * API name: {@code node_failures} + * *

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

*/ public final BuilderT nodeFailures(Function> fn) { return nodeFailures(fn.apply(new ErrorCause.Builder()).build()); } /** + * Task information grouped by node, if `group_by` was set to `node` (the default). + *

* API name: {@code nodes} + *

+ * *

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

*/ public final BuilderT nodes(Map map) { this.nodes = _mapPutAll(this.nodes, map); @@ -214,9 +215,14 @@ public final BuilderT nodes(Map map) { } /** + * Task information grouped by node, if `group_by` was set to `node` (the default). + *

* API name: {@code nodes} + *

+ * *

* Adds an entry to nodes. + *

*/ public final BuilderT nodes(String key, TaskExecutingNode value) { this.nodes = _mapPut(this.nodes, key, value); @@ -224,63 +230,80 @@ public final BuilderT nodes(String key, TaskExecutingNode value) { } /** + * Task information grouped by node, if `group_by` was set to `node` (the default). + *

* API name: {@code nodes} + *

+ * *

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

*/ public final BuilderT nodes(String key, Function> fn) { return nodes(key, fn.apply(new TaskExecutingNode.Builder()).build()); } /** - * API name: {@code tasks} + * API name: {@code task_failures} + * *

- * Adds all entries of map to tasks. + * Adds all elements of list to taskFailures. + *

*/ - public final BuilderT tasks(Map map) { - this.tasks = _mapPutAll(this.tasks, map); + public final BuilderT taskFailures(List list) { + this.taskFailures = _listAddAll(this.taskFailures, list); return self(); } /** - * API name: {@code tasks} + * API name: {@code task_failures} + * *

- * Adds an entry to tasks. + * Adds one or more values to taskFailures. + *

*/ - public final BuilderT tasks(String key, Info value) { - this.tasks = _mapPut(this.tasks, key, value); + public final BuilderT taskFailures(TaskFailure value, TaskFailure... values) { + this.taskFailures = _listAdd(this.taskFailures, value, values); return self(); } /** - * API name: {@code tasks} + * API name: {@code task_failures} + * *

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

*/ - public final BuilderT tasks(String key, Function> fn) { - return tasks(key, fn.apply(new Info.Builder()).build()); + public final BuilderT taskFailures(Function> fn) { + return taskFailures(fn.apply(new TaskFailure.Builder()).build()); } - protected abstract BuilderT self(); + /** + * API name: {@code tasks} + */ + public final BuilderT tasks(@Nullable TaskInfos value) { + this.tasks = value; + return self(); + } + + /** + * API name: {@code tasks} + */ + public final BuilderT tasks(Function> fn) { + return tasks(fn.apply(new TaskInfos.Builder()).build()); + } + protected abstract BuilderT self(); } // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link ListResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ListResponse::setupListResponseDeserializer - ); - - protected static > void setupListResponseDeserializer(ObjectDeserializer op) { - + protected static > void setupTaskListResponseBaseDeserializer( + ObjectDeserializer op + ) { op.add(AbstractBuilder::nodeFailures, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "node_failures"); op.add(AbstractBuilder::nodes, JsonpDeserializer.stringMapDeserializer(TaskExecutingNode._DESERIALIZER), "nodes"); - op.add(AbstractBuilder::tasks, JsonpDeserializer.stringMapDeserializer(Info._DESERIALIZER), "tasks"); - + op.add(AbstractBuilder::taskFailures, JsonpDeserializer.arrayDeserializer(TaskFailure._DESERIALIZER), "task_failures"); + op.add(AbstractBuilder::tasks, TaskInfos._DESERIALIZER, "tasks"); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java new file mode 100644 index 0000000000..80edbb43d0 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -0,0 +1,721 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.tasks; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.BulkByScrollFailure; +import org.opensearch.client.opensearch._types.BulkByScrollTaskStatusOrException; +import org.opensearch.client.opensearch._types.Retries; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: tasks.TaskResponse + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TaskResponse implements PlainJsonSerializable { + + private final int batches; + + @Nullable + private final String canceled; + + @Nullable + private final Long created; + + private final long deleted; + + private final List failures; + + private final long noops; + + private final float requestsPerSecond; + + private final Retries retries; + + @Nullable + private final Integer sliceId; + + private final List slices; + + @Nullable + private final Time throttled; + + private final long throttledMillis; + + @Nullable + private final Time throttledUntil; + + private final long throttledUntilMillis; + + private final boolean timedOut; + + private final long took; + + private final long total; + + @Nullable + private final Long updated; + + private final long versionConflicts; + + // --------------------------------------------------------------------------------------------- + + private TaskResponse(Builder builder) { + this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches"); + this.canceled = builder.canceled; + this.created = builder.created; + this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); + this.failures = ApiTypeHelper.unmodifiableRequired(builder.failures, this, "failures"); + this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops"); + this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond"); + this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); + this.sliceId = builder.sliceId; + this.slices = ApiTypeHelper.unmodifiable(builder.slices); + this.throttled = builder.throttled; + this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); + this.throttledUntil = builder.throttledUntil; + this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, "throttledUntilMillis"); + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.updated = builder.updated; + this.versionConflicts = ApiTypeHelper.requireNonNull(builder.versionConflicts, this, "versionConflicts"); + } + + public static TaskResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of scroll responses pulled back by the reindex. + *

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

+ */ + public final int batches() { + return this.batches; + } + + /** + * API name: {@code canceled} + */ + @Nullable + public final String canceled() { + return this.canceled; + } + + /** + * The number of documents that were successfully created. + *

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

+ */ + @Nullable + public final Long created() { + return this.created; + } + + /** + * Required - The number of documents that were successfully deleted. + *

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

+ */ + public final long deleted() { + return this.deleted; + } + + /** + * Required - API name: {@code failures} + */ + public final List failures() { + return this.failures; + } + + /** + * Required - The number of documents that were ignored. + *

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

+ */ + public final long noops() { + return this.noops; + } + + /** + * Required - The number of requests per second effectively executed during the reindex. + *

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

+ */ + public final float requestsPerSecond() { + return this.requestsPerSecond; + } + + /** + * Required - API name: {@code retries} + */ + public final Retries retries() { + return this.retries; + } + + /** + * API name: {@code slice_id} + */ + @Nullable + public final Integer sliceId() { + return this.sliceId; + } + + /** + * API name: {@code slices} + */ + public final List slices() { + return this.slices; + } + + /** + * API name: {@code throttled} + */ + @Nullable + public final Time throttled() { + return this.throttled; + } + + /** + * Required - API name: {@code throttled_millis} + */ + public final long throttledMillis() { + return this.throttledMillis; + } + + /** + * API name: {@code throttled_until} + */ + @Nullable + public final Time throttledUntil() { + return this.throttledUntil; + } + + /** + * Required - API name: {@code throttled_until_millis} + */ + public final long throttledUntilMillis() { + return this.throttledUntilMillis; + } + + /** + * Required - API name: {@code timed_out} + */ + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { + return this.took; + } + + /** + * Required - The number of documents that were successfully processed. + *

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

+ */ + public final long total() { + return this.total; + } + + /** + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

+ */ + @Nullable + public final Long updated() { + return this.updated; + } + + /** + * Required - The number of version conflicts that reindex hits. + *

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

+ */ + public final long versionConflicts() { + return this.versionConflicts; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("batches"); + generator.write(this.batches); + + if (this.canceled != null) { + generator.writeKey("canceled"); + generator.write(this.canceled); + } + + if (this.created != null) { + generator.writeKey("created"); + generator.write(this.created); + } + + generator.writeKey("deleted"); + generator.write(this.deleted); + + generator.writeKey("failures"); + generator.writeStartArray(); + for (BulkByScrollFailure item0 : this.failures) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + generator.writeKey("noops"); + generator.write(this.noops); + + generator.writeKey("requests_per_second"); + generator.write(this.requestsPerSecond); + + generator.writeKey("retries"); + this.retries.serialize(generator, mapper); + + if (this.sliceId != null) { + generator.writeKey("slice_id"); + generator.write(this.sliceId); + } + + if (ApiTypeHelper.isDefined(this.slices)) { + generator.writeKey("slices"); + generator.writeStartArray(); + for (BulkByScrollTaskStatusOrException item0 : this.slices) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); + } + + generator.writeKey("throttled_millis"); + generator.write(this.throttledMillis); + + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); + } + + generator.writeKey("throttled_until_millis"); + generator.write(this.throttledUntilMillis); + + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + generator.writeKey("took"); + generator.write(this.took); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.updated != null) { + generator.writeKey("updated"); + generator.write(this.updated); + } + + generator.writeKey("version_conflicts"); + generator.write(this.versionConflicts); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TaskResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer batches; + @Nullable + private String canceled; + @Nullable + private Long created; + private Long deleted; + private List failures; + private Long noops; + private Float requestsPerSecond; + private Retries retries; + @Nullable + private Integer sliceId; + @Nullable + private List slices; + @Nullable + private Time throttled; + private Long throttledMillis; + @Nullable + private Time throttledUntil; + private Long throttledUntilMillis; + private Boolean timedOut; + private Long took; + private Long total; + @Nullable + private Long updated; + private Long versionConflicts; + + /** + * Required - The number of scroll responses pulled back by the reindex. + *

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

+ */ + public final Builder batches(int value) { + this.batches = value; + return this; + } + + /** + * API name: {@code canceled} + */ + public final Builder canceled(@Nullable String value) { + this.canceled = value; + return this; + } + + /** + * The number of documents that were successfully created. + *

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

+ */ + public final Builder created(@Nullable Long value) { + this.created = value; + return this; + } + + /** + * Required - The number of documents that were successfully deleted. + *

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

+ */ + public final Builder deleted(long value) { + this.deleted = value; + return this; + } + + /** + * Required - API name: {@code failures} + * + *

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

+ */ + public final Builder failures(List list) { + this.failures = _listAddAll(this.failures, list); + return this; + } + + /** + * Required - API name: {@code failures} + * + *

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

+ */ + public final Builder failures(BulkByScrollFailure value, BulkByScrollFailure... values) { + this.failures = _listAdd(this.failures, value, values); + return this; + } + + /** + * Required - API name: {@code failures} + * + *

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

+ */ + public final Builder failures(Function> fn) { + return failures(fn.apply(new BulkByScrollFailure.Builder()).build()); + } + + /** + * Required - The number of documents that were ignored. + *

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

+ */ + public final Builder noops(long value) { + this.noops = value; + return this; + } + + /** + * Required - The number of requests per second effectively executed during the reindex. + *

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

+ */ + public final Builder requestsPerSecond(float value) { + this.requestsPerSecond = value; + return this; + } + + /** + * Required - API name: {@code retries} + */ + public final Builder retries(Retries value) { + this.retries = value; + return this; + } + + /** + * Required - API name: {@code retries} + */ + public final Builder retries(Function> fn) { + return retries(fn.apply(new Retries.Builder()).build()); + } + + /** + * API name: {@code slice_id} + */ + public final Builder sliceId(@Nullable Integer value) { + this.sliceId = value; + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices(List list) { + this.slices = _listAddAll(this.slices, list); + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices(BulkByScrollTaskStatusOrException value, BulkByScrollTaskStatusOrException... values) { + this.slices = _listAdd(this.slices, value, values); + return this; + } + + /** + * API name: {@code slices} + * + *

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

+ */ + public final Builder slices( + Function> fn + ) { + return slices(fn.apply(new BulkByScrollTaskStatusOrException.Builder()).build()); + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return throttled(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code throttled_millis} + */ + public final Builder throttledMillis(long value) { + this.throttledMillis = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return throttledUntil(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code throttled_until_millis} + */ + public final Builder throttledUntilMillis(long value) { + this.throttledUntilMillis = value; + return this; + } + + /** + * Required - API name: {@code timed_out} + */ + public final Builder timedOut(boolean value) { + this.timedOut = value; + return this; + } + + /** + * Required - API name: {@code took} + */ + public final Builder took(long value) { + this.took = value; + return this; + } + + /** + * Required - The number of documents that were successfully processed. + *

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

+ */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex + * updating it. + *

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

+ */ + public final Builder updated(@Nullable Long value) { + this.updated = value; + return this; + } + + /** + * Required - The number of version conflicts that reindex hits. + *

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

+ */ + public final Builder versionConflicts(long value) { + this.versionConflicts = value; + return this; + } + + /** + * Builds a {@link TaskResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public TaskResponse build() { + _checkSingleUse(); + + return new TaskResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TaskResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + TaskResponse::setupTaskResponseDeserializer + ); + + protected static void setupTaskResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::batches, JsonpDeserializer.integerDeserializer(), "batches"); + op.add(Builder::canceled, JsonpDeserializer.stringDeserializer(), "canceled"); + op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); + op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(BulkByScrollFailure._DESERIALIZER), "failures"); + op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); + op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); + op.add(Builder::retries, Retries._DESERIALIZER, "retries"); + op.add(Builder::sliceId, JsonpDeserializer.integerDeserializer(), "slice_id"); + op.add(Builder::slices, JsonpDeserializer.arrayDeserializer(BulkByScrollTaskStatusOrException._DESERIALIZER), "slices"); + op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); + op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); + op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); + op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); + op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); + op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index d3bac0d575..a0aca846f8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -125,7 +125,6 @@ import org.opensearch.client.opensearch.nodes.OpenSearchNodesAsyncClient; import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownAsyncClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; -import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -184,10 +183,6 @@ public OpenSearchSnapshotAsyncClient snapshot() { return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions); } - public OpenSearchTasksAsyncClient tasks() { - return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); - } - // ----- Endpoint: bulk /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java index 56653330c1..4327951b80 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -125,7 +125,6 @@ import org.opensearch.client.opensearch.nodes.OpenSearchNodesClient; import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; -import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -187,10 +186,6 @@ public OpenSearchSnapshotClient snapshot() { return new OpenSearchSnapshotClient(this.transport, this.transportOptions); } - public OpenSearchTasksClient tasks() { - return new OpenSearchTasksClient(this.transport, this.transportOptions); - } - // ----- Endpoint: bulk /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleResponse.java index 6aa588a151..4ceb7faa26 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleResponse.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleResponse.java @@ -37,13 +37,13 @@ import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch.tasks.ListResponse; +import org.opensearch.client.opensearch.tasks.TaskListResponseBase; import org.opensearch.client.util.ObjectBuilder; // typedef: _global.delete_by_query_rethrottle.Response @JsonpDeserializable -public class DeleteByQueryRethrottleResponse extends ListResponse { +public class DeleteByQueryRethrottleResponse extends TaskListResponseBase { // --------------------------------------------------------------------------------------------- private DeleteByQueryRethrottleResponse(Builder builder) { @@ -61,7 +61,9 @@ public static DeleteByQueryRethrottleResponse of(Function implements ObjectBuilder { + public static class Builder extends TaskListResponseBase.AbstractBuilder + implements + ObjectBuilder { @Override protected Builder self() { return this; @@ -91,7 +93,7 @@ public DeleteByQueryRethrottleResponse build() { ); protected static void setupDeleteByQueryRethrottleResponseDeserializer(ObjectDeserializer op) { - ListResponse.setupListResponseDeserializer(op); + TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/update_by_query_rethrottle/UpdateByQueryRethrottleNode.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/update_by_query_rethrottle/UpdateByQueryRethrottleNode.java index bbb2f678d9..d79457067e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/update_by_query_rethrottle/UpdateByQueryRethrottleNode.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/update_by_query_rethrottle/UpdateByQueryRethrottleNode.java @@ -41,7 +41,7 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.BaseNode; -import org.opensearch.client.opensearch.tasks.Info; +import org.opensearch.client.opensearch.tasks.TaskInfo; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -49,7 +49,7 @@ @JsonpDeserializable public class UpdateByQueryRethrottleNode extends BaseNode { - private final Map tasks; + private final Map tasks; // --------------------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ public static UpdateByQueryRethrottleNode of(Function tasks() { + public final Map tasks() { return this.tasks; } @@ -77,7 +77,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.tasks)) { generator.writeKey("tasks"); generator.writeStartObject(); - for (Map.Entry item0 : this.tasks.entrySet()) { + for (Map.Entry item0 : this.tasks.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); @@ -95,14 +95,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends BaseNode.AbstractBuilder implements ObjectBuilder { - private Map tasks; + private Map tasks; /** * Required - API name: {@code tasks} *

* Adds all entries of map to tasks. */ - public final Builder tasks(Map map) { + public final Builder tasks(Map map) { this.tasks = _mapPutAll(this.tasks, map); return this; } @@ -112,7 +112,7 @@ public final Builder tasks(Map map) { *

* Adds an entry to tasks. */ - public final Builder tasks(String key, Info value) { + public final Builder tasks(String key, TaskInfo value) { this.tasks = _mapPut(this.tasks, key, value); return this; } @@ -122,8 +122,8 @@ public final Builder tasks(String key, Info value) { *

* Adds an entry to tasks using a builder lambda. */ - public final Builder tasks(String key, Function> fn) { - return tasks(key, fn.apply(new Info.Builder()).build()); + public final Builder tasks(String key, Function> fn) { + return tasks(key, fn.apply(new TaskInfo.Builder()).build()); } @Override @@ -156,7 +156,7 @@ public UpdateByQueryRethrottleNode build() { protected static void setupUpdateByQueryRethrottleNodeDeserializer(ObjectDeserializer op) { BaseNode.setupBaseNodeDeserializer(op); - op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(Info._DESERIALIZER), "tasks"); + op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(TaskInfo._DESERIALIZER), "tasks"); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelResponse.java deleted file mode 100644 index abe4da1157..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/CancelResponse.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.tasks; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.ErrorCause; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: tasks.cancel.Response - -@JsonpDeserializable -public class CancelResponse implements PlainJsonSerializable { - private final List nodeFailures; - - private final Map nodes; - - // --------------------------------------------------------------------------------------------- - - private CancelResponse(Builder builder) { - - this.nodeFailures = ApiTypeHelper.unmodifiable(builder.nodeFailures); - this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); - - } - - public static CancelResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code node_failures} - */ - public final List nodeFailures() { - return this.nodeFailures; - } - - /** - * Required - API name: {@code nodes} - */ - public final Map nodes() { - return this.nodes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.nodeFailures)) { - generator.writeKey("node_failures"); - generator.writeStartArray(); - for (ErrorCause item0 : this.nodeFailures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.nodes)) { - generator.writeKey("nodes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.nodes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CancelResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private List nodeFailures; - - private Map nodes; - - /** - * API name: {@code node_failures} - *

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

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

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

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

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

- * Adds an entry to nodes using a builder lambda. - */ - public final Builder nodes(String key, Function> fn) { - return nodes(key, fn.apply(new TaskExecutingNode.Builder()).build()); - } - - /** - * Builds a {@link CancelResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CancelResponse build() { - _checkSingleUse(); - - return new CancelResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CancelResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CancelResponse::setupCancelResponseDeserializer - ); - - protected static void setupCancelResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::nodeFailures, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "node_failures"); - op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(TaskExecutingNode._DESERIALIZER), "nodes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/State.java b/java-client/src/main/java/org/opensearch/client/opensearch/tasks/State.java deleted file mode 100644 index 38a227a0c5..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/tasks/State.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.tasks; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: tasks._types.State - -@JsonpDeserializable -public class State implements PlainJsonSerializable { - private final String action; - - private final boolean cancellable; - - @Nullable - private final String description; - - private final Map> headers; - - private final long id; - - private final String node; - - @Nullable - private final String parentTaskId; - - private final long runningTimeInNanos; - - private final long startTimeInMillis; - - @Nullable - private final Status status; - - private final String type; - - // --------------------------------------------------------------------------------------------- - - private State(Builder builder) { - - this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); - this.cancellable = ApiTypeHelper.requireNonNull(builder.cancellable, this, "cancellable"); - this.description = builder.description; - this.headers = ApiTypeHelper.unmodifiableRequired(builder.headers, this, "headers"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.parentTaskId = builder.parentTaskId; - this.runningTimeInNanos = ApiTypeHelper.requireNonNull(builder.runningTimeInNanos, this, "runningTimeInNanos"); - this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); - this.status = builder.status; - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - - } - - public static State of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code action} - */ - public final String action() { - return this.action; - } - - /** - * Required - API name: {@code cancellable} - */ - public final boolean cancellable() { - return this.cancellable; - } - - /** - * API name: {@code description} - */ - @Nullable - public final String description() { - return this.description; - } - - /** - * Required - API name: {@code headers} - */ - public final Map> headers() { - return this.headers; - } - - /** - * Required - API name: {@code id} - */ - public final long id() { - return this.id; - } - - /** - * Required - API name: {@code node} - */ - public final String node() { - return this.node; - } - - /** - * API name: {@code parent_task_id} - */ - @Nullable - public final String parentTaskId() { - return this.parentTaskId; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final long runningTimeInNanos() { - return this.runningTimeInNanos; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final long startTimeInMillis() { - return this.startTimeInMillis; - } - - /** - * API name: {@code status} - */ - @Nullable - public final Status status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("action"); - generator.write(this.action); - - generator.writeKey("cancellable"); - generator.write(this.cancellable); - - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); - - } - if (ApiTypeHelper.isDefined(this.headers)) { - generator.writeKey("headers"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.headers.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (String item1 : item0.getValue()) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("node"); - generator.write(this.node); - - if (this.parentTaskId != null) { - generator.writeKey("parent_task_id"); - generator.write(this.parentTaskId); - - } - generator.writeKey("running_time_in_nanos"); - generator.write(this.runningTimeInNanos); - - generator.writeKey("start_time_in_millis"); - generator.write(this.startTimeInMillis); - - if (this.status != null) { - generator.writeKey("status"); - this.status.serialize(generator, mapper); - - } - generator.writeKey("type"); - generator.write(this.type); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link State}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String action; - - private Boolean cancellable; - - @Nullable - private String description; - - private Map> headers; - - private Long id; - - private String node; - - @Nullable - private String parentTaskId; - - private Long runningTimeInNanos; - - private Long startTimeInMillis; - - @Nullable - private Status status; - - private String type; - - /** - * Required - API name: {@code action} - */ - public final Builder action(String value) { - this.action = value; - return this; - } - - /** - * Required - API name: {@code cancellable} - */ - public final Builder cancellable(boolean value) { - this.cancellable = value; - return this; - } - - /** - * API name: {@code description} - */ - public final Builder description(@Nullable String value) { - this.description = value; - return this; - } - - /** - * Required - API name: {@code headers} - *

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

- * Adds an entry to headers. - */ - public final Builder headers(String key, List value) { - this.headers = _mapPut(this.headers, key, value); - return this; - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(long value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code node} - */ - public final Builder node(String value) { - this.node = value; - return this; - } - - /** - * API name: {@code parent_task_id} - */ - public final Builder parentTaskId(@Nullable String value) { - this.parentTaskId = value; - return this; - } - - /** - * Required - API name: {@code running_time_in_nanos} - */ - public final Builder runningTimeInNanos(long value) { - this.runningTimeInNanos = value; - return this; - } - - /** - * Required - API name: {@code start_time_in_millis} - */ - public final Builder startTimeInMillis(long value) { - this.startTimeInMillis = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(@Nullable Status value) { - this.status = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status(Function> fn) { - return this.status(fn.apply(new Status.Builder()).build()); - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Builds a {@link State}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public State build() { - _checkSingleUse(); - - return new State(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link State} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - State::setupStateDeserializer - ); - - protected static void setupStateDeserializer(ObjectDeserializer op) { - - op.add(Builder::action, JsonpDeserializer.stringDeserializer(), "action"); - op.add(Builder::cancellable, JsonpDeserializer.booleanDeserializer(), "cancellable"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add( - Builder::headers, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), - "headers" - ); - op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::parentTaskId, JsonpDeserializer.stringDeserializer(), "parent_task_id"); - op.add(Builder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(Builder::status, Status._DESERIALIZER, "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } - -} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/tasks/ListResponseTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/tasks/ListResponseTest.java new file mode 100644 index 0000000000..3899abf82a --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/tasks/ListResponseTest.java @@ -0,0 +1,218 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.tasks; + +import java.util.List; +import java.util.Map; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ListResponseTest extends ModelTestCase { + @Test + public void canDeserializeGroupedByNodes() { + final String json = "{\n" + + " \"nodes\": {\n" + + " \"y2hDJUdMTWa6sNA_0vdF6Q\": {\n" + + " \"name\": \"opensearch-node1\",\n" + + " \"transport_address\": \"172.17.0.4:9300\",\n" + + " \"host\": \"172.17.0.4\",\n" + + " \"ip\": \"172.17.0.4:9300\",\n" + + " \"roles\": [\n" + + " \"cluster_manager\",\n" + + " \"data\",\n" + + " \"ingest\",\n" + + " \"remote_cluster_client\"\n" + + " ],\n" + + " \"attributes\": {\n" + + " \"shard_indexing_pressure_enabled\": \"true\"\n" + + " },\n" + + " \"tasks\": {\n" + + " \"y2hDJUdMTWa6sNA_0vdF6Q:3970\": {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 3970,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists\",\n" + + " \"start_time_in_millis\": 1722997372508,\n" + + " \"running_time_in_nanos\": 2141574,\n" + + " \"cancellable\": false,\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"7ef238e7-e5fb-4779-81f5-9b7bfcc46bdd\"\n" + + " }\n" + + " },\n" + + " \"y2hDJUdMTWa6sNA_0vdF6Q:3971\": {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 3971,\n" + + " \"type\": \"direct\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722997372510,\n" + + " \"running_time_in_nanos\": 868850,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:3970\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"7ef238e7-e5fb-4779-81f5-9b7bfcc46bdd\"\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"upjixfEITyuPot3qTn9H_Q\": {\n" + + " \"name\": \"opensearch-node2\",\n" + + " \"transport_address\": \"172.17.0.3:9300\",\n" + + " \"host\": \"172.17.0.3\",\n" + + " \"ip\": \"172.17.0.3:9300\",\n" + + " \"roles\": [\n" + + " \"cluster_manager\",\n" + + " \"data\",\n" + + " \"ingest\",\n" + + " \"remote_cluster_client\"\n" + + " ],\n" + + " \"attributes\": {\n" + + " \"shard_indexing_pressure_enabled\": \"true\"\n" + + " },\n" + + " \"tasks\": {\n" + + " \"upjixfEITyuPot3qTn9H_Q:5061\": {\n" + + " \"node\": \"upjixfEITyuPot3qTn9H_Q\",\n" + + " \"id\": 5061,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722997372510,\n" + + " \"running_time_in_nanos\": 886766,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:3970\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"7ef238e7-e5fb-4779-81f5-9b7bfcc46bdd\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + + final ListResponse response = fromJson(json, ListResponse._DESERIALIZER); + assertNull(response.tasks()); + + final Map nodes = response.nodes(); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertEquals("opensearch-node2", nodes.get("upjixfEITyuPot3qTn9H_Q").name()); + } + + @Test + public void canDeserializeGroupedByParents() { + final String json = "{\n" + + " \"tasks\": {\n" + + " \"y2hDJUdMTWa6sNA_0vdF6Q:5306\": {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 5306,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists\",\n" + + " \"start_time_in_millis\": 1722997879217,\n" + + " \"running_time_in_nanos\": 1572170,\n" + + " \"cancellable\": false,\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"6033796b-4901-44f0-aae9-37c46d7d36ea\"\n" + + " },\n" + + " \"children\": [\n" + + " {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 5307,\n" + + " \"type\": \"direct\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722997879218,\n" + + " \"running_time_in_nanos\": 393734,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:5306\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"6033796b-4901-44f0-aae9-37c46d7d36ea\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"node\": \"upjixfEITyuPot3qTn9H_Q\",\n" + + " \"id\": 6646,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722997879218,\n" + + " \"running_time_in_nanos\": 356705,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:5306\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"6033796b-4901-44f0-aae9-37c46d7d36ea\"\n" + + " }\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + "}"; + + final ListResponse response = fromJson(json, ListResponse._DESERIALIZER); + assertTrue(response.nodes().isEmpty()); + + final TaskInfos tasks = response.tasks(); + assertNotNull(tasks); + assertTrue(tasks.isGroupedByParents()); + + final Map groups = tasks.groupedByParents(); + assertEquals(1, groups.size()); + + final TaskGroup task = groups.get("y2hDJUdMTWa6sNA_0vdF6Q:5306"); + assertNotNull(task); + + final List children = task.children(); + assertEquals(2, children.size()); + + assertEquals("cluster:monitor/tasks/lists[n]", children.get(0).action()); + } + + @Test + public void canDeserializeGroupedByNone() { + final String json = "{\n" + + " \"tasks\": [\n" + + " {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 5961,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists\",\n" + + " \"start_time_in_millis\": 1722998118297,\n" + + " \"running_time_in_nanos\": 1472050,\n" + + " \"cancellable\": false,\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"ccfdeab1-5807-4f9d-8258-111ea6642d9b\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"node\": \"y2hDJUdMTWa6sNA_0vdF6Q\",\n" + + " \"id\": 5962,\n" + + " \"type\": \"direct\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722998118298,\n" + + " \"running_time_in_nanos\": 95393,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:5961\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"ccfdeab1-5807-4f9d-8258-111ea6642d9b\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"node\": \"upjixfEITyuPot3qTn9H_Q\",\n" + + " \"id\": 7356,\n" + + " \"type\": \"transport\",\n" + + " \"action\": \"cluster:monitor/tasks/lists[n]\",\n" + + " \"start_time_in_millis\": 1722998118299,\n" + + " \"running_time_in_nanos\": 885987,\n" + + " \"cancellable\": false,\n" + + " \"parent_task_id\": \"y2hDJUdMTWa6sNA_0vdF6Q:5961\",\n" + + " \"headers\": {\n" + + " \"X-Opaque-Id\": \"ccfdeab1-5807-4f9d-8258-111ea6642d9b\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + + final ListResponse response = fromJson(json, ListResponse._DESERIALIZER); + } +} diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractTasksClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractTasksClientIT.java new file mode 100644 index 0000000000..00421d5bae --- /dev/null +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractTasksClientIT.java @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.integTest; + +import java.io.IOException; +import org.junit.Test; +import org.opensearch.client.opensearch.tasks.GroupBy; +import org.opensearch.client.opensearch.tasks.ListResponse; + +public abstract class AbstractTasksClientIT extends OpenSearchJavaClientTestCase { + @Test + public void list_groupedByNodes() throws IOException { + final ListResponse response = javaClient().tasks().list(l -> l.groupBy(GroupBy.Nodes)); + assertFalse(response.nodes().isEmpty()); + assertNull(response.tasks()); + } + + @Test + public void list_groupedByParents() throws IOException { + final ListResponse response = javaClient().tasks().list(l -> l.groupBy(GroupBy.Parents)); + assertTrue(response.nodes().isEmpty()); + assertNotNull(response.tasks()); + assertTrue(response.tasks().isGroupedByParents()); + } + + @Test + public void list_groupedByNone() throws IOException { + final ListResponse response = javaClient().tasks().list(l -> l.groupBy(GroupBy.None)); + assertTrue(response.nodes().isEmpty()); + assertNotNull(response.tasks()); + assertTrue(response.tasks().isGroupedByNone()); + } +} diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java index d8a3741cf1..e4825420a8 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java @@ -46,7 +46,13 @@ import org.opensearch.test.rest.OpenSearchRestTestCase; public abstract class OpenSearchJavaClientTestCase extends OpenSearchRestTestCase implements OpenSearchTransportSupport { - private static final List systemIndices = List.of(".opensearch-observability", ".opendistro_security", ".plugins-ml-config"); + private static final List systemIndices = List.of( + ".opensearch-observability", + ".opendistro_security", + ".plugins-ml-config", + ".plugins-ml-model-group", + ".ql-datasources" + ); private static OpenSearchClient javaClient; private static OpenSearchClient adminJavaClient; diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/TasksClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/TasksClientIT.java new file mode 100644 index 0000000000..b08857e758 --- /dev/null +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/TasksClientIT.java @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.integTest.httpclient5; + +import org.opensearch.client.opensearch.integTest.AbstractTasksClientIT; + +public class TasksClientIT extends AbstractTasksClientIT implements HttpClient5TransportSupport {} diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/TasksClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/TasksClientIT.java new file mode 100644 index 0000000000..02dc989607 --- /dev/null +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/TasksClientIT.java @@ -0,0 +1,24 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.integTest.restclient; + +import java.io.IOException; +import org.apache.hc.core5.http.HttpHost; +import org.opensearch.client.json.jackson.JacksonJsonpMapper; +import org.opensearch.client.opensearch.integTest.AbstractTasksClientIT; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.rest_client.RestClientTransport; +import org.opensearch.common.settings.Settings; + +public class TasksClientIT extends AbstractTasksClientIT { + @Override + public OpenSearchTransport buildTransport(Settings settings, HttpHost[] hosts) throws IOException { + return new RestClientTransport(buildClient(settings, hosts), new JacksonJsonpMapper()); + } +} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 889bedbbdf..97f65afef4 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -1501,34 +1501,6 @@ paths: responses: '200': $ref: '#/components/responses/nodes.hot_threads@200' - /_cluster/nodes/{node_id}/hotthreads: - get: - operationId: nodes.hot_threads.3 - x-operation-group: nodes.hot_threads - x-ignorable: true - deprecated: true - x-deprecation-message: The hot threads API accepts `hotthreads` but only `hot_threads` is documented - x-version-added: '1.0' - x-version-deprecated: '1.0' - description: Returns information about hot threads on each node in the cluster. - externalDocs: - url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ - parameters: - - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' - - $ref: '#/components/parameters/nodes.hot_threads::query.threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' - - $ref: '#/components/parameters/nodes.hot_threads::query.type' - - $ref: '#/components/parameters/_global::query.pretty' - - $ref: '#/components/parameters/_global::query.human' - - $ref: '#/components/parameters/_global::query.error_trace' - - $ref: '#/components/parameters/_global::query.source' - - $ref: '#/components/parameters/_global::query.filter_path' - responses: - '200': - $ref: '#/components/responses/nodes.hot_threads@200' /_cluster/nodes/hot_threads: get: operationId: nodes.hot_threads.0 @@ -1556,33 +1528,6 @@ paths: responses: '200': $ref: '#/components/responses/nodes.hot_threads@200' - /_cluster/nodes/hotthreads: - get: - operationId: nodes.hot_threads.1 - x-operation-group: nodes.hot_threads - x-ignorable: true - deprecated: true - x-deprecation-message: The hot threads API accepts `hotthreads` but only `hot_threads` is documented - x-version-added: '1.0' - x-version-deprecated: '1.0' - description: Returns information about hot threads on each node in the cluster. - externalDocs: - url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ - parameters: - - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' - - $ref: '#/components/parameters/nodes.hot_threads::query.threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' - - $ref: '#/components/parameters/nodes.hot_threads::query.type' - - $ref: '#/components/parameters/_global::query.pretty' - - $ref: '#/components/parameters/_global::query.human' - - $ref: '#/components/parameters/_global::query.error_trace' - - $ref: '#/components/parameters/_global::query.source' - - $ref: '#/components/parameters/_global::query.filter_path' - responses: - '200': - $ref: '#/components/responses/nodes.hot_threads@200' /_cluster/pending_tasks: get: operationId: cluster.pending_tasks.0 @@ -1663,6 +1608,8 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/cluster.put_weighted_routing' responses: '200': $ref: '#/components/responses/cluster.put_weighted_routing@200' @@ -1674,6 +1621,8 @@ paths: description: Delete weighted shard routing weights. externalDocs: url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-awareness/#example-deleting-weights + requestBody: + $ref: '#/components/requestBodies/cluster.delete_weighted_routing' responses: '200': $ref: '#/components/responses/cluster.delete_weighted_routing@200' @@ -3101,34 +3050,6 @@ paths: responses: '200': $ref: '#/components/responses/nodes.hot_threads@200' - /_nodes/{node_id}/hotthreads: - get: - operationId: nodes.hot_threads.7 - x-operation-group: nodes.hot_threads - x-ignorable: true - deprecated: true - x-deprecation-message: The hot threads API accepts `hotthreads` but only `hot_threads` is documented - x-version-added: '1.0' - x-version-deprecated: '1.0' - description: Returns information about hot threads on each node in the cluster. - externalDocs: - url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ - parameters: - - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' - - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' - - $ref: '#/components/parameters/nodes.hot_threads::query.threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' - - $ref: '#/components/parameters/nodes.hot_threads::query.type' - - $ref: '#/components/parameters/_global::query.pretty' - - $ref: '#/components/parameters/_global::query.human' - - $ref: '#/components/parameters/_global::query.error_trace' - - $ref: '#/components/parameters/_global::query.source' - - $ref: '#/components/parameters/_global::query.filter_path' - responses: - '200': - $ref: '#/components/responses/nodes.hot_threads@200' /_nodes/{node_id}/reload_secure_settings: post: operationId: nodes.reload_secure_settings.1 @@ -3293,33 +3214,6 @@ paths: responses: '200': $ref: '#/components/responses/nodes.hot_threads@200' - /_nodes/hotthreads: - get: - operationId: nodes.hot_threads.5 - x-operation-group: nodes.hot_threads - x-ignorable: true - deprecated: true - x-deprecation-message: The hot threads API accepts `hotthreads` but only `hot_threads` is documented - x-version-added: '1.0' - x-version-deprecated: '1.0' - description: Returns information about hot threads on each node in the cluster. - externalDocs: - url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ - parameters: - - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.interval' - - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' - - $ref: '#/components/parameters/nodes.hot_threads::query.threads' - - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' - - $ref: '#/components/parameters/nodes.hot_threads::query.type' - - $ref: '#/components/parameters/_global::query.pretty' - - $ref: '#/components/parameters/_global::query.human' - - $ref: '#/components/parameters/_global::query.error_trace' - - $ref: '#/components/parameters/_global::query.source' - - $ref: '#/components/parameters/_global::query.filter_path' - responses: - '200': - $ref: '#/components/responses/nodes.hot_threads@200' /_nodes/reload_secure_settings: post: operationId: nodes.reload_secure_settings.0 @@ -3473,6 +3367,81 @@ paths: $ref: '#/components/responses/security.get_sslinfo@200' '500': $ref: '#/components/responses/security.get_sslinfo@500' + /_plugins/_asynchronous_search: + post: + operationId: asynchronous_search.search.0 + x-operation-group: asynchronous_search.search + x-version-added: '1.0' + description: Perform an asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#rest-api + parameters: + - $ref: '#/components/parameters/asynchronous_search.search::query.index' + - $ref: '#/components/parameters/asynchronous_search.search::query.keep_alive' + - $ref: '#/components/parameters/asynchronous_search.search::query.keep_on_completion' + - $ref: '#/components/parameters/asynchronous_search.search::query.wait_for_completion_timeout' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/asynchronous_search.search' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.search@200' + /_plugins/_asynchronous_search/{id}: + delete: + operationId: asynchronous_search.delete.0 + x-operation-group: asynchronous_search.delete + x-version-added: '1.0' + description: Delete asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#delete-searches-and-results + parameters: + - $ref: '#/components/parameters/asynchronous_search.delete::path.id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.delete@200' + get: + operationId: asynchronous_search.get.0 + x-operation-group: asynchronous_search.get + x-version-added: '1.0' + description: Get partial responses from asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#get-partial-results + parameters: + - $ref: '#/components/parameters/asynchronous_search.get::path.id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.get@200' + /_plugins/_asynchronous_search/stats: + get: + operationId: asynchronous_search.stats.0 + x-operation-group: asynchronous_search.stats + x-version-added: '1.0' + description: Monitoring of asynchronous searches that are running, completed, and/or persisted. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#monitor-stats + responses: + '200': + $ref: '#/components/responses/asynchronous_search.stats@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' /_plugins/_knn/{node_id}/stats: get: operationId: knn.stats.2 @@ -11006,6 +10975,89 @@ paths: responses: '200': $ref: '#/components/responses/indices.validate_query@200' + /_opendistro/_asynchronous_search: + post: + operationId: asynchronous_search.search.0_superseded + x-operation-group: asynchronous_search.search + x-version-added: '1.0' + description: Perform an asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#rest-api + parameters: + - $ref: '#/components/parameters/asynchronous_search.search::query.index' + - $ref: '#/components/parameters/asynchronous_search.search::query.keep_alive' + - $ref: '#/components/parameters/asynchronous_search.search::query.keep_on_completion' + - $ref: '#/components/parameters/asynchronous_search.search::query.wait_for_completion_timeout' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/asynchronous_search.search' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.search@200' + deprecated: true + x-ignorable: true + /_opendistro/_asynchronous_search/stats: + get: + operationId: asynchronous_search.stats.0_superseded + x-operation-group: asynchronous_search.stats + x-version-added: '1.0' + description: Monitoring of asynchronous searches that are running, completed, and/or persisted. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#monitor-stats + responses: + '200': + $ref: '#/components/responses/asynchronous_search.stats@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true + /_opendistro/_asynchronous_search/{id}: + get: + operationId: asynchronous_search.get.0_superseded + x-operation-group: asynchronous_search.get + x-version-added: '1.0' + description: Get partial responses from asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#get-partial-results + parameters: + - $ref: '#/components/parameters/asynchronous_search.get::path.id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.get@200' + deprecated: true + x-ignorable: true + delete: + operationId: asynchronous_search.delete.0_superseded + x-operation-group: asynchronous_search.delete + x-version-added: '1.0' + description: Delete asynchronous search. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/async/index/#delete-searches-and-results + parameters: + - $ref: '#/components/parameters/asynchronous_search.delete::path.id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/asynchronous_search.delete@200' + deprecated: true + x-ignorable: true /_opendistro/_knn/stats/{stat}: get: operationId: knn.stats.1_superseded @@ -12876,6 +12928,112 @@ paths: $ref: '#/components/responses/sql.post_stats@200' deprecated: true x-ignorable: true + /_cluster/nodes/hotthreads: + get: + operationId: nodes.hot_threads.0_superseded + x-operation-group: nodes.hot_threads + x-ignorable: true + deprecated: true + x-deprecation-message: The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons + x-version-added: '1.0' + x-version-deprecated: '1.0' + description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ + parameters: + - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.interval' + - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' + - $ref: '#/components/parameters/nodes.hot_threads::query.threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' + - $ref: '#/components/parameters/nodes.hot_threads::query.type' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/nodes.hot_threads@200' + /_cluster/nodes/{node_id}/hotthreads: + get: + operationId: nodes.hot_threads.2_superseded + x-operation-group: nodes.hot_threads + x-ignorable: true + deprecated: true + x-deprecation-message: The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons + x-version-added: '1.0' + x-version-deprecated: '1.0' + description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ + parameters: + - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' + - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.interval' + - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' + - $ref: '#/components/parameters/nodes.hot_threads::query.threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' + - $ref: '#/components/parameters/nodes.hot_threads::query.type' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/nodes.hot_threads@200' + /_nodes/{node_id}/hotthreads: + get: + operationId: nodes.hot_threads.6_superseded + x-operation-group: nodes.hot_threads + x-version-added: '1.0' + description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ + parameters: + - $ref: '#/components/parameters/nodes.hot_threads::path.node_id' + - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.interval' + - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' + - $ref: '#/components/parameters/nodes.hot_threads::query.threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' + - $ref: '#/components/parameters/nodes.hot_threads::query.type' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/nodes.hot_threads@200' + deprecated: true + x-ignorable: true + /_nodes/hotthreads: + get: + operationId: nodes.hot_threads.4_superseded + x-operation-group: nodes.hot_threads + x-version-added: '1.0' + description: Returns information about hot threads on each node in the cluster. + externalDocs: + url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ + parameters: + - $ref: '#/components/parameters/nodes.hot_threads::query.ignore_idle_threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.interval' + - $ref: '#/components/parameters/nodes.hot_threads::query.snapshots' + - $ref: '#/components/parameters/nodes.hot_threads::query.threads' + - $ref: '#/components/parameters/nodes.hot_threads::query.timeout' + - $ref: '#/components/parameters/nodes.hot_threads::query.type' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/nodes.hot_threads@200' + deprecated: true + x-ignorable: true components: parameters: _global::query.pretty: @@ -12920,6 +13078,40 @@ components: items: type: string x-global: true + asynchronous_search.delete::path.id: + name: id + in: path + schema: + type: string + asynchronous_search.get::path.id: + name: id + in: path + schema: + type: string + asynchronous_search.search::query.index: + name: index + in: query + description: The name of the index to be searched. + schema: + type: string + asynchronous_search.search::query.keep_alive: + name: keep_alive + in: query + description: The amount of time that the result is saved in the cluster. + schema: + type: string + asynchronous_search.search::query.keep_on_completion: + name: keep_on_completion + in: query + description: Whether you want to save the results in the cluster after the search is complete. + schema: + type: boolean + asynchronous_search.search::query.wait_for_completion_timeout: + name: wait_for_completion_timeout + in: query + description: The amount of time that you plan to wait for the results. + schema: + type: string bulk::path.index: in: path name: index @@ -13080,7 +13272,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' cat.all_pit_segments::query.format: name: format in: query @@ -13139,7 +13331,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.allocation::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -13188,7 +13380,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.allocation::query.s: @@ -13257,7 +13449,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.cluster_manager::query.s: @@ -13349,7 +13541,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.fielddata::query.fields: in: query @@ -13478,7 +13670,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.indices::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -13549,7 +13741,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.indices::query.pri: @@ -13633,7 +13825,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.master::query.s: @@ -13702,7 +13894,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.nodeattrs::query.s: @@ -13729,7 +13921,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.nodes::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -13791,7 +13983,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.nodes::query.s: @@ -13866,7 +14058,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.pending_tasks::query.s: @@ -13899,7 +14091,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' cat.pit_segments::query.format: name: format in: query @@ -13992,7 +14184,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.plugins::query.s: @@ -14037,7 +14229,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.recovery::query.detailed: in: query @@ -14156,7 +14348,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.repositories::query.s: @@ -14208,7 +14400,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' cat.segment_replication::query.completed_only: name: completed_only in: query @@ -14340,7 +14532,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.segments::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -14381,7 +14573,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.segments::query.s: @@ -14419,7 +14611,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:StorageType' style: form cat.shards::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -14468,7 +14660,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.shards::query.s: @@ -14555,7 +14747,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.snapshots::query.s: @@ -14726,7 +14918,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.templates::query.s: @@ -14805,7 +14997,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true cat.thread_pool::query.s: @@ -14889,7 +15081,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.delete_component_template::query.timeout: in: query @@ -14952,7 +15144,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.get_component_template::path.name: in: path @@ -14991,7 +15183,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.get_decommission_awareness::path.awareness_attribute_name: name: awareness_attribute_name @@ -15034,7 +15226,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.get_settings::query.timeout: in: query @@ -15105,7 +15297,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.health::query.timeout: in: query @@ -15185,7 +15377,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.post_voting_config_exclusions::query.node_ids: in: query @@ -15254,7 +15446,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.put_component_template::query.timeout: name: timeout @@ -15301,7 +15493,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.put_settings::query.timeout: in: query @@ -15347,7 +15539,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.reroute::query.metric: in: query @@ -15440,7 +15632,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. cluster.state::query.wait_for_metadata_version: in: query @@ -15768,7 +15960,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. dangling_indices.delete_dangling_index::query.timeout: in: query @@ -15808,7 +16000,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. dangling_indices.import_dangling_index::query.timeout: in: query @@ -16150,7 +16342,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. delete_script::query.timeout: in: query @@ -16601,7 +16793,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. get_source::path.id: in: path @@ -16935,7 +17127,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.add_block::query.timeout: in: query @@ -17083,7 +17275,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.clone::query.task_execution_timeout: name: task_execution_timeout @@ -17170,7 +17362,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.close::query.timeout: in: query @@ -17229,7 +17421,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.create::query.timeout: in: query @@ -17297,7 +17489,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.delete_alias::query.timeout: in: query @@ -17339,7 +17531,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.delete_index_template::query.timeout: in: query @@ -17375,7 +17567,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.delete_template::query.timeout: in: query @@ -17444,7 +17636,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.delete::query.timeout: in: query @@ -17547,7 +17739,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.exists_template::path.name: in: path @@ -17588,7 +17780,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.exists::path.index: in: path @@ -17952,7 +18144,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.get_mapping::path.index: in: path @@ -18027,7 +18219,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.get_settings::path.index: in: path @@ -18121,7 +18313,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.get_template::path.name: in: path @@ -18167,7 +18359,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.get_upgrade::path.index: name: index @@ -18277,7 +18469,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.open::path.index: in: path @@ -18336,7 +18528,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.open::query.task_execution_timeout: name: task_execution_timeout @@ -18410,7 +18602,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.put_alias::query.timeout: in: query @@ -18458,7 +18650,7 @@ components: description: Operation timeout for connection to master node. schema: $ref: '#/components/schemas/_common:Duration' - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. deprecated: true indices.put_mapping::path.index: @@ -18513,7 +18705,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.put_mapping::query.timeout: in: query @@ -18599,7 +18791,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.put_settings::query.preserve_existing: in: query @@ -18651,7 +18843,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.put_template::query.order: in: query @@ -18795,7 +18987,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.rollover::query.timeout: in: query @@ -18947,7 +19139,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.shrink::query.task_execution_timeout: name: task_execution_timeout @@ -19028,7 +19220,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.simulate_template::path.name: in: path @@ -19071,7 +19263,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.split::path.index: in: path @@ -19114,7 +19306,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.split::query.task_execution_timeout: name: task_execution_timeout @@ -19255,7 +19447,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. indices.update_aliases::query.timeout: in: query @@ -19445,7 +19637,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. ingest.delete_pipeline::query.timeout: in: query @@ -19484,7 +19676,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. ingest.put_pipeline::path.id: in: path @@ -19509,7 +19701,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. ingest.put_pipeline::query.timeout: in: query @@ -20895,7 +21087,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. put_script::query.timeout: in: query @@ -22135,7 +22327,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.cleanup_repository::query.timeout: in: query @@ -22183,7 +22375,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.create_repository::path.repository: in: path @@ -22208,7 +22400,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.create_repository::query.timeout: in: query @@ -22255,7 +22447,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.create::query.wait_for_completion: in: query @@ -22288,7 +22480,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.delete_repository::query.timeout: in: query @@ -22328,7 +22520,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.get_repository::path.repository: in: path @@ -22361,7 +22553,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.get::path.repository: in: path @@ -22405,7 +22597,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.get::query.verbose: in: query @@ -22445,7 +22637,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.restore::query.wait_for_completion: in: query @@ -22494,7 +22686,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.verify_repository::path.repository: in: path @@ -22519,7 +22711,7 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager_timeout' instead. snapshot.verify_repository::query.timeout: in: query @@ -23363,6 +23555,11 @@ components: style: form x-default: '1' requestBodies: + asynchronous_search.search: + content: + application/json: + schema: + $ref: '#/components/schemas/asynchronous_search._common:Search' bulk: content: application/x-ndjson: @@ -23414,6 +23611,11 @@ components: description: Specifies the ID of the shard that you would like an explanation for. type: number description: The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' + cluster.delete_weighted_routing: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster.weighted_routing:WeightsBase' cluster.put_component_template: content: application/json: @@ -23451,6 +23653,11 @@ components: additionalProperties: {} description: The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). required: true + cluster.put_weighted_routing: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster.weighted_routing:Weights' cluster.reroute: content: application/json: @@ -24344,10 +24551,10 @@ components: knn: description: Defines the approximate kNN search to run. oneOf: - - $ref: '#/components/schemas/_common:KnnQuery' + - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' - type: array items: - $ref: '#/components/schemas/_common:KnnQuery' + $ref: '#/components/schemas/_common.query_dsl:KnnQuery' rank: $ref: '#/components/schemas/_common:RankContainer' min_score: @@ -24864,6 +25071,29 @@ components: $ref: '#/components/schemas/_common:Conflicts' description: The search definition using the Query DSL responses: + asynchronous_search.delete@200: + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + asynchronous_search.get@200: + content: + application/json: + schema: + $ref: '#/components/schemas/asynchronous_search._common:ResponseBody' + asynchronous_search.search@200: + content: + application/json: + schema: + $ref: '#/components/schemas/asynchronous_search._common:ResponseBody' + asynchronous_search.stats@200: + content: + application/json: + schema: + $ref: '#/components/schemas/asynchronous_search._common:StatsResponse' bulk@200: content: application/json: @@ -25215,11 +25445,19 @@ components: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' - cluster.delete_decommission_awareness@200: {} + cluster.delete_decommission_awareness@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:AcknowledgedResponseBase' cluster.delete_voting_config_exclusions@200: content: application/json: {} - cluster.delete_weighted_routing@200: {} + cluster.delete_weighted_routing@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:AcknowledgedResponseBase' cluster.exists_component_template@200: content: application/json: {} @@ -25235,7 +25473,11 @@ components: $ref: '#/components/schemas/cluster._common:ComponentTemplate' required: - component_templates - cluster.get_decommission_awareness@200: {} + cluster.get_decommission_awareness@200: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster.decommission_awareness:DecommissionStatusResponse' cluster.get_settings@200: content: application/json: @@ -25244,20 +25486,21 @@ components: properties: persistent: type: object - additionalProperties: - type: object + additionalProperties: true transient: type: object - additionalProperties: - type: object + additionalProperties: true defaults: type: object - additionalProperties: - type: object + additionalProperties: true required: - persistent - transient - cluster.get_weighted_routing@200: {} + cluster.get_weighted_routing@200: + content: + application/json: + schema: + $ref: '#/components/schemas/cluster.weighted_routing:WeightsResponse' cluster.health@200: content: application/json: @@ -25283,7 +25526,11 @@ components: application/json: schema: $ref: '#/components/schemas/_common:AcknowledgedResponseBase' - cluster.put_decommission_awareness@200: {} + cluster.put_decommission_awareness@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:AcknowledgedResponseBase' cluster.put_settings@200: content: application/json: @@ -25302,7 +25549,11 @@ components: - acknowledged - persistent - transient - cluster.put_weighted_routing@200: {} + cluster.put_weighted_routing@200: + content: + application/json: + schema: + type: object cluster.remote_info@200: content: application/json: @@ -25346,6 +25597,8 @@ components: schema: type: object properties: + terminated_early: + type: boolean count: type: number _shards: @@ -25416,42 +25669,12 @@ components: content: application/json: schema: - type: object - properties: - batches: - type: number - deleted: - type: number - failures: - type: array - items: - $ref: '#/components/schemas/_common:BulkIndexByScrollFailure' - noops: - type: number - requests_per_second: - type: number - retries: - $ref: '#/components/schemas/_common:Retries' - slice_id: - type: number - task: - $ref: '#/components/schemas/_common:TaskId' - throttled: - $ref: '#/components/schemas/_common:Duration' - throttled_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - throttled_until: - $ref: '#/components/schemas/_common:Duration' - throttled_until_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - timed_out: - type: boolean - took: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - total: - type: number - version_conflicts: - type: number + anyOf: + - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' + - type: object + properties: + task: + $ref: '#/components/schemas/_common:TaskId' delete_pit@200: content: application/json: @@ -25699,10 +25922,10 @@ components: items: $ref: '#/components/schemas/indices.data_streams_stats:DataStreamsStatsItem' total_store_sizes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' total_store_size_bytes: description: Total size, in bytes, of all shards for the selected data streams. - type: number + $ref: '#/components/schemas/_common:Bytes' required: - _shards - backing_indices @@ -26239,7 +26462,9 @@ components: $ref: '#/components/schemas/_core.mtermvectors:TermVectorsResult' required: - docs - nodes.hot_threads@200: {} + nodes.hot_threads@200: + content: + text/plain: {} nodes.info@200: content: application/json: @@ -26541,42 +26766,12 @@ components: content: application/json: schema: - type: object - properties: - batches: - type: number - created: - type: number - deleted: - type: number - failures: - type: array - items: - $ref: '#/components/schemas/_common:BulkIndexByScrollFailure' - noops: - type: number - retries: - $ref: '#/components/schemas/_common:Retries' - requests_per_second: - type: number - slice_id: - type: number - task: - $ref: '#/components/schemas/_common:TaskId' - throttled_millis: - $ref: '#/components/schemas/_common:EpochTimeUnitMillis' - throttled_until_millis: - $ref: '#/components/schemas/_common:EpochTimeUnitMillis' - timed_out: - type: boolean - took: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - total: - type: number - updated: - type: number - version_conflicts: - type: number + anyOf: + - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' + - type: object + properties: + task: + $ref: '#/components/schemas/_common:TaskId' remote_store.restore@200: content: application/json: @@ -27541,7 +27736,7 @@ components: task: $ref: '#/components/schemas/tasks._common:TaskInfo' response: - type: object + $ref: '#/components/schemas/tasks._common:TaskResponse' error: $ref: '#/components/schemas/_common:ErrorCause' required: @@ -27630,42 +27825,12 @@ components: content: application/json: schema: - type: object - properties: - batches: - type: number - failures: - type: array - items: - $ref: '#/components/schemas/_common:BulkIndexByScrollFailure' - noops: - type: number - deleted: - type: number - requests_per_second: - type: number - retries: - $ref: '#/components/schemas/_common:Retries' - task: - $ref: '#/components/schemas/_common:TaskId' - timed_out: - type: boolean - took: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - total: - type: number - updated: - type: number - version_conflicts: - type: number - throttled: - $ref: '#/components/schemas/_common:Duration' - throttled_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' - throttled_until: - $ref: '#/components/schemas/_common:Duration' - throttled_until_millis: - $ref: '#/components/schemas/_common:DurationValueUnitMillis' + anyOf: + - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' + - type: object + properties: + task: + $ref: '#/components/schemas/_common:TaskId' update@200: content: application/json: @@ -27705,12 +27870,100 @@ components: transport_address: $ref: '#/components/schemas/_common:TransportAddress' required: - - attributes - - host - - ip - name - - transport_address - _common:BulkIndexByScrollFailure: + _common:BulkByScrollFailure: + anyOf: + - $ref: '#/components/schemas/_common:BulkItemResponseFailure' + - $ref: '#/components/schemas/_common:ScrollableHitSourceSearchFailure' + _common:BulkByScrollResponseBase: + allOf: + - $ref: '#/components/schemas/_common:BulkByScrollTaskStatus' + - type: object + properties: + took: + type: integer + format: int64 + timed_out: + type: boolean + failures: + type: array + items: + $ref: '#/components/schemas/_common:BulkByScrollFailure' + required: + - failures + - timed_out + - took + _common:BulkByScrollTaskStatus: + type: object + properties: + slice_id: + type: integer + format: int32 + total: + description: The number of documents that were successfully processed. + type: integer + format: int64 + updated: + description: The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it. + type: integer + format: int64 + created: + description: The number of documents that were successfully created. + type: integer + format: int64 + deleted: + description: The number of documents that were successfully deleted. + type: integer + format: int64 + batches: + description: The number of scroll responses pulled back by the reindex. + type: integer + format: int32 + version_conflicts: + description: The number of version conflicts that reindex hits. + type: integer + format: int64 + noops: + description: The number of documents that were ignored. + type: integer + format: int64 + retries: + $ref: '#/components/schemas/_common:Retries' + throttled_millis: + $ref: '#/components/schemas/_common:DurationValueUnitMillis' + throttled: + $ref: '#/components/schemas/_common:Duration' + requests_per_second: + description: The number of requests per second effectively executed during the reindex. + type: number + format: float + canceled: + type: string + throttled_until_millis: + $ref: '#/components/schemas/_common:DurationValueUnitMillis' + throttled_until: + $ref: '#/components/schemas/_common:Duration' + slices: + type: array + items: + $ref: '#/components/schemas/_common:BulkByScrollTaskStatusOrException' + required: + - batches + - deleted + - noops + - requests_per_second + - retries + - throttled_millis + - throttled_until_millis + - total + - version_conflicts + _common:BulkByScrollTaskStatusOrException: + oneOf: + - title: status + $ref: '#/components/schemas/_common:BulkByScrollTaskStatus' + - title: exception + $ref: '#/components/schemas/_common:ErrorCause' + _common:BulkItemResponseFailure: type: object properties: cause: @@ -27720,35 +27973,16 @@ components: index: $ref: '#/components/schemas/_common:IndexName' status: - type: number - type: - type: string + type: integer + format: int32 required: - cause - - id - index - status - - type _common:byte: type: number _common:Bytes: - type: string - enum: - - b - - g - - gb - - k - - kb - - m - - mb - - p - - pb - - t - - tb - _common:ByteSize: - oneOf: - - type: number - - type: string + type: integer _common:ClusterDetails: type: object properties: @@ -27809,9 +28043,9 @@ components: properties: size_in_bytes: description: Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' fields: type: object additionalProperties: @@ -28008,9 +28242,9 @@ components: evictions: type: number memory_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' memory_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' fields: type: object additionalProperties: @@ -28021,9 +28255,9 @@ components: type: object properties: memory_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' memory_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - memory_size_in_bytes _common:Fields: @@ -28036,9 +28270,9 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - size_in_bytes _common:FieldValue: @@ -28162,7 +28396,7 @@ components: properties: total: type: number - time: + getTime: $ref: '#/components/schemas/_common:Duration' time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' @@ -28363,38 +28597,34 @@ components: - source _common:Ip: type: string - _common:KnnQuery: + _common:KnnField: type: object properties: - field: - $ref: '#/components/schemas/_common:Field' - query_vector: + vector: $ref: '#/components/schemas/_common:QueryVector' - query_vector_builder: - $ref: '#/components/schemas/_common:QueryVectorBuilder' k: - description: The final number of nearest neighbors to return as top hits + description: The final number of nearest neighbors to return as top hits. type: number - num_candidates: - description: The number of nearest neighbor candidates to consider per shard + min_score: + description: The minimum similarity score for a neighbor to be considered a hit. type: number - boost: - description: Boost value to apply to kNN scores + x-version-added: '2.14' + max_distance: + description: The maximum physical distance in vector space for a neighbor to be considered a hit. type: number + x-version-added: '2.14' filter: - description: Filters for the kNN search query + description: Filters for the kNN search query. oneOf: - $ref: '#/components/schemas/_common.query_dsl:QueryContainer' - type: array items: $ref: '#/components/schemas/_common.query_dsl:QueryContainer' - similarity: - description: The minimum similarity for a vector to be considered a match + boost: + description: Boost value to apply to kNN scores type: number required: - - field - - k - - num_candidates + - vector _common:LatLonGeoLocation: type: object properties: @@ -28421,21 +28651,21 @@ components: current_docs: type: number current_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' current_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' total: type: number total_auto_throttle: - type: string + $ref: '#/components/schemas/_common:StorageSize' total_auto_throttle_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' total_docs: type: number total_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' total_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' total_stopped_time: $ref: '#/components/schemas/_common:Duration' total_stopped_time_in_millis: @@ -28551,6 +28781,8 @@ components: - remote_cluster_client - transform - voting_only + x-deprecated-enums: + - master _common:NodeRoles: description: Node roles. type: array @@ -28599,13 +28831,13 @@ components: $ref: '#/components/schemas/_common:ErrorCause' total: description: Total number of nodes selected by the request. - type: number + type: integer successful: description: Number of nodes that responded successfully to the request. - type: number + type: integer failed: description: Number of nodes that rejected the request or failed to respond. If this value is not 0, a reason for the rejection or failure is included in the response. - type: number + type: integer required: - failed - successful @@ -28750,10 +28982,10 @@ components: description: Total count of query cache hits across all shards assigned to selected nodes. type: number memory_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' memory_size_in_bytes: description: Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' miss_count: description: Total count of query cache misses across all shards assigned to selected nodes. type: number @@ -28772,13 +29004,6 @@ components: type: array items: type: number - _common:QueryVectorBuilder: - type: object - properties: - text_embedding: - $ref: '#/components/schemas/_common:TextEmbedding' - minProperties: 1 - maxProperties: 1 _common:RankBase: type: object _common:RankContainer: @@ -28814,6 +29039,8 @@ components: properties: external_total: type: number + external_total_time: + $ref: '#/components/schemas/_common:Duration' external_total_time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' listeners: @@ -28846,6 +29073,9 @@ components: total_download_size: description: The total amount of data download from the remote segment store. $ref: '#/components/schemas/_common:RemoteStoreUploadDownloadStats' + total_time_spent: + description: The total duration, spent on downloads from the remote segment store. + $ref: '#/components/schemas/_common:Duration' total_time_spent_in_millis: description: The total duration, in milliseconds, spent on downloads from the remote segment store. $ref: '#/components/schemas/_common:DurationValueUnitMillis' @@ -28885,15 +29115,24 @@ components: type: object description: The total amount of data uploaded to the remote translog store. properties: + failed: + description: The number of bytes that failed to upload to the remote translog store. + $ref: '#/components/schemas/_common:StorageSize' failed_bytes: description: The number of bytes that failed to upload to the remote translog store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + started: + description: The number of bytes successfully uploaded to the remote translog store. + $ref: '#/components/schemas/_common:StorageSize' started_bytes: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + succeeded: + description: The number of bytes successfully uploaded to the remote translog store. + $ref: '#/components/schemas/_common:StorageSize' succeeded_bytes: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' required: - failed_bytes - started_bytes @@ -28919,15 +29158,24 @@ components: type: object description: The amount of data, in bytes, uploaded or downloaded to/from the remote segment store. properties: + failed: + description: The number of bytes that failed to upload/upload to/from the remote segment store. + $ref: '#/components/schemas/_common:StorageSize' failed_bytes: description: The number of bytes that failed to upload/upload to/from the remote segment store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + started: + description: The number of bytes to upload/download to/from the remote segment store after the upload/download has started. + $ref: '#/components/schemas/_common:StorageSize' started_bytes: description: The number of bytes to upload/download to/from the remote segment store after the upload/download has started. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + succeeded: + description: The number of bytes successfully uploaded/downloaded to/from the remote segment store. + $ref: '#/components/schemas/_common:StorageSize' succeeded_bytes: description: The number of bytes successfully uploaded/downloaded to/from the remote segment store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' required: - failed_bytes - started_bytes @@ -28945,12 +29193,18 @@ components: type: object description: The amount of lag during upload between the remote segment store and the local store. properties: + max: + description: The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. + $ref: '#/components/schemas/_common:StorageSize' max_bytes: description: The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + total: + description: The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. + $ref: '#/components/schemas/_common:StorageSize' total_bytes: description: The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' required: - max_bytes - total_bytes @@ -28958,6 +29212,9 @@ components: type: object description: Statistics related to uploads to the remote segment store. properties: + max_refresh_time_lag: + description: The maximum duration that the remote refresh is behind the local refresh. + $ref: '#/components/schemas/_common:Duration' max_refresh_time_lag_in_millis: description: The maximum duration, in milliseconds, that the remote refresh is behind the local refresh. $ref: '#/components/schemas/_common:DurationValueUnitMillis' @@ -28965,6 +29222,9 @@ components: $ref: '#/components/schemas/_common:RemoteStoreUploadPressureStats' refresh_size_lag: $ref: '#/components/schemas/_common:RemoteStoreUploadRefreshSizeLagStats' + total_time_spent: + description: The total amount of time, spent on uploads to the remote segment store. + $ref: '#/components/schemas/_common:Duration' total_time_spent_in_millis: description: The total amount of time, in milliseconds, spent on uploads to the remote segment store. $ref: '#/components/schemas/_common:DurationValueUnitMillis' @@ -28984,9 +29244,9 @@ components: hit_count: type: number memory_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' memory_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' miss_count: type: number required: @@ -28997,6 +29257,8 @@ components: _common:RequestStats: type: object properties: + time: + $ref: '#/components/schemas/_common:Duration' time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' current: @@ -29015,9 +29277,11 @@ components: type: object properties: bulk: - type: number + type: integer + format: int64 search: - type: number + type: integer + format: int64 required: - bulk - search @@ -29094,6 +29358,24 @@ components: - number - string - version + _common:ScrollableHitSourceSearchFailure: + type: object + properties: + index: + $ref: '#/components/schemas/_common:IndexName' + shard: + type: integer + format: int32 + node: + type: string + status: + type: integer + format: int32 + reason: + $ref: '#/components/schemas/_common:ErrorCause' + required: + - reason + - status _common:ScrollId: type: string _common:ScrollIds: @@ -29214,11 +29496,11 @@ components: type: object properties: max_bytes_behind: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' max_replication_lag: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' total_bytes_behind: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' required: - max_bytes_behind - max_replication_lag @@ -29230,10 +29512,10 @@ components: description: Total number of segments across all shards assigned to selected nodes. type: number doc_values_memory: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' doc_values_memory_in_bytes: description: Total amount, in bytes, of memory used for doc values across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' file_sizes: description: |- This object is not populated by the cluster stats API. @@ -29242,55 +29524,62 @@ components: additionalProperties: $ref: '#/components/schemas/indices.stats:ShardFileSizeInfo' fixed_bit_set: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' fixed_bit_set_memory_in_bytes: description: Total amount of memory, in bytes, used by fixed bit sets across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' index_writer_memory: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' index_writer_max_memory_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' index_writer_memory_in_bytes: description: Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' max_unsafe_auto_id_timestamp: description: Unix timestamp, in milliseconds, of the most recently retried indexing request. type: number memory: - $ref: '#/components/schemas/_common:ByteSize' + description: Total amount, of memory used for segments across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' memory_in_bytes: description: Total amount, in bytes, of memory used for segments across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' norms_memory: - $ref: '#/components/schemas/_common:ByteSize' + description: Total amount of memory used for normalization factors across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' norms_memory_in_bytes: description: Total amount, in bytes, of memory used for normalization factors across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' points_memory: - $ref: '#/components/schemas/_common:ByteSize' + description: Total amount of memory used for points across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' points_memory_in_bytes: description: Total amount, in bytes, of memory used for points across all shards assigned to selected nodes. - type: number - stored_memory: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + stored_fields_memory: + description: Total amount of memory used for stored fields across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' stored_fields_memory_in_bytes: description: Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' + terms_memory: + description: Total amount of memory used for terms across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' terms_memory_in_bytes: description: Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes. - type: number - terms_memory: - $ref: '#/components/schemas/_common:ByteSize' - term_vectory_memory: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' + term_vectors_memory: + description: Total amount of memory used for term vectors across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' term_vectors_memory_in_bytes: description: Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' version_map_memory: - $ref: '#/components/schemas/_common:ByteSize' + description: Total amount of memory used by all version maps across all shards assigned to selected nodes. + $ref: '#/components/schemas/_common:StorageSize' version_map_memory_in_bytes: description: Total amount, in bytes, of memory used by all version maps across all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' remote_store: $ref: '#/components/schemas/_common:RemoteStoreStats' segment_replication: @@ -29310,7 +29599,7 @@ components: - terms_memory_in_bytes - version_map_memory_in_bytes _common:SequenceNumber: - type: number + type: integer format: int64 _common:ShardFailure: type: object @@ -29322,7 +29611,7 @@ components: reason: $ref: '#/components/schemas/_common:ErrorCause' shard: - type: number + type: integer status: type: string required: @@ -29417,6 +29706,23 @@ components: type: array items: $ref: '#/components/schemas/_common:FieldValue' + _common:StorageSize: + type: string + pattern: \d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p) + _common:StorageType: + type: string + enum: + - b + - g + - gb + - k + - kb + - m + - mb + - p + - pb + - t + - tb _common:StoredScript: type: object properties: @@ -29445,15 +29751,15 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: description: Total size, in bytes, of all shards assigned to selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' reserved: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' reserved_in_bytes: description: A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. - type: number + $ref: '#/components/schemas/_common:Bytes' required: - reserved_in_bytes - size_in_bytes @@ -29517,7 +29823,7 @@ components: type: object properties: task_id: - type: number + type: integer node_id: $ref: '#/components/schemas/_common:NodeId' status: @@ -29533,16 +29839,6 @@ components: oneOf: - type: string - type: number - _common:TextEmbedding: - type: object - properties: - model_id: - type: string - model_text: - type: string - required: - - model_id - - model_text _common:TimeOfDay: description: Time of day, expressed as HH:MM:SS. type: string @@ -29588,15 +29884,15 @@ components: remote_store: $ref: '#/components/schemas/_common:RemoteStoreTranslogStats' size: - type: string + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' uncommitted_operations: type: number uncommitted_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' uncommitted_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - earliest_last_modified_age - operations @@ -29609,16 +29905,17 @@ components: type: string x-version-removed: '2.0' _common:uint: - type: number + type: integer _common:ulong: type: number _common:UnitMillis: description: Time unit for milliseconds. - type: number + type: integer format: int64 _common:UnitNanos: description: Time unit for nanoseconds. - type: number + type: integer + format: int64 _common:UnitSeconds: description: Time unit for seconds. type: number @@ -29627,7 +29924,7 @@ components: _common:Uuid: type: string _common:VersionNumber: - type: number + type: integer format: int64 _common:VersionString: type: string @@ -29697,7 +29994,7 @@ components: _index: $ref: '#/components/schemas/_common:IndexName' _primary_term: - type: number + type: integer format: int64 result: $ref: '#/components/schemas/_common:Result' @@ -37025,6 +37322,12 @@ components: $ref: '#/components/schemas/_common:Field' required: - pattern + _common.query_dsl:KnnQuery: + type: object + additionalProperties: + $ref: '#/components/schemas/_common:KnnField' + minProperties: 1 + maxProperties: 1 _common.query_dsl:Like: description: Text that we want similar documents for or a lookup to a document's field for the text. oneOf: @@ -37566,6 +37869,8 @@ components: $ref: '#/components/schemas/_common.query_dsl:IntervalsQuery' minProperties: 1 maxProperties: 1 + knn: + $ref: '#/components/schemas/_common.query_dsl:KnnQuery' match: description: |- Returns documents that match a provided text, number, date or boolean value. @@ -38204,10 +38509,27 @@ components: type: boolean required: - value + _common.query_dsl:Terms: + oneOf: + - type: array + items: + type: string + - type: object + properties: + index: + $ref: '#/components/schemas/_common:IndexName' + id: + $ref: '#/components/schemas/_common:Id' + path: + $ref: '#/components/schemas/_common:Field' + routing: + $ref: '#/components/schemas/_common:Routing' + additionalProperties: true + description: Object for fetching terms. _common.query_dsl:TermsQuery: - allOf: + anyOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - - type: object + - $ref: '#/components/schemas/_common.query_dsl:Terms' _common.query_dsl:TermsSetQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -38218,10 +38540,7 @@ components: minimum_should_match_script: $ref: '#/components/schemas/_common:Script' terms: - description: Array of terms you wish to find in the provided field. - type: array - items: - type: string + $ref: '#/components/schemas/_common.query_dsl:Terms' required: - terms _common.query_dsl:TextExpansionQuery: @@ -38749,10 +39068,10 @@ components: knn: description: Defines the approximate kNN search to run. oneOf: - - $ref: '#/components/schemas/_common:KnnQuery' + - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' - type: array items: - $ref: '#/components/schemas/_common:KnnQuery' + $ref: '#/components/schemas/_common.query_dsl:KnnQuery' from: description: |- Starting document offset. By default, you cannot page through more than 10,000 @@ -40294,6 +40613,186 @@ components: properties: get: $ref: '#/components/schemas/_common:InlineGet' + asynchronous_search._common:AsynchronousSearchStats: + type: object + properties: + submitted: + type: integer + initialized: + type: integer + search_failed: + type: integer + search_completed: + type: integer + rejected: + type: integer + persist_failed: + type: integer + cancelled: + type: integer + running_current: + type: integer + persisted: + type: integer + asynchronous_search._common:NodesStats: + type: object + properties: + asynchronous_search_stats: + $ref: '#/components/schemas/asynchronous_search._common:AsynchronousSearchStats' + asynchronous_search._common:ResponseBody: + type: object + properties: + id: + type: string + state: + type: string + start_time_in_millis: + type: number + expiration_time_in_millis: + type: number + took: + type: number + response: + $ref: '#/components/schemas/_core.search:ResponseBody' + asynchronous_search._common:Search: + type: object + properties: + aggregations: + description: Defines the aggregations that are run as part of the search request. + type: object + additionalProperties: + $ref: '#/components/schemas/_common.aggregations:AggregationContainer' + collapse: + $ref: '#/components/schemas/_core.search:FieldCollapse' + explain: + description: If true, returns detailed information about score computation as part of a hit. + type: boolean + ext: + description: Configuration of search extensions defined by OpenSearch plugins. + type: object + additionalProperties: + type: object + from: + description: |- + Starting document offset. + Needs to be non-negative. + By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. + To page through more hits, use the `search_after` parameter. + type: number + highlight: + $ref: '#/components/schemas/_core.search:Highlight' + track_total_hits: + $ref: '#/components/schemas/_core.search:TrackHits' + indices_boost: + description: Boosts the _score of documents from specified indices. + type: array + items: + type: object + additionalProperties: + type: number + docvalue_fields: + description: |- + Array of wildcard (`*`) patterns. + The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. + type: array + items: + $ref: '#/components/schemas/_common.query_dsl:FieldAndFormat' + rank: + $ref: '#/components/schemas/_common:RankContainer' + min_score: + description: |- + Minimum `_score` for matching documents. + Documents with a lower `_score` are not included in the search results. + type: number + post_filter: + $ref: '#/components/schemas/_common.query_dsl:QueryContainer' + profile: + description: |- + Set to `true` to return detailed timing information about the execution of individual components in a search request. + NOTE: This is a debugging tool and adds significant overhead to search execution. + type: boolean + query: + $ref: '#/components/schemas/_common.query_dsl:QueryContainer' + script_fields: + description: Retrieve a script evaluation (based on different fields) for each hit. + type: object + additionalProperties: + $ref: '#/components/schemas/_common:ScriptField' + search_after: + $ref: '#/components/schemas/_common:SortResults' + size: + description: |- + The number of hits to return. + By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. + To page through more hits, use the `search_after` parameter. + type: number + slice: + $ref: '#/components/schemas/_common:SlicedScroll' + sort: + $ref: '#/components/schemas/_common:Sort' + _source: + $ref: '#/components/schemas/_core.search:SourceConfig' + fields: + description: |- + Array of wildcard (`*`) patterns. + The request returns values for field names matching these patterns in the `hits.fields` property of the response. + type: array + items: + $ref: '#/components/schemas/_common.query_dsl:FieldAndFormat' + suggest: + $ref: '#/components/schemas/_core.search:Suggester' + terminate_after: + description: |- + Maximum number of documents to collect for each shard. + If a query reaches this limit, OpenSearch terminates the query early. + OpenSearch collects documents before sorting. + Use with caution. + OpenSearch applies this parameter to each shard handling the request. + When possible, let OpenSearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. + If set to `0` (default), the query does not terminate early. + type: number + timeout: + description: |- + Specifies the period of time to wait for a response from each shard. + If no response is received before the timeout expires, the request fails and returns an error. + Defaults to no timeout. + type: string + track_scores: + description: If true, calculate and return document scores, even if the scores are not used for sorting. + type: boolean + version: + description: If true, returns document version as part of a hit. + type: boolean + seq_no_primary_term: + description: If `true`, returns sequence number and primary term of the last modification of each hit. + type: boolean + stored_fields: + $ref: '#/components/schemas/_common:Fields' + pit: + $ref: '#/components/schemas/_core.search:PointInTimeReference' + runtime_mappings: + $ref: '#/components/schemas/_common.mapping:RuntimeFields' + stats: + description: |- + Stats groups to associate with the search. + Each group maintains a statistics aggregation for its associated searches. + You can retrieve these stats using the indices stats API. + type: array + items: + type: string + description: The search definition using the Query DSL. + asynchronous_search._common:StatsResponse: + type: object + properties: + _nodes: + $ref: '#/components/schemas/_common:NodeStatistics' + cluster_name: + type: string + nodes: + type: object + additionalProperties: + $ref: '#/components/schemas/asynchronous_search._common:NodesStats' cat._common:CatPitSegmentsRecord: type: object properties: @@ -40408,44 +40907,44 @@ components: description: |- Disk space used by the node's shards. Does not include disk space for the translog or unassigned shards. IMPORTANT: This metric double-counts disk space for hard-linked files, such as those created when shrinking, splitting, or cloning an index. - anyOf: - - $ref: '#/components/schemas/_common:ByteSize' - - type: 'null' + type: + - 'null' + - string disk.used: description: |- Total disk space in use. OpenSearch retrieves this metric from the node's operating system (OS). The metric includes disk space for: OpenSearch, including the translog and unassigned shards; the node's operating system; any other applications or files on the node. Unlike `disk.indices`, this metric does not double-count disk space for hard-linked files. - anyOf: - - $ref: '#/components/schemas/_common:ByteSize' - - type: 'null' + type: + - 'null' + - string disk.avail: description: |- Free disk space available to OpenSearch. OpenSearch retrieves this metric from the node's operating system. Disk-based shard allocation uses this metric to assign shards to nodes based on available disk space. - anyOf: - - $ref: '#/components/schemas/_common:ByteSize' - - type: 'null' + type: + - 'null' + - string disk.total: description: Total disk space for the node, including in-use and available space. - anyOf: - - $ref: '#/components/schemas/_common:ByteSize' - - type: 'null' + type: + - 'null' + - string disk.percent: description: Total percentage of disk space in use. Calculated as `disk.used / disk.total`. - anyOf: + oneOf: - $ref: '#/components/schemas/_common:Percentage' - type: 'null' host: description: Network host for the node. Set using the `network.host` setting. - anyOf: + oneOf: - $ref: '#/components/schemas/_common:Host' - type: 'null' ip: description: IP address and port for the node. - anyOf: + oneOf: - $ref: '#/components/schemas/_common:Ip' - type: 'null' node: @@ -40596,352 +41095,640 @@ components: - string completion.size: description: size of completion - type: string + type: + - 'null' + - string pri.completion.size: description: size of completion - type: string + type: + - 'null' + - string fielddata.memory_size: description: used fielddata cache - type: string + type: + - 'null' + - string pri.fielddata.memory_size: description: used fielddata cache - type: string + type: + - 'null' + - string fielddata.evictions: description: fielddata evictions - type: string + type: + - 'null' + - string pri.fielddata.evictions: description: fielddata evictions - type: string + type: + - 'null' + - string query_cache.memory_size: description: used query cache - type: string + type: + - 'null' + - string pri.query_cache.memory_size: description: used query cache - type: string + type: + - 'null' + - string query_cache.evictions: description: query cache evictions - type: string + type: + - 'null' + - string pri.query_cache.evictions: description: query cache evictions - type: string + type: + - 'null' + - string request_cache.memory_size: description: used request cache - type: string + type: + - 'null' + - string pri.request_cache.memory_size: description: used request cache - type: string + type: + - 'null' + - string request_cache.evictions: description: request cache evictions - type: string + type: + - 'null' + - string pri.request_cache.evictions: description: request cache evictions - type: string + type: + - 'null' + - string request_cache.hit_count: description: request cache hit count - type: string + type: + - 'null' + - string pri.request_cache.hit_count: description: request cache hit count - type: string + type: + - 'null' + - string request_cache.miss_count: description: request cache miss count - type: string + type: + - 'null' + - string pri.request_cache.miss_count: description: request cache miss count - type: string + type: + - 'null' + - string flush.total: description: number of flushes - type: string + type: + - 'null' + - string pri.flush.total: description: number of flushes - type: string + type: + - 'null' + - string flush.total_time: description: time spent in flush - type: string + type: + - 'null' + - string pri.flush.total_time: description: time spent in flush - type: string + type: + - 'null' + - string get.current: description: number of current get ops - type: string + type: + - 'null' + - string pri.get.current: description: number of current get ops - type: string + type: + - 'null' + - string get.time: description: time spent in get - type: string + type: + - 'null' + - string pri.get.time: description: time spent in get - type: string + type: + - 'null' + - string get.total: description: number of get ops - type: string + type: + - 'null' + - string pri.get.total: description: number of get ops - type: string + type: + - 'null' + - string get.exists_time: description: time spent in successful gets - type: string + type: + - 'null' + - string pri.get.exists_time: description: time spent in successful gets - type: string + type: + - 'null' + - string get.exists_total: description: number of successful gets - type: string + type: + - 'null' + - string pri.get.exists_total: description: number of successful gets - type: string + type: + - 'null' + - string get.missing_time: description: time spent in failed gets - type: string + type: + - 'null' + - string pri.get.missing_time: description: time spent in failed gets - type: string + type: + - 'null' + - string get.missing_total: description: number of failed gets - type: string + type: + - 'null' + - string pri.get.missing_total: description: number of failed gets - type: string + type: + - 'null' + - string indexing.delete_current: description: number of current deletions - type: string + type: + - 'null' + - string pri.indexing.delete_current: description: number of current deletions - type: string + type: + - 'null' + - string indexing.delete_time: description: time spent in deletions - type: string + type: + - 'null' + - string pri.indexing.delete_time: description: time spent in deletions - type: string + type: + - 'null' + - string indexing.delete_total: description: number of delete ops - type: string + type: + - 'null' + - string pri.indexing.delete_total: description: number of delete ops - type: string + type: + - 'null' + - string indexing.index_current: description: number of current indexing ops - type: string + type: + - 'null' + - string pri.indexing.index_current: description: number of current indexing ops - type: string + type: + - 'null' + - string indexing.index_time: description: time spent in indexing - type: string + type: + - 'null' + - string pri.indexing.index_time: description: time spent in indexing - type: string + type: + - 'null' + - string indexing.index_total: description: number of indexing ops - type: string + type: + - 'null' + - string pri.indexing.index_total: description: number of indexing ops - type: string + type: + - 'null' + - string indexing.index_failed: description: number of failed indexing ops - type: string + type: + - 'null' + - string pri.indexing.index_failed: description: number of failed indexing ops - type: string + type: + - 'null' + - string merges.current: description: number of current merges - type: string + type: + - 'null' + - string pri.merges.current: description: number of current merges - type: string + type: + - 'null' + - string merges.current_docs: description: number of current merging docs - type: string + type: + - 'null' + - string pri.merges.current_docs: description: number of current merging docs - type: string + type: + - 'null' + - string merges.current_size: description: size of current merges - type: string + type: + - 'null' + - string pri.merges.current_size: description: size of current merges - type: string + type: + - 'null' + - string merges.total: description: number of completed merge ops - type: string + type: + - 'null' + - string pri.merges.total: description: number of completed merge ops - type: string + type: + - 'null' + - string merges.total_docs: description: docs merged - type: string + type: + - 'null' + - string pri.merges.total_docs: description: docs merged - type: string + type: + - 'null' + - string merges.total_size: description: size merged - type: string + type: + - 'null' + - string pri.merges.total_size: description: size merged - type: string + type: + - 'null' + - string merges.total_time: description: time spent in merges - type: string + type: + - 'null' + - string pri.merges.total_time: description: time spent in merges - type: string + type: + - 'null' + - string refresh.total: description: total refreshes - type: string + type: + - 'null' + - string pri.refresh.total: description: total refreshes - type: string + type: + - 'null' + - string refresh.time: description: time spent in refreshes - type: string + type: + - 'null' + - string pri.refresh.time: description: time spent in refreshes - type: string + type: + - 'null' + - string refresh.external_total: description: total external refreshes - type: string + type: + - 'null' + - string pri.refresh.external_total: description: total external refreshes - type: string + type: + - 'null' + - string refresh.external_time: description: time spent in external refreshes - type: string + type: + - 'null' + - string pri.refresh.external_time: description: time spent in external refreshes - type: string + type: + - 'null' + - string refresh.listeners: description: number of pending refresh listeners - type: string + type: + - 'null' + - string pri.refresh.listeners: description: number of pending refresh listeners - type: string + type: + - 'null' + - string search.fetch_current: description: current fetch phase ops - type: string + type: + - 'null' + - string pri.search.fetch_current: description: current fetch phase ops - type: string + type: + - 'null' + - string search.fetch_time: description: time spent in fetch phase - type: string + type: + - 'null' + - string pri.search.fetch_time: description: time spent in fetch phase - type: string + type: + - 'null' + - string search.fetch_total: description: total fetch ops - type: string + type: + - 'null' + - string pri.search.fetch_total: description: total fetch ops - type: string + type: + - 'null' + - string search.open_contexts: description: open search contexts - type: string + type: + - 'null' + - string pri.search.open_contexts: description: open search contexts - type: string + type: + - 'null' + - string search.query_current: description: current query phase ops - type: string + type: + - 'null' + - string pri.search.query_current: description: current query phase ops - type: string + type: + - 'null' + - string search.query_time: description: time spent in query phase - type: string + type: + - 'null' + - string pri.search.query_time: description: time spent in query phase - type: string + type: + - 'null' + - string search.query_total: description: total query phase ops - type: string + type: + - 'null' + - string pri.search.query_total: description: total query phase ops - type: string + type: + - 'null' + - string + search.concurrent_query_current: + type: + - 'null' + - string + pri.search.concurrent_query_current: + type: + - 'null' + - string + search.concurrent_query_time: + type: + - 'null' + - string + pri.search.concurrent_query_time: + type: + - 'null' + - string + search.concurrent_query_total: + type: + - 'null' + - string + pri.search.concurrent_query_total: + type: + - 'null' + - string + search.concurrent_avg_slice_count: + type: + - 'null' + - string + pri.search.concurrent_avg_slice_count: + type: + - 'null' + - string search.scroll_current: description: open scroll contexts - type: string + type: + - 'null' + - string pri.search.scroll_current: description: open scroll contexts - type: string + type: + - 'null' + - string search.scroll_time: description: time scroll contexts held open - type: string + type: + - 'null' + - string pri.search.scroll_time: description: time scroll contexts held open - type: string + type: + - 'null' + - string search.scroll_total: description: completed scroll contexts - type: string + type: + - 'null' + - string pri.search.scroll_total: description: completed scroll contexts - type: string + type: + - 'null' + - string + search.point_in_time_current: + type: + - 'null' + - string + pri.search.point_in_time_current: + type: + - 'null' + - string + search.point_in_time_time: + type: + - 'null' + - string + pri.search.point_in_time_time: + type: + - 'null' + - string + search.point_in_time_total: + type: + - 'null' + - string + pri.search.point_in_time_total: + type: + - 'null' + - string segments.count: description: number of segments - type: string + type: + - 'null' + - string pri.segments.count: description: number of segments - type: string + type: + - 'null' + - string segments.memory: description: memory used by segments - type: string + type: + - 'null' + - string pri.segments.memory: description: memory used by segments - type: string + type: + - 'null' + - string segments.index_writer_memory: description: memory used by index writer - type: string + type: + - 'null' + - string pri.segments.index_writer_memory: description: memory used by index writer - type: string + type: + - 'null' + - string segments.version_map_memory: description: memory used by version map - type: string + type: + - 'null' + - string pri.segments.version_map_memory: description: memory used by version map - type: string + type: + - 'null' + - string segments.fixed_bitset_memory: description: memory used by fixed bit sets for nested object field types and export type filters for types referred in _parent fields - type: string + type: + - 'null' + - string pri.segments.fixed_bitset_memory: description: memory used by fixed bit sets for nested object field types and export type filters for types referred in _parent fields - type: string + type: + - 'null' + - string warmer.current: description: current warmer ops - type: string + type: + - 'null' + - string pri.warmer.current: description: current warmer ops - type: string + type: + - 'null' + - string warmer.total: description: total warmer ops - type: string + type: + - 'null' + - string pri.warmer.total: description: total warmer ops - type: string + type: + - 'null' + - string warmer.total_time: description: time spent in warmers - type: string + type: + - 'null' + - string pri.warmer.total_time: description: time spent in warmers - type: string + type: + - 'null' + - string suggest.current: description: number of current suggest ops - type: string + type: + - 'null' + - string pri.suggest.current: description: number of current suggest ops - type: string + type: + - 'null' + - string suggest.time: description: time spend in suggest - type: string + type: + - 'null' + - string pri.suggest.time: description: time spend in suggest - type: string + type: + - 'null' + - string suggest.total: description: number of suggest ops - type: string + type: + - 'null' + - string pri.suggest.total: description: number of suggest ops - type: string + type: + - 'null' + - string memory.total: description: total used memory type: string @@ -40951,36 +41738,6 @@ components: search.throttled: description: indicates if the index is search throttled type: string - bulk.total_operations: - description: number of bulk shard ops - type: string - pri.bulk.total_operations: - description: number of bulk shard ops - type: string - bulk.total_time: - description: time spend in shard bulk - type: string - pri.bulk.total_time: - description: time spend in shard bulk - type: string - bulk.total_size_in_bytes: - description: total size in bytes of shard bulk - type: string - pri.bulk.total_size_in_bytes: - description: total size in bytes of shard bulk - type: string - bulk.avg_time: - description: average time spend in shard bulk - type: string - pri.bulk.avg_time: - description: average time spend in shard bulk - type: string - bulk.avg_size_in_bytes: - description: average size in bytes of shard bulk - type: string - pri.bulk.avg_size_in_bytes: - description: average size in bytes of shard bulk - type: string cat.master:MasterRecord: type: object properties: @@ -41055,11 +41812,11 @@ components: description: The Java version. type: string disk.total: - $ref: '#/components/schemas/_common:ByteSize' + type: string disk.used: - $ref: '#/components/schemas/_common:ByteSize' + type: string disk.avail: - $ref: '#/components/schemas/_common:ByteSize' + type: string disk.used_percent: $ref: '#/components/schemas/_common:Percentage' heap.current: @@ -41121,7 +41878,7 @@ components: Indicates whether the node is the elected master node. Returned values include `*`(elected master) and `-`(not elected master). type: string - x-version-deprecated: 2.0.0 + x-version-deprecated: '2.0' x-deprecation-message: To promote inclusive language, use 'cluster_manager' instead. name: $ref: '#/components/schemas/_common:Name' @@ -41272,6 +42029,14 @@ components: search.query_total: description: The total query phase operations. type: string + search.concurrent_query_current: + type: string + search.concurrent_query_time: + type: string + search.concurrent_query_total: + type: string + search.concurrent_avg_slice_count: + type: string search.scroll_current: description: The open scroll contexts. type: string @@ -41281,6 +42046,12 @@ components: search.scroll_total: description: The completed scroll contexts. type: string + search.point_in_time_current: + type: string + search.point_in_time_time: + type: string + search.point_in_time_total: + type: string segments.count: description: The number of segments. type: string @@ -41364,11 +42135,11 @@ components: start_time: $ref: '#/components/schemas/_common:DateTime' start_time_millis: - $ref: '#/components/schemas/_common:EpochTimeUnitMillis' + $ref: '#/components/schemas/_common:StringifiedEpochTimeUnitMillis' stop_time: $ref: '#/components/schemas/_common:DateTime' stop_time_millis: - $ref: '#/components/schemas/_common:EpochTimeUnitMillis' + $ref: '#/components/schemas/_common:StringifiedEpochTimeUnitMillis' time: $ref: '#/components/schemas/_common:Duration' type: @@ -41472,9 +42243,9 @@ components: Also, OpenSearch creates extra deleted documents to internally track the recent history of operations on a shard. type: string size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' size.memory: - $ref: '#/components/schemas/_common:ByteSize' + type: string committed: description: |- If `true`, the segment is synced to disk. @@ -41531,7 +42302,9 @@ components: - string id: description: The unique identifier for the node. - type: string + type: + - 'null' + - string node: description: The name of node. type: @@ -41539,7 +42312,9 @@ components: - string sync_id: description: The sync identifier. - type: string + type: + - 'null' + - string unassigned.reason: description: |- The reason for the last change to the state of an unassigned shard. @@ -41562,204 +42337,372 @@ components: `REINITIALIZED`: When a shard moves from started back to initializing. `REPLICA_ADDED`: Unassigned as a result of explicit addition of a replica. `REROUTE_CANCELLED`: Unassigned as a result of explicit cancel reroute command. - type: string + type: + - 'null' + - string unassigned.at: description: The time at which the shard became unassigned in Coordinated Universal Time (UTC). - type: string + type: + - 'null' + - string unassigned.for: description: The time at which the shard was requested to be unassigned in Coordinated Universal Time (UTC). - type: string + type: + - 'null' + - string unassigned.details: description: |- Additional details as to why the shard became unassigned. It does not explain why the shard is not assigned; use the cluster allocation explain API for that information. - type: string + type: + - 'null' + - string recoverysource.type: description: The type of recovery source. - type: string + type: + - 'null' + - string completion.size: description: The size of completion. - type: string + type: + - 'null' + - string fielddata.memory_size: description: The used fielddata cache memory. - type: string + type: + - 'null' + - string fielddata.evictions: description: The fielddata cache evictions. - type: string + type: + - 'null' + - string query_cache.memory_size: description: The used query cache memory. - type: string + type: + - 'null' + - string query_cache.evictions: description: The query cache evictions. - type: string + type: + - 'null' + - string flush.total: description: The number of flushes. - type: string + type: + - 'null' + - string flush.total_time: description: The time spent in flush. - type: string + type: + - 'null' + - string get.current: description: The number of current get operations. - type: string + type: + - 'null' + - string get.time: description: The time spent in get operations. - type: string + type: + - 'null' + - string get.total: description: The number of get operations. - type: string + type: + - 'null' + - string get.exists_time: description: The time spent in successful get operations. - type: string + type: + - 'null' + - string get.exists_total: description: The number of successful get operations. - type: string + type: + - 'null' + - string get.missing_time: description: The time spent in failed get operations. - type: string + type: + - 'null' + - string get.missing_total: description: The number of failed get operations. - type: string + type: + - 'null' + - string indexing.delete_current: description: The number of current deletion operations. - type: string + type: + - 'null' + - string indexing.delete_time: description: The time spent in deletion operations. - type: string + type: + - 'null' + - string indexing.delete_total: description: The number of delete operations. - type: string + type: + - 'null' + - string indexing.index_current: description: The number of current indexing operations. - type: string + type: + - 'null' + - string indexing.index_time: description: The time spent in indexing operations. - type: string + type: + - 'null' + - string indexing.index_total: description: The number of indexing operations. - type: string + type: + - 'null' + - string indexing.index_failed: description: The number of failed indexing operations. - type: string + type: + - 'null' + - string merges.current: description: The number of current merge operations. - type: string + type: + - 'null' + - string merges.current_docs: description: The number of current merging documents. - type: string + type: + - 'null' + - string merges.current_size: description: The size of current merge operations. - type: string + type: + - 'null' + - string merges.total: description: The number of completed merge operations. - type: string + type: + - 'null' + - string merges.total_docs: description: The number of merged documents. - type: string + type: + - 'null' + - string merges.total_size: description: The size of current merges. - type: string + type: + - 'null' + - string merges.total_time: description: The time spent merging documents. - type: string + type: + - 'null' + - string refresh.total: description: The total number of refreshes. - type: string + type: + - 'null' + - string refresh.time: description: The time spent in refreshes. - type: string + type: + - 'null' + - string refresh.external_total: description: The total number of external refreshes. - type: string + type: + - 'null' + - string refresh.external_time: description: The time spent in external refreshes. - type: string + type: + - 'null' + - string refresh.listeners: description: The number of pending refresh listeners. - type: string + type: + - 'null' + - string search.fetch_current: description: The current fetch phase operations. - type: string + type: + - 'null' + - string search.fetch_time: description: The time spent in fetch phase. - type: string + type: + - 'null' + - string search.fetch_total: description: The total number of fetch operations. - type: string + type: + - 'null' + - string search.open_contexts: description: The number of open search contexts. - type: string + type: + - 'null' + - string search.query_current: description: The current query phase operations. - type: string + type: + - 'null' + - string search.query_time: description: The time spent in query phase. - type: string + type: + - 'null' + - string search.query_total: description: The total number of query phase operations. - type: string + type: + - 'null' + - string + search.concurrent_query_current: + type: + - 'null' + - string + search.concurrent_query_time: + type: + - 'null' + - string + search.concurrent_query_total: + type: + - 'null' + - string + search.concurrent_avg_slice_count: + type: + - 'null' + - string search.scroll_current: description: The open scroll contexts. - type: string + type: + - 'null' + - string search.scroll_time: description: The time scroll contexts were held open. - type: string + type: + - 'null' + - string search.scroll_total: description: The number of completed scroll contexts. - type: string + type: + - 'null' + - string + search.point_in_time_current: + type: + - 'null' + - string + search.point_in_time_time: + type: + - 'null' + - string + search.point_in_time_total: + type: + - 'null' + - string + search.search_idle_reactivate_count_total: + type: + - 'null' + - string segments.count: description: The number of segments. - type: string + type: + - 'null' + - string segments.memory: description: The memory used by segments. - type: string + type: + - 'null' + - string segments.index_writer_memory: description: The memory used by the index writer. - type: string + type: + - 'null' + - string segments.version_map_memory: description: The memory used by the version map. - type: string + type: + - 'null' + - string segments.fixed_bitset_memory: description: The memory used by fixed bit sets for nested object field types and export type filters for types referred in `_parent` fields. - type: string + type: + - 'null' + - string seq_no.max: description: The maximum sequence number. - type: string + type: + - 'null' + - string seq_no.local_checkpoint: description: The local checkpoint. - type: string + type: + - 'null' + - string seq_no.global_checkpoint: description: The global checkpoint. - type: string + type: + - 'null' + - string warmer.current: description: The number of current warmer operations. - type: string + type: + - 'null' + - string warmer.total: description: The total number of warmer operations. - type: string + type: + - 'null' + - string warmer.total_time: description: The time spent in warmer operations. - type: string + type: + - 'null' + - string path.data: description: The shard data path. - type: string + type: + - 'null' + - string path.state: description: The shard state path. - type: string + type: + - 'null' + - string bulk.total_operations: description: The number of bulk shard operations. - type: string + type: + - 'null' + - string bulk.total_time: description: The time spent in shard bulk operations. - type: string + type: + - 'null' + - string bulk.total_size_in_bytes: description: The total size in bytes of shard bulk operations. - type: string + type: + - 'null' + - string bulk.avg_time: description: The average time spent in shard bulk operations. - type: string + type: + - 'null' + - string bulk.avg_size_in_bytes: description: The average size in bytes of shard bulk operations. - type: string + type: + - 'null' + - string + docs.deleted: + type: + - 'null' + - string cat.snapshots:SnapshotsRecord: type: object properties: @@ -41922,6 +42865,8 @@ components: completed: description: The number of completed tasks. type: string + total_wait_time: + type: string core: description: The core number of active threads allowed in a scaling thread pool. type: @@ -42012,7 +42957,7 @@ components: in_sync: type: boolean matching_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' matching_sync_id: type: boolean store_exception: @@ -42034,7 +42979,9 @@ components: shard_sizes: type: object additionalProperties: - type: number + oneOf: + - $ref: '#/components/schemas/_common:Bytes' + - $ref: '#/components/schemas/_common:StorageSize' shard_data_set_sizes: type: object additionalProperties: @@ -42089,12 +43036,18 @@ components: properties: path: type: string + total: + $ref: '#/components/schemas/_common:StorageSize' total_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + used: + $ref: '#/components/schemas/_common:StorageSize' used_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + free: + $ref: '#/components/schemas/_common:StorageSize' free_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' free_disk_percent: type: number used_disk_percent: @@ -42206,6 +43159,35 @@ components: - REINITIALIZED - REPLICA_ADDED - REROUTE_CANCELLED + cluster.decommission_awareness:DecommissionStatusResponse: + oneOf: + - $ref: '#/components/schemas/cluster.decommission_awareness:ZoneDecommissionStatusResponse' + cluster.decommission_awareness:ZoneDecommissionStatusResponse: + type: object + additionalProperties: + type: string + enum: + - DRAINING + - FAILED + - INIT + - IN_PROGRESS + - SUCCESSFUL + cluster.health:AwarenessAttributeStats: + type: object + x-version-added: '2.5' + properties: + active_shards: + type: number + initializing_shards: + type: number + relocating_shards: + type: number + unassigned_shards: + type: number + data_nodes: + type: number + weight: + type: number cluster.health:HealthResponseBody: type: object properties: @@ -42217,11 +43199,25 @@ components: type: number active_shards_percent_as_number: $ref: '#/components/schemas/_common:Percentage' + awareness_attributes: + description: Cluster health information for each awareness attribute. + type: object + x-version-added: '2.5' + additionalProperties: + $ref: '#/components/schemas/cluster.health:AwarenessAttributeStats' cluster_name: $ref: '#/components/schemas/_common:Name' delayed_unassigned_shards: description: The number of shards whose allocation has been delayed by the timeout settings. type: number + discovered_master: + description: True if the master node has been discovered. + type: boolean + x-version-deprecated: '2.0' + discovered_cluster_manager: + description: True if the cluster manager node has been discovered. + type: boolean + x-version-added: '2.0' indices: type: object additionalProperties: @@ -42251,7 +43247,7 @@ components: task_max_waiting_in_queue_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' timed_out: - description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default) + description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default). type: boolean unassigned_shards: description: The number of shards that are not allocated. @@ -42617,18 +43613,38 @@ components: cluster.stats:ClusterFileSystem: type: object properties: + available: + description: |- + Total number of bytes available to JVM in file stores across all selected nodes. + Depending on operating system or process-level restrictions, this number may be less than `nodes.fs.free_in_byes`. + This is the actual amount of free disk space the selected OpenSearch nodes can use. + $ref: '#/components/schemas/_common:StorageSize' available_in_bytes: description: |- Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or process-level restrictions, this number may be less than `nodes.fs.free_in_byes`. This is the actual amount of free disk space the selected OpenSearch nodes can use. - type: number + $ref: '#/components/schemas/_common:Bytes' + free: + description: Total number of unallocated bytes in file stores across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' free_in_bytes: description: Total number of unallocated bytes in file stores across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' + total: + description: Total size, of all file stores across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: description: Total size, in bytes, of all file stores across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' + cache_reserved: + description: Total size, of all cache reserved across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' + x-version-added: '2.7' + cache_reserved_in_bytes: + description: Total size, in bytes, of all cache reserved across all selected nodes. + $ref: '#/components/schemas/_common:Bytes' + x-version-added: '2.7' required: - available_in_bytes - free_in_bytes @@ -42715,6 +43731,8 @@ components: cluster.stats:ClusterJvm: type: object properties: + max_uptime: + $ref: '#/components/schemas/_common:Duration' max_uptime_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' mem: @@ -42735,12 +43753,18 @@ components: cluster.stats:ClusterJvmMemory: type: object properties: + heap_max: + description: Maximum amount of memory available for use by the heap across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' heap_max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' + heap_used: + description: Memory currently in use by the heap across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' heap_used_in_bytes: description: Memory, in bytes, currently in use by the heap across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' required: - heap_max_in_bytes - heap_used_in_bytes @@ -42811,10 +43835,16 @@ components: type: number master: type: number + cluster_manager: + type: number + x-version-added: '2.0' ml: type: number remote_cluster_client: type: number + search: + type: number + x-version-added: '2.4' total: type: number transform: @@ -42824,17 +43854,10 @@ components: required: - coordinating_only - data - - data_cold - - data_content - - data_hot - - data_warm - ingest - master - - ml - remote_cluster_client - total - - transform - - voting_only cluster.stats:ClusterNodes: type: object properties: @@ -42880,7 +43903,6 @@ components: - count - discovery_types - fs - - indexing_pressure - ingest - jvm - network_types @@ -43081,10 +44103,10 @@ components: description: Total number of fields in all non-system indices, accounting for mapping deduplication. type: number total_deduplicated_mapping_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' total_deduplicated_mapping_size_in_bytes: description: Total size of all mappings, in bytes, after deduplication and compression. - type: number + $ref: '#/components/schemas/_common:Bytes' required: - field_types cluster.stats:IndexingPressure: @@ -43100,7 +44122,7 @@ components: current: $ref: '#/components/schemas/cluster.stats:IndexingPressureMemorySummary' limit_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' total: $ref: '#/components/schemas/cluster.stats:IndexingPressureMemorySummary' required: @@ -43111,19 +44133,19 @@ components: type: object properties: all_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' combined_coordinating_and_primary_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' coordinating_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' coordinating_rejections: type: number primary_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' primary_rejections: type: number replica_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' replica_rejections: type: number required: @@ -43140,7 +44162,7 @@ components: primary_shard_count: type: number total_primary_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' version: $ref: '#/components/schemas/_common:VersionString' required: @@ -43162,26 +44184,34 @@ components: type: string required: - count - - flavor - type cluster.stats:OperatingSystemMemoryInfo: type: object properties: adjusted_total_in_bytes: description: Total amount, in bytes, of memory across all selected nodes, but using the value specified using the `es.total_memory_bytes` system property instead of measured total memory for those nodes where that system property was set. - type: number + $ref: '#/components/schemas/_common:Bytes' + free: + description: Amount, in bytes, of free physical memory across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' free_in_bytes: description: Amount, in bytes, of free physical memory across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' free_percent: description: Percentage of free physical memory across all selected nodes. type: number + total: + description: Total amount of physical memory across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: description: Total amount, in bytes, of physical memory across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' + used: + description: Amount of physical memory in use across all selected nodes. + $ref: '#/components/schemas/_common:StorageSize' used_in_bytes: description: Amount, in bytes, of physical memory in use across all selected nodes. - type: number + $ref: '#/components/schemas/_common:Bytes' used_percent: description: Percentage of physical memory in use across all selected nodes. type: number @@ -43277,6 +44307,25 @@ components: - nodes - status - timestamp + cluster.weighted_routing:Weights: + allOf: + - $ref: '#/components/schemas/cluster.weighted_routing:WeightsBase' + - type: object + properties: + weights: + type: object + cluster.weighted_routing:WeightsBase: + type: object + properties: + _version: + $ref: '#/components/schemas/_common:VersionNumber' + cluster.weighted_routing:WeightsResponse: + allOf: + - $ref: '#/components/schemas/cluster.weighted_routing:Weights' + - type: object + properties: + discovered_cluster_manager: + type: boolean dangling_indices.list_dangling_indices:DanglingIndex: type: object properties: @@ -43444,13 +44493,13 @@ components: max_docs: type: number min_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' max_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' min_primary_shard_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' max_primary_shard_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' min_primary_shard_docs: type: number max_primary_shard_docs: @@ -44284,7 +45333,7 @@ components: durability: $ref: '#/components/schemas/indices._common:TranslogDurability' flush_threshold_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' retention: $ref: '#/components/schemas/indices._common:TranslogRetention' indices._common:TranslogDurability: @@ -44296,7 +45345,7 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' age: $ref: '#/components/schemas/_common:Duration' indices.add_block:IndicesBlockOptions: @@ -44459,10 +45508,10 @@ components: maximum_timestamp: $ref: '#/components/schemas/_common:EpochTimeUnitMillis' store_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' store_size_bytes: description: Total size, in bytes, of all shards for the data stream's backing indices. - type: number + $ref: '#/components/schemas/_common:Bytes' required: - backing_indices - data_stream @@ -44542,21 +45591,21 @@ components: percent: $ref: '#/components/schemas/_common:Percentage' recovered: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' recovered_in_bytes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' recovered_from_snapshot: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' recovered_from_snapshot_in_bytes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' reused: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' reused_in_bytes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' total: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' required: - percent - recovered_in_bytes @@ -44796,21 +45845,21 @@ components: max_docs: type: number max_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' max_size_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' min_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' min_size_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' max_primary_shard_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' max_primary_shard_size_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' min_primary_shard_size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' min_primary_shard_size_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' max_primary_shard_docs: type: number min_primary_shard_docs: @@ -44822,35 +45871,41 @@ components: type: object additionalProperties: oneOf: - - $ref: '#/components/schemas/indices.segments:ShardsSegment' - type: array items: $ref: '#/components/schemas/indices.segments:ShardsSegment' + - $ref: '#/components/schemas/indices.segments:ShardsSegment' required: - shards indices.segments:Segment: type: object properties: - attributes: - type: object - additionalProperties: - type: string + generation: + type: integer + num_docs: + type: integer + deleted_docs: + type: integer + size: + $ref: '#/components/schemas/_common:StorageSize' + size_in_bytes: + $ref: '#/components/schemas/_common:Bytes' + memory: + $ref: '#/components/schemas/_common:StorageSize' + memory_in_bytes: + $ref: '#/components/schemas/_common:Bytes' committed: type: boolean - compound: - type: boolean - deleted_docs: - type: number - generation: - type: number search: type: boolean - size_in_bytes: - type: number - num_docs: - type: number version: $ref: '#/components/schemas/_common:VersionString' + compound: + type: boolean + attributes: + type: object + additionalProperties: + type: string required: - attributes - committed @@ -45077,14 +46132,16 @@ components: properties: description: type: string + size: + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' min_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' max_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' average_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' count: type: number required: @@ -46244,7 +47301,7 @@ components: type: string description: The model group name. latest_version: - type: number + type: integer description: The latest version. description: type: string @@ -46401,16 +47458,16 @@ components: properties: estimated_size: description: Estimated memory used for the operation. - type: string + $ref: '#/components/schemas/_common:StorageSize' estimated_size_in_bytes: description: Estimated memory used, in bytes, for the operation. - type: number + $ref: '#/components/schemas/_common:Bytes' limit_size: description: Memory limit for the circuit breaker. - type: string + $ref: '#/components/schemas/_common:StorageSize' limit_size_in_bytes: description: Memory limit, in bytes, for the circuit breaker. - type: number + $ref: '#/components/schemas/_common:Bytes' overhead: description: A constant that all estimates for the circuit breaker are multiplied with to calculate a final estimate. type: number @@ -46502,7 +47559,7 @@ components: type: number request_size_bytes: description: Cumulative size in bytes of all requests from this client. - type: number + $ref: '#/components/schemas/_common:Bytes' x_opaque_id: description: |- Value from the client's `x-opaque-id` HTTP header. @@ -46622,34 +47679,38 @@ components: properties: available: description: Total amount of disk space available to this Java virtual machine on this file store. - type: string + $ref: '#/components/schemas/_common:StorageSize' available_in_bytes: description: Total number of bytes available to this Java virtual machine on this file store. - type: number + $ref: '#/components/schemas/_common:Bytes' + cache_reserved: + x-version-added: '2.7' + description: Total number of cache bytes reserved available to this Java virtual machine on this file store. + $ref: '#/components/schemas/_common:StorageSize' cache_reserved_in_bytes: x-version-added: '2.7' description: Total number of cache bytes reserved available to this Java virtual machine on this file store. - type: number + $ref: '#/components/schemas/_common:Bytes' disk_queue: type: string disk_reads: type: number disk_read_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' disk_read_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' disk_writes: type: number disk_write_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' disk_write_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' free: description: Total amount of unallocated disk space in the file store. - type: string + $ref: '#/components/schemas/_common:StorageSize' free_in_bytes: description: Total number of unallocated bytes in the file store. - type: number + $ref: '#/components/schemas/_common:Bytes' mount: description: 'Mount point of the file store (for example: `/dev/sda2`).' type: string @@ -46658,10 +47719,10 @@ components: type: string total: description: Total size of the file store. - type: string + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: description: Total size of the file store in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' type: description: 'Type of the file store (ex: ext4).' type: string @@ -46723,29 +47784,33 @@ components: Total disk space available to this Java virtual machine on all file stores. Depending on OS or process level restrictions, this might appear less than `free`. This is the actual amount of free disk space the OpenSearch node can utilize. - type: string + $ref: '#/components/schemas/_common:StorageSize' available_in_bytes: description: |- Total number of bytes available to this Java virtual machine on all file stores. Depending on OS or process level restrictions, this might appear less than `free_in_bytes`. This is the actual amount of free disk space the OpenSearch node can utilize. - type: number + $ref: '#/components/schemas/_common:Bytes' free: description: Total unallocated disk space in all file stores. - type: string + $ref: '#/components/schemas/_common:StorageSize' free_in_bytes: description: Total number of unallocated bytes in all file stores. - type: number + $ref: '#/components/schemas/_common:Bytes' total: description: Total size of all file stores. - type: string + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: description: Total size of all file stores in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' + cache_reserved: + x-version-added: '2.7' + description: Total size of cache bytes reserved in all file stores. + $ref: '#/components/schemas/_common:StorageSize' cache_reserved_in_bytes: x-version-added: '2.7' description: Total size of cache bytes reserved in all file stores. - type: number + $ref: '#/components/schemas/_common:Bytes' nodes._common:GarbageCollector: type: object properties: @@ -46791,12 +47856,12 @@ components: type: object properties: limit: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' limit_in_bytes: description: |- Configured memory limit, in bytes, for the indexing requests. Replica requests have an automatic limit that is 1.5x this value. - type: number + $ref: '#/components/schemas/_common:Bytes' current: $ref: '#/components/schemas/nodes._common:PressureMemory' total: @@ -46830,6 +47895,8 @@ components: type: object additionalProperties: $ref: '#/components/schemas/nodes._common:KeyedProcessor' + time: + $ref: '#/components/schemas/_common:Duration' time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' nodes._common:IoStatDevice: @@ -46915,24 +47982,39 @@ components: nodes._common:JvmMemoryStats: type: object properties: + heap_used: + description: Memory currently in use by the heap. + $ref: '#/components/schemas/_common:StorageSize' heap_used_in_bytes: description: Memory, in bytes, currently in use by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' heap_used_percent: description: Percentage of memory currently in use by the heap. type: number + heap_committed: + description: Amount of memory available for use by the heap. + $ref: '#/components/schemas/_common:StorageSize' heap_committed_in_bytes: description: Amount of memory, in bytes, available for use by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' + heap_max: + description: Maximum amount of memory available for use by the heap. + $ref: '#/components/schemas/_common:StorageSize' heap_max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' + non_heap_used: + description: Non-heap memory used. + $ref: '#/components/schemas/_common:StorageSize' non_heap_used_in_bytes: description: Non-heap memory used, in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' + non_heap_committed: + description: Amount of non-heap memory available. + $ref: '#/components/schemas/_common:StorageSize' non_heap_committed_in_bytes: description: Amount of non-heap memory available, in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' pools: description: Contains statistics about heap memory usage for the node. type: object @@ -46957,10 +48039,14 @@ components: nodes._common:LastGcStats: type: object properties: + used: + $ref: '#/components/schemas/_common:StorageSize' used_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + max: + $ref: '#/components/schemas/_common:StorageSize' max_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' usage_percent: type: number nodes._common:MemoryStats: @@ -46970,28 +48056,37 @@ components: description: |- If the amount of physical memory has been overridden using the `es`.`total_memory_bytes` system property then this reports the overridden value in bytes. Otherwise it reports the same value as `total_in_bytes`. - type: number + $ref: '#/components/schemas/_common:Bytes' resident: - type: string + $ref: '#/components/schemas/_common:StorageSize' resident_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' share: - type: string + $ref: '#/components/schemas/_common:StorageSize' share_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' total_virtual: - type: string + $ref: '#/components/schemas/_common:StorageSize' total_virtual_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + total: + description: Total amount of physical memory. + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: description: Total amount of physical memory in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' + free: + description: Amount of free physical memory. + $ref: '#/components/schemas/_common:StorageSize' free_in_bytes: description: Amount of free physical memory in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' + used: + description: Amount of used physical memory. + $ref: '#/components/schemas/_common:StorageSize' used_in_bytes: description: Amount of used physical memory in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' nodes._common:NodeBufferPool: type: object properties: @@ -47000,16 +48095,16 @@ components: type: number total_capacity: description: Total capacity of buffer pools. - type: string + $ref: '#/components/schemas/_common:StorageSize' total_capacity_in_bytes: description: Total capacity of buffer pools in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' used: description: Size of buffer pools. - type: string + $ref: '#/components/schemas/_common:StorageSize' used_in_bytes: description: Size of buffer pools in bytes. - type: number + $ref: '#/components/schemas/_common:Bytes' nodes._common:NodeReloadError: type: object properties: @@ -47044,18 +48139,30 @@ components: nodes._common:Pool: type: object properties: + used: + description: Memory used by the heap. + $ref: '#/components/schemas/_common:StorageSize' used_in_bytes: description: Memory, in bytes, used by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' + max: + description: Maximum amount of memory available for use by the heap. + $ref: '#/components/schemas/_common:StorageSize' max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' + peak_used: + description: Largest amount of memory historically used by the heap. + $ref: '#/components/schemas/_common:StorageSize' peak_used_in_bytes: description: Largest amount of memory, in bytes, historically used by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' + peak_max: + description: Largest amount of memory historically used by the heap. + $ref: '#/components/schemas/_common:StorageSize' peak_max_in_bytes: description: Largest amount of memory, in bytes, historically used by the heap. - type: number + $ref: '#/components/schemas/_common:Bytes' last_gc_stats: description: Most recent GC cycle stats for a particular memory pool. $ref: '#/components/schemas/nodes._common:LastGcStats' @@ -47063,32 +48170,32 @@ components: type: object properties: all: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' all_in_bytes: description: Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage. - type: number + $ref: '#/components/schemas/_common:Bytes' combined_coordinating_and_primary: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' combined_coordinating_and_primary_in_bytes: description: |- Memory consumed, in bytes, by indexing requests in the coordinating or primary stage. This value is not the sum of coordinating and primary as a node can reuse the coordinating memory if the primary stage is executed locally. - type: number + $ref: '#/components/schemas/_common:Bytes' coordinating: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' coordinating_in_bytes: description: Memory consumed, in bytes, by indexing requests in the coordinating stage. - type: number + $ref: '#/components/schemas/_common:Bytes' primary: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' primary_in_bytes: description: Memory consumed, in bytes, by indexing requests in the primary stage. - type: number + $ref: '#/components/schemas/_common:Bytes' replica: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' replica_in_bytes: description: Memory consumed, in bytes, by indexing requests in the replica stage. - type: number + $ref: '#/components/schemas/_common:Bytes' coordinating_rejections: description: Number of indexing requests rejected in the coordinating stage. type: number @@ -47208,13 +48315,13 @@ components: count: type: number uncompressed_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' uncompressed_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' compressed_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' compressed_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' nodes._common:ShardAdmissionControlStats: type: object properties: @@ -47229,8 +48336,10 @@ components: nodes._common:ShardCacheStats: type: object properties: + size: + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' evictions: type: number hit_count: @@ -47319,8 +48428,12 @@ components: properties: cancellation_count: type: number + current_max: + $ref: '#/components/schemas/_common:Duration' current_max_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' + current_avg: + $ref: '#/components/schemas/_common:Duration' current_avg_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' nodes._common:ShardSearchBackpressureTaskResourceTrackerElapsedTimeTrackerStats: @@ -47328,8 +48441,12 @@ components: properties: cancellation_count: type: number + current_max: + $ref: '#/components/schemas/_common:Duration' current_max_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' + current_avg: + $ref: '#/components/schemas/_common:Duration' current_avg_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' nodes._common:ShardSearchBackpressureTaskResourceTrackerHeapUsageTrackerStats: @@ -47337,12 +48454,18 @@ components: properties: cancellation_count: type: number + current_max: + $ref: '#/components/schemas/_common:StorageSize' current_max_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + current_avg: + $ref: '#/components/schemas/_common:StorageSize' current_avg_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' + rolling_avg: + $ref: '#/components/schemas/_common:StorageSize' rolling_avg_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' nodes._common:ShardSearchBackpressureTaskResourceTrackerStats: type: object properties: @@ -47376,6 +48499,8 @@ components: properties: count: type: number + time: + $ref: '#/components/schemas/_common:Duration' time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' current: @@ -47522,6 +48647,11 @@ components: threads: description: Number of threads in the thread pool. type: number + total_wait_time: + description: | + The total amount of time that tasks spend waiting in the thread pool queue. + Currently, only `search`, `search_throttled`, and `index_searcher` thread pools support this metric. + $ref: '#/components/schemas/_common:Duration' total_wait_time_in_nanos: description: | The total amount of time that tasks spend waiting in the thread pool queue. @@ -47554,10 +48684,10 @@ components: type: number rx_size: description: Size of RX packets received by the node during internal cluster communication. - type: string + $ref: '#/components/schemas/_common:StorageSize' rx_size_in_bytes: description: Size, in bytes, of RX packets received by the node during internal cluster communication. - type: number + $ref: '#/components/schemas/_common:Bytes' server_open: description: Current number of inbound TCP connections used for internal communication between nodes. type: number @@ -47566,10 +48696,10 @@ components: type: number tx_size: description: Size of TX packets sent by the node during internal cluster communication. - type: string + $ref: '#/components/schemas/_common:StorageSize' tx_size_in_bytes: description: Size, in bytes, of TX packets sent by the node during internal cluster communication. - type: number + $ref: '#/components/schemas/_common:Bytes' total_outbound_connections: description: |- The cumulative number of outbound transport connections that this node has opened since it started. @@ -47671,7 +48801,7 @@ components: description: Total heap allowed to be used to hold recently indexed documents before they must be written to disk. This size is a shared pool across all shards on this node, and is controlled by Indexing Buffer settings. type: number total_indexing_buffer_in_bytes: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:Bytes' transport: $ref: '#/components/schemas/nodes.info:NodeInfoTransport' transport_address: @@ -47741,9 +48871,9 @@ components: items: type: string max_content_length: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' max_content_length_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' publish_address: type: string required: @@ -47784,25 +48914,25 @@ components: type: object properties: direct_max: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' direct_max_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' heap_init: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' heap_init_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' heap_max: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' heap_max_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' non_heap_init: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' non_heap_init_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' non_heap_max: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' non_heap_max_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - direct_max_in_bytes - heap_init_in_bytes @@ -47813,9 +48943,9 @@ components: type: object properties: total: - type: string + $ref: '#/components/schemas/_common:StorageSize' total_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - total - total_in_bytes @@ -47846,9 +48976,9 @@ components: type: object properties: cache_size: - type: string + $ref: '#/components/schemas/_common:StorageSize' cache_size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' cores_per_socket: type: number mhz: @@ -50468,7 +51598,7 @@ components: file_count: type: number size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - file_count - size_in_bytes @@ -50478,9 +51608,9 @@ components: shard_count: type: number size: - $ref: '#/components/schemas/_common:ByteSize' + $ref: '#/components/schemas/_common:StorageSize' size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' max_segments_per_shard: type: number required: @@ -50584,7 +51714,7 @@ components: file_count: type: number size_in_bytes: - type: number + $ref: '#/components/schemas/_common:Bytes' required: - file_count - size_in_bytes @@ -50953,32 +52083,43 @@ components: - nodes - none - parents - tasks._common:NodeTasks: + tasks._common:PersistentTaskStatus: type: object properties: - name: - $ref: '#/components/schemas/_common:NodeId' - transport_address: - $ref: '#/components/schemas/_common:TransportAddress' - host: - $ref: '#/components/schemas/_common:Host' - ip: - $ref: '#/components/schemas/_common:Ip' - roles: - type: array - items: - type: string - attributes: - type: object - additionalProperties: - type: string - tasks: - type: object - additionalProperties: - $ref: '#/components/schemas/tasks._common:TaskInfo' + state: + type: string required: - - tasks - tasks._common:ParentTaskInfo: + - state + tasks._common:RawTaskStatus: + type: object + additionalProperties: + title: metadata + tasks._common:ReplicationTaskStatus: + type: object + properties: + phase: + type: string + required: + - phase + tasks._common:Status: + description: Task status information can vary wildly from task to task. + anyOf: + - $ref: '#/components/schemas/tasks._common:ReplicationTaskStatus' + - $ref: '#/components/schemas/_common:BulkByScrollTaskStatus' + - $ref: '#/components/schemas/tasks._common:PersistentTaskStatus' + - $ref: '#/components/schemas/tasks._common:RawTaskStatus' + tasks._common:TaskExecutingNode: + allOf: + - $ref: '#/components/schemas/_common:BaseNode' + - type: object + properties: + tasks: + type: object + additionalProperties: + $ref: '#/components/schemas/tasks._common:TaskInfo' + required: + - tasks + tasks._common:TaskGroup: allOf: - $ref: '#/components/schemas/tasks._common:TaskInfo' - type: object @@ -50986,7 +52127,7 @@ components: children: type: array items: - $ref: '#/components/schemas/tasks._common:TaskInfo' + $ref: '#/components/schemas/tasks._common:TaskGroup' tasks._common:TaskInfo: type: object properties: @@ -51003,7 +52144,8 @@ components: additionalProperties: type: string id: - type: number + type: integer + format: int64 node: $ref: '#/components/schemas/_common:NodeId' running_time: @@ -51013,8 +52155,7 @@ components: start_time_in_millis: $ref: '#/components/schemas/_common:EpochTimeUnitMillis' status: - description: Task status information can vary wildly from task to task. - type: object + $ref: '#/components/schemas/tasks._common:Status' type: type: string parent_task_id: @@ -51030,12 +52171,14 @@ components: - type tasks._common:TaskInfos: oneOf: - - type: array + - title: grouped_by_none + type: array items: $ref: '#/components/schemas/tasks._common:TaskInfo' - - type: object + - title: grouped_by_parents + type: object additionalProperties: - $ref: '#/components/schemas/tasks._common:ParentTaskInfo' + $ref: '#/components/schemas/tasks._common:TaskGroup' tasks._common:TaskListResponseBase: type: object properties: @@ -51051,9 +52194,12 @@ components: description: Task information grouped by node, if `group_by` was set to `node` (the default). type: object additionalProperties: - $ref: '#/components/schemas/tasks._common:NodeTasks' + $ref: '#/components/schemas/tasks._common:TaskExecutingNode' tasks: $ref: '#/components/schemas/tasks._common:TaskInfos' + tasks._common:TaskResponse: + anyOf: + - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' transforms._common:ContinuousStats: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 86c3b198fd..b1eaa8d06b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -43,7 +43,8 @@ public class CodeGenerator { private static final OperationGroupMatcher OPERATION_MATCHER = or( and(namespace(""), named("info")), namespace("dangling_indices"), - and(namespace("ml"), not(named("search_models"))) // TODO: search_models is complex and ideally should re-use the search structures + and(namespace("ml"), not(named("search_models"))), // TODO: search_models is complex and ideally should re-use the search structures + and(namespace("tasks")) ); public static void main(String[] args) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index 68c6a4feb5..e0e3861bcc 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -13,6 +13,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.TreeMap; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -22,6 +23,8 @@ import org.opensearch.client.codegen.utils.Strings; public class Namespace { + private static final Set PARTIAL_NAMESPACES = Set.of(""); + private final Namespace parent; private final String name; private final Map children = new TreeMap<>(); @@ -82,7 +85,7 @@ public void render(ShapeRenderingContext ctx) throws RenderException { if (operations.isEmpty()) return; - var asBaseClass = "".equals(name); + var asBaseClass = PARTIAL_NAMESPACES.contains(name); new Client(this, false, asBaseClass, operations).render(ctx); new Client(this, true, asBaseClass, operations).render(ctx); @@ -116,12 +119,17 @@ private Client(Namespace parent, boolean async, boolean base, Collection bodyFields = new TreeMap<>(); protected Field additionalPropertiesField; @@ -25,6 +24,7 @@ public ObjectShape(Namespace parent, String className, String typedefName, Strin public void addBodyField(Field field) { bodyFields.put(field.getName(), field); + tryAddReference(ReferenceKind.Field, field.getType()); } public Collection getBodyFields() { @@ -42,24 +42,15 @@ public Collection getFields() { public void setAdditionalPropertiesField(Field field) { additionalPropertiesField = field; + if (field != null) { + tryAddReference(ReferenceKind.Field, field.getType()); + } } public Field getAdditionalPropertiesField() { return additionalPropertiesField; } - public void setExtendsType(Type extendsType) { - this.extendsType = extendsType; - } - - public Type getExtendsType() { - return extendsType; - } - - public boolean extendsOtherShape() { - return extendsType != null; - } - public boolean hasFieldsToSerialize() { return !bodyFields.isEmpty() || additionalPropertiesField != null; } @@ -71,4 +62,8 @@ public Collection getImplementsTypes() { public Collection getAnnotations() { return (hasFieldsToSerialize() || extendsOtherShape()) && !isAbstract() ? List.of(Types.Client.Json.JsonpDeserializable) : null; } + + public static class BuilderModel { + + } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ReferenceKind.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ReferenceKind.java new file mode 100644 index 0000000000..19a92dd6fb --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ReferenceKind.java @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model; + +public enum ReferenceKind { + Extends(false), + Field(true), + UnionVariant(true); + + private final boolean isConcreteUsage; + + ReferenceKind(boolean isConcreteUsage) { + this.isConcreteUsage = isConcreteUsage; + } + + public boolean isConcreteUsage() { + return isConcreteUsage; + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 2de1320733..18facfd53e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -50,11 +50,6 @@ public String getId() { return operationGroup.getName(); } - @Override - public boolean extendsOtherShape() { - return extendsType != Types.Client.OpenSearch._Types.RequestBase; - } - public String getHttpMethod() { return Streams.sortedBy(httpMethods.stream(), m -> { switch (m) { @@ -144,6 +139,7 @@ public void addBodyField(Field field) { private void addField(Field field) { fields.put(field.getName(), field); + tryAddReference(ReferenceKind.Field, field.getType()); } @Override diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index 8f6eaa5c04..c44c8d72d9 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -8,11 +8,17 @@ package org.opensearch.client.codegen.model; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; import java.util.TreeSet; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.client.codegen.exceptions.RenderException; @@ -20,11 +26,14 @@ public abstract class Shape { private static final Logger LOGGER = LogManager.getLogger(); + private final Set referencedTypes = new HashSet<>(); + private final Map> incomingReferences = new HashMap<>(); + private final Map> outgoingReferences = new HashMap<>(); protected final Namespace parent; private final String className; - private final Set referencedTypes = new HashSet<>(); private final String typedefName; private final String description; + private Type extendsType; public Shape(Namespace parent, String className, String typedefName, String description) { this.parent = parent; @@ -46,7 +55,12 @@ public JavaClassKind getClassKind() { } public boolean isAbstract() { - return this.className.endsWith("Base") || this.className.startsWith("Base"); + var refKinds = incomingReferences.entrySet() + .stream() + .filter(e -> !e.getValue().isEmpty()) + .map(Map.Entry::getKey) + .collect(Collectors.toSet()); + return !refKinds.isEmpty() && refKinds.stream().noneMatch(ReferenceKind::isConcreteUsage); } public String getTypedefName() { @@ -66,15 +80,38 @@ public TypeParameterDiamond getTypeParameters() { } public Type getExtendsType() { - return null; + return extendsType; + } + + public void setExtendsType(Type extendsType) { + this.extendsType = extendsType; + tryAddReference(ReferenceKind.Extends, extendsType); + } + + public boolean extendsOtherShape() { + return extendsType != null && extendsType.getTargetShape().isPresent(); + } + + public boolean extendedByOtherShape() { + return !incomingReferences.getOrDefault(ReferenceKind.Extends, Collections.emptyList()).isEmpty(); } public Collection getImplementsTypes() { return Collections.emptyList(); } - public Type getType() { - return Type.builder().withPackage(getPackageName()).withName(className).build(); + protected void tryAddReference(ReferenceKind kind, Type to) { + if (to == null) return; + to.getTargetShape().ifPresent(s -> addReference(kind, s)); + } + + private void addReference(ReferenceKind kind, Shape to) { + outgoingReferences.computeIfAbsent(kind, k -> new ArrayList<>()).add(to); + to.incomingReferences.computeIfAbsent(kind, k -> new ArrayList<>()).add(this); + } + + public @Nonnull Type getType() { + return Type.builder().withPackage(getPackageName()).withName(className).withTargetShape(this).build(); } public Namespace getParent() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index fffd8a017f..2a3b8ee993 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -54,7 +54,7 @@ public class SpecTransformer { @Nonnull private final Namespace root = new Namespace(); @Nonnull - private final Set visitedSchemas = new HashSet<>(); + private final Map visitedSchemas = new ConcurrentHashMap<>(); @Nonnull private final Map schemaToType = new ConcurrentHashMap<>(); @@ -232,29 +232,26 @@ private Field visit(OpenApiParameter parameter) { ); } - private void visit(OpenApiSchema schema) { + private Shape visit(OpenApiSchema schema) { var namespace = schema.getNamespace().orElseThrow(); var name = schema.getName().orElseThrow(); - visit(root.child(namespace), name, namespace + "." + name, schema); + return visit(root.child(namespace), name, namespace + "." + name, schema); } - private void visit(Namespace parent, String className, String typedefName, OpenApiSchema schema) { - if (!visitedSchemas.add(schema)) { - return; + private Shape visit(Namespace parent, String className, String typedefName, OpenApiSchema schema) { + Shape shape = visitedSchemas.get(schema); + + if (shape != null) { + return shape; } LOGGER.info("Visiting Schema: {}", schema); - Shape shape; - var description = schema.getDescription().orElse(null); if (schema.isArray()) { shape = new ArrayShape(parent, className, mapType(schema), typedefName, description); - } else if (schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object) { - var objShape = new ObjectShape(parent, className, typedefName, description); - visitInto(schema, objShape); - shape = objShape; + visitedSchemas.putIfAbsent(schema, shape); } else if (schema.isString() && schema.hasEnums()) { var deprecatedEnums = schema.getDeprecatedEnums().orElseGet(Collections::emptySet); shape = new EnumShape( @@ -264,25 +261,37 @@ private void visit(Namespace parent, String className, String typedefName, OpenA typedefName, description ); + visitedSchemas.putIfAbsent(schema, shape); } else if (schema.hasOneOf()) { var taggedUnion = new TaggedUnionShape(parent, className, typedefName, description); + shape = taggedUnion; + visitedSchemas.putIfAbsent(schema, shape); + schema.getOneOf().orElseThrow().forEach(s -> { var title = s.getTitle() .orElseThrow(() -> new IllegalStateException("oneOf variant [" + s.getPointer() + "] is missing a `title` tag")); taggedUnion.addVariant(title, mapType(s)); }); - shape = taggedUnion; + } else if (schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object) { + var objShape = new ObjectShape(parent, className, typedefName, description); + shape = objShape; + visitedSchemas.putIfAbsent(schema, shape); + + visitInto(schema, objShape); } else { throw new NotImplementedException("Unsupported schema: " + schema); } parent.addShape(shape); + + return shape; } private void visitInto(OpenApiSchema schema, ObjectShape shape) { var allOf = schema.getAllOf(); if (allOf.isPresent()) { - shape.setExtendsType(mapType(allOf.get().get(0))); + var baseSchema = allOf.get().get(0); + shape.setExtendsType(mapType(baseSchema)); schema = allOf.get().get(1); } @@ -392,13 +401,9 @@ private Type mapTypeInner(OpenApiSchema schema) { return mapType(schema); } - visit(schema); + var shape = visit(schema); - return Type.builder() - .withPackage(Types.Client.OpenSearch.PACKAGE + "." + schema.getNamespace().orElseThrow()) - .withName(schema.getName().orElseThrow()) - .isEnum(schema.hasEnums()) - .build(); + return shape.getType(); } var oneOf = schema.getOneOf(); @@ -428,6 +433,7 @@ private Type mapTypeInner(OpenApiSchema schema) { case Boolean: return Types.Primitive.Boolean; case Integer: + return mapInteger(schema); case Number: return mapNumber(schema); } @@ -444,7 +450,9 @@ private Type mapOneOf(List oneOf) { if (types.size() == 2 && types.contains(OpenApiSchemaType.String) - && (types.contains(OpenApiSchemaType.Boolean) || types.contains(OpenApiSchemaType.Number))) { + && (types.contains(OpenApiSchemaType.Boolean) + || types.contains(OpenApiSchemaType.Integer) + || types.contains(OpenApiSchemaType.Number))) { return Types.Java.Lang.String; } @@ -469,24 +477,36 @@ private Type mapArray(OpenApiSchema schema) { return Types.Java.Util.List(items); } - private Type mapNumber(OpenApiSchema schema) { + private Type mapInteger(OpenApiSchema schema) { var format = schema.getFormat().orElse(OpenApiSchemaFormat.Int32); switch (format) { case Int32: return Types.Primitive.Int; case Int64: return Types.Primitive.Long; + default: + throw new UnsupportedOperationException( + "Can not get type name for integer [" + schema.getPointer() + "] with format: " + format + ); + } + } + + private Type mapNumber(OpenApiSchema schema) { + var format = schema.getFormat().orElse(OpenApiSchemaFormat.Float); + switch (format) { case Float: return Types.Primitive.Float; case Double: return Types.Primitive.Double; default: - throw new UnsupportedOperationException("Can not get type name for integer/number with format: " + format); + throw new UnsupportedOperationException( + "Can not get type name for number [" + schema.getPointer() + "] with format: " + format + ); } } private boolean shouldKeepRef(OpenApiSchema schema) { - if (schema.isNumber() || schema.isArray()) { + if (schema.isInteger() || schema.isNumber() || schema.isArray()) { return false; } if (schema.isString() && schema.getEnums().isEmpty()) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java index 36dc7e2f2a..cc3d28ff7c 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java @@ -22,6 +22,7 @@ public TaggedUnionShape(Namespace parent, String className, String typedefName, public void addVariant(String name, Type type) { variants.add(new Variant(name, type.getBoxed())); + tryAddReference(ReferenceKind.UnionVariant, type); } public Collection getVariants() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index b8e3585151..2e4391b787 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -12,6 +12,7 @@ import static org.opensearch.client.codegen.model.Types.Java; import com.samskivert.mustache.Mustache; +import java.util.Optional; import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -43,6 +44,7 @@ public class Type { "Number" ); + @Nonnull public static Builder builder() { return new Builder(); } @@ -53,17 +55,18 @@ public static Builder builder() { private final String name; @Nullable private final Type[] typeParams; - private final boolean isEnum; + private final Shape targetShape; private Type(Builder builder) { this.packageName = builder.packageName; this.name = Strings.requireNonBlank(builder.name, "name must not be blank"); this.typeParams = builder.typeParams; - this.isEnum = builder.isEnum; + this.targetShape = builder.targetShape; } + @Nonnull public Builder toBuilder() { - return new Builder().withPackage(packageName).withName(name).withTypeParameters(typeParams).isEnum(isEnum); + return new Builder().withPackage(packageName).withName(name).withTypeParameters(typeParams).withTargetShape(targetShape); } @Override @@ -105,6 +108,11 @@ public Type getBoxed() { } } + @Nonnull + public Optional getTargetShape() { + return Optional.ofNullable(targetShape); + } + public boolean isMap() { return "Map".equals(name); } @@ -154,7 +162,7 @@ public boolean isNumber() { } public boolean isEnum() { - return isEnum; + return targetShape != null && targetShape instanceof EnumShape; } public boolean isTime() { @@ -205,7 +213,7 @@ public void getRequiredImports(Set imports, String currentPkg) { } } - public Type withTypeParams(Type... typeParams) { + public Type withTypeParameters(Type... typeParams) { return toBuilder().withTypeParameters(typeParams).build(); } @@ -221,7 +229,7 @@ public static final class Builder extends ObjectBuilderBase { private String packageName; private String name; private Type[] typeParams; - private boolean isEnum; + private Shape targetShape; private Builder() {} @@ -250,8 +258,8 @@ public Builder withTypeParameters(@Nullable Type... typeParams) { } @Nonnull - public Builder isEnum(boolean isEnum) { - this.isEnum = isEnum; + public Builder withTargetShape(Shape shape) { + this.targetShape = shape; return this; } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index be82acb55f..8d522a11f1 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -75,7 +75,10 @@ public static final class Util { public static final Type HashMap = Type.builder().withPackage(PACKAGE).withName("HashMap").build(); public static Type Map(Type keyType, Type valueType) { - return Map.withTypeParams(keyType, valueType); + return Map.toBuilder() + .withTypeParameters(keyType, valueType) + .withTargetShape(valueType.getTargetShape().orElse(null)) + .build(); } public static final Type Map = Type.builder().withPackage(PACKAGE).withName("Map").build(); @@ -85,7 +88,12 @@ public static Type MapEntry(Type keyType, Type valueType) { } public static Type List(Type valueType) { - return Type.builder().withPackage(PACKAGE).withName("List").withTypeParameters(valueType).build(); + return Type.builder() + .withPackage(PACKAGE) + .withName("List") + .withTypeParameters(valueType) + .withTargetShape(valueType.getTargetShape().orElse(null)) + .build(); } public static final class Concurrent { @@ -122,7 +130,7 @@ public static final class Client { public static final String PACKAGE = "org.opensearch.client"; public static Type ApiClient(Type transport, Type client) { - return ApiClient.withTypeParams(transport, client); + return ApiClient.withTypeParameters(transport, client); } public static final Type ApiClient = Type.builder().withPackage(PACKAGE).withName("ApiClient").build(); @@ -161,7 +169,7 @@ public static final class Transport { public static final Type Endpoint = Type.builder().withPackage(PACKAGE).withName("Endpoint").build(); public static Type JsonEndpoint(Type requestType, Type responseType, Type errorType) { - return JsonEndpoint.withTypeParams(requestType, responseType, errorType); + return JsonEndpoint.withTypeParameters(requestType, responseType, errorType); } public static final Type JsonEndpoint = Type.builder().withPackage(PACKAGE).withName("JsonEndpoint").build(); @@ -179,14 +187,14 @@ public static final class Util { public static final Type ApiTypeHelper = Type.builder().withPackage(PACKAGE).withName("ApiTypeHelper").build(); public static Type ObjectBuilder(Type type) { - return ObjectBuilder.withTypeParams(type); + return ObjectBuilder.withTypeParameters(type); } public static final Type ObjectBuilder = Type.builder().withPackage(PACKAGE).withName("ObjectBuilder").build(); public static final Type ObjectBuilderBase = Type.builder().withPackage(PACKAGE).withName("ObjectBuilderBase").build(); public static Type TaggedUnion(Type tagType, Type baseType) { - return TaggedUnion.withTypeParams(tagType, baseType); + return TaggedUnion.withTypeParameters(tagType, baseType); } public static final Type TaggedUnion = Type.builder().withPackage(PACKAGE).withName("TaggedUnion").build(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index 88f5d28779..d4df9b3c07 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -183,6 +183,10 @@ public boolean isBoolean() { return is(OpenApiSchemaType.Boolean); } + public boolean isInteger() { + return is(OpenApiSchemaType.Integer); + } + public boolean isNumber() { return is(OpenApiSchemaType.Number); } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache index 8547a4e05e..5160e90ed9 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Client.mustache @@ -42,10 +42,7 @@ * {{description}} */ public {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}({{type}} request) throws {{TYPES.Java.Io.IOException}}, {{TYPES.Client.OpenSearch._Types.OpenSearchException}} { - @SuppressWarnings("unchecked") - {{jsonEndpointType}} endpoint = ({{jsonEndpointType}}) {{type.name}}._ENDPOINT; - - return this.transport.performRequest{{#async}}Async{{/async}}(request, endpoint, this.transportOptions); + return this.transport.performRequest{{#async}}Async{{/async}}(request, {{type.name}}._ENDPOINT, this.transportOptions); } /** @@ -62,9 +59,9 @@ /** * {{description}} */ - public {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}() + public final {{#async}}{{TYPES.Java.Util.Concurrent.CompletableFuture}}<{{/async}}{{responseType}}{{#async}}>{{/async}} {{#camelCase}}{{id}}{{/camelCase}}() throws IOException, OpenSearchException { - return this.transport.performRequest{{#async}}Async{{/async}}(new {{type.builderType}}().build(), {{type.name}}._ENDPOINT, this.transportOptions); + return {{#camelCase}}{{id}}{{/camelCase}}(new {{type.builderType}}().build()); } {{/hasAnyRequiredFields}} {{/canBeSingleton}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache index 26d308c6a5..b3ab0f1355 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache @@ -1,108 +1,41 @@ {{^abstract}} /** - * Builder for {@link {{className}}}. - */ - public static class Builder extends -{{#extendsOtherShape}} - {{extendsType}}.AbstractBuilder -{{/extendsOtherShape}} -{{^extendsOtherShape}} - {{TYPES.Client.Util.ObjectBuilderBase}} -{{/extendsOtherShape}} - implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { + * Builder for {@link {{className}}}. + */ {{#extendsOtherShape}} - @Override - protected Builder self() { - return this; - } - {{/extendsOtherShape}} -{{/abstract}} -{{#abstract}} - protected abstract static class AbstractBuilder> extends {{TYPES.Client.Util.ObjectBuilderBase}} { -{{/abstract}} - {{#fields}} - {{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}private {{type.boxed}} {{name}}; - {{/fields}} - - {{#fields}} - {{#type.isMap}} - {{>ObjectShape/FieldDoc/MapAddAll}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type}} map) { - this.{{name}} = _mapPutAll(this.{{name}}, map); - return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; - } - - {{>ObjectShape/FieldDoc/MapAdd}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.mapKeyType}} key, {{type.mapValueType}} value) { - this.{{name}} = _mapPut(this.{{name}}, key, value); - return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; - } - {{#type.mapValueType.hasBuilder}} - - {{>ObjectShape/FieldDoc/MapAddBuilderFn}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}(String key, {{type.mapValueType.builderFnType}} fn) { - return {{name}}(key, fn.apply(new {{type.mapValueType.builderType}}()).build()); - } - {{/type.mapValueType.hasBuilder}} - {{/type.isMap}} - {{#type.isList}} - {{>ObjectShape/FieldDoc/ListAddAll}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type}} list) { - this.{{name}} = _listAddAll(this.{{name}}, list); - return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; - } - - {{>ObjectShape/FieldDoc/ListAdd}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.listValueType}} value, {{type.listValueType}}... values) { - this.{{name}} = _listAdd(this.{{name}}, value, values); - return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; - } - {{#type.listValueType.hasBuilder}} + public static class Builder extends {{extendsType}}.AbstractBuilder + implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { + {{>ObjectShape/Builder/SelfImpl}} - {{>ObjectShape/FieldDoc/ListAddBuilderFn}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.listValueType.builderFnType}} fn) { - return {{name}}(fn.apply(new {{type.listValueType.builderType}}()).build()); - } - {{/type.listValueType.hasBuilder}} - {{/type.isList}} - {{^type.isListOrMap}} - {{>ObjectShape/FieldDoc/Basic}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}{{type}} value) { - this.{{name}} = value; - return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; - } - {{#type.hasBuilder}} + {{>ObjectShape/Builder/Fields}} - {{>ObjectShape/FieldDoc/Basic}} - {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.builderFnType}} fn) { - return {{name}}(fn.apply(new {{type.builderType}}()).build()); + {{>ObjectShape/Builder/BuildImpl}} } - {{/type.hasBuilder}} - {{/type.isListOrMap}} - - {{/fields}} - {{^abstract}} - /** - * Builds a {@link {{className}}}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public {{className}} build() { - _checkSingleUse(); + {{/extendsOtherShape}} + {{^extendsOtherShape}} + {{#extendedByOtherShape}} + public static class Builder extends {{type}}.AbstractBuilder + implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { + {{>ObjectShape/Builder/SelfImpl}} + + {{>ObjectShape/Builder/BuildImpl}} + } + {{/extendedByOtherShape}} + {{^extendedByOtherShape}} + public static class Builder extends {{TYPES.Client.Util.ObjectBuilderBase}} + implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { + {{>ObjectShape/Builder/Fields}} + + {{>ObjectShape/Builder/BuildImpl}} + } + {{/extendedByOtherShape}} + {{/extendsOtherShape}} +{{/abstract}} +{{#extendedByOtherShape}} + protected abstract static class AbstractBuilder> + extends {{#extendsOtherShape}}{{extendsType}}.AbstractBuilder{{/extendsOtherShape}}{{^extendsOtherShape}}{{TYPES.Client.Util.ObjectBuilderBase}}{{/extendsOtherShape}} { + {{>ObjectShape/Builder/Fields}} - return new {{className}}(this); - } - {{/abstract}} - {{#abstract}} protected abstract BuilderT self(); - {{/abstract}} - } \ No newline at end of file + } +{{/extendedByOtherShape}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/BuildImpl.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/BuildImpl.mustache new file mode 100644 index 0000000000..882fad9d21 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/BuildImpl.mustache @@ -0,0 +1,10 @@ +/** + * Builds a {@link {{className}}}. + * + * @throws NullPointerException if some of the required fields are null. + */ +public {{className}} build() { + _checkSingleUse(); + + return new {{className}}(this); +} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Fields.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Fields.mustache new file mode 100644 index 0000000000..88184a506f --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/Fields.mustache @@ -0,0 +1,69 @@ +{{#fields}} + {{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}private {{type.boxed}} {{name}}; +{{/fields}} + +{{#fields}} + {{#type.isMap}} + {{>ObjectShape/FieldDoc/MapAddAll}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type}} map) { + this.{{name}} = _mapPutAll(this.{{name}}, map); + return {{^extendedByOtherShape}}this{{/extendedByOtherShape}}{{#extendedByOtherShape}}self(){{/extendedByOtherShape}}; + } + + {{>ObjectShape/FieldDoc/MapAdd}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type.mapKeyType}} key, {{type.mapValueType}} value) { + this.{{name}} = _mapPut(this.{{name}}, key, value); + return {{^extendedByOtherShape}}this{{/extendedByOtherShape}}{{#extendedByOtherShape}}self(){{/extendedByOtherShape}}; + } + {{#type.mapValueType.hasBuilder}} + + {{>ObjectShape/FieldDoc/MapAddBuilderFn}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}(String key, {{type.mapValueType.builderFnType}} fn) { + return {{name}}(key, fn.apply(new {{type.mapValueType.builderType}}()).build()); + } + {{/type.mapValueType.hasBuilder}} + {{/type.isMap}} + {{#type.isList}} + {{>ObjectShape/FieldDoc/ListAddAll}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type}} list) { + this.{{name}} = _listAddAll(this.{{name}}, list); + return {{^extendedByOtherShape}}this{{/extendedByOtherShape}}{{#extendedByOtherShape}}self(){{/extendedByOtherShape}}; + } + + {{>ObjectShape/FieldDoc/ListAdd}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type.listValueType}} value, {{type.listValueType}}... values) { + this.{{name}} = _listAdd(this.{{name}}, value, values); + return {{^extendedByOtherShape}}this{{/extendedByOtherShape}}{{#extendedByOtherShape}}self(){{/extendedByOtherShape}}; + } + {{#type.listValueType.hasBuilder}} + + {{>ObjectShape/FieldDoc/ListAddBuilderFn}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type.listValueType.builderFnType}} fn) { + return {{name}}(fn.apply(new {{type.listValueType.builderType}}()).build()); + } + {{/type.listValueType.hasBuilder}} + {{/type.isList}} + {{^type.isListOrMap}} + {{>ObjectShape/FieldDoc/Basic}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}{{type}} value) { + this.{{name}} = value; + return {{^extendedByOtherShape}}this{{/extendedByOtherShape}}{{#extendedByOtherShape}}self(){{/extendedByOtherShape}}; + } + {{#type.hasBuilder}} + + {{>ObjectShape/FieldDoc/Basic}} + {{#deprecation}}@Deprecated{{/deprecation}} + public final Builder{{#extendedByOtherShape}}T{{/extendedByOtherShape}} {{name}}({{type.builderFnType}} fn) { + return {{name}}(fn.apply(new {{type.builderType}}()).build()); + } + {{/type.hasBuilder}} + {{/type.isListOrMap}} + +{{/fields}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/SelfImpl.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/SelfImpl.mustache new file mode 100644 index 0000000000..7d897fe252 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder/SelfImpl.mustache @@ -0,0 +1,4 @@ +@Override +protected Builder self() { + return this; +} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache index d526639524..b047e2a099 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache @@ -1,9 +1,9 @@ -{{^abstract}} +{{^extendedByOtherShape}} private {{className}}(Builder builder) { -{{/abstract}} -{{#abstract}} +{{/extendedByOtherShape}} +{{#extendedByOtherShape}} protected {{className}}(AbstractBuilder builder) { -{{/abstract}} +{{/extendedByOtherShape}} {{#extendsOtherShape}} super(builder); {{/extendsOtherShape}} @@ -28,7 +28,7 @@ } {{^abstract}} - public static {{className}} of({{type.builderFnType}} fn) { + public static {{className}} {{#extendedByOtherShape}}{{#camelCase}}{{className}}{{/camelCase}}Of{{/extendedByOtherShape}}{{^extendedByOtherShape}}of{{/extendedByOtherShape}}({{type.builderFnType}} fn) { return fn.apply(new Builder()).build(); } {{/abstract}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache index 366d666744..4496a97a93 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache @@ -4,16 +4,18 @@ */ public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = {{TYPES.Client.Json.ObjectBuilderDeserializer}}.lazy(Builder::new, {{className}}::setup{{className}}Deserializer); - protected static void setup{{className}}Deserializer({{TYPES.Client.Json.ObjectDeserializer}}<{{type.builderType}}> op) { {{/abstract}} -{{#abstract}} +{{^extendedByOtherShape}} + protected static void setup{{className}}Deserializer({{TYPES.Client.Json.ObjectDeserializer}}<{{type.builderType}}> op) { +{{/extendedByOtherShape}} +{{#extendedByOtherShape}} protected static > void setup{{className}}Deserializer({{TYPES.Client.Json.ObjectDeserializer}} op) { -{{/abstract}} +{{/extendedByOtherShape}} {{#extendsOtherShape}} {{extendsType}}.setup{{extendsType.name}}Deserializer(op); {{/extendsOtherShape}} {{#bodyFields}} - op.add({{#abstract}}Abstract{{/abstract}}Builder::{{name}}, {{#type}}{{>Type/deserializer}}{{/type}}, {{#quoted}}{{wireName}}{{/quoted}}); + op.add({{#extendedByOtherShape}}Abstract{{/extendedByOtherShape}}Builder::{{name}}, {{#type}}{{>Type/deserializer}}{{/type}}, {{#quoted}}{{wireName}}{{/quoted}}); {{/bodyFields}} {{#additionalPropertiesField}} op.setUnknownFieldHandler((builder, name, parser, mapper) -> { diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index 65bb3b6360..236daf9abb 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -35,7 +35,7 @@ switch (_kind) { {{#variants}} case {{#pascalCase}}{{name}}{{/pascalCase}}: - return {{#type.queryParamify}}this.{{name}}(){{/type.queryParamify}}; + return {{#type.queryParamify}}this.{{#camelCase}}{{name}}{{/camelCase}}(){{/type.queryParamify}}; {{/variants}} default: throw new IllegalStateException("Unknown kind " + _kind); @@ -56,7 +56,7 @@ * * @throws IllegalStateException if the current variant is not the {@code {{name}}} kind. */ - public {{type}} {{name}}() { + public {{type}} {{#camelCase}}{{name}}{{/camelCase}}() { return {{TYPES.Client.Util.TaggedUnionUtils}}.get(this, Kind.{{#pascalCase}}{{name}}{{/pascalCase}}); } @@ -84,15 +84,15 @@ private Object _value; {{#variants}} - public {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> {{name}}({{type}} v) { + public {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> {{#camelCase}}{{name}}{{/camelCase}}({{type}} v) { this._kind = Kind.{{#pascalCase}}{{name}}{{/pascalCase}}; this._value = v; return this; } {{#type.hasBuilder}} - public {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> {{name}}({{type.builderFnType}} fn) { - return this.{{name}}(fn.apply(new {{type.builderType}}()).build()); + public {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> {{#camelCase}}{{name}}{{/camelCase}}({{type.builderFnType}} fn) { + return this.{{#camelCase}}{{name}}{{/camelCase}}(fn.apply(new {{type.builderType}}()).build()); } {{/type.hasBuilder}} From 061a3b80173e9bd750dbfc2891069b2f72f3667c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 07:55:20 -0400 Subject: [PATCH 27/37] Bump org.apache.httpcomponents.core5:httpcore5-h2 from 5.2.5 to 5.3 (#1192) * Bump org.apache.httpcomponents.core5:httpcore5-h2 from 5.2.5 to 5.3 Bumps [org.apache.httpcomponents.core5:httpcore5-h2](https://github.com/apache/httpcomponents-core) from 5.2.5 to 5.3. - [Changelog](https://github.com/apache/httpcomponents-core/blob/master/RELEASE_NOTES.txt) - [Commits](https://github.com/apache/httpcomponents-core/compare/rel/v5.2.5...rel/v5.3) --- updated-dependencies: - dependency-name: org.apache.httpcomponents.core5:httpcore5-h2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1489b7d53c..0ab71d9c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 +- Bumps `org.apache.httpcomponents.core5:httpcore5-h2` from 5.2.5 to 5.3 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 7744fea2d7..c216d87cd7 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -190,7 +190,7 @@ dependencies { exclude(group = "org.apache.httpcomponents.core5") } api("org.apache.httpcomponents.core5:httpcore5:5.2.5") - api("org.apache.httpcomponents.core5:httpcore5-h2:5.2.5") + api("org.apache.httpcomponents.core5:httpcore5-h2:5.3") // Apache 2.0 // https://search.maven.org/artifact/com.google.code.findbugs/jsr305 From 9561ac2895e6d1cde79f7db264fcc0a5b660ea2c Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Mon, 16 Sep 2024 16:39:31 -0400 Subject: [PATCH 28/37] Bump org.apache.httpcomponents.core5:httpcore5 from 5.2.5 to 5.3 (#1194) Signed-off-by: Andriy Redko --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab71d9c0b..e5463bba00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 - Bumps `org.apache.httpcomponents.core5:httpcore5-h2` from 5.2.5 to 5.3 +- Bumps `org.apache.httpcomponents.core5:httpcore5` from 5.2.5 to 5.3 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index c216d87cd7..4ba04ae056 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -189,7 +189,7 @@ dependencies { api("org.apache.httpcomponents.client5:httpclient5:5.3.1") { exclude(group = "org.apache.httpcomponents.core5") } - api("org.apache.httpcomponents.core5:httpcore5:5.2.5") + api("org.apache.httpcomponents.core5:httpcore5:5.3") api("org.apache.httpcomponents.core5:httpcore5-h2:5.3") // Apache 2.0 From 8e5c38cd15edab48fa76255ece0b9c525e24a32b Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Mon, 16 Sep 2024 16:40:02 -0400 Subject: [PATCH 29/37] Update Gradle to 8.10.1 (#1195) Signed-off-by: Andriy Redko --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 176d08d230..b1d1292344 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -28,7 +28,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a +distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1 From 8a37f3f2776f5ef2244382c6bc379747e05f203e Mon Sep 17 00:00:00 2001 From: Liam Macpherson Date: Tue, 17 Sep 2024 12:57:13 +0100 Subject: [PATCH 30/37] fix: remove required check on indices.stats.ShardStats.shards (#1177) * fix: remove required check on indices.stats.ShardStats.shards Signed-off-by: Liam Macpherson Signed-off-by: Liam Macpherson * address review comments re: imports and changelog Signed-off-by: Liam Macpherson * add test and remove check in constructor Signed-off-by: Liam Macpherson Signed-off-by: Liam Macpherson * re-remove auto import organisation Signed-off-by: Liam Macpherson Signed-off-by: Liam Macpherson * chore: correct changelog link Signed-off-by: Liam Macpherson * spotlessApply tidyup Signed-off-by: Liam Macpherson Signed-off-by: Liam Macpherson --------- Signed-off-by: Liam Macpherson Signed-off-by: Liam Macpherson --- CHANGELOG.md | 6 +- .../opensearch/indices/stats/ShardStats.java | 19 +- .../opensearch/model/ShardStatsTest.java | 198 ++++++++++++++++++ 3 files changed, 213 insertions(+), 10 deletions(-) create mode 100644 java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index e5463bba00..2c56882829 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 3.0] ### Dependencies -- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.4 +- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0 +- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 @@ -50,6 +51,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Fixed - Fix queries not preserving boost and name when converted to builders ([#1181](https://github.com/opensearch-project/opensearch-java/pull/1181)) +- Remove required check on ShardStats.shards ([#1177](https://github.com/opensearch-project/opensearch-java/pull/1177)) ### Security @@ -549,4 +551,4 @@ This section is for maintaining a changelog for all breaking changes for the cli [2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0 [2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0 [2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0 -[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 \ No newline at end of file +[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java index 9cc34fa4d5..7f7fca54b1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/stats/ShardStats.java @@ -110,6 +110,7 @@ public class ShardStats implements PlainJsonSerializable { @Nullable private final BulkStats bulk; + @Nullable private final ShardsTotalStats shards; // --------------------------------------------------------------------------------------------- @@ -138,8 +139,7 @@ private ShardStats(Builder builder) { this.translog = ApiTypeHelper.requireNonNull(builder.translog, this, "translog"); this.warmer = ApiTypeHelper.requireNonNull(builder.warmer, this, "warmer"); this.bulk = builder.bulk; - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - + this.shards = builder.shards; } public static ShardStats of(Function> fn) { @@ -302,8 +302,9 @@ public final BulkStats bulk() { } /** - * Required - API name: {@code shards} + * API name: {@code shards} */ + @Nullable public final ShardsTotalStats shards() { return this.shards; } @@ -387,9 +388,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.bulk.serialize(generator, mapper); } - generator.writeKey("shards"); - this.shards.serialize(generator, mapper); - + if (this.shards != null) { + generator.writeKey("shards"); + this.shards.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- @@ -444,6 +446,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder> } /** - * Required - API name: {@code shards} + * API name: {@code shards} */ public final Builder shards(ShardsTotalStats value) { this.shards = value; @@ -785,7 +788,7 @@ public final Builder shards(ShardsTotalStats value) { } /** - * Required - API name: {@code shards} + * API name: {@code shards} */ public final Builder shards(Function> fn) { return this.shards(fn.apply(new ShardsTotalStats.Builder()).build()); diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java new file mode 100644 index 0000000000..e86d347514 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/ShardStatsTest.java @@ -0,0 +1,198 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +package org.opensearch.client.opensearch.model; + +import static java.util.Collections.emptyList; + +import java.util.HashMap; +import org.junit.Assert; +import org.junit.Test; +import org.opensearch.client.opensearch._types.CompletionStats; +import org.opensearch.client.opensearch._types.DocStats; +import org.opensearch.client.opensearch._types.FielddataStats; +import org.opensearch.client.opensearch._types.FlushStats; +import org.opensearch.client.opensearch._types.GetStats; +import org.opensearch.client.opensearch._types.IndexingStats; +import org.opensearch.client.opensearch._types.MergesStats; +import org.opensearch.client.opensearch._types.RecoveryStats; +import org.opensearch.client.opensearch._types.RefreshStats; +import org.opensearch.client.opensearch._types.RequestCacheStats; +import org.opensearch.client.opensearch._types.SearchStats; +import org.opensearch.client.opensearch._types.SegmentsStats; +import org.opensearch.client.opensearch._types.StoreStats; +import org.opensearch.client.opensearch._types.TranslogStats; +import org.opensearch.client.opensearch._types.WarmerStats; +import org.opensearch.client.opensearch.indices.stats.ShardCommit; +import org.opensearch.client.opensearch.indices.stats.ShardPath; +import org.opensearch.client.opensearch.indices.stats.ShardQueryCache; +import org.opensearch.client.opensearch.indices.stats.ShardRetentionLeases; +import org.opensearch.client.opensearch.indices.stats.ShardRouting; +import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; +import org.opensearch.client.opensearch.indices.stats.ShardSequenceNumber; +import org.opensearch.client.opensearch.indices.stats.ShardStats; +import org.opensearch.client.util.MissingRequiredPropertyException; + +public class ShardStatsTest extends Assert { + + @Test + public void testShardStatsBulkAndShardsPropertiesNotRequired() { + + ShardStats.Builder builder = createShardsStatsBuilderWithRequiredFields(); + + try { + builder.build(); + } catch (MissingRequiredPropertyException e) { + fail(e.getClass().getSimpleName() + " was thrown: " + e.getMessage()); + } + } + + private ShardStats.Builder createShardsStatsBuilderWithRequiredFields() { + ShardCommit commit = new ShardCommit.Builder().id("").generation(0).numDocs(0).userData(new HashMap<>()).build(); + CompletionStats completion = new CompletionStats.Builder().sizeInBytes(0).build(); + DocStats docs = new DocStats.Builder().count(0).deleted(0).build(); + FielddataStats fielddata = new FielddataStats.Builder().memorySizeInBytes(0).build(); + FlushStats flush = new FlushStats.Builder().periodic(0).total(0).totalTimeInMillis(0).build(); + GetStats get = new GetStats.Builder().current(0) + .existsTimeInMillis(0) + .existsTotal(0) + .missingTimeInMillis(0) + .missingTotal(0) + .timeInMillis(0) + .total(0) + .build(); + IndexingStats indexing = new IndexingStats.Builder().indexCurrent(0) + .deleteCurrent(0) + .deleteTimeInMillis(0) + .deleteTotal(0) + .isThrottled(false) + .noopUpdateTotal(0) + .throttleTimeInMillis(0) + .indexTimeInMillis(0) + .indexTotal(0) + .indexFailed(0) + .types(new HashMap<>()) + .build(); + MergesStats merges = new MergesStats.Builder().current(0) + .currentDocs(0) + .currentSizeInBytes(0) + .total(0) + .totalAutoThrottleInBytes(0) + .totalDocs(0) + .totalSizeInBytes(0) + .totalStoppedTimeInMillis(0) + .totalThrottledTimeInMillis(0) + .totalTimeInMillis(0) + .build(); + ShardPath shardPath = new ShardPath.Builder().dataPath("").isCustomDataPath(false).statePath("").build(); + ShardQueryCache queryCache = new ShardQueryCache.Builder().cacheCount(0) + .cacheSize(0) + .evictions(0) + .hitCount(0) + .memorySizeInBytes(0) + .missCount(0) + .totalCount(0) + .build(); + RecoveryStats recovery = new RecoveryStats.Builder().currentAsSource(0).currentAsTarget(0).throttleTimeInMillis(0).build(); + RefreshStats refresh = new RefreshStats.Builder().externalTotal(0) + .externalTotalTimeInMillis(0) + .listeners(0) + .total(0) + .totalTimeInMillis(0) + .build(); + RequestCacheStats requestCache = new RequestCacheStats.Builder().evictions(0).hitCount(0).memorySizeInBytes(0).missCount(0).build(); + ShardRetentionLeases retentionLeases = new ShardRetentionLeases.Builder().primaryTerm(0).version(0).leases(emptyList()).build(); + ShardRouting routing = new ShardRouting.Builder().node("").primary(false).state(ShardRoutingState.Unassigned).build(); + SearchStats search = new SearchStats.Builder().fetchCurrent(0) + .fetchTimeInMillis(0) + .fetchTotal(0) + .queryCurrent(0) + .queryTimeInMillis(0) + .queryTotal(0) + .scrollCurrent(0) + .scrollTimeInMillis(0) + .scrollTotal(0) + .suggestCurrent(0) + .suggestTimeInMillis(0) + .suggestTotal(0) + .build(); + SegmentsStats segments = new SegmentsStats.Builder().count(0) + .docValuesMemoryInBytes(0) + .fileSizes(new HashMap<>()) + .fixedBitSetMemoryInBytes(0) + .indexWriterMemoryInBytes(0) + .maxUnsafeAutoIdTimestamp(0) + .memoryInBytes(0) + .normsMemoryInBytes(0) + .pointsMemoryInBytes(0) + .storedFieldsMemoryInBytes(0) + .termsMemoryInBytes(0) + .termVectorsMemoryInBytes(0) + .versionMapMemoryInBytes(0) + .build(); + ShardSequenceNumber seqNo = new ShardSequenceNumber.Builder().globalCheckpoint(0).localCheckpoint(0).maxSeqNo(0).build(); + StoreStats store = new StoreStats.Builder().sizeInBytes(0).reservedInBytes(0).build(); + TranslogStats translog = new TranslogStats.Builder().earliestLastModifiedAge(0) + .operations(0) + .sizeInBytes(0) + .uncommittedOperations(0) + .uncommittedSizeInBytes(0) + .build(); + WarmerStats warmer = new WarmerStats.Builder().current(0).total(0).totalTimeInMillis(0).build(); + + ShardStats.Builder builder = new ShardStats.Builder(); + + builder.commit(commit) + .completion(completion) + .docs(docs) + .fielddata(fielddata) + .flush(flush) + .get(get) + .indexing(indexing) + .merges(merges) + .shardPath(shardPath) + .queryCache(queryCache) + .recovery(recovery) + .refresh(refresh) + .requestCache(requestCache) + .retentionLeases(retentionLeases) + .routing(routing) + .search(search) + .segments(segments) + .seqNo(seqNo) + .store(store) + .translog(translog) + .warmer(warmer); + + return builder; + } +} From 432919c1e3dff3898f48196cc43d096925f3f784 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 18 Sep 2024 09:04:58 +1200 Subject: [PATCH 31/37] Support new mechanism of defining deprecated enum variants in OpenAPI (#1198) * Support new mechanism of defining deprecated enum variants in OpenAPI Signed-off-by: Thomas Farr * Spotless Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- java-codegen/opensearch-openapi.yaml | 2877 ++++++++++++++--- .../client/codegen/model/SpecTransformer.java | 39 +- .../codegen/openapi/HttpStatusCode.java | 2 + .../client/codegen/openapi/OpenApiSchema.java | 29 +- .../codegen/openapi/OpenApiSchemaFormat.java | 15 +- 5 files changed, 2500 insertions(+), 462 deletions(-) diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 97f65afef4..8eb4f6063f 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -3442,6 +3442,428 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_flow_framework/workflow: + post: + operationId: flow_framework.create.0 + x-operation-group: flow_framework.create + x-version-added: '2.12' + description: Create a workflow. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/create-workflow/ + parameters: + - $ref: '#/components/parameters/flow_framework.create::query.provision' + - $ref: '#/components/parameters/flow_framework.create::query.reprovision' + - $ref: '#/components/parameters/flow_framework.create::query.update_fields' + - $ref: '#/components/parameters/flow_framework.create::query.use_case' + - $ref: '#/components/parameters/flow_framework.create::query.validation' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/flow_framework.create' + responses: + '201': + $ref: '#/components/responses/flow_framework.create@201' + '400': + $ref: '#/components/responses/flow_framework.create@400' + '403': + $ref: '#/components/responses/flow_framework.create@403' + /_plugins/_flow_framework/workflow/_search: + get: + operationId: flow_framework.search.1 + x-operation-group: flow_framework.search + x-version-added: '2.12' + description: Search for workflows by using a query matching a field. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/provision-workflow/ + requestBody: + $ref: '#/components/requestBodies/flow_framework.search' + responses: + '200': + $ref: '#/components/responses/flow_framework.search@200' + '400': + $ref: '#/components/responses/flow_framework.search@400' + '403': + $ref: '#/components/responses/flow_framework.search@403' + '408': + $ref: '#/components/responses/flow_framework.search@408' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: flow_framework.search.0 + x-operation-group: flow_framework.search + x-version-added: '2.12' + description: Search for workflows by using a query matching a field. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/provision-workflow/ + requestBody: + $ref: '#/components/requestBodies/flow_framework.search' + responses: + '200': + $ref: '#/components/responses/flow_framework.search@200' + '400': + $ref: '#/components/responses/flow_framework.search@400' + '403': + $ref: '#/components/responses/flow_framework.search@403' + '408': + $ref: '#/components/responses/flow_framework.search@408' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_flow_framework/workflow/_steps: + get: + operationId: flow_framework.get_steps.0 + x-operation-group: flow_framework.get_steps + x-version-added: '2.12' + description: Get a list of workflow steps. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/get-workflow-steps/ + parameters: + - $ref: '#/components/parameters/flow_framework.get_steps::query.workflow_step' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/flow_framework.get_steps@200' + '400': + $ref: '#/components/responses/flow_framework.get_steps@400' + '403': + $ref: '#/components/responses/flow_framework.get_steps@403' + /_plugins/_flow_framework/workflow/{workflow_id}: + delete: + operationId: flow_framework.delete.0 + x-operation-group: flow_framework.delete + x-version-added: '2.12' + description: Delete a workflow. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/delete-workflow/ + parameters: + - $ref: '#/components/parameters/flow_framework.delete::path.workflow_id' + - $ref: '#/components/parameters/flow_framework.delete::query.clear_status' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/flow_framework.delete@200' + '400': + $ref: '#/components/responses/flow_framework.delete@400' + '403': + $ref: '#/components/responses/flow_framework.delete@403' + get: + operationId: flow_framework.get.0 + x-operation-group: flow_framework.get + x-version-added: '2.12' + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/get-workflow/ + description: Get a workflow. + parameters: + - $ref: '#/components/parameters/flow_framework.get::path.workflow_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/flow_framework.get@200' + '404': + $ref: '#/components/responses/flow_framework.get@404' + put: + operationId: flow_framework.update.0 + x-operation-group: flow_framework.update + x-version-added: '2.12' + description: Update a workflow. You can only update a complete workflow if it has not yet been provisioned. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/create-workflow/ + parameters: + - $ref: '#/components/parameters/flow_framework.update::path.workflow_id' + - $ref: '#/components/parameters/flow_framework.update::query.provision' + - $ref: '#/components/parameters/flow_framework.update::query.reprovision' + - $ref: '#/components/parameters/flow_framework.update::query.update_fields' + - $ref: '#/components/parameters/flow_framework.update::query.use_case' + - $ref: '#/components/parameters/flow_framework.update::query.validation' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/flow_framework.update' + responses: + '201': + $ref: '#/components/responses/flow_framework.update@201' + description: It returns the workflow_id + '400': + $ref: '#/components/responses/flow_framework.update@400' + '404': + $ref: '#/components/responses/flow_framework.update@404' + /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision: + post: + operationId: flow_framework.deprovision.0 + x-operation-group: flow_framework.deprovision + x-version-added: '2.12' + description: Deprovision workflow's resources when you no longer need it. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/deprovision-workflow/ + parameters: + - $ref: '#/components/parameters/flow_framework.deprovision::path.workflow_id' + - $ref: '#/components/parameters/flow_framework.deprovision::query.allow_delete' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/flow_framework.deprovision@200' + '202': + $ref: '#/components/responses/flow_framework.deprovision@202' + '403': + $ref: '#/components/responses/flow_framework.deprovision@403' + '404': + $ref: '#/components/responses/flow_framework.deprovision@404' + /_plugins/_flow_framework/workflow/{workflow_id}/_provision: + post: + operationId: flow_framework.provision.0 + x-operation-group: flow_framework.provision + x-version-added: '2.12' + description: Provisioning a workflow. This API is also executed when the Create or Update Workflow API is called with the provision parameter set to true. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/provision-workflow/ + parameters: + - $ref: '#/components/parameters/flow_framework.provision::path.workflow_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + description: |- + Pass dynamic substitution expressions as key-value pairs, either as query parameters or in the request body. + For example, if you specified a credential field in the template as `openai_key: '$'`, + you can pass `openai_key` as a query parameter or in the request body. + $ref: '#/components/requestBodies/flow_framework.provision' + responses: + '200': + $ref: '#/components/responses/flow_framework.provision@200' + '400': + $ref: '#/components/responses/flow_framework.provision@400' + '403': + $ref: '#/components/responses/flow_framework.provision@403' + /_plugins/_flow_framework/workflow/{workflow_id}/_status: + get: + operationId: flow_framework.get_status.0 + x-operation-group: flow_framework.get_status + x-version-added: '2.12' + description: Get the provisioning deployment status until it is complete. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/get-workflow-status/ + parameters: + - $ref: '#/components/parameters/flow_framework.get_status::path.workflow_id' + - $ref: '#/components/parameters/flow_framework.get_status::query.all' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/flow_framework.get_status@200' + '403': + $ref: '#/components/responses/flow_framework.get_status@403' + '404': + $ref: '#/components/responses/flow_framework.get_status@404' + /_plugins/_flow_framework/workflow/state/_search: + get: + operationId: flow_framework.search_state.1 + x-operation-group: flow_framework.search_state + x-version-added: '2.12' + description: Search for workflows by using a query matching a field. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/search-workflow-state/ + requestBody: + $ref: '#/components/requestBodies/flow_framework.search_state' + responses: + '200': + $ref: '#/components/responses/flow_framework.search_state@200' + '400': + $ref: '#/components/responses/flow_framework.search_state@400' + '403': + $ref: '#/components/responses/flow_framework.search_state@403' + '408': + $ref: '#/components/responses/flow_framework.search_state@408' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: flow_framework.search_state.0 + x-operation-group: flow_framework.search_state + x-version-added: '2.12' + description: Search for workflows by using a query matching a field. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/api/search-workflow-state/ + requestBody: + $ref: '#/components/requestBodies/flow_framework.search_state' + responses: + '200': + $ref: '#/components/responses/flow_framework.search_state@200' + '400': + $ref: '#/components/responses/flow_framework.search_state@400' + '403': + $ref: '#/components/responses/flow_framework.search_state@403' + '408': + $ref: '#/components/responses/flow_framework.search_state@408' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_ism/add/{index}: + post: + operationId: ism.add_policy.0 + x-operation-group: ism.add_policy + description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + /_plugins/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.0 + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + /_plugins/_ism/explain/{index}: + get: + operationId: ism.explain_index.0 + x-operation-group: ism.explain_index + description: Gets the currently applied policy on an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.explain_index@200' + /_plugins/_ism/policies/{policy_id}: + delete: + operationId: ism.delete_policy.0 + x-operation-group: ism.delete_policy + description: Deletes a policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#delete-policy + parameters: + - $ref: '#/components/parameters/ism.delete_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.delete_policy@200' + get: + operationId: ism.get_policy.0 + x-operation-group: ism.get_policy + description: Gets the policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.get_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.get_policy@200' + put: + operationId: ism.put_policy.0 + x-operation-group: ism.put_policy + description: Creates or updates a policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + parameters: + - $ref: '#/components/parameters/ism.put_policy::path.policy_id' + - $ref: '#/components/parameters/ism.put_policy::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policy::query.if_seq_no' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.put_policy' + responses: + '200': + $ref: '#/components/responses/ism.put_policy@200' + '201': + $ref: '#/components/responses/ism.put_policy@201' + /_plugins/_ism/remove/{index}: + post: + operationId: ism.remove_policy.0 + x-operation-group: ism.remove_policy + description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' /_plugins/_knn/{node_id}/stats: get: operationId: knn.stats.2 @@ -6415,13 +6837,15 @@ paths: '200': $ref: '#/components/responses/transforms.search@200' /_plugins/_transform/_preview: - get: + post: operationId: transforms.preview.0 x-operation-group: transforms.preview x-version-added: '1.0' description: Returns a preview of what a transformed index would look like. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/index-transforms/transforms-apis/#preview-a-transform-jobs-results + requestBody: + $ref: '#/components/requestBodies/transforms.preview' responses: '200': $ref: '#/components/responses/transforms.preview@200' @@ -11058,6 +11482,147 @@ paths: $ref: '#/components/responses/asynchronous_search.delete@200' deprecated: true x-ignorable: true + /_opendistro/_ism/add/{index}: + post: + operationId: ism.add_policy.0_superseded + x-operation-group: ism.add_policy + description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.0_superseded + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/explain/{index}: + get: + operationId: ism.explain_index.0_superseded + x-operation-group: ism.explain_index + description: Gets the currently applied policy on an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.explain_index@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/policies/{policyID}: + get: + operationId: ism.get_policy.0_superseded + x-operation-group: ism.get_policy + description: Gets the policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.get_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.get_policy@200' + deprecated: true + x-ignorable: true + put: + operationId: ism.put_policy.0_superseded + x-operation-group: ism.put_policy + description: Creates or updates a policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + parameters: + - $ref: '#/components/parameters/ism.put_policy::path.policy_id' + - $ref: '#/components/parameters/ism.put_policy::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policy::query.if_seq_no' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.put_policy' + responses: + '200': + $ref: '#/components/responses/ism.put_policy@200' + '201': + $ref: '#/components/responses/ism.put_policy@201' + deprecated: true + x-ignorable: true + delete: + operationId: ism.delete_policy.0_superseded + x-operation-group: ism.delete_policy + description: Deletes a policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#delete-policy + parameters: + - $ref: '#/components/parameters/ism.delete_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.delete_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/remove/{index}: + post: + operationId: ism.remove_policy.0_superseded + x-operation-group: ism.remove_policy + description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' + deprecated: true + x-ignorable: true /_opendistro/_knn/stats/{stat}: get: operationId: knn.stats.1_superseded @@ -13070,7 +13635,7 @@ components: _global::query.filter_path: name: filter_path in: query - description: Comma-separated list of filters used to reduce the response. + description: Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-". schema: oneOf: - type: string @@ -13272,7 +13837,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' cat.all_pit_segments::query.format: name: format in: query @@ -13331,7 +13896,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.allocation::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -13541,7 +14106,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.fielddata::query.fields: in: query @@ -13670,7 +14235,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.indices::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -13921,7 +14486,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.nodes::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -14091,7 +14656,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' cat.pit_segments::query.format: name: format in: query @@ -14229,7 +14794,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.recovery::query.detailed: in: query @@ -14400,7 +14965,7 @@ components: in: query description: The unit in which to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' cat.segment_replication::query.completed_only: name: completed_only in: query @@ -14532,7 +15097,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.segments::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -14611,7 +15176,7 @@ components: name: bytes description: The unit used to display byte values. schema: - $ref: '#/components/schemas/_common:StorageType' + $ref: '#/components/schemas/_common:ByteUnit' style: form cat.shards::query.cluster_manager_timeout: name: cluster_manager_timeout @@ -16770,6 +17335,125 @@ components: type: boolean default: false style: form + flow_framework.create::query.provision: + in: query + name: provision + schema: + $ref: '#/components/schemas/flow_framework.common:Provision' + flow_framework.create::query.reprovision: + x-version-added: '2.17' + in: query + name: reprovision + schema: + $ref: '#/components/schemas/flow_framework.common:Reprovision' + flow_framework.create::query.update_fields: + in: query + name: update_fields + schema: + $ref: '#/components/schemas/flow_framework.common:UpdateFields' + flow_framework.create::query.use_case: + description: To use a workflow template, specify it in the use_case query parameter when creating a workflow. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/workflow-templates/#supported-workflow-templates + in: query + name: use_case + schema: + $ref: '#/components/schemas/flow_framework.common:UseCase' + flow_framework.create::query.validation: + in: query + name: validation + schema: + $ref: '#/components/schemas/flow_framework.common:Validation' + flow_framework.delete::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.delete::query.clear_status: + in: query + name: clear_status + schema: + description: Delete the workflow state (without deprovisioning resources) after deleting the template. OpenSearch deletes the workflow state only if the provisioning status is not IN_PROGRESS. Default is false. + type: boolean + default: false + flow_framework.deprovision::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.deprovision::query.allow_delete: + in: query + name: allow_delete + schema: + $ref: '#/components/schemas/flow_framework.common:AllowDelete' + flow_framework.get_status::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.get_status::query.all: + description: The all parameter specifies whether the response should return all fields. + in: query + name: all + schema: + $ref: '#/components/schemas/flow_framework.common:All' + flow_framework.get_steps::query.workflow_step: + in: query + name: workflow_step + required: false + schema: + description: The name of the step to retrieve. + $ref: '#/components/schemas/flow_framework.common:WorkflowStepName' + flow_framework.get::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.provision::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.update::path.workflow_id: + name: workflow_id + in: path + required: true + schema: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.update::query.provision: + in: query + name: provision + schema: + $ref: '#/components/schemas/flow_framework.common:Provision' + flow_framework.update::query.reprovision: + x-version-added: '2.17' + in: query + name: reprovision + schema: + $ref: '#/components/schemas/flow_framework.common:Reprovision' + flow_framework.update::query.update_fields: + in: query + name: update_fields + schema: + $ref: '#/components/schemas/flow_framework.common:UpdateFields' + flow_framework.update::query.use_case: + description: To use a workflow template, specify it in the use_case query parameter when creating a workflow. + externalDocs: + url: https://opensearch.org/docs/latest/automating-configurations/workflow-templates/#supported-workflow-templates + in: query + name: use_case + schema: + $ref: '#/components/schemas/flow_framework.common:UseCase' + flow_framework.update::query.validation: + in: query + name: validation + schema: + $ref: '#/components/schemas/flow_framework.common:Validation' get_script::path.id: in: path name: id @@ -19728,6 +20412,78 @@ components: type: boolean default: false style: form + ism.add_policy::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple + ism.change_policy::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple + ism.delete_policy::path.policy_id: + name: policy_id + in: path + required: true + schema: + type: string + ism.explain_index::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple + ism.get_policy::path.policy_id: + name: policy_id + in: path + required: true + schema: + type: string + ism.put_policy::path.policy_id: + name: policy_id + in: path + required: true + schema: + type: string + ism.put_policy::query.if_primary_term: + name: if_primary_term + in: query + description: Only perform the operation if the document has this primary term. + schema: + type: number + style: form + ism.put_policy::query.if_seq_no: + name: if_seq_no + in: query + description: Only perform the operation if the document has this sequence number. + schema: + $ref: '#/components/schemas/_common:SequenceNumber' + style: form + ism.remove_policy::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple knn.delete_model::path.model_id: name: model_id in: path @@ -23736,6 +24492,34 @@ components: runtime_mappings: $ref: '#/components/schemas/_common.mapping:RuntimeFields' description: An index filter specified with the Query DSL + flow_framework.create: + content: + application/json: + schema: + $ref: '#/components/schemas/flow_framework.common:FlowFrameworkCreate' + flow_framework.provision: + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/flow_framework.common:UserProvidedSubstitutionExpressions' + flow_framework.search: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/flow_framework.common:SearchWorkflowRequest' + flow_framework.search_state: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/flow_framework.common:SearchWorkflowRequest' + flow_framework.update: + content: + application/json: + schema: + $ref: '#/components/schemas/flow_framework.common:FlowFrameworkUpdate' index: content: application/json: @@ -24148,6 +24932,21 @@ components: $ref: '#/components/schemas/ingest._common:Pipeline' description: The simulate definition required: true + ism.add_policy: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:AddPolicyRequest' + ism.change_policy: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:ChangePolicyRequest' + ism.put_policy: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyRequest' knn.search_models: content: application/json: @@ -24548,13 +25347,6 @@ components: type: array items: $ref: '#/components/schemas/_common.query_dsl:FieldAndFormat' - knn: - description: Defines the approximate kNN search to run. - oneOf: - - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' - - type: array - items: - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' rank: $ref: '#/components/schemas/_common:RankContainer' min_score: @@ -25016,6 +25808,16 @@ components: additionalProperties: type: string description: Define parameters and or supply a document to get termvectors for. See documentation. + transforms.preview: + content: + application/json: + schema: + type: object + properties: + transform: + $ref: '#/components/schemas/transforms._common:Transform' + required: + - transform transforms.put: content: application/json: @@ -25669,7 +26471,7 @@ components: content: application/json: schema: - anyOf: + oneOf: - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' - type: object properties: @@ -25738,6 +26540,175 @@ components: required: - fields - indices + flow_framework.create@201: + content: + application/json: + schema: + type: object + properties: + workflow_id: + type: string + description: The ID of the workflow to be updated. Required for the PUT method. + required: + - workflow_id + flow_framework.create@400: + description: Bad Request - Multiple possible reasons + content: + application/json: + oneOf: + - $ref: '#/components/schemas/flow_framework.errors:InvalidParameterError' + - $ref: '#/components/schemas/flow_framework.errors:ConflictError' + - $ref: '#/components/schemas/flow_framework.errors:MissingParameterError' + - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' + - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + flow_framework.create@403: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.delete@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:FlowFrameworkDeleteResponse' + flow_framework.delete@400: + description: Work Flow Id Null Error + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:WorkFlowIdNullError' + flow_framework.delete@403: + description: Flow Framework API Disabled Error + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.deprovision@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.deprovision@202: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:DeprovisioningError' + flow_framework.deprovision@403: + content: + application/json: + oneOf: + - $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + - $ref: '#/components/schemas/flow_framework.errors:DeprovisioningForbiddenError' + flow_framework.deprovision@404: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:TemplateNotFoundError' + flow_framework.get_status@200: + content: + application/json: + oneOf: + - $ref: '#/components/schemas/flow_framework.common:WorkFlowStatusFullResponse' + - $ref: '#/components/schemas/flow_framework.common:WorkFlowStatusDefaultResponse' + flow_framework.get_status@403: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.get_status@404: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:TemplateNotFoundError' + flow_framework.get_steps@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:WorkflowStep' + flow_framework.get_steps@400: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:WorkflowStepsRetrieveError' + flow_framework.get_steps@403: + description: Flow Framework API Disabled Error + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.get@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:FlowFrameworkGetResponse' + flow_framework.get@404: + description: Template Not Found Error + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:TemplateNotFoundError' + flow_framework.provision@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:WorkflowID' + flow_framework.provision@400: + content: + application/json: + oneOf: + - $ref: '#/components/schemas/flow_framework.errors:WorkFlowIdNullError' + - $ref: '#/components/schemas/flow_framework.errors:RequestBodyParsingFailedError' + - $ref: '#/components/schemas/flow_framework.errors:InvalidRequestBodyFieldError' + - $ref: '#/components/schemas/flow_framework.errors:DuplicateKeyError' + flow_framework.provision@403: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.search_state@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:WorkflowSearchStateResponse' + flow_framework.search_state@400: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:BadRequestError' + flow_framework.search_state@403: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.search_state@408: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:RequestTimeoutError' + flow_framework.search@200: + content: + application/json: + $ref: '#/components/schemas/flow_framework.common:WorkflowSearchResponse' + flow_framework.search@400: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:BadRequestError' + flow_framework.search@403: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:FlowFrameworkAPIDisabledError' + flow_framework.search@408: + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:RequestTimeoutError' + flow_framework.update@201: + content: + application/json: + schema: + type: object + properties: + workflow_id: + type: string + description: The ID of the workflow to be updated. Required for the PUT method. + required: + - workflow_id + flow_framework.update@400: + description: Bad Request - Multiple possible reasons + content: + application/json: + oneOf: + - $ref: '#/components/schemas/flow_framework.errors:InvalidParameterError' + - $ref: '#/components/schemas/flow_framework.errors:ConflictError' + - $ref: '#/components/schemas/flow_framework.errors:MissingParameterError' + - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' + - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + flow_framework.update@404: + description: Template Not Found Error + content: + application/json: + $ref: '#/components/schemas/flow_framework.errors:TemplateNotFoundError' get_all_pits@200: content: application/json: @@ -25922,10 +26893,10 @@ components: items: $ref: '#/components/schemas/indices.data_streams_stats:DataStreamsStatsItem' total_store_sizes: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_store_size_bytes: description: Total size, in bytes, of all shards for the selected data streams. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - _shards - backing_indices @@ -26354,6 +27325,46 @@ components: $ref: '#/components/schemas/ingest.simulate:PipelineSimulation' required: - docs + ism.add_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:AddPolicyResponse' + ism.change_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:ChangePolicyResponse' + ism.delete_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:DeletePolicyResponse' + ism.explain_index@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:ExplainIndexResponse' + ism.get_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:GetPolicyResponse' + ism.put_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyResponse' + ism.put_policy@201: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyResponse' + ism.remove_policy@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RemovePolicyResponse' knn.delete_model@200: {} knn.get_model@200: {} knn.search_models@200: {} @@ -26766,7 +27777,7 @@ components: content: application/json: schema: - anyOf: + oneOf: - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' - type: object properties: @@ -27825,7 +28836,7 @@ components: content: application/json: schema: - anyOf: + oneOf: - $ref: '#/components/schemas/_common:BulkByScrollResponseBase' - type: object properties: @@ -27981,8 +28992,23 @@ components: - status _common:byte: type: number - _common:Bytes: + _common:ByteCount: type: integer + format: int64 + _common:ByteUnit: + type: string + enum: + - b + - g + - gb + - k + - kb + - m + - mb + - p + - pb + - t + - tb _common:ClusterDetails: type: object properties: @@ -28043,9 +29069,9 @@ components: properties: size_in_bytes: description: Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' fields: type: object additionalProperties: @@ -28242,9 +29268,9 @@ components: evictions: type: number memory_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' fields: type: object additionalProperties: @@ -28255,9 +29281,9 @@ components: type: object properties: memory_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - memory_size_in_bytes _common:Fields: @@ -28270,9 +29296,9 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - size_in_bytes _common:FieldValue: @@ -28283,6 +29309,10 @@ components: - number - object - string + _common:FieldWithOrder: + type: object + additionalProperties: + $ref: '#/components/schemas/_common:ScoreSort' _common:FlushStats: type: object properties: @@ -28458,6 +29488,9 @@ components: - type: array items: type: string + _common:HumanReadableByteCount: + type: string + pattern: \d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p) _common:IBDistribution: type: string enum: @@ -28651,21 +29684,21 @@ components: current_docs: type: number current_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' current_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: type: number total_auto_throttle: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_auto_throttle_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total_docs: type: number total_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total_stopped_time: $ref: '#/components/schemas/_common:Duration' total_stopped_time_in_millis: @@ -28707,6 +29740,13 @@ components: - type: string _common:MultiTermQueryRewrite: type: string + enum: + - constant_score + - constant_score_boolean + - scoring_boolean + - top_terms_N + - top_terms_blended_freqs_N + - top_terms_boost_N _common:Name: type: string _common:Names: @@ -28764,25 +29804,32 @@ components: _common:NodeName: type: string _common:NodeRole: - type: string - enum: - - client - - cluster_manager - - coordinating_only - - data - - data_cold - - data_content - - data_frozen - - data_hot - - data_warm - - ingest - - master - - ml - - remote_cluster_client - - transform - - voting_only - x-deprecated-enums: - - master + oneOf: + - type: string + enum: + - client + - coordinating_only + - data + - data_cold + - data_content + - data_frozen + - data_hot + - data_warm + - ingest + - ml + - remote_cluster_client + - transform + - voting_only + - type: string + enum: + - master + deprecated: true + x-version-deprecated: '2.0' + x-deprecation-message: To promote inclusive language, use 'cluster_manager' instead. + - type: string + enum: + - cluster_manager + x-version-added: '2.0' _common:NodeRoles: description: Node roles. type: array @@ -28890,10 +29937,11 @@ components: - index _common:Password: type: string - _common:Percentage: - oneOf: - - type: string - - type: number + _common:PercentageNumber: + type: number + _common:PercentageString: + type: string + pattern: \d+(\.\d+)? _common:PhaseTook: type: object properties: @@ -28982,10 +30030,10 @@ components: description: Total count of query cache hits across all shards assigned to selected nodes. type: number memory_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_size_in_bytes: description: Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' miss_count: description: Total count of query cache misses across all shards assigned to selected nodes. type: number @@ -29117,22 +30165,22 @@ components: properties: failed: description: The number of bytes that failed to upload to the remote translog store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' failed_bytes: description: The number of bytes that failed to upload to the remote translog store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' started: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' started_bytes: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' succeeded: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' succeeded_bytes: description: The number of bytes successfully uploaded to the remote translog store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - failed_bytes - started_bytes @@ -29160,22 +30208,22 @@ components: properties: failed: description: The number of bytes that failed to upload/upload to/from the remote segment store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' failed_bytes: description: The number of bytes that failed to upload/upload to/from the remote segment store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' started: description: The number of bytes to upload/download to/from the remote segment store after the upload/download has started. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' started_bytes: description: The number of bytes to upload/download to/from the remote segment store after the upload/download has started. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' succeeded: description: The number of bytes successfully uploaded/downloaded to/from the remote segment store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' succeeded_bytes: description: The number of bytes successfully uploaded/downloaded to/from the remote segment store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - failed_bytes - started_bytes @@ -29195,16 +30243,16 @@ components: properties: max: description: The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_bytes: description: The maximum amount of lag, in bytes, during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: description: The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_bytes: description: The total number of bytes that lagged during the upload refresh between the remote segment store and the local store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - max_bytes - total_bytes @@ -29244,9 +30292,9 @@ components: hit_count: type: number memory_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' miss_count: type: number required: @@ -29496,11 +30544,11 @@ components: type: object properties: max_bytes_behind: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_replication_lag: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total_bytes_behind: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - max_bytes_behind - max_replication_lag @@ -29512,10 +30560,10 @@ components: description: Total number of segments across all shards assigned to selected nodes. type: number doc_values_memory: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' doc_values_memory_in_bytes: description: Total amount, in bytes, of memory used for doc values across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' file_sizes: description: |- This object is not populated by the cluster stats API. @@ -29524,62 +30572,62 @@ components: additionalProperties: $ref: '#/components/schemas/indices.stats:ShardFileSizeInfo' fixed_bit_set: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' fixed_bit_set_memory_in_bytes: description: Total amount of memory, in bytes, used by fixed bit sets across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' index_writer_memory: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' index_writer_max_memory_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' index_writer_memory_in_bytes: description: Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_unsafe_auto_id_timestamp: description: Unix timestamp, in milliseconds, of the most recently retried indexing request. type: number memory: description: Total amount, of memory used for segments across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_in_bytes: description: Total amount, in bytes, of memory used for segments across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' norms_memory: description: Total amount of memory used for normalization factors across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' norms_memory_in_bytes: description: Total amount, in bytes, of memory used for normalization factors across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' points_memory: description: Total amount of memory used for points across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' points_memory_in_bytes: description: Total amount, in bytes, of memory used for points across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' stored_fields_memory: description: Total amount of memory used for stored fields across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' stored_fields_memory_in_bytes: description: Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' terms_memory: description: Total amount of memory used for terms across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' terms_memory_in_bytes: description: Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' term_vectors_memory: description: Total amount of memory used for term vectors across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' term_vectors_memory_in_bytes: description: Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' version_map_memory: description: Total amount of memory used by all version maps across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' version_map_memory_in_bytes: description: Total amount, in bytes, of memory used by all version maps across all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' remote_store: $ref: '#/components/schemas/_common:RemoteStoreStats' segment_replication: @@ -29675,6 +30723,7 @@ components: _common:SortCombinations: oneOf: - $ref: '#/components/schemas/_common:Field' + - $ref: '#/components/schemas/_common:FieldWithOrder' - $ref: '#/components/schemas/_common:SortOptions' _common:SortMode: type: string @@ -29706,23 +30755,6 @@ components: type: array items: $ref: '#/components/schemas/_common:FieldValue' - _common:StorageSize: - type: string - pattern: \d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p) - _common:StorageType: - type: string - enum: - - b - - g - - gb - - k - - kb - - m - - mb - - p - - pb - - t - - tb _common:StoredScript: type: object properties: @@ -29751,15 +30783,15 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: description: Total size, in bytes, of all shards assigned to selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' reserved: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' reserved_in_bytes: description: A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - reserved_in_bytes - size_in_bytes @@ -29884,15 +30916,15 @@ components: remote_store: $ref: '#/components/schemas/_common:RemoteStoreTranslogStats' size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' uncommitted_operations: type: number uncommitted_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' uncommitted_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - earliest_last_modified_age - operations @@ -30014,6 +31046,32 @@ components: - _shards - _version - result + _common:XyCartesianCoordinates: + x-version-added: '2.4' + type: object + properties: + x: + description: The x coordinate. + type: number + y: + description: The y coordinate. + type: number + required: + - x + - y + _common:XyLocation: + x-version-added: '2.4' + description: |- + A two-dimensional Cartesian point specified by x and y coordinates. It can be represented in various ways: + - as a `{x, y}` object + - as a `[x, y]` array + - as a string in `"x, y"` or WKT point formats. + oneOf: + - $ref: '#/components/schemas/_common:XyCartesianCoordinates' + - type: array + items: + type: number + - type: string _common.aggregations:AdjacencyMatrixAggregate: allOf: - $ref: '#/components/schemas/_common.aggregations:MultiBucketAggregateBaseAdjacencyMatrixBucket' @@ -35858,6 +36916,10 @@ components: $ref: '#/components/schemas/_common.mapping:GeoOrientation' strategy: $ref: '#/components/schemas/_common.mapping:GeoStrategy' + deprecated: true + distance_error_pct: + type: number + deprecated: true type: type: string enum: @@ -36185,23 +37247,6 @@ components: - percolator required: - type - _common.mapping:PointProperty: - allOf: - - $ref: '#/components/schemas/_common.mapping:DocValuesPropertyBase' - - type: object - properties: - ignore_malformed: - type: boolean - ignore_z_value: - type: boolean - null_value: - type: string - type: - type: string - enum: - - point - required: - - type _common.mapping:Property: type: object discriminator: @@ -36237,8 +37282,8 @@ components: - $ref: '#/components/schemas/_common.mapping:TokenCountProperty' - $ref: '#/components/schemas/_common.mapping:GeoPointProperty' - $ref: '#/components/schemas/_common.mapping:GeoShapeProperty' - - $ref: '#/components/schemas/_common.mapping:PointProperty' - - $ref: '#/components/schemas/_common.mapping:ShapeProperty' + - $ref: '#/components/schemas/_common.mapping:XyPointProperty' + - $ref: '#/components/schemas/_common.mapping:XyShapeProperty' - $ref: '#/components/schemas/_common.mapping:ByteNumberProperty' - $ref: '#/components/schemas/_common.mapping:DoubleNumberProperty' - $ref: '#/components/schemas/_common.mapping:FloatNumberProperty' @@ -36406,25 +37451,6 @@ components: - search_as_you_type required: - type - _common.mapping:ShapeProperty: - allOf: - - $ref: '#/components/schemas/_common.mapping:DocValuesPropertyBase' - - type: object - properties: - coerce: - type: boolean - ignore_malformed: - type: boolean - ignore_z_value: - type: boolean - orientation: - $ref: '#/components/schemas/_common.mapping:GeoOrientation' - type: - type: string - enum: - - shape - required: - - type _common.mapping:ShortNumberProperty: allOf: - $ref: '#/components/schemas/_common.mapping:NumberPropertyBase' @@ -36667,6 +37693,44 @@ components: type: string required: - type + _common.mapping:XyPointProperty: + x-version-added: '2.4' + allOf: + - $ref: '#/components/schemas/_common.mapping:DocValuesPropertyBase' + - type: object + properties: + ignore_malformed: + type: boolean + ignore_z_value: + type: boolean + null_value: + $ref: '#/components/schemas/_common:XyLocation' + type: + type: string + enum: + - xy_point + required: + - type + _common.mapping:XyShapeProperty: + x-version-added: '2.4' + allOf: + - $ref: '#/components/schemas/_common.mapping:DocValuesPropertyBase' + - type: object + properties: + coerce: + type: boolean + ignore_malformed: + type: boolean + ignore_z_value: + type: boolean + orientation: + $ref: '#/components/schemas/_common.mapping:GeoOrientation' + type: + type: string + enum: + - xy_shape + required: + - type _common.query_dsl:BoolQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -37042,6 +38106,9 @@ components: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' + additionalProperties: + $ref: '#/components/schemas/_common:GeoBounds' + minProperties: 1 _common.query_dsl:GeoDecayFunction: allOf: - $ref: '#/components/schemas/_common.query_dsl:DecayFunctionBase' @@ -37063,11 +38130,11 @@ components: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' - field: - type: object + additionalProperties: + $ref: '#/components/schemas/_common:GeoLocation' + minProperties: 2 required: - distance - - field _common.query_dsl:GeoExecution: type: string enum: @@ -37082,6 +38149,22 @@ components: $ref: '#/components/schemas/_common.query_dsl:GeoValidationMethod' ignore_unmapped: $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' + _common.query_dsl:GeoShape: + type: object + properties: + type: + type: string + coordinates: + type: array + _common.query_dsl:GeoShapeField: + type: object + properties: + shape: + $ref: '#/components/schemas/_common.query_dsl:GeoShape' + relation: + $ref: '#/components/schemas/_common:GeoShapeRelation' + required: + - shape _common.query_dsl:GeoShapeQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -37089,6 +38172,9 @@ components: properties: ignore_unmapped: $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' + additionalProperties: + $ref: '#/components/schemas/_common.query_dsl:GeoShapeField' + minProperties: 1 _common.query_dsl:GeoValidationMethod: type: string enum: @@ -37358,9 +38444,7 @@ components: version_type: $ref: '#/components/schemas/_common:VersionType' _common.query_dsl:MatchAllQuery: - allOf: - - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - - type: object + $ref: '#/components/schemas/_common.query_dsl:QueryBase' _common.query_dsl:MatchBoolPrefixQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -37957,8 +39041,6 @@ components: $ref: '#/components/schemas/_common.query_dsl:ScriptQuery' script_score: $ref: '#/components/schemas/_common.query_dsl:ScriptScoreQuery' - shape: - $ref: '#/components/schemas/_common.query_dsl:ShapeQuery' simple_query_string: $ref: '#/components/schemas/_common.query_dsl:SimpleQueryStringQuery' span_containing: @@ -37996,7 +39078,8 @@ components: minProperties: 1 maxProperties: 1 terms: - $ref: '#/components/schemas/_common.query_dsl:TermsQuery' + description: Returns documents that contain one or more exact terms in a provided field. + $ref: '#/components/schemas/_common.query_dsl:TermsQueryField' terms_set: description: |- Returns documents that contain a minimum number of exact terms in a provided field. @@ -38013,6 +39096,8 @@ components: $ref: '#/components/schemas/_common.query_dsl:TextExpansionQuery' minProperties: 1 maxProperties: 1 + type: + $ref: '#/components/schemas/_common.query_dsl:TypeQuery' weighted_tokens: description: Supports returning text_expansion query results by sending in precomputed tokens with the query. type: object @@ -38029,8 +39114,8 @@ components: maxProperties: 1 wrapper: $ref: '#/components/schemas/_common.query_dsl:WrapperQuery' - type: - $ref: '#/components/schemas/_common.query_dsl:TypeQuery' + xy_shape: + $ref: '#/components/schemas/_common.query_dsl:XyShapeQuery' minProperties: 1 maxProperties: 1 _common.query_dsl:QueryStringQuery: @@ -38262,13 +39347,6 @@ components: required: - query - script - _common.query_dsl:ShapeQuery: - allOf: - - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - - type: object - properties: - ignore_unmapped: - $ref: '#/components/schemas/_common.query_dsl:IgnoreUnmapped' _common.query_dsl:SimpleQueryStringFlag: type: string enum: @@ -38509,27 +39587,33 @@ components: type: boolean required: - value - _common.query_dsl:Terms: - oneOf: - - type: array - items: - type: string - - type: object - properties: - index: - $ref: '#/components/schemas/_common:IndexName' - id: - $ref: '#/components/schemas/_common:Id' - path: - $ref: '#/components/schemas/_common:Field' - routing: - $ref: '#/components/schemas/_common:Routing' - additionalProperties: true - description: Object for fetching terms. - _common.query_dsl:TermsQuery: - anyOf: - - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - - $ref: '#/components/schemas/_common.query_dsl:Terms' + _common.query_dsl:TermsLookupField: + type: object + properties: + index: + $ref: '#/components/schemas/_common:IndexName' + id: + $ref: '#/components/schemas/_common:Id' + path: + $ref: '#/components/schemas/_common:Field' + routing: + $ref: '#/components/schemas/_common:Routing' + _common.query_dsl:TermsQueryField: + type: object + properties: + boost: + description: |- + A floating-point value that specifies the weight of this field toward the relevance score. + Values above 1.0 increase the field’s relevance. Values between 0.0 and 1.0 decrease the field’s relevance. + Default is 1.0. + type: number + format: float + additionalProperties: + oneOf: + - $ref: '#/components/schemas/_common.query_dsl:TermsLookupField' + - type: array + items: + type: string _common.query_dsl:TermsSetQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -38540,7 +39624,9 @@ components: minimum_should_match_script: $ref: '#/components/schemas/_common:Script' terms: - $ref: '#/components/schemas/_common.query_dsl:Terms' + type: array + items: + type: string required: - terms _common.query_dsl:TextExpansionQuery: @@ -38631,6 +39717,31 @@ components: type: string required: - query + _common.query_dsl:XyShape: + type: object + properties: + type: + type: string + coordinates: + type: array + _common.query_dsl:XyShapeField: + type: object + properties: + shape: + $ref: '#/components/schemas/_common.query_dsl:XyShape' + relation: + $ref: '#/components/schemas/_common:GeoShapeRelation' + required: + - shape + _common.query_dsl:XyShapeQuery: + x-version-added: '2.4' + allOf: + - $ref: '#/components/schemas/_common.query_dsl:QueryBase' + - type: object + additionalProperties: + $ref: '#/components/schemas/_common.query_dsl:XyShapeField' + minProperties: 1 + maxProperties: 1 _common.query_dsl:ZeroTermsQuery: type: string enum: @@ -38677,17 +39788,11 @@ components: type: integer format: int32 _core.bulk:CreateOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:WriteOperation' - - type: object + $ref: '#/components/schemas/_core.bulk:WriteOperation' _core.bulk:DeleteOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:OperationBase' - - type: object + $ref: '#/components/schemas/_core.bulk:OperationBase' _core.bulk:IndexOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:WriteOperation' - - type: object + $ref: '#/components/schemas/_core.bulk:WriteOperation' _core.bulk:OperationBase: type: object properties: @@ -40850,11 +41955,11 @@ components: files_fetched: type: string files_percent: - type: string + $ref: '#/components/schemas/_common:PercentageString' bytes_fetched: type: string bytes_percent: - type: string + $ref: '#/components/schemas/_common:PercentageString' start_time: type: string stop_time: @@ -40935,7 +42040,7 @@ components: disk.percent: description: Total percentage of disk space in use. Calculated as `disk.used / disk.total`. oneOf: - - $ref: '#/components/schemas/_common:Percentage' + - $ref: '#/components/schemas/_common:PercentageString' - type: 'null' host: description: Network host for the node. Set using the `network.host` setting. @@ -41038,7 +42143,7 @@ components: type: string active_shards_percent: description: active number of shards in percent - type: string + $ref: '#/components/schemas/_common:PercentageString' discovered_cluster_manager: description: cluster manager is discovered or not type: string @@ -41818,12 +42923,12 @@ components: disk.avail: type: string disk.used_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' heap.current: description: The used heap. type: string heap.percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' heap.max: description: The maximum configured heap. type: string @@ -41831,7 +42936,7 @@ components: description: The used machine memory. type: string ram.percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' ram.max: description: The total machine memory. type: string @@ -41839,7 +42944,7 @@ components: description: The used file descriptors. type: string file_desc.percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' file_desc.max: description: The maximum number of file descriptors. type: string @@ -42173,7 +43278,7 @@ components: description: The files recovered. type: string files_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' files_total: description: The total number of files. type: string @@ -42184,7 +43289,7 @@ components: description: The bytes recovered. type: string bytes_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' bytes_total: description: The total number of bytes. type: string @@ -42195,7 +43300,7 @@ components: description: The translog operations recovered. type: string translog_ops_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' cat.repositories:RepositoriesRecord: type: object properties: @@ -42243,7 +43348,7 @@ components: Also, OpenSearch creates extra deleted documents to internally track the recent history of operations on a shard. type: string size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size.memory: type: string committed: @@ -42957,7 +44062,7 @@ components: in_sync: type: boolean matching_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' matching_sync_id: type: boolean store_exception: @@ -42980,8 +44085,8 @@ components: type: object additionalProperties: oneOf: - - $ref: '#/components/schemas/_common:Bytes' - - $ref: '#/components/schemas/_common:StorageSize' + - $ref: '#/components/schemas/_common:ByteCount' + - $ref: '#/components/schemas/_common:HumanReadableByteCount' shard_data_set_sizes: type: object additionalProperties: @@ -43037,21 +44142,21 @@ components: path: type: string total: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' used: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free_disk_percent: - type: number + $ref: '#/components/schemas/_common:PercentageNumber' used_disk_percent: - type: number + $ref: '#/components/schemas/_common:PercentageNumber' required: - free_bytes - free_disk_percent @@ -43197,8 +44302,10 @@ components: active_shards: description: The total number of active primary and replica shards. type: number + active_shards_percent: + $ref: '#/components/schemas/_common:PercentageString' active_shards_percent_as_number: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageNumber' awareness_attributes: description: Cluster health information for each awareness attribute. type: object @@ -43618,32 +44725,32 @@ components: Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or process-level restrictions, this number may be less than `nodes.fs.free_in_byes`. This is the actual amount of free disk space the selected OpenSearch nodes can use. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' available_in_bytes: description: |- Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or process-level restrictions, this number may be less than `nodes.fs.free_in_byes`. This is the actual amount of free disk space the selected OpenSearch nodes can use. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: description: Total number of unallocated bytes in file stores across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_in_bytes: description: Total number of unallocated bytes in file stores across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: description: Total size, of all file stores across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: description: Total size, in bytes, of all file stores across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' cache_reserved: description: Total size, of all cache reserved across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' x-version-added: '2.7' cache_reserved_in_bytes: description: Total size, in bytes, of all cache reserved across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' x-version-added: '2.7' required: - available_in_bytes @@ -43755,16 +44862,16 @@ components: properties: heap_max: description: Maximum amount of memory available for use by the heap across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' heap_used: description: Memory currently in use by the heap across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_used_in_bytes: description: Memory, in bytes, currently in use by the heap across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - heap_max_in_bytes - heap_used_in_bytes @@ -43997,7 +45104,7 @@ components: description: |- Percentage of CPU used across all selected nodes. Returns `-1` if not supported. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' required: - percent cluster.stats:ClusterProcessOpenFileDescriptors: @@ -44103,10 +45210,10 @@ components: description: Total number of fields in all non-system indices, accounting for mapping deduplication. type: number total_deduplicated_mapping_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_deduplicated_mapping_size_in_bytes: description: Total size of all mappings, in bytes, after deduplication and compression. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - field_types cluster.stats:IndexingPressure: @@ -44122,7 +45229,7 @@ components: current: $ref: '#/components/schemas/cluster.stats:IndexingPressureMemorySummary' limit_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: $ref: '#/components/schemas/cluster.stats:IndexingPressureMemorySummary' required: @@ -44133,19 +45240,19 @@ components: type: object properties: all_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' combined_coordinating_and_primary_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' coordinating_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' coordinating_rejections: type: number primary_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' primary_rejections: type: number replica_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' replica_rejections: type: number required: @@ -44162,7 +45269,7 @@ components: primary_shard_count: type: number total_primary_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' version: $ref: '#/components/schemas/_common:VersionString' required: @@ -44190,31 +45297,31 @@ components: properties: adjusted_total_in_bytes: description: Total amount, in bytes, of memory across all selected nodes, but using the value specified using the `es.total_memory_bytes` system property instead of measured total memory for those nodes where that system property was set. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: description: Amount, in bytes, of free physical memory across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_in_bytes: description: Amount, in bytes, of free physical memory across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free_percent: description: Percentage of free physical memory across all selected nodes. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' total: description: Total amount of physical memory across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: description: Total amount, in bytes, of physical memory across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' used: description: Amount of physical memory in use across all selected nodes. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_in_bytes: description: Amount, in bytes, of physical memory in use across all selected nodes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' used_percent: description: Percentage of physical memory in use across all selected nodes. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' required: - free_in_bytes - free_percent @@ -44344,6 +45451,539 @@ components: - index_name - index_uuid - node_ids + flow_framework.common:All: + description: The all parameter specifies whether the response should return all fields. + type: boolean + default: false + flow_framework.common:AllowDelete: + description: Required when deleting resources involves a high potential for data loss. + type: string + flow_framework.common:FlowFrameworkCreate: + type: object + properties: + name: + type: string + description: The name of the workflow. + description: + type: string + description: A description of the workflow. + use_case: + type: string + description: A use case, which can be used with the Search Workflow API to find related workflows. + version: + $ref: '#/components/schemas/flow_framework.common:version' + workflows: + type: object + description: A map of workflows. Presently, only the provision key is supported. The value for the workflow key is a key-value map that includes fields for user_params and lists of nodes and edges. + required: + - name + flow_framework.common:FlowFrameworkDeleteResponse: + type: object + properties: + _index: + type: string + description: The name of the index where the document was stored. + _id: + type: string + description: The unique identifier of the deleted document. + _version: + type: integer + description: The version of the document after the deletion. + result: + type: string + description: The result of the deletion operation. + enum: + - deleted + - not_found + _shards: + $ref: '#/components/schemas/flow_framework.common:shards' + _seq_no: + type: integer + description: The sequence number assigned to the document after the deletion. + _primary_term: + type: integer + description: The primary term assigned to the document after the deletion. + flow_framework.common:FlowFrameworkGetResponse: + type: object + properties: + name: + type: string + description: + type: string + use_case: + type: string + workflows: + type: object + user: + $ref: '#/components/schemas/flow_framework.common:user' + created_time: + type: integer + last_updated_time: + type: integer + flow_framework.common:FlowFrameworkUpdate: + type: object + properties: + name: + type: string + description: The name of the workflow. + description: + type: string + description: A description of the workflow. + use_case: + type: string + description: A use case, which can be used with the Search Workflow API to find related workflows. + version: + $ref: '#/components/schemas/flow_framework.common:version' + minProperties: 1 + flow_framework.common:hits: + type: object + properties: + total: + $ref: '#/components/schemas/flow_framework.common:total' + max_score: + type: number + format: float + description: The maximum score of the search hits. + hits: + type: array + items: + $ref: '#/components/schemas/flow_framework.common:itemsObject' + flow_framework.common:itemsObject: + type: object + properties: + _index: + type: string + description: The index name where the document resides. + _id: + type: string + description: The document ID. + _version: + type: integer + description: The version of the document. + _seq_no: + type: integer + description: The sequence number of the document. + _primary_term: + type: integer + description: The primary term of the document. + _score: + type: number + format: float + description: The score of the search hit. + _source: + $ref: '#/components/schemas/flow_framework.common:FlowFrameworkGetResponse' + flow_framework.common:Provision: + description: Provision the workflow as part of the request. + type: boolean + default: false + flow_framework.common:query: + type: object + description: The search query to match workflows. Use `match_all` to retrieve all workflows, or `match` to search by specific fields like `use_case`. + properties: + match: + type: object + match_all: + type: object + flow_framework.common:Reprovision: + type: boolean + default: false + flow_framework.common:SearchStateResponse: + type: object + properties: + workflow_id: + type: string + provisioning_progress: + type: string + state: + type: string + user: + $ref: '#/components/schemas/flow_framework.common:user' + flow_framework.common:SearchWorkflowRequest: + type: object + properties: + query: + $ref: '#/components/schemas/flow_framework.common:query' + flow_framework.common:shards: + type: object + properties: + total: + type: integer + description: The total number of shards involved in the deletion. + successful: + type: integer + description: The number of shards where the deletion was successful. + failed: + type: integer + description: The number of shards where the deletion failed. + flow_framework.common:StateHits: + type: object + properties: + total: + $ref: '#/components/schemas/flow_framework.common:total' + max_score: + type: number + format: float + description: The maximum score of the search hits. + hits: + type: array + items: + $ref: '#/components/schemas/flow_framework.common:StateItems' + flow_framework.common:StateItems: + type: object + properties: + _index: + type: string + description: The index name where the document resides. + _id: + type: string + description: The document ID. + _version: + type: integer + description: The version of the document. + _seq_no: + type: integer + description: The sequence number of the document. + _primary_term: + type: integer + description: The primary term of the document. + _score: + type: number + format: float + description: The score of the search hit. + _source: + $ref: '#/components/schemas/flow_framework.common:SearchStateResponse' + flow_framework.common:total: + type: object + properties: + value: + type: integer + description: Total number of matching documents. + relation: + type: string + description: The relation of the total hits. + flow_framework.common:UpdateFields: + description: Update only the fields included in the request body. + type: boolean + default: false + flow_framework.common:UseCase: + type: string + flow_framework.common:user: + type: object + properties: + name: + type: string + backend_roles: + type: array + items: + type: string + roles: + type: array + items: + type: string + custom_attribute_names: + type: array + items: + type: string + user_requested_tenant: + type: string + nullable: true + flow_framework.common:UserProvidedSubstitutionExpressions: + type: object + additionalProperties: + type: string + description: The value for the user-provided key. Keys represent substitution expressions. + flow_framework.common:Validation: + description: Validate the workflow. Valid values are all (validate the template) and none (do not validate the template). Default is all. + type: string + default: all + flow_framework.common:version: + type: object + description: A key-value map with two fields, template, which identifies the template version, and compatibility, which identifies a list of minimum required OpenSearch versions. + properties: + template: + type: string + description: The template version of the workflow. + compatibility: + type: array + items: + type: string + description: A list of minimum required OpenSearch versions. + flow_framework.common:WorkflowID: + type: string + flow_framework.common:WorkflowSearchResponse: + type: object + properties: + took: + type: integer + description: Time in milliseconds that the request took to complete. + timed_out: + type: boolean + description: Indicates if the request timed out. + _shards: + $ref: '#/components/schemas/flow_framework.common:shards' + hits: + $ref: '#/components/schemas/flow_framework.common:hits' + flow_framework.common:WorkflowSearchStateResponse: + type: object + properties: + took: + type: integer + description: Time in milliseconds that the request took to complete. + timed_out: + type: boolean + description: Indicates if the request timed out. + _shards: + $ref: '#/components/schemas/flow_framework.common:shards' + hits: + $ref: '#/components/schemas/flow_framework.common:StateHits' + flow_framework.common:WorkFlowStatusDefaultResponse: + type: object + properties: + workflow_id: + type: string + description: The ID of the workflow + error: + type: string + description: Any error state associated with the workflow + nullable: true + state: + type: string + description: The current state of the workflow + resources_created: + type: array + items: + type: string + description: A list of resources created by the workflow + flow_framework.common:WorkFlowStatusFullResponse: + type: object + properties: + workflow_id: + type: string + description: The ID of the workflow + error: + type: string + description: Any error state associated with the workflow + nullable: true + state: + type: string + description: The current state of the workflow + enum: + - COMPLETED + - FAILED + - NOT_STARTED + - PROVISIONING + resources_created: + type: array + items: + type: string + description: A list of resources created by the workflow + provisioning_progress: + type: string + description: The progress of the provisioning process + nullable: true + provision_start_time: + type: string + format: date-time + description: The start time of the provisioning process + provision_end_time: + type: string + format: date-time + description: The end time of the provisioning process + user: + $ref: '#/components/schemas/flow_framework.common:user' + user_outputs: + type: array + items: + type: string + description: Outputs generated by the user + flow_framework.common:WorkflowStep: + type: object + properties: + inputs: + type: array + items: + type: string + description: The list of required inputs for the workflow step + outputs: + type: array + items: + type: string + description: The list of outputs generated by the workflow step + required_plugins: + type: array + items: + type: string + description: The list of plugins required for the workflow step + flow_framework.common:WorkflowStepName: + type: string + flow_framework.errors:BadRequestError: + type: object + properties: + error: + type: string + description: Error message when the request body or parameters are invalid. + example: Invalid request body or query parameters. + status: + type: integer + description: HTTP status code for the error. + example: 400 + flow_framework.errors:ConflictError: + content: + application/json: + type: object + properties: + message: + type: string + example: You cannot use both the 'provision_workflow' and 'update_workflow_fields' parameters in the same request. + status: + type: integer + flow_framework.errors:DeprovisioningError: + type: object + properties: + error: + type: string + description: Describes the deprovisioning error and identifies resources that were not deprovisioned + example: Failed to deprovision some resources [connector_id Lw7PX4wBfVtHp98y06wV]. + required: + - error + flow_framework.errors:DeprovisioningForbiddenError: + type: object + properties: + error: + type: string + description: Describes the resources that require the allow_delete parameter for deprovisioning + example: These resources require the allow_delete parameter to deprovision [index_name my-index]. + required: + - error + flow_framework.errors:DuplicateKeyError: + type: object + properties: + error: + type: string + description: Error message when a duplicate key is found in the request. + status: + type: integer + description: HTTP status code for the error. + example: 400 + flow_framework.errors:FlowFrameworkAPIDisabledError: + content: + application/json: + type: object + properties: + message: + type: string + example: This API is disabled. To enable it, set [flow_framework.enabled] to true. + status: + type: integer + flow_framework.errors:InvalidParameterError: + content: + application/json: + type: object + properties: + message: + type: string + example: Only the parameters [param1, param2] are permitted unless the provision parameter is set to true. + status: + type: integer + flow_framework.errors:InvalidRequestBodyFieldError: + type: object + properties: + error: + type: string + description: Error message when a request body field is not a string. + status: + type: integer + description: HTTP status code for the error. + flow_framework.errors:MaxWorkflowsLimitError: + content: + application/json: + type: object + properties: + message: + type: string + example: Maximum workflows limit reached 50 + code: + type: integer + flow_framework.errors:MissingParameterError: + content: + application/json: + type: object + properties: + message: + type: string + example: You cannot use the 'reprovision_workflow' parameter to create a new template. + status: + type: integer + flow_framework.errors:ParameterConflictError: + content: + application/json: + type: object + properties: + message: + type: string + example: You cannot use the 'reprovision_workflow' and 'use_case' parameters in the same request. + status: + type: integer + flow_framework.errors:RequestBodyParsingFailedError: + type: object + properties: + error: + type: string + description: Error message when request body parsing fails. + status: + type: integer + description: HTTP status code for the error. + example: 400 + flow_framework.errors:RequestTimeoutError: + type: object + properties: + error: + type: string + description: Error message when the request times out. + status: + type: integer + description: HTTP status code for the error. + example: 408 + flow_framework.errors:TemplateNotFoundError: + content: + application/json: + type: object + properties: + message: + type: string + example: Failed to retrieve template (12345) from global context. + code: + type: integer + flow_framework.errors:WorkFlowIdNullError: + content: + application/json: + type: object + properties: + message: + type: string + example: Workflow ID can not be null + status: + type: integer + flow_framework.errors:WorkflowSaveError: + content: + application/json: + type: object + properties: + message: + type: string + example: Failed to save workflow state + status: + type: integer + flow_framework.errors:WorkflowStepsRetrieveError: + content: + application/json: + type: object + properties: + message: + type: string + example: Failed to retrieve workflow step json. + code: + type: integer indices._common:Alias: type: object properties: @@ -44493,13 +46133,13 @@ components: max_docs: type: number min_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' min_primary_shard_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_primary_shard_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' min_primary_shard_docs: type: number max_primary_shard_docs: @@ -45333,7 +46973,7 @@ components: durability: $ref: '#/components/schemas/indices._common:TranslogDurability' flush_threshold_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' retention: $ref: '#/components/schemas/indices._common:TranslogRetention' indices._common:TranslogDurability: @@ -45345,7 +46985,7 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' age: $ref: '#/components/schemas/_common:Duration' indices.add_block:IndicesBlockOptions: @@ -45508,10 +47148,10 @@ components: maximum_timestamp: $ref: '#/components/schemas/_common:EpochTimeUnitMillis' store_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' store_size_bytes: description: Total size, in bytes, of all shards for the data stream's backing indices. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - backing_indices - data_stream @@ -45589,23 +47229,23 @@ components: type: object properties: percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' recovered: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' recovered_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' recovered_from_snapshot: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' recovered_from_snapshot_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' reused: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' reused_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - percent - recovered_in_bytes @@ -45619,7 +47259,7 @@ components: items: $ref: '#/components/schemas/indices.recovery:FileDetails' percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' recovered: type: number reused: @@ -45759,7 +47399,7 @@ components: type: object properties: percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' recovered: type: number total: @@ -45845,21 +47485,21 @@ components: max_docs: type: number max_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_size_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' min_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' min_size_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_primary_shard_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_primary_shard_size_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' min_primary_shard_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' min_primary_shard_size_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_primary_shard_docs: type: number min_primary_shard_docs: @@ -45887,13 +47527,13 @@ components: deleted_docs: type: integer size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' memory: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' memory_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' committed: type: boolean search: @@ -46133,15 +47773,15 @@ components: description: type: string size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' min_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' average_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' count: type: number required: @@ -47263,6 +48903,379 @@ components: type: string status: $ref: '#/components/schemas/_common:ActionStatusOptions' + ism._common:Action: + type: object + description: An action to perform. + properties: + timeout: + $ref: '#/components/schemas/ism._common:ActionTimeout' + retry: + $ref: '#/components/schemas/ism._common:ActionRetry' + alias: + $ref: '#/components/schemas/ism._common:ActionAlias' + delete: + $ref: '#/components/schemas/ism._common:ActionDelete' + force_merge: + $ref: '#/components/schemas/ism._common:ActionForceMerge' + read_only: + $ref: '#/components/schemas/ism._common:ActionReadOnly' + read_write: + $ref: '#/components/schemas/ism._common:ActionReadWrite' + replica_count: + $ref: '#/components/schemas/ism._common:ActionReplicaCount' + index_priority: + $ref: '#/components/schemas/ism._common:ActionIndexPriority' + close: + $ref: '#/components/schemas/ism._common:ActionClose' + open: + $ref: '#/components/schemas/ism._common:ActionOpen' + snapshot: + $ref: '#/components/schemas/ism._common:ActionSnapshot' + rollover: + $ref: '#/components/schemas/ism._common:ActionRollover' + notification: + $ref: '#/components/schemas/ism._common:ActionNotification' + allocation: + $ref: '#/components/schemas/ism._common:ActionAllocation' + rollup: + $ref: '#/components/schemas/ism._common:ActionRollup' + transform: + $ref: '#/components/schemas/ism._common:ActionTransform' + shrink: + $ref: '#/components/schemas/ism._common:ActionShrink' + custom: + $ref: '#/components/schemas/ism._common:ActionCustom' + ism._common:ActionAlias: + type: object + properties: + actions: + type: object + additionalProperties: true + ism._common:ActionAllocation: + type: object + properties: + require: + type: object + additionalProperties: true + include: + type: object + additionalProperties: true + exclude: + type: object + additionalProperties: true + wait_for: + type: boolean + ism._common:ActionClose: + type: object + ism._common:ActionCustom: + type: object + additionalProperties: true + ism._common:ActionDelete: + type: object + ism._common:ActionForceMerge: + type: object + properties: + max_num_segments: + type: integer + ism._common:ActionIndexPriority: + type: object + properties: + priority: + type: number + ism._common:ActionNotification: + type: object + additionalProperties: true + ism._common:ActionOpen: + type: object + ism._common:ActionReadOnly: + type: object + ism._common:ActionReadWrite: + type: object + ism._common:ActionReplicaCount: + type: object + properties: + number_of_replicas: + type: number + ism._common:ActionRetry: + type: object + properties: + count: + type: integer + backoff: + type: string + delay: + type: string + ism._common:ActionRollover: + type: object + properties: + min_size: + type: number + min_index_age: + type: number + min_doc_count: + type: number + min_primary_shard_size: + type: number + copy_alias: + type: boolean + ism._common:ActionRollup: + type: object + additionalProperties: true + ism._common:ActionShrink: + type: object + additionalProperties: true + ism._common:ActionSnapshot: + type: object + properties: + repository: + type: string + snapshot: + type: string + include_global_state: + type: boolean + ism._common:ActionTimeout: + type: object + properties: + timeout: + type: object + ism._common:ActionTransform: + type: object + additionalProperties: true + ism._common:AddPolicyRequest: + type: object + properties: + policy_id: + type: string + required: + - policy_id + ism._common:AddPolicyResponse: + $ref: '#/components/schemas/ism._common:ChangePolicyResponse' + ism._common:ChangePolicyRequest: + type: object + properties: + policy_id: + type: string + state: + type: string + include: + type: array + items: + $ref: '#/components/schemas/ism._common:IncludeState' + required: + - policy_id + ism._common:ChangePolicyResponse: + type: object + properties: + updated_indices: + type: number + failures: + type: boolean + failed_indices: + type: array + items: + $ref: '#/components/schemas/ism._common:FailedIndex' + ism._common:Channel: + type: object + properties: + id: + type: string + ism._common:DeletePolicyResponse: + $ref: '#/components/schemas/_common:WriteResponseBase' + ism._common:ErrorNotification: + type: object + properties: + destination: + $ref: '#/components/schemas/ism._common:ErrorNotificationDestination' + channel: + $ref: '#/components/schemas/ism._common:Channel' + message_template: + type: object + additionalProperties: true + ism._common:ErrorNotificationChime: + type: object + properties: + url: + type: string + ism._common:ErrorNotificationDestination: + type: object + properties: + name: + type: string + last_update_time: + type: integer + additionalProperties: + anyOf: + - $ref: '#/components/schemas/ism._common:ErrorNotificationChime' + - $ref: '#/components/schemas/ism._common:ErrorNotificationSlack' + ism._common:ErrorNotificationSlack: + type: object + properties: + url: + type: string + custom_webhook: + $ref: '#/components/schemas/ism._common:SlackCustomWebhook' + ism._common:ExplainIndexResponse: + type: object + properties: + total_managed_indices: + type: number + additionalProperties: + $ref: '#/components/schemas/ism._common:ExplainPolicy' + ism._common:ExplainPolicy: + type: object + properties: + index.plugins.index_state_management.policy_id: + type: + - 'null' + - string + index.opendistro.index_state_management.policy_id: + type: + - 'null' + - string + enabled: + type: + - boolean + - 'null' + ism._common:FailedIndex: + type: object + properties: + index_name: + type: string + index_uuid: + type: string + reason: + type: string + ism._common:GetPolicyResponse: + allOf: + - $ref: '#/components/schemas/ism._common:Metadata' + - $ref: '#/components/schemas/ism._common:PolicyEnvelope' + ism._common:IncludeState: + type: object + properties: + state: + type: string + ism._common:IsmTemplate: + type: object + properties: + index_patterns: + type: array + items: + type: string + priority: + type: number + last_updated_time: + type: integer + ism._common:Metadata: + type: object + properties: + _id: + $ref: '#/components/schemas/_common:Id' + _primary_term: + type: number + _seq_no: + $ref: '#/components/schemas/_common:SequenceNumber' + _version: + $ref: '#/components/schemas/_common:VersionNumber' + ism._common:Policy: + type: object + description: A policy defines how an index is managed throughout its lifetime. + properties: + policy_id: + type: string + description: + type: string + last_updated_time: + type: integer + schema_version: + type: number + error_notification: + oneOf: + - $ref: '#/components/schemas/ism._common:ErrorNotification' + - type: 'null' + default_state: + type: string + description: The default state an index is in. + states: + type: array + description: List of states for the index to transition between. + items: + $ref: '#/components/schemas/ism._common:States' + ism_template: + oneOf: + - $ref: '#/components/schemas/ism._common:IsmTemplate' + - type: 'null' + - type: array + items: + $ref: '#/components/schemas/ism._common:IsmTemplate' + ism._common:PolicyEnvelope: + type: object + properties: + policy: + $ref: '#/components/schemas/ism._common:Policy' + ism._common:PutPolicyRequest: + $ref: '#/components/schemas/ism._common:PolicyEnvelope' + ism._common:PutPolicyResponse: + allOf: + - $ref: '#/components/schemas/ism._common:Metadata' + - type: object + properties: + policy: + $ref: '#/components/schemas/ism._common:PolicyEnvelope' + ism._common:RemovePolicyResponse: + $ref: '#/components/schemas/ism._common:ChangePolicyResponse' + ism._common:SlackCustomWebhook: + type: object + properties: + url: + type: string + scheme: + type: string + host: + type: string + port: + type: integer + path: + type: string + query_params: + type: object + additionalProperties: true + header_params: + type: object + additionalProperties: true + username: + type: string + password: + type: string + ism._common:States: + type: object + description: |- + A list of actions to perform, and transitions to enter a new state. + Once a managed index enters a state it will sequentially execute the actions + in the same order listed in the policy. Once all actions have been successfully completed + state transitions will be checked until a true condition is eventually met. + If you define multiple transitions in a state, the first one in the list that is true will be used. + properties: + name: + type: string + actions: + type: array + description: A list of actions to perform. + items: + $ref: '#/components/schemas/ism._common:Action' + transitions: + type: array + description: A list of transitions to enter a new state. + items: + $ref: '#/components/schemas/ism._common:Transition' + ism._common:Transition: + type: object + description: A transition into a new state. + properties: + state_name: + type: string + conditions: + type: object + additionalProperties: true knn._common:DefaultOperator: type: string description: The default operator for query string query (AND or OR). @@ -47458,16 +49471,16 @@ components: properties: estimated_size: description: Estimated memory used for the operation. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' estimated_size_in_bytes: description: Estimated memory used, in bytes, for the operation. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' limit_size: description: Memory limit for the circuit breaker. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' limit_size_in_bytes: description: Memory limit, in bytes, for the circuit breaker. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' overhead: description: A constant that all estimates for the circuit breaker are multiplied with to calculate a final estimate. type: number @@ -47559,7 +49572,7 @@ components: type: number request_size_bytes: description: Cumulative size in bytes of all requests from this client. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' x_opaque_id: description: |- Value from the client's `x-opaque-id` HTTP header. @@ -47649,7 +49662,7 @@ components: type: object properties: percent: - type: number + $ref: '#/components/schemas/_common:PercentageNumber' sys: $ref: '#/components/schemas/_common:Duration' sys_in_millis: @@ -47679,38 +49692,38 @@ components: properties: available: description: Total amount of disk space available to this Java virtual machine on this file store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' available_in_bytes: description: Total number of bytes available to this Java virtual machine on this file store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' cache_reserved: x-version-added: '2.7' description: Total number of cache bytes reserved available to this Java virtual machine on this file store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' cache_reserved_in_bytes: x-version-added: '2.7' description: Total number of cache bytes reserved available to this Java virtual machine on this file store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' disk_queue: type: string disk_reads: type: number disk_read_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' disk_read_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' disk_writes: type: number disk_write_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' disk_write_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: description: Total amount of unallocated disk space in the file store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_in_bytes: description: Total number of unallocated bytes in the file store. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' mount: description: 'Mount point of the file store (for example: `/dev/sda2`).' type: string @@ -47719,10 +49732,10 @@ components: type: string total: description: Total size of the file store. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: description: Total size of the file store in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' type: description: 'Type of the file store (ex: ext4).' type: string @@ -47755,10 +49768,10 @@ components: properties: free_percent: description: Percentage of free memory. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' used_percent: description: Percentage of used memory. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' nodes._common:FileSystem: type: object properties: @@ -47784,33 +49797,33 @@ components: Total disk space available to this Java virtual machine on all file stores. Depending on OS or process level restrictions, this might appear less than `free`. This is the actual amount of free disk space the OpenSearch node can utilize. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' available_in_bytes: description: |- Total number of bytes available to this Java virtual machine on all file stores. Depending on OS or process level restrictions, this might appear less than `free_in_bytes`. This is the actual amount of free disk space the OpenSearch node can utilize. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: description: Total unallocated disk space in all file stores. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_in_bytes: description: Total number of unallocated bytes in all file stores. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: description: Total size of all file stores. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: description: Total size of all file stores in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' cache_reserved: x-version-added: '2.7' description: Total size of cache bytes reserved in all file stores. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' cache_reserved_in_bytes: x-version-added: '2.7' description: Total size of cache bytes reserved in all file stores. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' nodes._common:GarbageCollector: type: object properties: @@ -47856,12 +49869,12 @@ components: type: object properties: limit: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' limit_in_bytes: description: |- Configured memory limit, in bytes, for the indexing requests. Replica requests have an automatic limit that is 1.5x this value. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' current: $ref: '#/components/schemas/nodes._common:PressureMemory' total: @@ -47984,37 +49997,37 @@ components: properties: heap_used: description: Memory currently in use by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_used_in_bytes: description: Memory, in bytes, currently in use by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' heap_used_percent: description: Percentage of memory currently in use by the heap. - type: number + $ref: '#/components/schemas/_common:PercentageNumber' heap_committed: description: Amount of memory available for use by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_committed_in_bytes: description: Amount of memory, in bytes, available for use by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' heap_max: description: Maximum amount of memory available for use by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' non_heap_used: description: Non-heap memory used. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' non_heap_used_in_bytes: description: Non-heap memory used, in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' non_heap_committed: description: Amount of non-heap memory available. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' non_heap_committed_in_bytes: description: Amount of non-heap memory available, in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' pools: description: Contains statistics about heap memory usage for the node. type: object @@ -48040,15 +50053,15 @@ components: type: object properties: used: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' usage_percent: - type: number + $ref: '#/components/schemas/_common:PercentageNumber' nodes._common:MemoryStats: type: object properties: @@ -48056,37 +50069,37 @@ components: description: |- If the amount of physical memory has been overridden using the `es`.`total_memory_bytes` system property then this reports the overridden value in bytes. Otherwise it reports the same value as `total_in_bytes`. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' resident: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' resident_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' share: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' share_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total_virtual: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_virtual_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total: description: Total amount of physical memory. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: description: Total amount of physical memory in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' free: description: Amount of free physical memory. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' free_in_bytes: description: Amount of free physical memory in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' used: description: Amount of used physical memory. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_in_bytes: description: Amount of used physical memory in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' nodes._common:NodeBufferPool: type: object properties: @@ -48095,16 +50108,16 @@ components: type: number total_capacity: description: Total capacity of buffer pools. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_capacity_in_bytes: description: Total capacity of buffer pools in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' used: description: Size of buffer pools. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_in_bytes: description: Size of buffer pools in bytes. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' nodes._common:NodeReloadError: type: object properties: @@ -48141,28 +50154,28 @@ components: properties: used: description: Memory used by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' used_in_bytes: description: Memory, in bytes, used by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max: description: Maximum amount of memory available for use by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_in_bytes: description: Maximum amount of memory, in bytes, available for use by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' peak_used: description: Largest amount of memory historically used by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' peak_used_in_bytes: description: Largest amount of memory, in bytes, historically used by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' peak_max: description: Largest amount of memory historically used by the heap. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' peak_max_in_bytes: description: Largest amount of memory, in bytes, historically used by the heap. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' last_gc_stats: description: Most recent GC cycle stats for a particular memory pool. $ref: '#/components/schemas/nodes._common:LastGcStats' @@ -48170,32 +50183,32 @@ components: type: object properties: all: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' all_in_bytes: description: Memory consumed, in bytes, by indexing requests in the coordinating, primary, or replica stage. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' combined_coordinating_and_primary: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' combined_coordinating_and_primary_in_bytes: description: |- Memory consumed, in bytes, by indexing requests in the coordinating or primary stage. This value is not the sum of coordinating and primary as a node can reuse the coordinating memory if the primary stage is executed locally. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' coordinating: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' coordinating_in_bytes: description: Memory consumed, in bytes, by indexing requests in the coordinating stage. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' primary: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' primary_in_bytes: description: Memory consumed, in bytes, by indexing requests in the primary stage. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' replica: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' replica_in_bytes: description: Memory consumed, in bytes, by indexing requests in the replica stage. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' coordinating_rejections: description: Number of indexing requests rejected in the coordinating stage. type: number @@ -48235,6 +50248,8 @@ components: failed: description: Number of failed operations for the processor. type: number + time: + $ref: '#/components/schemas/_common:Duration' time_in_millis: $ref: '#/components/schemas/_common:DurationValueUnitMillis' nodes._common:PublishedClusterStates: @@ -48315,13 +50330,13 @@ components: count: type: number uncompressed_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' uncompressed_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' compressed_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' compressed_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' nodes._common:ShardAdmissionControlStats: type: object properties: @@ -48337,9 +50352,9 @@ components: type: object properties: size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' evictions: type: number hit_count: @@ -48387,16 +50402,16 @@ components: timestamp: type: number cpu_utilization_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' memory_utilization_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' io_usage_stats: $ref: '#/components/schemas/nodes._common:ShardResourceUsageStatsIoUsageStats' nodes._common:ShardResourceUsageStatsIoUsageStats: type: object properties: max_io_utilization_percent: - $ref: '#/components/schemas/_common:Percentage' + $ref: '#/components/schemas/_common:PercentageString' nodes._common:ShardSearchBackpressureMode: type: string enum: @@ -48420,7 +50435,7 @@ components: cancellation_limit_reached_count: type: number cancelled_task_percentage: - type: number + $ref: '#/components/schemas/_common:PercentageNumber' current_cancellation_eligible_tasks_count: type: number nodes._common:ShardSearchBackpressureTaskResourceTrackerCpuUsageTrackerStats: @@ -48455,17 +50470,17 @@ components: cancellation_count: type: number current_max: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' current_max_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' current_avg: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' current_avg_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' rolling_avg: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' rolling_avg_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' nodes._common:ShardSearchBackpressureTaskResourceTrackerStats: type: object properties: @@ -48684,10 +50699,10 @@ components: type: number rx_size: description: Size of RX packets received by the node during internal cluster communication. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' rx_size_in_bytes: description: Size, in bytes, of RX packets received by the node during internal cluster communication. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' server_open: description: Current number of inbound TCP connections used for internal communication between nodes. type: number @@ -48696,10 +50711,10 @@ components: type: number tx_size: description: Size of TX packets sent by the node during internal cluster communication. - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' tx_size_in_bytes: description: Size, in bytes, of TX packets sent by the node during internal cluster communication. - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' total_outbound_connections: description: |- The cumulative number of outbound transport connections that this node has opened since it started. @@ -48801,7 +50816,7 @@ components: description: Total heap allowed to be used to hold recently indexed documents before they must be written to disk. This size is a shared pool across all shards on this node, and is controlled by Indexing Buffer settings. type: number total_indexing_buffer_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' transport: $ref: '#/components/schemas/nodes.info:NodeInfoTransport' transport_address: @@ -48871,9 +50886,9 @@ components: items: type: string max_content_length: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' max_content_length_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' publish_address: type: string required: @@ -48914,25 +50929,25 @@ components: type: object properties: direct_max: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' direct_max_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' heap_init: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_init_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' heap_max: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' heap_max_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' non_heap_init: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' non_heap_init_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' non_heap_max: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' non_heap_max_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - direct_max_in_bytes - heap_init_in_bytes @@ -48943,9 +50958,9 @@ components: type: object properties: total: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' total_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - total - total_in_bytes @@ -48976,9 +50991,9 @@ components: type: object properties: cache_size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' cache_size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' cores_per_socket: type: number mhz: @@ -51598,7 +53613,7 @@ components: file_count: type: number size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - file_count - size_in_bytes @@ -51608,9 +53623,9 @@ components: shard_count: type: number size: - $ref: '#/components/schemas/_common:StorageSize' + $ref: '#/components/schemas/_common:HumanReadableByteCount' size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' max_segments_per_shard: type: number required: @@ -51714,7 +53729,7 @@ components: file_count: type: number size_in_bytes: - $ref: '#/components/schemas/_common:Bytes' + $ref: '#/components/schemas/_common:ByteCount' required: - file_count - size_in_bytes diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 2a3b8ee993..575a955811 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -42,7 +43,6 @@ import org.opensearch.client.codegen.openapi.OpenApiSchemaFormat; import org.opensearch.client.codegen.openapi.OpenApiSchemaType; import org.opensearch.client.codegen.openapi.OpenApiSpecification; -import org.opensearch.client.codegen.utils.Lists; import org.opensearch.client.codegen.utils.Versions; public class SpecTransformer { @@ -249,25 +249,33 @@ private Shape visit(Namespace parent, String className, String typedefName, Open var description = schema.getDescription().orElse(null); + var oneOf = schema.getOneOf(); + if (schema.isArray()) { shape = new ArrayShape(parent, className, mapType(schema), typedefName, description); visitedSchemas.putIfAbsent(schema, shape); - } else if (schema.isString() && schema.hasEnums()) { - var deprecatedEnums = schema.getDeprecatedEnums().orElseGet(Collections::emptySet); - shape = new EnumShape( - parent, - className, - Lists.map(schema.getEnums().orElseThrow(), v -> new EnumShape.Variant(v, deprecatedEnums.contains(v))), - typedefName, - description - ); + } else if (schema.isStringEnum() || (oneOf.isPresent() && oneOf.get().stream().allMatch(OpenApiSchema::isStringEnum))) { + var variants = new ArrayList(); + + if (oneOf.isPresent()) { + oneOf.get().forEach(s -> { + var isDeprecated = s.getVersionDeprecated().isPresent(); + s.getEnums().orElseThrow().forEach(v -> variants.add(new EnumShape.Variant(v, isDeprecated))); + }); + } else { + schema.getEnums().orElseThrow().forEach(v -> variants.add(new EnumShape.Variant(v, false))); + } + + variants.sort(Comparator.comparing(EnumShape.Variant::getName)); + + shape = new EnumShape(parent, className, variants, typedefName, description); visitedSchemas.putIfAbsent(schema, shape); - } else if (schema.hasOneOf()) { + } else if (oneOf.isPresent()) { var taggedUnion = new TaggedUnionShape(parent, className, typedefName, description); shape = taggedUnion; visitedSchemas.putIfAbsent(schema, shape); - schema.getOneOf().orElseThrow().forEach(s -> { + oneOf.get().forEach(s -> { var title = s.getTitle() .orElseThrow(() -> new IllegalStateException("oneOf variant [" + s.getPointer() + "] is missing a `title` tag")); taggedUnion.addVariant(title, mapType(s)); @@ -509,8 +517,8 @@ private boolean shouldKeepRef(OpenApiSchema schema) { if (schema.isInteger() || schema.isNumber() || schema.isArray()) { return false; } - if (schema.isString() && schema.getEnums().isEmpty()) { - return false; + if (schema.isString()) { + return schema.hasEnums(); } if (schema.isObject() && schema.getProperties().map(Map::isEmpty).orElse(true) @@ -518,7 +526,8 @@ private boolean shouldKeepRef(OpenApiSchema schema) { return false; } if (schema.getOneOf().isPresent()) { - return schema.getOneOf().orElseThrow().stream().allMatch(s -> s.getTitle().isPresent()); + var oneOf = schema.getOneOf().orElseThrow(); + return oneOf.stream().allMatch(s -> s.getTitle().isPresent()) || oneOf.stream().allMatch(OpenApiSchema::isStringEnum); } if (schema.getAllOf().isPresent()) { return schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java index 11e57a1b7b..36f39bb006 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpStatusCode.java @@ -15,10 +15,12 @@ public enum HttpStatusCode { Ok("200"), Created("201"), + Accepted("202"), NoContent("204"), BadRequest("400"), Forbidden("403"), NotFound("404"), + RequestTimeout("408"), InternalServerError("500"), NotImplemented("501"); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index d4df9b3c07..8a1a3d1d03 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -11,7 +11,6 @@ import static org.opensearch.client.codegen.utils.Functional.ifNonnull; import io.swagger.v3.oas.models.media.Schema; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -55,8 +54,6 @@ public class OpenApiSchema extends OpenApiRefElement { @Nullable private final List enums; @Nullable - private final Set deprecatedEnums; - @Nullable private final OpenApiSchema items; @Nullable private final OpenApiSchema additionalProperties; @@ -70,6 +67,8 @@ public class OpenApiSchema extends OpenApiRefElement { private final String pattern; @Nullable private final Semver versionRemoved; + @Nullable + private final Semver versionDeprecated; private OpenApiSchema(@Nonnull Builder builder) { super(builder.parent, Objects.requireNonNull(builder.pointer, "pointer must not be null"), builder.$ref, OpenApiSchema.class); @@ -82,7 +81,6 @@ private OpenApiSchema(@Nonnull Builder builder) { anyOf = builder.anyOf; oneOf = builder.oneOf; enums = builder.enums; - deprecatedEnums = builder.deprecatedEnums; items = builder.items; additionalProperties = builder.additionalProperties; properties = builder.properties; @@ -90,6 +88,7 @@ private OpenApiSchema(@Nonnull Builder builder) { title = builder.title; pattern = builder.pattern; versionRemoved = builder.versionRemoved; + versionDeprecated = builder.versionDeprecated; } protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer pointer, @Nonnull Schema schema) { @@ -139,10 +138,8 @@ protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer var extensions = schema.getExtensions(); - // noinspection unchecked - deprecatedEnums = Maps.tryGet(extensions, "x-deprecated-enums").map(e -> (Collection) e).map(HashSet::new).orElse(null); - versionRemoved = Maps.tryGet(extensions, "x-version-removed").map(v -> Versions.coerce((String) v)).orElse(null); + versionDeprecated = Maps.tryGet(extensions, "x-version-deprecated").map(v -> Versions.coerce((String) v)).orElse(null); } @Nonnull @@ -199,6 +196,10 @@ public boolean isString() { return is(OpenApiSchemaType.String); } + public boolean isStringEnum() { + return isString() && hasEnums(); + } + public boolean hasAllOf() { return allOf != null && !allOf.isEmpty(); } @@ -235,11 +236,6 @@ public Optional> getEnums() { return Lists.unmodifiableOpt(enums); } - @Nonnull - public Optional> getDeprecatedEnums() { - return Sets.unmodifiableOpt(deprecatedEnums); - } - @Nonnull public Optional getItems() { return Optional.ofNullable(items); @@ -275,6 +271,11 @@ public Optional getVersionRemoved() { return Optional.ofNullable(versionRemoved); } + @Nonnull + public Optional getVersionDeprecated() { + return Optional.ofNullable(versionDeprecated); + } + public static Set determineTypes(List schemas) { return schemas.stream().map(OpenApiSchema::determineTypes).flatMap(Set::stream).collect(Collectors.toSet()); } @@ -342,8 +343,6 @@ public static class Builder extends ObjectBuilderBase { @Nullable private List enums; @Nullable - private Set deprecatedEnums; - @Nullable private OpenApiSchema items; @Nullable private OpenApiSchema additionalProperties; @@ -357,6 +356,8 @@ public static class Builder extends ObjectBuilderBase { private String pattern; @Nullable private Semver versionRemoved; + @Nullable + private Semver versionDeprecated; private Builder() {} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java index f3bd8fa731..bdd021510e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchemaFormat.java @@ -18,10 +18,21 @@ public enum OpenApiSchemaFormat { Double, Int32, Int64, - Binary; + Binary, + DateTime("date-time"); private static final Map VALUES = Maps.createLookupOf(values(), OpenApiSchemaFormat::toString); + private final String format; + + OpenApiSchemaFormat(String format) { + this.format = format; + } + + OpenApiSchemaFormat() { + this.format = name().toLowerCase(); + } + @Nonnull public static OpenApiSchemaFormat from(@Nonnull String format) { var value = VALUES.get(Strings.requireNonBlank(format, "format must not be blank")); @@ -33,6 +44,6 @@ public static OpenApiSchemaFormat from(@Nonnull String format) { @Override public String toString() { - return name().toLowerCase(); + return format; } } From 230a92cf3bf2d13015cd08b93a6d5b5094caa039 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:29:55 +1200 Subject: [PATCH 32/37] Re-generate client code using latest OpenSearch API specification (2024-09-23) (#1113) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../client/opensearch/ml/Action.java | 289 +++++ .../client/opensearch/ml/ClientConfig.java | 282 +++++ .../opensearch/ml/CreateConnectorRequest.java | 368 ++++++ .../ml/CreateConnectorResponse.java | 114 ++ .../client/opensearch/ml/Credential.java | 217 ++++ .../opensearch/ml/DeleteAgentRequest.java | 101 ++ .../opensearch/ml/DeleteAgentResponse.java | 76 ++ .../opensearch/ml/DeleteConnectorRequest.java | 101 ++ .../ml/DeleteConnectorResponse.java | 76 ++ .../client/opensearch/ml/Headers.java | 161 +++ .../opensearch/client/opensearch/ml/LLM.java | 161 +++ .../client/opensearch/ml/Memory.java | 114 ++ .../ml/OpenSearchMlAsyncClient.java | 82 ++ .../opensearch/ml/OpenSearchMlClient.java | 76 ++ .../opensearch/ml/RegisterAgentsRequest.java | 389 ++++++ .../opensearch/ml/RegisterAgentsResponse.java | 114 ++ .../client/opensearch/ml/ToolItems.java | 236 ++++ java-codegen/opensearch-openapi.yaml | 1085 ++++++++++++++++- 18 files changed, 3980 insertions(+), 62 deletions(-) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java new file mode 100644 index 0000000000..e9912634cc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java @@ -0,0 +1,289 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.Action + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Action implements PlainJsonSerializable { + + @Nullable + private final String actionType; + + @Nullable + private final Headers headers; + + @Nullable + private final String method; + + @Nullable + private final String postProcessFunction; + + @Nullable + private final String preProcessFunction; + + @Nullable + private final String requestBody; + + @Nullable + private final String url; + + // --------------------------------------------------------------------------------------------- + + private Action(Builder builder) { + this.actionType = builder.actionType; + this.headers = builder.headers; + this.method = builder.method; + this.postProcessFunction = builder.postProcessFunction; + this.preProcessFunction = builder.preProcessFunction; + this.requestBody = builder.requestBody; + this.url = builder.url; + } + + public static Action of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code action_type} + */ + @Nullable + public final String actionType() { + return this.actionType; + } + + /** + * API name: {@code headers} + */ + @Nullable + public final Headers headers() { + return this.headers; + } + + /** + * API name: {@code method} + */ + @Nullable + public final String method() { + return this.method; + } + + /** + * API name: {@code post_process_function} + */ + @Nullable + public final String postProcessFunction() { + return this.postProcessFunction; + } + + /** + * API name: {@code pre_process_function} + */ + @Nullable + public final String preProcessFunction() { + return this.preProcessFunction; + } + + /** + * API name: {@code request_body} + */ + @Nullable + public final String requestBody() { + return this.requestBody; + } + + /** + * API name: {@code url} + */ + @Nullable + public final String url() { + return this.url; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.actionType != null) { + generator.writeKey("action_type"); + generator.write(this.actionType); + } + + if (this.headers != null) { + generator.writeKey("headers"); + this.headers.serialize(generator, mapper); + } + + if (this.method != null) { + generator.writeKey("method"); + generator.write(this.method); + } + + if (this.postProcessFunction != null) { + generator.writeKey("post_process_function"); + generator.write(this.postProcessFunction); + } + + if (this.preProcessFunction != null) { + generator.writeKey("pre_process_function"); + generator.write(this.preProcessFunction); + } + + if (this.requestBody != null) { + generator.writeKey("request_body"); + generator.write(this.requestBody); + } + + if (this.url != null) { + generator.writeKey("url"); + generator.write(this.url); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Action}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String actionType; + @Nullable + private Headers headers; + @Nullable + private String method; + @Nullable + private String postProcessFunction; + @Nullable + private String preProcessFunction; + @Nullable + private String requestBody; + @Nullable + private String url; + + /** + * API name: {@code action_type} + */ + public final Builder actionType(@Nullable String value) { + this.actionType = value; + return this; + } + + /** + * API name: {@code headers} + */ + public final Builder headers(@Nullable Headers value) { + this.headers = value; + return this; + } + + /** + * API name: {@code headers} + */ + public final Builder headers(Function> fn) { + return headers(fn.apply(new Headers.Builder()).build()); + } + + /** + * API name: {@code method} + */ + public final Builder method(@Nullable String value) { + this.method = value; + return this; + } + + /** + * API name: {@code post_process_function} + */ + public final Builder postProcessFunction(@Nullable String value) { + this.postProcessFunction = value; + return this; + } + + /** + * API name: {@code pre_process_function} + */ + public final Builder preProcessFunction(@Nullable String value) { + this.preProcessFunction = value; + return this; + } + + /** + * API name: {@code request_body} + */ + public final Builder requestBody(@Nullable String value) { + this.requestBody = value; + return this; + } + + /** + * API name: {@code url} + */ + public final Builder url(@Nullable String value) { + this.url = value; + return this; + } + + /** + * Builds a {@link Action}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public Action build() { + _checkSingleUse(); + + return new Action(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Action} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Action::setupActionDeserializer + ); + + protected static void setupActionDeserializer(ObjectDeserializer op) { + op.add(Builder::actionType, JsonpDeserializer.stringDeserializer(), "action_type"); + op.add(Builder::headers, Headers._DESERIALIZER, "headers"); + op.add(Builder::method, JsonpDeserializer.stringDeserializer(), "method"); + op.add(Builder::postProcessFunction, JsonpDeserializer.stringDeserializer(), "post_process_function"); + op.add(Builder::preProcessFunction, JsonpDeserializer.stringDeserializer(), "pre_process_function"); + op.add(Builder::requestBody, JsonpDeserializer.stringDeserializer(), "request_body"); + op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java new file mode 100644 index 0000000000..e3907e7f59 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java @@ -0,0 +1,282 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.ClientConfig + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClientConfig implements PlainJsonSerializable { + + @Nullable + private final Integer connectionTimeout; + + @Nullable + private final Integer maxConnection; + + @Nullable + private final Integer maxRetryTimes; + + @Nullable + private final Integer readTimeout; + + @Nullable + private final Integer retryBackoffMillis; + + @Nullable + private final String retryBackoffPolicy; + + @Nullable + private final Integer retryTimeoutSeconds; + + // --------------------------------------------------------------------------------------------- + + private ClientConfig(Builder builder) { + this.connectionTimeout = builder.connectionTimeout; + this.maxConnection = builder.maxConnection; + this.maxRetryTimes = builder.maxRetryTimes; + this.readTimeout = builder.readTimeout; + this.retryBackoffMillis = builder.retryBackoffMillis; + this.retryBackoffPolicy = builder.retryBackoffPolicy; + this.retryTimeoutSeconds = builder.retryTimeoutSeconds; + } + + public static ClientConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code connection_timeout} + */ + @Nullable + public final Integer connectionTimeout() { + return this.connectionTimeout; + } + + /** + * API name: {@code max_connection} + */ + @Nullable + public final Integer maxConnection() { + return this.maxConnection; + } + + /** + * API name: {@code max_retry_times} + */ + @Nullable + public final Integer maxRetryTimes() { + return this.maxRetryTimes; + } + + /** + * API name: {@code read_timeout} + */ + @Nullable + public final Integer readTimeout() { + return this.readTimeout; + } + + /** + * API name: {@code retry_backoff_millis} + */ + @Nullable + public final Integer retryBackoffMillis() { + return this.retryBackoffMillis; + } + + /** + * API name: {@code retry_backoff_policy} + */ + @Nullable + public final String retryBackoffPolicy() { + return this.retryBackoffPolicy; + } + + /** + * API name: {@code retry_timeout_seconds} + */ + @Nullable + public final Integer retryTimeoutSeconds() { + return this.retryTimeoutSeconds; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.connectionTimeout != null) { + generator.writeKey("connection_timeout"); + generator.write(this.connectionTimeout); + } + + if (this.maxConnection != null) { + generator.writeKey("max_connection"); + generator.write(this.maxConnection); + } + + if (this.maxRetryTimes != null) { + generator.writeKey("max_retry_times"); + generator.write(this.maxRetryTimes); + } + + if (this.readTimeout != null) { + generator.writeKey("read_timeout"); + generator.write(this.readTimeout); + } + + if (this.retryBackoffMillis != null) { + generator.writeKey("retry_backoff_millis"); + generator.write(this.retryBackoffMillis); + } + + if (this.retryBackoffPolicy != null) { + generator.writeKey("retry_backoff_policy"); + generator.write(this.retryBackoffPolicy); + } + + if (this.retryTimeoutSeconds != null) { + generator.writeKey("retry_timeout_seconds"); + generator.write(this.retryTimeoutSeconds); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClientConfig}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer connectionTimeout; + @Nullable + private Integer maxConnection; + @Nullable + private Integer maxRetryTimes; + @Nullable + private Integer readTimeout; + @Nullable + private Integer retryBackoffMillis; + @Nullable + private String retryBackoffPolicy; + @Nullable + private Integer retryTimeoutSeconds; + + /** + * API name: {@code connection_timeout} + */ + public final Builder connectionTimeout(@Nullable Integer value) { + this.connectionTimeout = value; + return this; + } + + /** + * API name: {@code max_connection} + */ + public final Builder maxConnection(@Nullable Integer value) { + this.maxConnection = value; + return this; + } + + /** + * API name: {@code max_retry_times} + */ + public final Builder maxRetryTimes(@Nullable Integer value) { + this.maxRetryTimes = value; + return this; + } + + /** + * API name: {@code read_timeout} + */ + public final Builder readTimeout(@Nullable Integer value) { + this.readTimeout = value; + return this; + } + + /** + * API name: {@code retry_backoff_millis} + */ + public final Builder retryBackoffMillis(@Nullable Integer value) { + this.retryBackoffMillis = value; + return this; + } + + /** + * API name: {@code retry_backoff_policy} + */ + public final Builder retryBackoffPolicy(@Nullable String value) { + this.retryBackoffPolicy = value; + return this; + } + + /** + * API name: {@code retry_timeout_seconds} + */ + public final Builder retryTimeoutSeconds(@Nullable Integer value) { + this.retryTimeoutSeconds = value; + return this; + } + + /** + * Builds a {@link ClientConfig}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public ClientConfig build() { + _checkSingleUse(); + + return new ClientConfig(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClientConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClientConfig::setupClientConfigDeserializer + ); + + protected static void setupClientConfigDeserializer(ObjectDeserializer op) { + op.add(Builder::connectionTimeout, JsonpDeserializer.integerDeserializer(), "connection_timeout"); + op.add(Builder::maxConnection, JsonpDeserializer.integerDeserializer(), "max_connection"); + op.add(Builder::maxRetryTimes, JsonpDeserializer.integerDeserializer(), "max_retry_times"); + op.add(Builder::readTimeout, JsonpDeserializer.integerDeserializer(), "read_timeout"); + op.add(Builder::retryBackoffMillis, JsonpDeserializer.integerDeserializer(), "retry_backoff_millis"); + op.add(Builder::retryBackoffPolicy, JsonpDeserializer.stringDeserializer(), "retry_backoff_policy"); + op.add(Builder::retryTimeoutSeconds, JsonpDeserializer.integerDeserializer(), "retry_timeout_seconds"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorRequest.java new file mode 100644 index 0000000000..f9233dd6a9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorRequest.java @@ -0,0 +1,368 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.create_connector.Request + +/** + * Creates a standalone connector. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateConnectorRequest extends RequestBase implements PlainJsonSerializable { + + private final List actions; + + @Nullable + private final ClientConfig clientConfig; + + private final Credential credential; + + private final String description; + + private final String name; + + private final Map parameters; + + private final String protocol; + + private final int version; + + // --------------------------------------------------------------------------------------------- + + private CreateConnectorRequest(Builder builder) { + this.actions = ApiTypeHelper.unmodifiableRequired(builder.actions, this, "actions"); + this.clientConfig = builder.clientConfig; + this.credential = ApiTypeHelper.requireNonNull(builder.credential, this, "credential"); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.parameters = ApiTypeHelper.unmodifiableRequired(builder.parameters, this, "parameters"); + this.protocol = ApiTypeHelper.requireNonNull(builder.protocol, this, "protocol"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + } + + public static CreateConnectorRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code actions} + */ + public final List actions() { + return this.actions; + } + + /** + * API name: {@code client_config} + */ + @Nullable + public final ClientConfig clientConfig() { + return this.clientConfig; + } + + /** + * Required - API name: {@code credential} + */ + public final Credential credential() { + return this.credential; + } + + /** + * Required - API name: {@code description} + */ + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code parameters} + */ + public final Map parameters() { + return this.parameters; + } + + /** + * Required - API name: {@code protocol} + */ + public final String protocol() { + return this.protocol; + } + + /** + * Required - API name: {@code version} + */ + public final int version() { + return this.version; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("actions"); + generator.writeStartArray(); + for (Action item0 : this.actions) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + if (this.clientConfig != null) { + generator.writeKey("client_config"); + this.clientConfig.serialize(generator, mapper); + } + + generator.writeKey("credential"); + this.credential.serialize(generator, mapper); + + generator.writeKey("description"); + generator.write(this.description); + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + + generator.writeKey("protocol"); + generator.write(this.protocol); + + generator.writeKey("version"); + generator.write(this.version); + } + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CreateConnectorRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private List actions; + @Nullable + private ClientConfig clientConfig; + private Credential credential; + private String description; + private String name; + private Map parameters; + private String protocol; + private Integer version; + + /** + * Required - API name: {@code actions} + * + *

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

+ */ + public final Builder actions(List list) { + this.actions = _listAddAll(this.actions, list); + return this; + } + + /** + * Required - API name: {@code actions} + * + *

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

+ */ + public final Builder actions(Action value, Action... values) { + this.actions = _listAdd(this.actions, value, values); + return this; + } + + /** + * Required - API name: {@code actions} + * + *

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

+ */ + public final Builder actions(Function> fn) { + return actions(fn.apply(new Action.Builder()).build()); + } + + /** + * API name: {@code client_config} + */ + public final Builder clientConfig(@Nullable ClientConfig value) { + this.clientConfig = value; + return this; + } + + /** + * API name: {@code client_config} + */ + public final Builder clientConfig(Function> fn) { + return clientConfig(fn.apply(new ClientConfig.Builder()).build()); + } + + /** + * Required - API name: {@code credential} + */ + public final Builder credential(Credential value) { + this.credential = value; + return this; + } + + /** + * Required - API name: {@code credential} + */ + public final Builder credential(Function> fn) { + return credential(fn.apply(new Credential.Builder()).build()); + } + + /** + * Required - API name: {@code description} + */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code parameters} + * + *

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

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

+ * Adds an entry to parameters. + *

+ */ + public final Builder parameters(String key, JsonData value) { + this.parameters = _mapPut(this.parameters, key, value); + return this; + } + + /** + * Required - API name: {@code protocol} + */ + public final Builder protocol(String value) { + this.protocol = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + public final Builder version(int value) { + this.version = value; + return this; + } + + /** + * Builds a {@link CreateConnectorRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public CreateConnectorRequest build() { + _checkSingleUse(); + + return new CreateConnectorRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateConnectorRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateConnectorRequest::setupCreateConnectorRequestDeserializer + ); + + protected static void setupCreateConnectorRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::actions, JsonpDeserializer.arrayDeserializer(Action._DESERIALIZER), "actions"); + op.add(Builder::clientConfig, ClientConfig._DESERIALIZER, "client_config"); + op.add(Builder::credential, Credential._DESERIALIZER, "credential"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + op.add(Builder::protocol, JsonpDeserializer.stringDeserializer(), "protocol"); + op.add(Builder::version, JsonpDeserializer.integerDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.create_connector}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/connectors/_create", + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + true, + CreateConnectorResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java new file mode 100644 index 0000000000..5bed16c40a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java @@ -0,0 +1,114 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.create_connector.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateConnectorResponse implements PlainJsonSerializable { + + @Nullable + private final String connectorId; + + // --------------------------------------------------------------------------------------------- + + private CreateConnectorResponse(Builder builder) { + this.connectorId = builder.connectorId; + } + + public static CreateConnectorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code connector_id} + */ + @Nullable + public final String connectorId() { + return this.connectorId; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.connectorId != null) { + generator.writeKey("connector_id"); + generator.write(this.connectorId); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CreateConnectorResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String connectorId; + + /** + * API name: {@code connector_id} + */ + public final Builder connectorId(@Nullable String value) { + this.connectorId = value; + return this; + } + + /** + * Builds a {@link CreateConnectorResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public CreateConnectorResponse build() { + _checkSingleUse(); + + return new CreateConnectorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateConnectorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateConnectorResponse::setupCreateConnectorResponseDeserializer + ); + + protected static void setupCreateConnectorResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::connectorId, JsonpDeserializer.stringDeserializer(), "connector_id"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java new file mode 100644 index 0000000000..8e32830e5e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java @@ -0,0 +1,217 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.Credential + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Credential implements PlainJsonSerializable { + + @Nullable + private final String accessKey; + + @Nullable + private final String secretKey; + + @Nullable + private final String sessionToken; + + private final Map metadata; + + // --------------------------------------------------------------------------------------------- + + private Credential(Builder builder) { + this.accessKey = builder.accessKey; + this.secretKey = builder.secretKey; + this.sessionToken = builder.sessionToken; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + } + + public static Credential of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code access_key} + */ + @Nullable + public final String accessKey() { + return this.accessKey; + } + + /** + * API name: {@code secret_key} + */ + @Nullable + public final String secretKey() { + return this.secretKey; + } + + /** + * API name: {@code session_token} + */ + @Nullable + public final String sessionToken() { + return this.sessionToken; + } + + /** + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + if (this.accessKey != null) { + generator.writeKey("access_key"); + generator.write(this.accessKey); + } + + if (this.secretKey != null) { + generator.writeKey("secret_key"); + generator.write(this.secretKey); + } + + if (this.sessionToken != null) { + generator.writeKey("session_token"); + generator.write(this.sessionToken); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Credential}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String accessKey; + @Nullable + private String secretKey; + @Nullable + private String sessionToken; + @Nullable + private Map metadata; + + /** + * API name: {@code access_key} + */ + public final Builder accessKey(@Nullable String value) { + this.accessKey = value; + return this; + } + + /** + * API name: {@code secret_key} + */ + public final Builder secretKey(@Nullable String value) { + this.secretKey = value; + return this; + } + + /** + * API name: {@code session_token} + */ + public final Builder sessionToken(@Nullable String value) { + this.sessionToken = value; + return this; + } + + /** + * + *

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

+ */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * + *

+ * Adds an entry to metadata. + *

+ */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * Builds a {@link Credential}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public Credential build() { + _checkSingleUse(); + + return new Credential(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Credential} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Credential::setupCredentialDeserializer + ); + + protected static void setupCredentialDeserializer(ObjectDeserializer op) { + op.add(Builder::accessKey, JsonpDeserializer.stringDeserializer(), "access_key"); + op.add(Builder::secretKey, JsonpDeserializer.stringDeserializer(), "secret_key"); + op.add(Builder::sessionToken, JsonpDeserializer.stringDeserializer(), "session_token"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java new file mode 100644 index 0000000000..74f9771997 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.delete_agent.Request + +/** + * Delete an agent. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteAgentRequest extends RequestBase { + + private final String agentId; + + // --------------------------------------------------------------------------------------------- + + private DeleteAgentRequest(Builder builder) { + this.agentId = ApiTypeHelper.requireNonNull(builder.agentId, this, "agentId"); + } + + public static DeleteAgentRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code agent_id} + */ + public final String agentId() { + return this.agentId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteAgentRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String agentId; + + /** + * Required - API name: {@code agent_id} + */ + public final Builder agentId(String value) { + this.agentId = value; + return this; + } + + /** + * Builds a {@link DeleteAgentRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteAgentRequest build() { + _checkSingleUse(); + + return new DeleteAgentRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_agent}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/agents/"); + SimpleEndpoint.pathEncode(request.agentId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteAgentResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentResponse.java new file mode 100644 index 0000000000..8624845cc7 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentResponse.java @@ -0,0 +1,76 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: ml.delete_agent.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteAgentResponse extends WriteResponseBase { + + // --------------------------------------------------------------------------------------------- + + private DeleteAgentResponse(Builder builder) { + super(builder); + } + + public static DeleteAgentResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteAgentResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteAgentResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteAgentResponse build() { + _checkSingleUse(); + + return new DeleteAgentResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteAgentResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteAgentResponse::setupDeleteAgentResponseDeserializer + ); + + protected static void setupDeleteAgentResponseDeserializer(ObjectDeserializer op) { + WriteResponseBase.setupWriteResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java new file mode 100644 index 0000000000..30e0f7d202 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java @@ -0,0 +1,101 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.delete_connector.Request + +/** + * Deletes a standalone connector. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteConnectorRequest extends RequestBase { + + private final String connectorId; + + // --------------------------------------------------------------------------------------------- + + private DeleteConnectorRequest(Builder builder) { + this.connectorId = ApiTypeHelper.requireNonNull(builder.connectorId, this, "connectorId"); + } + + public static DeleteConnectorRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code connector_id} + */ + public final String connectorId() { + return this.connectorId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteConnectorRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String connectorId; + + /** + * Required - API name: {@code connector_id} + */ + public final Builder connectorId(String value) { + this.connectorId = value; + return this; + } + + /** + * Builds a {@link DeleteConnectorRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteConnectorRequest build() { + _checkSingleUse(); + + return new DeleteConnectorRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_connector}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/connectors/"); + SimpleEndpoint.pathEncode(request.connectorId, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteConnectorResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java new file mode 100644 index 0000000000..1ba0900cc8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java @@ -0,0 +1,76 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: ml.delete_connector.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteConnectorResponse extends WriteResponseBase { + + // --------------------------------------------------------------------------------------------- + + private DeleteConnectorResponse(Builder builder) { + super(builder); + } + + public static DeleteConnectorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteConnectorResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder implements ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteConnectorResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public DeleteConnectorResponse build() { + _checkSingleUse(); + + return new DeleteConnectorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteConnectorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteConnectorResponse::setupDeleteConnectorResponseDeserializer + ); + + protected static void setupDeleteConnectorResponseDeserializer(ObjectDeserializer op) { + WriteResponseBase.setupWriteResponseBaseDeserializer(op); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java new file mode 100644 index 0000000000..837e3b4332 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Headers.java @@ -0,0 +1,161 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.Headers + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Headers implements PlainJsonSerializable { + + @Nullable + private final String contentType; + + private final Map metadata; + + // --------------------------------------------------------------------------------------------- + + private Headers(Builder builder) { + this.contentType = builder.contentType; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + } + + public static Headers of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code content_type} + */ + @Nullable + public final String contentType() { + return this.contentType; + } + + /** + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + if (this.contentType != null) { + generator.writeKey("content_type"); + generator.write(this.contentType); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Headers}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String contentType; + @Nullable + private Map metadata; + + /** + * API name: {@code content_type} + */ + public final Builder contentType(@Nullable String value) { + this.contentType = value; + return this; + } + + /** + * + *

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

+ */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * + *

+ * Adds an entry to metadata. + *

+ */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * Builds a {@link Headers}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public Headers build() { + _checkSingleUse(); + + return new Headers(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Headers} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Headers::setupHeadersDeserializer + ); + + protected static void setupHeadersDeserializer(ObjectDeserializer op) { + op.add(Builder::contentType, JsonpDeserializer.stringDeserializer(), "content_type"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java new file mode 100644 index 0000000000..77a786f256 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java @@ -0,0 +1,161 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.LLM + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class LLM implements PlainJsonSerializable { + + @Nullable + private final String modelId; + + private final Map parameters; + + // --------------------------------------------------------------------------------------------- + + private LLM(Builder builder) { + this.modelId = builder.modelId; + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + } + + public static LLM of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code parameters} + */ + public final Map parameters() { + return this.parameters; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + if (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link LLM}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String modelId; + @Nullable + private Map parameters; + + /** + * API name: {@code model_id} + */ + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code parameters} + * + *

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

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

+ * Adds an entry to parameters. + *

+ */ + public final Builder parameters(String key, JsonData value) { + this.parameters = _mapPut(this.parameters, key, value); + return this; + } + + /** + * Builds a {@link LLM}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public LLM build() { + _checkSingleUse(); + + return new LLM(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link LLM} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, LLM::setupLLMDeserializer); + + protected static void setupLLMDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java new file mode 100644 index 0000000000..dfc0a9083c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java @@ -0,0 +1,114 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.Memory + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Memory implements PlainJsonSerializable { + + @Nullable + private final String type; + + // --------------------------------------------------------------------------------------------- + + private Memory(Builder builder) { + this.type = builder.type; + } + + public static Memory of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code type} + */ + @Nullable + public final String type() { + return this.type; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.type != null) { + generator.writeKey("type"); + generator.write(this.type); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Memory}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String type; + + /** + * API name: {@code type} + */ + public final Builder type(@Nullable String value) { + this.type = value; + return this; + } + + /** + * Builds a {@link Memory}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public Memory build() { + _checkSingleUse(); + + return new Memory(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Memory} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Memory::setupMemoryDeserializer + ); + + protected static void setupMemoryDeserializer(ObjectDeserializer op) { + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java index e4199fca36..4f5332eb7f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java @@ -41,6 +41,68 @@ public OpenSearchMlAsyncClient withTransportOptions(@Nullable TransportOptions t return new OpenSearchMlAsyncClient(this.transport, transportOptions); } + // ----- Endpoint: ml.create_connector + + /** + * Creates a standalone connector. + */ + public CompletableFuture createConnector(CreateConnectorRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CreateConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link CreateConnectorRequest} + */ + public final CompletableFuture createConnector( + Function> fn + ) throws IOException, OpenSearchException { + return createConnector(fn.apply(new CreateConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_agent + + /** + * Delete an agent. + */ + public CompletableFuture deleteAgent(DeleteAgentRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteAgentRequest._ENDPOINT, this.transportOptions); + } + + /** + * Delete an agent. + * + * @param fn a function that initializes a builder to create the {@link DeleteAgentRequest} + */ + public final CompletableFuture deleteAgent( + Function> fn + ) throws IOException, OpenSearchException { + return deleteAgent(fn.apply(new DeleteAgentRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_connector + + /** + * Deletes a standalone connector. + */ + public CompletableFuture deleteConnector(DeleteConnectorRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DeleteConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link DeleteConnectorRequest} + */ + public final CompletableFuture deleteConnector( + Function> fn + ) throws IOException, OpenSearchException { + return deleteConnector(fn.apply(new DeleteConnectorRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_model /** @@ -160,6 +222,26 @@ public final CompletableFuture getTask(Function registerAgents(RegisterAgentsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RegisterAgentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Register an agent. + * + * @param fn a function that initializes a builder to create the {@link RegisterAgentsRequest} + */ + public final CompletableFuture registerAgents( + Function> fn + ) throws IOException, OpenSearchException { + return registerAgents(fn.apply(new RegisterAgentsRequest.Builder()).build()); + } + // ----- Endpoint: ml.register_model /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java index 7e6fa317c2..a93402b689 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java @@ -40,6 +40,63 @@ public OpenSearchMlClient withTransportOptions(@Nullable TransportOptions transp return new OpenSearchMlClient(this.transport, transportOptions); } + // ----- Endpoint: ml.create_connector + + /** + * Creates a standalone connector. + */ + public CreateConnectorResponse createConnector(CreateConnectorRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CreateConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link CreateConnectorRequest} + */ + public final CreateConnectorResponse createConnector(Function> fn) + throws IOException, OpenSearchException { + return createConnector(fn.apply(new CreateConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_agent + + /** + * Delete an agent. + */ + public DeleteAgentResponse deleteAgent(DeleteAgentRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteAgentRequest._ENDPOINT, this.transportOptions); + } + + /** + * Delete an agent. + * + * @param fn a function that initializes a builder to create the {@link DeleteAgentRequest} + */ + public final DeleteAgentResponse deleteAgent(Function> fn) + throws IOException, OpenSearchException { + return deleteAgent(fn.apply(new DeleteAgentRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_connector + + /** + * Deletes a standalone connector. + */ + public DeleteConnectorResponse deleteConnector(DeleteConnectorRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link DeleteConnectorRequest} + */ + public final DeleteConnectorResponse deleteConnector(Function> fn) + throws IOException, OpenSearchException { + return deleteConnector(fn.apply(new DeleteConnectorRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_model /** @@ -155,6 +212,25 @@ public final GetTaskResponse getTask(Function> fn) + throws IOException, OpenSearchException { + return registerAgents(fn.apply(new RegisterAgentsRequest.Builder()).build()); + } + // ----- Endpoint: ml.register_model /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java new file mode 100644 index 0000000000..155e0de881 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java @@ -0,0 +1,389 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_agents.Request + +/** + * Register an agent. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterAgentsRequest extends RequestBase implements PlainJsonSerializable { + + @Nullable + private final String appType; + + @Nullable + private final String description; + + @Nullable + private final LLM llm; + + @Nullable + private final Memory memory; + + private final String name; + + private final Map parameters; + + private final List tools; + + private final String type; + + // --------------------------------------------------------------------------------------------- + + private RegisterAgentsRequest(Builder builder) { + this.appType = builder.appType; + this.description = builder.description; + this.llm = builder.llm; + this.memory = builder.memory; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + this.tools = ApiTypeHelper.unmodifiable(builder.tools); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + } + + public static RegisterAgentsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code app_type} + */ + @Nullable + public final String appType() { + return this.appType; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code llm} + */ + @Nullable + public final LLM llm() { + return this.llm; + } + + /** + * API name: {@code memory} + */ + @Nullable + public final Memory memory() { + return this.memory; + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * API name: {@code parameters} + */ + public final Map parameters() { + return this.parameters; + } + + /** + * API name: {@code tools} + */ + public final List tools() { + return this.tools; + } + + /** + * Required - API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.appType != null) { + generator.writeKey("app_type"); + generator.write(this.appType); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.llm != null) { + generator.writeKey("llm"); + this.llm.serialize(generator, mapper); + } + + if (this.memory != null) { + generator.writeKey("memory"); + this.memory.serialize(generator, mapper); + } + + generator.writeKey("name"); + generator.write(this.name); + + if (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.tools)) { + generator.writeKey("tools"); + generator.writeStartArray(); + for (ToolItems item0 : this.tools) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("type"); + generator.write(this.type); + } + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterAgentsRequest}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String appType; + @Nullable + private String description; + @Nullable + private LLM llm; + @Nullable + private Memory memory; + private String name; + @Nullable + private Map parameters; + @Nullable + private List tools; + private String type; + + /** + * API name: {@code app_type} + */ + public final Builder appType(@Nullable String value) { + this.appType = value; + return this; + } + + /** + * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code llm} + */ + public final Builder llm(@Nullable LLM value) { + this.llm = value; + return this; + } + + /** + * API name: {@code llm} + */ + public final Builder llm(Function> fn) { + return llm(fn.apply(new LLM.Builder()).build()); + } + + /** + * API name: {@code memory} + */ + public final Builder memory(@Nullable Memory value) { + this.memory = value; + return this; + } + + /** + * API name: {@code memory} + */ + public final Builder memory(Function> fn) { + return memory(fn.apply(new Memory.Builder()).build()); + } + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * API name: {@code parameters} + * + *

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

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

+ * Adds an entry to parameters. + *

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

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

+ */ + public final Builder tools(List list) { + this.tools = _listAddAll(this.tools, list); + return this; + } + + /** + * API name: {@code tools} + * + *

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

+ */ + public final Builder tools(ToolItems value, ToolItems... values) { + this.tools = _listAdd(this.tools, value, values); + return this; + } + + /** + * API name: {@code tools} + * + *

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

+ */ + public final Builder tools(Function> fn) { + return tools(fn.apply(new ToolItems.Builder()).build()); + } + + /** + * Required - API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Builds a {@link RegisterAgentsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterAgentsRequest build() { + _checkSingleUse(); + + return new RegisterAgentsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterAgentsRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterAgentsRequest::setupRegisterAgentsRequestDeserializer + ); + + protected static void setupRegisterAgentsRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::appType, JsonpDeserializer.stringDeserializer(), "app_type"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::llm, LLM._DESERIALIZER, "llm"); + op.add(Builder::memory, Memory._DESERIALIZER, "memory"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + op.add(Builder::tools, JsonpDeserializer.arrayDeserializer(ToolItems._DESERIALIZER), "tools"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.register_agents}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/agents/_register", + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + true, + RegisterAgentsResponse._DESERIALIZER + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java new file mode 100644 index 0000000000..e69ff9e0de --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java @@ -0,0 +1,114 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.register_agents.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterAgentsResponse implements PlainJsonSerializable { + + @Nullable + private final String agentId; + + // --------------------------------------------------------------------------------------------- + + private RegisterAgentsResponse(Builder builder) { + this.agentId = builder.agentId; + } + + public static RegisterAgentsResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code agent_id} + */ + @Nullable + public final String agentId() { + return this.agentId; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.agentId != null) { + generator.writeKey("agent_id"); + generator.write(this.agentId); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RegisterAgentsResponse}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String agentId; + + /** + * API name: {@code agent_id} + */ + public final Builder agentId(@Nullable String value) { + this.agentId = value; + return this; + } + + /** + * Builds a {@link RegisterAgentsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public RegisterAgentsResponse build() { + _checkSingleUse(); + + return new RegisterAgentsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterAgentsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterAgentsResponse::setupRegisterAgentsResponseDeserializer + ); + + protected static void setupRegisterAgentsResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::agentId, JsonpDeserializer.stringDeserializer(), "agent_id"); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java new file mode 100644 index 0000000000..b52d7fae3a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ToolItems.java @@ -0,0 +1,236 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +// typedef: ml.ToolItems + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ToolItems implements PlainJsonSerializable { + + @Nullable + private final String name; + + private final Map parameters; + + @Nullable + private final String type; + + private final Map metadata; + + // --------------------------------------------------------------------------------------------- + + private ToolItems(Builder builder) { + this.name = builder.name; + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + this.type = builder.type; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + } + + public static ToolItems of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * API name: {@code parameters} + */ + public final Map parameters() { + return this.parameters; + } + + /** + * API name: {@code type} + */ + @Nullable + public final String type() { + return this.type; + } + + /** + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.type != null) { + generator.writeKey("type"); + generator.write(this.type); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ToolItems}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String name; + @Nullable + private Map parameters; + @Nullable + private String type; + @Nullable + private Map metadata; + + /** + * API name: {@code name} + */ + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * API name: {@code parameters} + * + *

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

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

+ * Adds an entry to parameters. + *

+ */ + public final Builder parameters(String key, JsonData value) { + this.parameters = _mapPut(this.parameters, key, value); + return this; + } + + /** + * API name: {@code type} + */ + public final Builder type(@Nullable String value) { + this.type = value; + return this; + } + + /** + * + *

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

+ */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * + *

+ * Adds an entry to metadata. + *

+ */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * Builds a {@link ToolItems}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public ToolItems build() { + _checkSingleUse(); + + return new ToolItems(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ToolItems} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ToolItems::setupToolItemsDeserializer + ); + + protected static void setupToolItemsDeserializer(ObjectDeserializer op) { + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + if (builder.metadata == null) { + builder.metadata = new HashMap<>(); + } + builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } +} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 8eb4f6063f..e9e4e42740 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -3737,15 +3737,35 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' - /_plugins/_ism/add/{index}: + /_plugins/_ism/add: post: operationId: ism.add_policy.0 x-operation-group: ism.add_policy description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + /_plugins/_ism/add/{index}: + post: + operationId: ism.add_policy.1 + x-operation-group: ism.add_policy + description: Adds a policy to an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy parameters: - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/ism.add_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3756,15 +3776,35 @@ paths: responses: '200': $ref: '#/components/responses/ism.add_policy@200' - /_plugins/_ism/change_policy/{index}: + /_plugins/_ism/change_policy: post: operationId: ism.change_policy.0 x-operation-group: ism.change_policy description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + /_plugins/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.1 + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy parameters: - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/ism.change_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3775,23 +3815,114 @@ paths: responses: '200': $ref: '#/components/responses/ism.change_policy@200' + /_plugins/_ism/explain: + get: + operationId: ism.explain_policy.0 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: ism.explain_policy.0 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' /_plugins/_ism/explain/{index}: get: - operationId: ism.explain_index.0 - x-operation-group: ism.explain_index - description: Gets the currently applied policy on an index. + operationId: ism.explain_policy.1 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index parameters: - - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/ism.explain_policy::path.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + post: + operationId: ism.explain_policy.1 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + /_plugins/_ism/policies: + get: + operationId: ism.get_policies.0 + x-operation-group: ism.get_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy responses: '200': - $ref: '#/components/responses/ism.explain_index@200' + $ref: '#/components/responses/ism.get_policies@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + put: + operationId: ism.put_policies.0 + x-operation-group: ism.put_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + requestBody: + $ref: '#/components/requestBodies/ism.put_policies' + parameters: + - $ref: '#/components/parameters/ism.put_policies::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policies::query.if_seq_no' + - $ref: '#/components/parameters/ism.put_policies::query.policyID' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.put_policies@200' /_plugins/_ism/policies/{policy_id}: delete: operationId: ism.delete_policy.0 @@ -3812,9 +3943,9 @@ paths: get: operationId: ism.get_policy.0 x-operation-group: ism.get_policy - description: Gets the policy. + description: Gets a policy. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#put-policy parameters: - $ref: '#/components/parameters/ism.get_policy::path.policy_id' - $ref: '#/components/parameters/_global::query.pretty' @@ -3825,6 +3956,24 @@ paths: responses: '200': $ref: '#/components/responses/ism.get_policy@200' + head: + operationId: ism.exists_policy.0 + x-operation-group: ism.exists_policy + description: Checks whether the policy exists. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.exists_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.exists_policy@200' + '404': + $ref: '#/components/responses/ism.exists_policy@404' put: operationId: ism.put_policy.0 x-operation-group: ism.put_policy @@ -3847,15 +3996,33 @@ paths: $ref: '#/components/responses/ism.put_policy@200' '201': $ref: '#/components/responses/ism.put_policy@201' - /_plugins/_ism/remove/{index}: + /_plugins/_ism/remove: post: operationId: ism.remove_policy.0 x-operation-group: ism.remove_policy description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' + /_plugins/_ism/remove/{index}: + post: + operationId: ism.remove_policy.1 + x-operation-group: ism.remove_policy + description: Removes a policy from an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy parameters: - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/ism.remove_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3864,6 +4031,45 @@ paths: responses: '200': $ref: '#/components/responses/ism.remove_policy@200' + /_plugins/_ism/retry: + post: + operationId: ism.retry_index.0 + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + /_plugins/_ism/retry/{index}: + post: + operationId: ism.retry_index.1 + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::path.index' + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' /_plugins/_knn/{node_id}/stats: get: operationId: knn.stats.2 @@ -4155,6 +4361,68 @@ paths: responses: '200': $ref: '#/components/responses/knn.warmup@200' + /_plugins/_ml/agents/_register: + post: + operationId: ml.register_agents.0 + x-operation-group: ml.register_agents + description: Register an agent. + requestBody: + $ref: '#/components/requestBodies/ml.register_agents' + responses: + '200': + $ref: '#/components/responses/ml.register_agents@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_ml/agents/{agent_id}: + delete: + operationId: ml.delete_agent.0 + x-operation-group: ml.delete_agent + description: Delete an agent. + parameters: + - $ref: '#/components/parameters/ml.delete_agent::path.agent_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.delete_agent@200' + /_plugins/_ml/connectors/_create: + post: + operationId: ml.create_connector.0 + x-operation-group: ml.create_connector + description: Creates a standalone connector. + requestBody: + $ref: '#/components/requestBodies/ml.create_connector' + responses: + '200': + $ref: '#/components/responses/ml.create_connector@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_ml/connectors/{connector_id}: + delete: + operationId: ml.delete_connector.0 + x-operation-group: ml.delete_connector + description: Deletes a standalone connector. + parameters: + - $ref: '#/components/parameters/ml.delete_connector::path.connector_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.delete_connector@200' /_plugins/_ml/model_groups/_register: post: operationId: ml.register_model_group.0 @@ -4826,6 +5094,23 @@ paths: responses: '200': $ref: '#/components/responses/sql.settings@200' + /_plugins/_refresh_search_analyzers/{index}: + post: + operationId: ism.refresh_search_analyzers.0 + x-operation-group: ism.refresh_search_analyzers + description: Refresh search analyzers in real time. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/refresh-analyzer/ + parameters: + - $ref: '#/components/parameters/ism.refresh_search_analyzers::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.refresh_search_analyzers@200' /_plugins/_rollup/jobs/{id}: delete: operationId: rollups.delete.0 @@ -7334,6 +7619,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7356,6 +7642,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7380,6 +7667,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7403,6 +7691,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -11482,15 +11771,37 @@ paths: $ref: '#/components/responses/asynchronous_search.delete@200' deprecated: true x-ignorable: true - /_opendistro/_ism/add/{index}: + /_opendistro/_ism/add: post: operationId: ism.add_policy.0_superseded x-operation-group: ism.add_policy description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/add/{index}: + post: + operationId: ism.add_policy.1_superseded + x-operation-group: ism.add_policy + description: Adds a policy to an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy parameters: - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/ism.add_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11503,15 +11814,37 @@ paths: $ref: '#/components/responses/ism.add_policy@200' deprecated: true x-ignorable: true - /_opendistro/_ism/change_policy/{index}: + /_opendistro/_ism/change_policy: post: operationId: ism.change_policy.0_superseded x-operation-group: ism.change_policy description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.1_superseded + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy parameters: - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/ism.change_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11524,15 +11857,116 @@ paths: $ref: '#/components/responses/ism.change_policy@200' deprecated: true x-ignorable: true + /_opendistro/_ism/explain: + get: + operationId: ism.explain_policy.0_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true + post: + operationId: ism.explain_policy.0_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true /_opendistro/_ism/explain/{index}: get: - operationId: ism.explain_index.0_superseded - x-operation-group: ism.explain_index - description: Gets the currently applied policy on an index. + operationId: ism.explain_policy.1_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index parameters: - - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + deprecated: true + x-ignorable: true + post: + operationId: ism.explain_policy.1_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/policies: + get: + operationId: ism.get_policies.0_superseded + x-operation-group: ism.get_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + responses: + '200': + $ref: '#/components/responses/ism.get_policies@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true + put: + operationId: ism.put_policies.0_superseded + x-operation-group: ism.put_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + requestBody: + $ref: '#/components/requestBodies/ism.put_policies' + parameters: + - $ref: '#/components/parameters/ism.put_policies::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policies::query.if_seq_no' + - $ref: '#/components/parameters/ism.put_policies::query.policyID' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11540,16 +11974,16 @@ paths: - $ref: '#/components/parameters/_global::query.filter_path' responses: '200': - $ref: '#/components/responses/ism.explain_index@200' + $ref: '#/components/responses/ism.put_policies@200' deprecated: true x-ignorable: true /_opendistro/_ism/policies/{policyID}: get: operationId: ism.get_policy.0_superseded x-operation-group: ism.get_policy - description: Gets the policy. + description: Gets a policy. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#put-policy parameters: - $ref: '#/components/parameters/ism.get_policy::path.policy_id' - $ref: '#/components/parameters/_global::query.pretty' @@ -11562,6 +11996,26 @@ paths: $ref: '#/components/responses/ism.get_policy@200' deprecated: true x-ignorable: true + head: + operationId: ism.exists_policy.0_superseded + x-operation-group: ism.exists_policy + description: Checks whether the policy exists. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.exists_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.exists_policy@200' + '404': + $ref: '#/components/responses/ism.exists_policy@404' + deprecated: true + x-ignorable: true put: operationId: ism.put_policy.0_superseded x-operation-group: ism.put_policy @@ -11604,15 +12058,35 @@ paths: $ref: '#/components/responses/ism.delete_policy@200' deprecated: true x-ignorable: true - /_opendistro/_ism/remove/{index}: + /_opendistro/_ism/remove: post: operationId: ism.remove_policy.0_superseded x-operation-group: ism.remove_policy description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/remove/{index}: + post: + operationId: ism.remove_policy.1_superseded + x-operation-group: ism.remove_policy + description: Removes a policy from an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy parameters: - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/ism.remove_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11623,6 +12097,49 @@ paths: $ref: '#/components/responses/ism.remove_policy@200' deprecated: true x-ignorable: true + /_opendistro/_ism/retry: + post: + operationId: ism.retry_index.0_superseded + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/retry/{index}: + post: + operationId: ism.retry_index.1_superseded + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::path.index' + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + deprecated: true + x-ignorable: true /_opendistro/_knn/stats/{stat}: get: operationId: knn.stats.1_superseded @@ -11775,6 +12292,25 @@ paths: $ref: '#/components/responses/ppl.post_stats@200' deprecated: true x-ignorable: true + /_opendistro/_refresh_search_analyzers/{index}: + post: + operationId: ism.refresh_search_analyzers.0_superseded + x-operation-group: ism.refresh_search_analyzers + description: Refresh search analyzers in real time. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/refresh-analyzer/ + parameters: + - $ref: '#/components/parameters/ism.refresh_search_analyzers::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.refresh_search_analyzers@200' + deprecated: true + x-ignorable: true /_opendistro/_rollup/jobs/{rollupID}: get: operationId: rollups.get.0_superseded @@ -16111,7 +16647,11 @@ components: name: metric description: Limits the information returned to the specified metrics. schema: - $ref: '#/components/schemas/_common:Metrics' + oneOf: + - $ref: '#/components/schemas/cluster.reroute:Metric' + - type: array + items: + $ref: '#/components/schemas/cluster.reroute:Metric' style: form cluster.reroute::query.retry_failed: in: query @@ -16411,10 +16951,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '#/components/schemas/_common:Routing' explode: true create::path.id: in: path @@ -19777,10 +20314,10 @@ components: description: List of shard health statuses used to limit the request. schema: oneOf: - - $ref: '#/components/schemas/indices.shard_stores:ShardStoreStatus' + - $ref: '#/components/schemas/indices.shard_stores:Status' - type: array items: - $ref: '#/components/schemas/indices.shard_stores:ShardStoreStatus' + $ref: '#/components/schemas/indices.shard_stores:Status' style: form indices.shrink::path.index: in: path @@ -20039,7 +20576,11 @@ components: description: Limit the information returned the specific metrics. required: true schema: - $ref: '#/components/schemas/_common:Metrics' + oneOf: + - $ref: '#/components/schemas/indices.stats:Metric' + - type: array + items: + $ref: '#/components/schemas/indices.stats:Metric' style: simple indices.stats::query.completion_fields: in: query @@ -20422,6 +20963,15 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.add_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' ism.change_policy::path.index: name: index in: path @@ -20432,13 +20982,28 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.change_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' ism.delete_policy::path.policy_id: name: policy_id in: path required: true schema: type: string - ism.explain_index::path.index: + ism.exists_policy::path.policy_id: + name: policy_id + in: path + required: true + schema: + type: string + ism.explain_policy::path.index: name: index in: path description: |- @@ -20454,6 +21019,27 @@ components: required: true schema: type: string + ism.put_policies::query.if_primary_term: + name: if_primary_term + in: query + description: Only perform the operation if the document has this primary term. + schema: + type: number + style: form + ism.put_policies::query.if_seq_no: + name: if_seq_no + in: query + description: Only perform the operation if the document has this sequence number. + schema: + $ref: '#/components/schemas/_common:SequenceNumber' + style: form + ism.put_policies::query.policyID: + name: policyID + in: query + required: true + schema: + type: string + style: form ism.put_policy::path.policy_id: name: policy_id in: path @@ -20474,6 +21060,16 @@ components: schema: $ref: '#/components/schemas/_common:SequenceNumber' style: form + ism.refresh_search_analyzers::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple ism.remove_policy::path.index: name: index in: path @@ -20484,6 +21080,34 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.remove_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + ism.retry_index::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple + ism.retry_index::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' knn.delete_model::path.model_id: name: model_id in: path @@ -20700,10 +21324,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '#/components/schemas/_common:Routing' explode: true knn.search_models::query.scroll: name: scroll @@ -20986,6 +21607,18 @@ components: schema: $ref: '#/components/schemas/_common:Fields' style: form + ml.delete_agent::path.agent_id: + name: agent_id + in: path + required: true + schema: + type: string + ml.delete_connector::path.connector_id: + name: connector_id + in: path + required: true + schema: + type: string ml.delete_model_group::path.model_group_id: name: model_group_id in: path @@ -21833,6 +22466,14 @@ components: schema: $ref: '#/components/schemas/_common:Duration' x-version-added: '2.0' + put_script::query.context: + name: context + in: query + description: |- + Context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in this context. + schema: + type: string put_script::query.master_timeout: in: query name: master_timeout @@ -21904,7 +22545,7 @@ components: name: search_type description: Search operation type schema: - type: string + $ref: '#/components/schemas/_common:SearchType' style: form reindex_rethrottle::path.task_id: in: path @@ -24942,11 +25583,25 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:ChangePolicyRequest' + ism.explain_policy: + content: + application/json: + schema: {} + ism.put_policies: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyRequest' ism.put_policy: content: application/json: schema: $ref: '#/components/schemas/ism._common:PutPolicyRequest' + ism.retry_index: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RetryIndexRequest' knn.search_models: content: application/json: @@ -24996,6 +25651,16 @@ components: $ref: '#/components/schemas/_common:Ids' description: Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. required: true + ml.create_connector: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common:CreateConnectorRequest' + ml.register_agents: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common:RegisterAgentsRequest' ml.register_model: content: application/json: @@ -26562,6 +27227,10 @@ components: - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowParsingError' + - $ref: '#/components/schemas/flow_framework.errors:UnsupportedFieldUpdateError' + - $ref: '#/components/schemas/flow_framework.errors:InvalidTemplateVersionError' + - $ref: '#/components/schemas/flow_framework.errors:TemplateNameRequiredError' flow_framework.create@403: content: application/json: @@ -26704,6 +27373,9 @@ components: - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + - $ref: '#/components/schemas/flow_framework.errors:InvalidTemplateVersionError' + - $ref: '#/components/schemas/flow_framework.errors:UnsupportedFieldUpdateError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowParsingError' flow_framework.update@404: description: Template Not Found Error content: @@ -27340,16 +28012,34 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:DeletePolicyResponse' - ism.explain_index@200: + ism.exists_policy@200: + content: + application/json: + schema: {} + ism.exists_policy@404: + content: + application/json: + schema: {} + ism.explain_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:ExplainIndexResponse' + ism.get_policies@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:GetPoliciesResponse' ism.get_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:GetPolicyResponse' + ism.put_policies@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyResponse' ism.put_policy@200: content: application/json: @@ -27360,11 +28050,21 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:PutPolicyResponse' + ism.refresh_search_analyzers@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RefreshSearchAnalyzersResponse' ism.remove_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:RemovePolicyResponse' + ism.retry_index@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RetryIndexResponse' knn.delete_model@200: {} knn.get_model@200: {} knn.search_models@200: {} @@ -27383,6 +28083,24 @@ components: $ref: '#/components/schemas/_core.mget:ResponseItem' required: - docs + ml.create_connector@200: + content: + application/json: + schema: + type: object + properties: + connector_id: + type: string + ml.delete_agent@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:WriteResponseBase' + ml.delete_connector@200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common:WriteResponseBase' ml.delete_model_group@200: content: application/json: @@ -27423,6 +28141,14 @@ components: application/json: schema: $ref: '#/components/schemas/ml._common:Task' + ml.register_agents@200: + content: + application/json: + schema: + type: object + properties: + agent_id: + type: string ml.register_model_group@200: content: application/json: @@ -29727,12 +30453,6 @@ components: _common:Metadata: type: object additionalProperties: true - _common:Metrics: - oneOf: - - type: string - - type: array - items: - type: string _common:MinimumShouldMatch: description: The minimum number of terms that should match as integer, percentage or range. oneOf: @@ -30334,7 +31054,11 @@ components: - bulk - search _common:Routing: - type: string + oneOf: + - type: string + - type: array + items: + type: string _common:RrfRank: allOf: - $ref: '#/components/schemas/_common:RankBase' @@ -44605,6 +45329,18 @@ components: - index - shard - to_node + cluster.reroute:Metric: + type: string + enum: + - _all + - blocks + - cluster_manager_node + - master_node + - metadata + - nodes + - routing_nodes + - routing_table + - version cluster.reroute:RerouteDecision: type: object properties: @@ -45532,6 +46268,8 @@ components: use_case: type: string description: A use case, which can be used with the Search Workflow API to find related workflows. + workflows: + type: object version: $ref: '#/components/schemas/flow_framework.common:version' minProperties: 1 @@ -45832,7 +46570,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use both the 'provision_workflow' and 'update_workflow_fields' parameters in the same request. status: @@ -45870,7 +46608,7 @@ components: application/json: type: object properties: - message: + error: type: string example: This API is disabled. To enable it, set [flow_framework.enabled] to true. status: @@ -45880,7 +46618,7 @@ components: application/json: type: object properties: - message: + error: type: string example: Only the parameters [param1, param2] are permitted unless the provision parameter is set to true. status: @@ -45894,12 +46632,21 @@ components: status: type: integer description: HTTP status code for the error. + flow_framework.errors:InvalidTemplateVersionError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when the template version is invalid or missing. + example: Unable to parse field [version] in a version object. flow_framework.errors:MaxWorkflowsLimitError: content: application/json: type: object properties: - message: + error: type: string example: Maximum workflows limit reached 50 code: @@ -45909,7 +46656,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use the 'reprovision_workflow' parameter to create a new template. status: @@ -45919,7 +46666,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use the 'reprovision_workflow' and 'use_case' parameters in the same request. status: @@ -45944,32 +46691,56 @@ components: type: integer description: HTTP status code for the error. example: 408 + flow_framework.errors:TemplateNameRequiredError: + type: object + properties: + error: + type: string + description: Error message when the template name is missing. flow_framework.errors:TemplateNotFoundError: content: application/json: type: object properties: - message: + error: type: string example: Failed to retrieve template (12345) from global context. code: type: integer + flow_framework.errors:UnsupportedFieldUpdateError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when trying to update an unsupported field in a template. + example: You can not update the field [fieldName] without updating the whole template. flow_framework.errors:WorkFlowIdNullError: content: application/json: type: object properties: - message: + error: type: string example: Workflow ID can not be null status: type: integer + flow_framework.errors:WorkflowParsingError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when workflow parsing fails. + example: Unable to parse field [workflow] in a template object. flow_framework.errors:WorkflowSaveError: content: application/json: type: object properties: - message: + error: type: string example: Failed to save workflow state status: @@ -45979,7 +46750,7 @@ components: application/json: type: object properties: - message: + error: type: string example: Failed to retrieve workflow step json. code: @@ -47623,13 +48394,6 @@ components: required: - reason - type - indices.shard_stores:ShardStoreStatus: - type: string - enum: - - all - - green - - red - - yellow indices.shard_stores:ShardStoreWrapper: type: object properties: @@ -47639,6 +48403,13 @@ components: $ref: '#/components/schemas/indices.shard_stores:ShardStore' required: - stores + indices.shard_stores:Status: + type: string + enum: + - all + - green + - red + - yellow indices.simulate_template:Overlapping: type: object properties: @@ -47749,6 +48520,27 @@ components: - primaries - total - uuid + indices.stats:Metric: + type: string + enum: + - _all + - completion + - docs + - fielddata + - flush + - get + - indexing + - merge + - query_cache + - recovery + - refresh + - request_cache + - search + - segments + - store + - suggest + - translog + - warmer indices.stats:ShardCommit: type: object properties: @@ -49064,6 +49856,8 @@ components: required: - policy_id ism._common:ChangePolicyResponse: + $ref: '#/components/schemas/ism._common:ChangeResponse' + ism._common:ChangeResponse: type: object properties: updated_indices: @@ -49145,10 +49939,17 @@ components: type: string reason: type: string + ism._common:GetPoliciesResponse: + type: object + properties: + total_policies: + type: number + policies: + type: array + items: + $ref: '#/components/schemas/ism._common:PolicyWithMetadata' ism._common:GetPolicyResponse: - allOf: - - $ref: '#/components/schemas/ism._common:Metadata' - - $ref: '#/components/schemas/ism._common:PolicyEnvelope' + $ref: '#/components/schemas/ism._common:PolicyWithMetadata' ism._common:IncludeState: type: object properties: @@ -49212,6 +50013,11 @@ components: properties: policy: $ref: '#/components/schemas/ism._common:Policy' + ism._common:PolicyWithMetadata: + type: object + allOf: + - $ref: '#/components/schemas/ism._common:Metadata' + - $ref: '#/components/schemas/ism._common:PolicyEnvelope' ism._common:PutPolicyRequest: $ref: '#/components/schemas/ism._common:PolicyEnvelope' ism._common:PutPolicyResponse: @@ -49221,8 +50027,35 @@ components: properties: policy: $ref: '#/components/schemas/ism._common:PolicyEnvelope' + ism._common:RefreshSearchAnalyzersResponse: + type: object + properties: + _shards: + $ref: '#/components/schemas/_common:ShardStatistics' + successful_refresh_details: + type: array + items: + $ref: '#/components/schemas/ism._common:RefreshSearchAnalyzersResponseDetails' + ism._common:RefreshSearchAnalyzersResponseDetails: + type: object + properties: + index: + type: string + refreshed_analyzers: + type: array + items: + type: string ism._common:RemovePolicyResponse: $ref: '#/components/schemas/ism._common:ChangePolicyResponse' + ism._common:RetryIndexRequest: + type: object + properties: + state: + type: string + required: + - state + ism._common:RetryIndexResponse: + $ref: '#/components/schemas/ism._common:ChangeResponse' ism._common:SlackCustomWebhook: type: object properties: @@ -49295,6 +50128,85 @@ components: - always - missing - popular + ml._common:Action: + type: object + properties: + action_type: + type: string + method: + type: string + headers: + $ref: '#/components/schemas/ml._common:Headers' + url: + type: string + request_body: + type: string + pre_process_function: + type: string + post_process_function: + type: string + ml._common:ClientConfig: + type: object + properties: + max_connection: + type: integer + connection_timeout: + type: integer + read_timeout: + type: integer + retry_backoff_policy: + type: string + max_retry_times: + type: integer + retry_backoff_millis: + type: integer + retry_timeout_seconds: + type: integer + ml._common:CreateConnectorRequest: + type: object + properties: + name: + type: string + description: + type: string + version: + type: integer + protocol: + type: string + credential: + $ref: '#/components/schemas/ml._common:Credential' + parameters: + $ref: '#/components/schemas/ml._common:Parameters' + client_config: + $ref: '#/components/schemas/ml._common:ClientConfig' + actions: + type: array + items: + $ref: '#/components/schemas/ml._common:Action' + required: + - actions + - credential + - description + - name + - parameters + - protocol + - version + ml._common:Credential: + type: object + properties: + access_key: + type: string + secret_key: + type: string + session_token: + type: string + additionalProperties: true + ml._common:Headers: + type: object + properties: + content_type: + type: string + additionalProperties: true ml._common:HitsTotal: type: object properties: @@ -49307,6 +50219,18 @@ components: required: - relation - value + ml._common:LLM: + type: object + properties: + model_id: + type: string + parameters: + $ref: '#/components/schemas/ml._common:Parameters' + ml._common:Memory: + type: object + properties: + type: + type: string ml._common:ModelGroup: type: object properties: @@ -49345,6 +50269,33 @@ components: required: - model_group_id - status + ml._common:Parameters: + type: object + additionalProperties: true + ml._common:RegisterAgentsRequest: + type: object + properties: + name: + type: string + type: + type: string + description: + type: string + tools: + type: array + items: + $ref: '#/components/schemas/ml._common:ToolItems' + parameters: + $ref: '#/components/schemas/ml._common:Parameters' + app_type: + type: string + memory: + $ref: '#/components/schemas/ml._common:Memory' + llm: + $ref: '#/components/schemas/ml._common:LLM' + required: + - name + - type ml._common:SearchModelsHits: type: object properties: @@ -49431,6 +50382,16 @@ components: type: string required: - state + ml._common:ToolItems: + type: object + properties: + name: + type: string + type: + type: string + parameters: + $ref: '#/components/schemas/ml._common:Parameters' + additionalProperties: true ml._common:UndeployModelNode: type: object properties: From 888121822d2fe05159aa03a1708dec2f40b15bff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:21:11 -0400 Subject: [PATCH 33/37] Bump org.apache.httpcomponents.client5:httpclient5 from 5.3.1 to 5.4 (#1204) * Bump org.apache.httpcomponents.client5:httpclient5 from 5.3.1 to 5.4 Bumps [org.apache.httpcomponents.client5:httpclient5](https://github.com/apache/httpcomponents-client) from 5.3.1 to 5.4. - [Changelog](https://github.com/apache/httpcomponents-client/blob/master/RELEASE_NOTES.txt) - [Commits](https://github.com/apache/httpcomponents-client/compare/rel/v5.3.1...rel/v5.4) --- updated-dependencies: - dependency-name: org.apache.httpcomponents.client5:httpclient5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 3 ++- java-client/build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c56882829..f7d4791ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `com.github.jk1.dependency-license-report` from 2.8 to 2.9 - Bumps `org.apache.httpcomponents.core5:httpcore5-h2` from 5.2.5 to 5.3 - Bumps `org.apache.httpcomponents.core5:httpcore5` from 5.2.5 to 5.3 +- Bumps `org.apache.httpcomponents.client5:httpclient5` from 5.3.1 to 5.4 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. @@ -551,4 +552,4 @@ This section is for maintaining a changelog for all breaking changes for the cli [2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0 [2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0 [2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0 -[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 +[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 \ No newline at end of file diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 4ba04ae056..0ef813ccaa 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -186,7 +186,7 @@ dependencies { } testImplementation("org.opensearch.client", "opensearch-rest-client", opensearchVersion) - api("org.apache.httpcomponents.client5:httpclient5:5.3.1") { + api("org.apache.httpcomponents.client5:httpclient5:5.4") { exclude(group = "org.apache.httpcomponents.core5") } api("org.apache.httpcomponents.core5:httpcore5:5.3") From 6a5a8ccfeffe74a0fc003738bd5900a633301df2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:34:18 -0400 Subject: [PATCH 34/37] Bump io.github.classgraph:classgraph from 4.8.175 to 4.8.176 in /java-client (#1203) * Bump io.github.classgraph:classgraph in /java-client Bumps [io.github.classgraph:classgraph](https://github.com/classgraph/classgraph) from 4.8.175 to 4.8.176. - [Release notes](https://github.com/classgraph/classgraph/releases) - [Commits](https://github.com/classgraph/classgraph/compare/classgraph-4.8.175...classgraph-4.8.176) --- updated-dependencies: - dependency-name: io.github.classgraph:classgraph dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 1 + java-client/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d4791ffe..6df6b2e903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.apache.httpcomponents.core5:httpcore5-h2` from 5.2.5 to 5.3 - Bumps `org.apache.httpcomponents.core5:httpcore5` from 5.2.5 to 5.3 - Bumps `org.apache.httpcomponents.client5:httpclient5` from 5.3.1 to 5.4 +- Bumps `io.github.classgraph:classgraph` from 4.8.175 to 4.8.176 This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section. diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 0ef813ccaa..7cc5ab0f01 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -230,7 +230,7 @@ dependencies { implementation("org.eclipse", "yasson", "2.0.2") // https://github.com/classgraph/classgraph - testImplementation("io.github.classgraph:classgraph:4.8.175") + testImplementation("io.github.classgraph:classgraph:4.8.176") // Eclipse 1.0 testImplementation("junit", "junit" , "4.13.2") { From 851ab58e17ca53b8486e9b485e35533179675095 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 25 Sep 2024 03:55:22 +1200 Subject: [PATCH 35/37] Begin generating snapshot namespace (#1207) * Generate snapshot.verify_snapshot Signed-off-by: Thomas Farr * Generate snapshot.cleanup_snapshot Signed-off-by: Thomas Farr * Generate snapshot.clone Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- UPGRADING.md | 11 +- .../opensearch/OpenSearchAsyncClientBase.java | 5 + .../opensearch/OpenSearchClientBase.java | 5 + .../snapshot/CleanupRepositoryRequest.java | 160 +++++++-------- .../snapshot/CleanupRepositoryResponse.java | 23 +-- .../snapshot/CloneSnapshotRequest.java | 191 +++++++----------- .../snapshot/CloneSnapshotResponse.java | 16 +- .../OpenSearchSnapshotAsyncClientBase.java | 122 +++++++++++ .../OpenSearchSnapshotClientBase.java | 118 +++++++++++ .../snapshot/VerifyRepositoryRequest.java | 149 +++++++------- .../snapshot/VerifyRepositoryResponse.java | 47 ++--- .../CleanupRepositoryResults.java | 42 ++-- .../verify_repository/CompactNodeInfo.java | 21 +- .../OpenSearchSnapshotAsyncClient.java | 107 +--------- .../snapshot/OpenSearchSnapshotClient.java | 104 +--------- java-codegen/opensearch-openapi.yaml | 6 +- .../client/codegen/CodeGenerator.java | 1 + .../client/codegen/model/Namespace.java | 2 +- .../client/codegen/model/RequestShape.java | 2 + 19 files changed, 565 insertions(+), 567 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java (75%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java (88%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java (79%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java (87%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java (82%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java (81%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java (89%) diff --git a/UPGRADING.md b/UPGRADING.md index e59cba1254..4556772bea 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -42,4 +42,13 @@ After: - The `tasks` field is now a `TaskInfos` union type instead of a `Map` to correctly handle `groupBy` parents or none. ### GetTasksResponse response type -- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`. \ No newline at end of file +- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`. + +### VerifyRepositoryRequest property naming +- The `name` field, getter and builder method have been renamed to `repository`. + +### CleanupRepositoryRequest property naming +- The `name` field, getter and builder method have been renamed to `repository`. + +### CloneSnapshotRequest timeout removal +- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index cc9296ed41..cbe9d63a80 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -46,6 +46,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; +import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -69,6 +70,10 @@ public OpenSearchMlAsyncClient ml() { return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); } + public OpenSearchSnapshotAsyncClient snapshot() { + return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions); + } + public OpenSearchTasksAsyncClient tasks() { return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index 7e09f00916..36f4a912b6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -45,6 +45,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.opensearch.ml.OpenSearchMlClient; +import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -68,6 +69,10 @@ public OpenSearchMlClient ml() { return new OpenSearchMlClient(this.transport, this.transportOptions); } + public OpenSearchSnapshotClient snapshot() { + return new OpenSearchSnapshotClient(this.transport, this.transportOptions); + } + public OpenSearchTasksClient tasks() { return new OpenSearchTasksClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java index 1d262d386a..3c30cc3dd5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -49,18 +54,18 @@ /** * Removes stale data from repository. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryRequest extends RequestBase { - @Deprecated - @Nullable - private final Time masterTimeout; @Nullable private final Time clusterManagerTimeout; - private final String name; + @Deprecated + @Nullable + private final Time masterTimeout; + + private final String repository; @Nullable private final Time timeout; @@ -68,52 +73,54 @@ public class CleanupRepositoryRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private CleanupRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.masterTimeout = builder.masterTimeout; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.timeout = builder.timeout; - } - public static CleanupRepositoryRequest of(Function> fn) { + public static CleanupRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to cluster-manager node + * Period to wait for a connection to the master node. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** - * Required - A repository name + * Required - Snapshot repository to clean up. *

* API name: {@code repository} + *

*/ - public final String name() { - return this.name; + public final String repository() { + return this.repository; } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -125,74 +132,75 @@ public final Time timeout() { /** * Builder for {@link CleanupRepositoryRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - @Nullable private Time clusterManagerTimeout; - - private String name; - + @Nullable + private Time masterTimeout; + private String repository; @Nullable private Time timeout; /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to cluster-manager node + * Period to wait for a connection to the master node. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to cluster-manager node + * Period to wait for a connection to the master node. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - A repository name + * Required - Snapshot repository to clean up. *

* API name: {@code repository} + *

*/ - public final Builder name(String value) { - this.name = value; + public final Builder repository(String value) { + this.repository = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -200,19 +208,19 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link CleanupRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryRequest build() { _checkSingleUse(); @@ -227,47 +235,29 @@ public CleanupRepositoryRequest build() { * Endpoint "{@code snapshot.cleanup_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_cleanup"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/_cleanup"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java similarity index 88% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java index 40ed5d13b7..30dacbf36d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -48,18 +53,18 @@ // typedef: snapshot.cleanup_repository.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryResponse implements PlainJsonSerializable { + private final CleanupRepositoryResults results; // --------------------------------------------------------------------------------------------- private CleanupRepositoryResponse(Builder builder) { - this.results = ApiTypeHelper.requireNonNull(builder.results, this, "results"); - } - public static CleanupRepositoryResponse of(Function> fn) { + public static CleanupRepositoryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -73,6 +78,7 @@ public final CleanupRepositoryResults results() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,10 +86,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("results"); this.results.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -91,7 +95,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CleanupRepositoryResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private CleanupRepositoryResults results; @@ -107,14 +110,13 @@ public final Builder results(CleanupRepositoryResults value) { * Required - API name: {@code results} */ public final Builder results(Function> fn) { - return this.results(fn.apply(new CleanupRepositoryResults.Builder()).build()); + return results(fn.apply(new CleanupRepositoryResults.Builder()).build()); } /** * Builds a {@link CleanupRepositoryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryResponse build() { _checkSingleUse(); @@ -134,9 +136,6 @@ public CleanupRepositoryResponse build() { ); protected static void setupCleanupRepositoryResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::results, CleanupRepositoryResults._DESERIALIZER, "results"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java index b6e03de864..464881269c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java @@ -30,12 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -55,47 +60,53 @@ // typedef: snapshot.clone.Request /** - * Clones indices from one snapshot into another snapshot in the same - * repository. + * Clones indices from one snapshot into another snapshot in the same repository. */ @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CloneSnapshotRequest extends RequestBase implements PlainJsonSerializable { + + @Nullable + private final Time clusterManagerTimeout; + private final String indices; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - private final String repository; private final String snapshot; private final String targetSnapshot; - @Nullable - private final Time timeout; - // --------------------------------------------------------------------------------------------- private CloneSnapshotRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); this.targetSnapshot = ApiTypeHelper.requireNonNull(builder.targetSnapshot, this, "targetSnapshot"); - this.timeout = builder.timeout; - } - public static CloneSnapshotRequest of(Function> fn) { + public static CloneSnapshotRequest of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * Required - API name: {@code indices} */ @@ -107,26 +118,19 @@ public final String indices() { * Explicit operation timeout for connection to master node *

* API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable public final Time masterTimeout() { return this.masterTimeout; } - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Required - A repository name *

* API name: {@code repository} + *

*/ public final String repository() { return this.repository; @@ -136,6 +140,7 @@ public final String repository() { * Required - The name of the snapshot to clone from *

* API name: {@code snapshot} + *

*/ public final String snapshot() { return this.snapshot; @@ -145,22 +150,16 @@ public final String snapshot() { * Required - The name of the cloned snapshot to create *

* API name: {@code target_snapshot} + *

*/ public final String targetSnapshot() { return this.targetSnapshot; } - /** - * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -168,36 +167,44 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("indices"); generator.write(this.indices); - } - // --------------------------------------------------------------------------------------------- /** * Builder for {@link CloneSnapshotRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Time clusterManagerTimeout; private String indices; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - private String repository; - private String snapshot; - private String targetSnapshot; - @Nullable - private Time timeout; + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } /** * Required - API name: {@code indices} @@ -211,6 +218,7 @@ public final Builder indices(String value) { * Explicit operation timeout for connection to master node *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(@Nullable Time value) { @@ -222,35 +230,18 @@ public final Builder masterTimeout(@Nullable Time value) { * Explicit operation timeout for connection to master node *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ public final Builder repository(String value) { this.repository = value; @@ -261,6 +252,7 @@ public final Builder repository(String value) { * Required - The name of the snapshot to clone from *

* API name: {@code snapshot} + *

*/ public final Builder snapshot(String value) { this.snapshot = value; @@ -271,32 +263,17 @@ public final Builder snapshot(String value) { * Required - The name of the cloned snapshot to create *

* API name: {@code target_snapshot} + *

*/ public final Builder targetSnapshot(String value) { this.targetSnapshot = value; return this; } - /** - * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - /** * Builds a {@link CloneSnapshotRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CloneSnapshotRequest build() { _checkSingleUse(); @@ -316,9 +293,7 @@ public CloneSnapshotRequest build() { ); protected static void setupCloneSnapshotRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::indices, JsonpDeserializer.stringDeserializer(), "indices"); - } // --------------------------------------------------------------------------------------------- @@ -327,55 +302,29 @@ protected static void setupCloneSnapshotRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _targetSnapshot = 1 << 0; - final int _repository = 1 << 1; - final int _snapshot = 1 << 2; - - int propsSet = 0; - - propsSet |= _targetSnapshot; - propsSet |= _repository; - propsSet |= _snapshot; - - if (propsSet == (_repository | _snapshot | _targetSnapshot)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.repository, buf); - buf.append("/"); - SimpleEndpoint.pathEncode(request.snapshot, buf); - buf.append("/_clone"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.targetSnapshot, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.snapshot, buf); + buf.append("/_clone/"); + SimpleEndpoint.pathEncode(request.targetSnapshot, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java similarity index 87% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java index b41d071c45..237dc0fe9c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java @@ -30,9 +30,14 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +48,16 @@ // typedef: snapshot.clone.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CloneSnapshotResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- private CloneSnapshotResponse(Builder builder) { super(builder); - } - public static CloneSnapshotResponse of(Function> fn) { + public static CloneSnapshotResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,7 +66,6 @@ public static CloneSnapshotResponse of(Function implements ObjectBuilder { @Override protected Builder self() { @@ -70,8 +75,7 @@ protected Builder self() { /** * Builds a {@link CloneSnapshotResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CloneSnapshotResponse build() { _checkSingleUse(); @@ -92,7 +96,5 @@ public CloneSnapshotResponse build() { protected static void setupCloneSnapshotResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java new file mode 100644 index 0000000000..5ee841e825 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java @@ -0,0 +1,122 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.snapshot; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the snapshot namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class OpenSearchSnapshotAsyncClientBase> extends ApiClient< + OpenSearchTransport, + Self> { + public OpenSearchSnapshotAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + // ----- Endpoint: snapshot.cleanup_repository + + /** + * Removes stale data from repository. + */ + public CompletableFuture cleanupRepository(CleanupRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CleanupRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Removes stale data from repository. + * + * @param fn a function that initializes a builder to create the {@link CleanupRepositoryRequest} + */ + public final CompletableFuture cleanupRepository( + Function> fn + ) throws IOException, OpenSearchException { + return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.clone + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + */ + public CompletableFuture clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CloneSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + * + * @param fn a function that initializes a builder to create the {@link CloneSnapshotRequest} + */ + public final CompletableFuture clone( + Function> fn + ) throws IOException, OpenSearchException { + return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.verify_repository + + /** + * Verifies a repository. + */ + public CompletableFuture verifyRepository(VerifyRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, VerifyRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Verifies a repository. + * + * @param fn a function that initializes a builder to create the {@link VerifyRepositoryRequest} + */ + public final CompletableFuture verifyRepository( + Function> fn + ) throws IOException, OpenSearchException { + return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java new file mode 100644 index 0000000000..27a5c47915 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java @@ -0,0 +1,118 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.snapshot; + +import java.io.IOException; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the snapshot namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class OpenSearchSnapshotClientBase> extends ApiClient< + OpenSearchTransport, + Self> { + public OpenSearchSnapshotClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + // ----- Endpoint: snapshot.cleanup_repository + + /** + * Removes stale data from repository. + */ + public CleanupRepositoryResponse cleanupRepository(CleanupRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CleanupRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Removes stale data from repository. + * + * @param fn a function that initializes a builder to create the {@link CleanupRepositoryRequest} + */ + public final CleanupRepositoryResponse cleanupRepository( + Function> fn + ) throws IOException, OpenSearchException { + return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.clone + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + */ + public CloneSnapshotResponse clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CloneSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + * + * @param fn a function that initializes a builder to create the {@link CloneSnapshotRequest} + */ + public final CloneSnapshotResponse clone(Function> fn) + throws IOException, OpenSearchException { + return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.verify_repository + + /** + * Verifies a repository. + */ + public VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, VerifyRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Verifies a repository. + * + * @param fn a function that initializes a builder to create the {@link VerifyRepositoryRequest} + */ + public final VerifyRepositoryResponse verifyRepository( + Function> fn + ) throws IOException, OpenSearchException { + return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java index 5df9766364..6d7efc4332 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -50,16 +55,17 @@ /** * Verifies a repository. */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class VerifyRepositoryRequest extends RequestBase { - @Deprecated - @Nullable - private final Time masterTimeout; @Nullable private final Time clusterManagerTimeout; - private final String name; + @Deprecated + @Nullable + private final Time masterTimeout; + + private final String repository; @Nullable private final Time timeout; @@ -67,52 +73,54 @@ public class VerifyRepositoryRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private VerifyRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.masterTimeout = builder.masterTimeout; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.timeout = builder.timeout; - } - public static VerifyRepositoryRequest of(Function> fn) { + public static VerifyRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to cluster-manager node + * Explicit operation timeout for connection to master node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * Required - A repository name *

* API name: {@code repository} + *

*/ - public final String name() { - return this.name; + public final String repository() { + return this.repository; } /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -124,67 +132,67 @@ public final Time timeout() { /** * Builder for {@link VerifyRepositoryRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - @Nullable private Time clusterManagerTimeout; - - private String name; - + @Nullable + private Time masterTimeout; + private String repository; @Nullable private Time timeout; /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to cluster-manager node + * Explicit operation timeout for connection to master node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to cluster-manager node + * Explicit operation timeout for connection to master node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ - public final Builder name(String value) { - this.name = value; + public final Builder repository(String value) { + this.repository = value; return this; } @@ -192,6 +200,7 @@ public final Builder name(String value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -202,16 +211,16 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link VerifyRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public VerifyRepositoryRequest build() { _checkSingleUse(); @@ -226,47 +235,29 @@ public VerifyRepositoryRequest build() { * Endpoint "{@code snapshot.verify_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_verify"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/_verify"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java index 4efe8e604e..5a40b49c69 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -49,18 +54,18 @@ // typedef: snapshot.verify_repository.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class VerifyRepositoryResponse implements PlainJsonSerializable { + private final Map nodes; // --------------------------------------------------------------------------------------------- private VerifyRepositoryResponse(Builder builder) { - this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); - } - public static VerifyRepositoryResponse of(Function> fn) { + public static VerifyRepositoryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -74,6 +79,7 @@ public final Map nodes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,19 +87,13 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.nodes)) { - generator.writeKey("nodes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.nodes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- @@ -101,14 +101,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link VerifyRepositoryResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Map nodes; /** * Required - API name: {@code nodes} + * *

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

*/ public final Builder nodes(Map map) { this.nodes = _mapPutAll(this.nodes, map); @@ -117,8 +118,10 @@ public final Builder nodes(Map map) { /** * Required - API name: {@code nodes} + * *

* Adds an entry to nodes. + *

*/ public final Builder nodes(String key, CompactNodeInfo value) { this.nodes = _mapPut(this.nodes, key, value); @@ -127,8 +130,10 @@ public final Builder nodes(String key, CompactNodeInfo value) { /** * Required - API name: {@code nodes} + * *

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

*/ public final Builder nodes(String key, Function> fn) { return nodes(key, fn.apply(new CompactNodeInfo.Builder()).build()); @@ -137,8 +142,7 @@ public final Builder nodes(String key, Function op) { - op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(CompactNodeInfo._DESERIALIZER), "nodes"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java index 8b674ec955..4fb8fb8b92 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot.cleanup_repository; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,7 +52,9 @@ // typedef: snapshot.cleanup_repository.CleanupRepositoryResults @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryResults implements PlainJsonSerializable { + private final long deletedBlobs; private final long deletedBytes; @@ -55,25 +62,29 @@ public class CleanupRepositoryResults implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private CleanupRepositoryResults(Builder builder) { - this.deletedBlobs = ApiTypeHelper.requireNonNull(builder.deletedBlobs, this, "deletedBlobs"); this.deletedBytes = ApiTypeHelper.requireNonNull(builder.deletedBytes, this, "deletedBytes"); - } - public static CleanupRepositoryResults of(Function> fn) { + public static CleanupRepositoryResults of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code deleted_blobs} + * Required - Number of binary large objects (blobs) removed during cleanup. + *

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

*/ public final long deletedBlobs() { return this.deletedBlobs; } /** - * Required - API name: {@code deleted_bytes} + * Required - Number of bytes freed by cleanup operations. + *

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

*/ public final long deletedBytes() { return this.deletedBytes; @@ -82,6 +93,7 @@ public final long deletedBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,13 +101,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("deleted_blobs"); generator.write(this.deletedBlobs); generator.writeKey("deleted_bytes"); generator.write(this.deletedBytes); - } // --------------------------------------------------------------------------------------------- @@ -103,14 +113,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CleanupRepositoryResults}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Long deletedBlobs; - private Long deletedBytes; /** - * Required - API name: {@code deleted_blobs} + * Required - Number of binary large objects (blobs) removed during cleanup. + *

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

*/ public final Builder deletedBlobs(long value) { this.deletedBlobs = value; @@ -118,7 +129,10 @@ public final Builder deletedBlobs(long value) { } /** - * Required - API name: {@code deleted_bytes} + * Required - Number of bytes freed by cleanup operations. + *

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

*/ public final Builder deletedBytes(long value) { this.deletedBytes = value; @@ -128,8 +142,7 @@ public final Builder deletedBytes(long value) { /** * Builds a {@link CleanupRepositoryResults}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryResults build() { _checkSingleUse(); @@ -149,10 +162,7 @@ public CleanupRepositoryResults build() { ); protected static void setupCleanupRepositoryResultsDeserializer(ObjectDeserializer op) { - op.add(Builder::deletedBlobs, JsonpDeserializer.longDeserializer(), "deleted_blobs"); op.add(Builder::deletedBytes, JsonpDeserializer.longDeserializer(), "deleted_bytes"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java similarity index 89% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java index 1ee49f758e..8d9bad177a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot.verify_repository; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,18 +52,18 @@ // typedef: snapshot.verify_repository.CompactNodeInfo @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CompactNodeInfo implements PlainJsonSerializable { + private final String name; // --------------------------------------------------------------------------------------------- private CompactNodeInfo(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - } - public static CompactNodeInfo of(Function> fn) { + public static CompactNodeInfo of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -72,6 +77,7 @@ public final String name() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,10 +85,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("name"); generator.write(this.name); - } // --------------------------------------------------------------------------------------------- @@ -90,7 +94,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CompactNodeInfo}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String name; @@ -105,8 +108,7 @@ public final Builder name(String value) { /** * Builds a {@link CompactNodeInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CompactNodeInfo build() { _checkSingleUse(); @@ -126,9 +128,6 @@ public CompactNodeInfo build() { ); protected static void setupCompactNodeInfoDeserializer(ObjectDeserializer op) { - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index 002845d767..6e7e3997c9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -36,7 +36,6 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.transport.JsonEndpoint; @@ -47,7 +46,7 @@ /** * Client for the snapshot namespace. */ -public class OpenSearchSnapshotAsyncClient extends ApiClient { +public class OpenSearchSnapshotAsyncClient extends OpenSearchSnapshotAsyncClientBase { public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport) { super(transport, null); @@ -62,75 +61,6 @@ public OpenSearchSnapshotAsyncClient withTransportOptions(@Nullable TransportOpt return new OpenSearchSnapshotAsyncClient(this.transport, transportOptions); } - // ----- Endpoint: snapshot.cleanup_repository - - /** - * Removes stale data from repository. - * - * - */ - - public CompletableFuture cleanupRepository(CleanupRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CleanupRepositoryRequest, - CleanupRepositoryResponse, - ErrorResponse>) CleanupRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Removes stale data from repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CleanupRepositoryRequest} - * - */ - - public final CompletableFuture cleanupRepository( - Function> fn - ) throws IOException, OpenSearchException { - return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.clone - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * - */ - - public CompletableFuture clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneSnapshotRequest, - CloneSnapshotResponse, - ErrorResponse>) CloneSnapshotRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneSnapshotRequest} - * - */ - - public final CompletableFuture clone( - Function> fn - ) throws IOException, OpenSearchException { - return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.create /** @@ -422,39 +352,4 @@ public CompletableFuture status() throws IOException, Op this.transportOptions ); } - - // ----- Endpoint: snapshot.verify_repository - - /** - * Verifies a repository. - * - * - */ - - public CompletableFuture verifyRepository(VerifyRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - VerifyRepositoryRequest, - VerifyRepositoryResponse, - ErrorResponse>) VerifyRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Verifies a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link VerifyRepositoryRequest} - * - */ - - public final CompletableFuture verifyRepository( - Function> fn - ) throws IOException, OpenSearchException { - return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index be2081adeb..29103dd89f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -35,7 +35,6 @@ import java.io.IOException; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.transport.JsonEndpoint; @@ -46,7 +45,7 @@ /** * Client for the snapshot namespace. */ -public class OpenSearchSnapshotClient extends ApiClient { +public class OpenSearchSnapshotClient extends OpenSearchSnapshotClientBase { public OpenSearchSnapshotClient(OpenSearchTransport transport) { super(transport, null); @@ -61,73 +60,6 @@ public OpenSearchSnapshotClient withTransportOptions(@Nullable TransportOptions return new OpenSearchSnapshotClient(this.transport, transportOptions); } - // ----- Endpoint: snapshot.cleanup_repository - - /** - * Removes stale data from repository. - * - * - */ - - public CleanupRepositoryResponse cleanupRepository(CleanupRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CleanupRepositoryRequest, - CleanupRepositoryResponse, - ErrorResponse>) CleanupRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Removes stale data from repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CleanupRepositoryRequest} - * - */ - - public final CleanupRepositoryResponse cleanupRepository( - Function> fn - ) throws IOException, OpenSearchException { - return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.clone - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * - */ - - public CloneSnapshotResponse clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneSnapshotRequest, - CloneSnapshotResponse, - ErrorResponse>) CloneSnapshotRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneSnapshotRequest} - * - */ - - public final CloneSnapshotResponse clone(Function> fn) - throws IOException, OpenSearchException { - return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.create /** @@ -413,38 +345,4 @@ public SnapshotStatusResponse status() throws IOException, OpenSearchException { this.transportOptions ); } - - // ----- Endpoint: snapshot.verify_repository - - /** - * Verifies a repository. - * - * - */ - - public VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - VerifyRepositoryRequest, - VerifyRepositoryResponse, - ErrorResponse>) VerifyRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Verifies a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link VerifyRepositoryRequest} - * - */ - - public final VerifyRepositoryResponse verifyRepository( - Function> fn - ) throws IOException, OpenSearchException { - return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); - } - } diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index e9e4e42740..d0a8b5d22a 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -54849,10 +54849,12 @@ components: properties: deleted_blobs: description: Number of binary large objects (blobs) removed during cleanup. - type: number + type: integer + format: int64 deleted_bytes: description: Number of bytes freed by cleanup operations. - type: number + type: integer + format: int64 required: - deleted_blobs - deleted_bytes diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index b1eaa8d06b..70d12db927 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -44,6 +44,7 @@ public class CodeGenerator { and(namespace(""), named("info")), namespace("dangling_indices"), and(namespace("ml"), not(named("search_models"))), // TODO: search_models is complex and ideally should re-use the search structures + and(namespace("snapshot"), named("cleanup_repository", "clone", "verify_repository")), and(namespace("tasks")) ); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index e0e3861bcc..7c2f4ebd88 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -23,7 +23,7 @@ import org.opensearch.client.codegen.utils.Strings; public class Namespace { - private static final Set PARTIAL_NAMESPACES = Set.of(""); + private static final Set PARTIAL_NAMESPACES = Set.of("", "snapshot"); private final Namespace parent; private final String name; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 18facfd53e..b0d93dcea8 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -169,6 +169,8 @@ private static String responseClassName(@Nonnull OperationGroup operationGroup) private static String classBaseName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); switch (operationGroup.toString()) { + case "snapshot.clone": + return "CloneSnapshot"; case "tasks.get": return "GetTasks"; default: From 96be238fdef8875ab930a9bb2f70edf122374e69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 07:46:30 -0400 Subject: [PATCH 36/37] Bump org.junit:junit-bom from 5.11.0 to 5.11.1 (#1211) * Bump org.junit:junit-bom from 5.11.0 to 5.11.1 Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.11.0 to 5.11.1. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.0...r5.11.1) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update changelog Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] --- CHANGELOG.md | 2 +- java-codegen/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df6b2e903..df2cea576f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 3.0] ### Dependencies -- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.0 +- Bumps `org.junit:junit-bom` from 5.10.2 to 5.11.1 - Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3 - Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7 - Bumps `org.hamcrest:hamcrest` from 2.2 to 3.0 diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index e7d138b968..7049c7df98 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -172,7 +172,7 @@ dependencies { implementation("org.semver4j", "semver4j", "5.3.0") // EPL-2.0 - testImplementation(platform("org.junit:junit-bom:5.11.0")) + testImplementation(platform("org.junit:junit-bom:5.11.1")) testImplementation("org.junit.jupiter", "junit-jupiter") testRuntimeOnly("org.junit.platform", "junit-platform-launcher") } From 18a84604c74c945c2a08e1228b89b04d64d0db5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Vil=C3=A1?= Date: Mon, 30 Sep 2024 23:03:33 +0100 Subject: [PATCH 37/37] Generate hashCode and equals (#1201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Generate hashCode and equals , wip Signed-off-by: miguel-vila * add changelog entry Signed-off-by: miguel-vila * remove change Signed-off-by: miguel-vila * take into account primitives Signed-off-by: miguel-vila * refactor and format Signed-off-by: miguel-vila * use Object.equals Co-authored-by: Thomas Farr Signed-off-by: Miguel Vilá * use `&&` chain Signed-off-by: miguel-vila * adjust last line Signed-off-by: miguel-vila * use fqn Signed-off-by: miguel-vila * use fqn for Objects.hashCode, take into account parent Signed-off-by: miguel-vila * remove unused var definition Signed-off-by: miguel-vila * codegen equals/hashCode for request shapes Signed-off-by: miguel-vila * add hashCode/equals to TaggedUnion Signed-off-by: miguel-vila * use import Signed-off-by: miguel-vila * fix equals for request shapes Signed-off-by: miguel-vila * codegen latest from main Signed-off-by: miguel-vila --------- Signed-off-by: miguel-vila Signed-off-by: Miguel Vilá Co-authored-by: Thomas Farr --- CHANGELOG.md | 1 + .../_types/AcknowledgedResponseBase.java | 13 +++++ .../client/opensearch/_types/BaseNode.java | 24 +++++++++ .../_types/BulkByScrollFailure.java | 26 ++++++++++ .../_types/BulkByScrollTaskStatus.java | 44 ++++++++++++++++ .../BulkByScrollTaskStatusOrException.java | 15 ++++++ .../client/opensearch/_types/ErrorCause.java | 26 ++++++++++ .../opensearch/_types/NodeStatistics.java | 20 ++++++++ .../_types/OpenSearchVersionInfo.java | 32 ++++++++++++ .../client/opensearch/_types/Retries.java | 14 ++++++ .../opensearch/_types/ShardFailure.java | 22 ++++++++ .../opensearch/_types/ShardStatistics.java | 22 ++++++++ .../client/opensearch/_types/TaskFailure.java | 20 ++++++++ .../opensearch/_types/WriteResponseBase.java | 28 +++++++++++ .../client/opensearch/core/InfoRequest.java | 11 ++++ .../client/opensearch/core/InfoResponse.java | 22 ++++++++ .../DeleteDanglingIndexRequest.java | 22 ++++++++ .../DeleteDanglingIndexResponse.java | 14 ++++++ .../ImportDanglingIndexRequest.java | 22 ++++++++ .../ImportDanglingIndexResponse.java | 14 ++++++ .../ListDanglingIndicesRequest.java | 11 ++++ .../ListDanglingIndicesResponse.java | 18 +++++++ .../list_dangling_indices/DanglingIndex.java | 22 ++++++++ .../client/opensearch/ml/Action.java | 26 ++++++++++ .../client/opensearch/ml/ClientConfig.java | 26 ++++++++++ .../opensearch/ml/CreateConnectorRequest.java | 28 +++++++++++ .../ml/CreateConnectorResponse.java | 14 ++++++ .../client/opensearch/ml/Credential.java | 20 ++++++++ .../opensearch/ml/DeleteAgentRequest.java | 14 ++++++ .../opensearch/ml/DeleteAgentResponse.java | 14 ++++++ .../opensearch/ml/DeleteConnectorRequest.java | 14 ++++++ .../ml/DeleteConnectorResponse.java | 14 ++++++ .../ml/DeleteModelGroupRequest.java | 14 ++++++ .../ml/DeleteModelGroupResponse.java | 14 ++++++ .../opensearch/ml/DeleteModelRequest.java | 14 ++++++ .../opensearch/ml/DeleteModelResponse.java | 14 ++++++ .../opensearch/ml/DeleteTaskRequest.java | 14 ++++++ .../opensearch/ml/DeleteTaskResponse.java | 14 ++++++ .../opensearch/ml/DeployModelRequest.java | 14 ++++++ .../opensearch/ml/DeployModelResponse.java | 18 +++++++ .../opensearch/ml/GetModelGroupRequest.java | 14 ++++++ .../opensearch/ml/GetModelGroupResponse.java | 24 +++++++++ .../client/opensearch/ml/GetTaskRequest.java | 14 ++++++ .../client/opensearch/ml/GetTaskResponse.java | 32 ++++++++++++ .../client/opensearch/ml/Headers.java | 15 ++++++ .../opensearch/client/opensearch/ml/LLM.java | 15 ++++++ .../client/opensearch/ml/Memory.java | 14 ++++++ .../opensearch/ml/RegisterAgentsRequest.java | 28 +++++++++++ .../opensearch/ml/RegisterAgentsResponse.java | 14 ++++++ .../ml/RegisterModelGroupRequest.java | 22 ++++++++ .../ml/RegisterModelGroupResponse.java | 15 ++++++ .../opensearch/ml/RegisterModelRequest.java | 22 ++++++++ .../opensearch/ml/RegisterModelResponse.java | 15 ++++++ .../client/opensearch/ml/ToolItems.java | 20 ++++++++ .../opensearch/ml/UndeployModelNode.java | 14 ++++++ .../opensearch/ml/UndeployModelRequest.java | 14 ++++++ .../opensearch/ml/UndeployModelResponse.java | 14 ++++++ .../opensearch/tasks/CancelRequest.java | 22 ++++++++ .../opensearch/tasks/CancelResponse.java | 14 ++++++ .../opensearch/tasks/GetTasksRequest.java | 18 +++++++ .../opensearch/tasks/GetTasksResponse.java | 20 ++++++++ .../client/opensearch/tasks/ListRequest.java | 26 ++++++++++ .../client/opensearch/tasks/ListResponse.java | 14 ++++++ .../client/opensearch/tasks/Status.java | 50 +++++++++++++++++++ .../opensearch/tasks/TaskExecutingNode.java | 17 +++++++ .../client/opensearch/tasks/TaskGroup.java | 17 +++++++ .../client/opensearch/tasks/TaskInfo.java | 38 ++++++++++++++ .../client/opensearch/tasks/TaskInfos.java | 15 ++++++ .../tasks/TaskListResponseBase.java | 20 ++++++++ .../client/opensearch/tasks/TaskResponse.java | 50 +++++++++++++++++++ .../client/codegen/model/Field.java | 8 +++ .../client/codegen/model/ObjectShape.java | 4 ++ .../client/codegen/model/RequestShape.java | 4 ++ .../opensearch/client/codegen/model/Type.java | 12 +++++ .../client/codegen/model/Types.java | 1 + .../codegen/templates/ObjectShape.mustache | 6 ++- .../templates/ObjectShape/Equals.mustache | 27 ++++++++++ .../templates/ObjectShape/HashCode.mustache | 22 ++++++++ .../ObjectShape/TaggedUnionEquals.mustache | 6 +++ .../ObjectShape/TaggedUnionHashCode.mustache | 6 +++ .../codegen/templates/RequestShape.mustache | 6 ++- .../templates/TaggedUnionShape.mustache | 5 ++ 82 files changed, 1481 insertions(+), 2 deletions(-) create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache create mode 100644 java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache diff --git a/CHANGELOG.md b/CHANGELOG.md index df2cea576f..7b86918528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ## [Unreleased 2.x] ### Added +- Add `hashCode` and `equals` implementations ([#312](https://github.com/opensearch-project/opensearch-java/pull/312)). ### Dependencies - Bumps `org.junit:junit-bom` from 5.10.3 to 5.11.0 diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index d955102ca7..631c4bdef1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -109,4 +109,17 @@ protected static > void setupAcknowle ) { op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acknowledged); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + AcknowledgedResponseBase other = (AcknowledgedResponseBase) o; + return this.acknowledged() == other.acknowledged(); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java index 8726abe2e5..bcd4083925 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -39,6 +39,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; @@ -281,4 +282,27 @@ protected static > void setupBaseNode op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.attributes); + result = 31 * result + Objects.hashCode(this.host); + result = 31 * result + Objects.hashCode(this.ip); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.roles); + result = 31 * result + Objects.hashCode(this.transportAddress); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + BaseNode other = (BaseNode) o; + return Objects.equals(this.attributes, other.attributes) + && Objects.equals(this.host, other.host) + && Objects.equals(this.ip, other.ip) + && Objects.equals(this.name, other.name) + && Objects.equals(this.roles, other.roles) + && Objects.equals(this.transportAddress, other.transportAddress); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java index a31cc9741a..d3993eacfb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/BulkByScrollFailure.java @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -313,4 +314,29 @@ protected static void setupBulkByScrollFailureDeserializer(ObjectDeserializer buildBulkByS public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( BulkByScrollTaskStatusOrException::buildBulkByScrollTaskStatusOrExceptionDeserializer ); + + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + BulkByScrollTaskStatusOrException other = (BulkByScrollTaskStatusOrException) o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } + } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index c029456c39..de1cad3599 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -40,6 +40,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -404,4 +405,29 @@ protected static void setupErrorCauseDeserializer(ObjectDeserializer> void setupWriteRes op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(AbstractBuilder::version, JsonpDeserializer.longDeserializer(), "_version"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.forcedRefresh); + result = 31 * result + this.id.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Long.hashCode(this.primaryTerm); + result = 31 * result + this.result.hashCode(); + result = 31 * result + Long.hashCode(this.seqNo); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Long.hashCode(this.version); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + WriteResponseBase other = (WriteResponseBase) o; + return this.forcedRefresh() == other.forcedRefresh() + && Objects.equals(this.id, other.id) + && Objects.equals(this.index, other.index) + && this.primaryTerm() == other.primaryTerm() + && Objects.equals(this.result, other.result) + && this.seqNo() == other.seqNo() + && Objects.equals(this.shards, other.shards) + && this.version() == other.version(); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java index 6c9e5d2202..b40292bc51 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoRequest.java @@ -72,4 +72,15 @@ public InfoRequest() {} false, InfoResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index 8f48dfd984..8698576035 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch.core; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; @@ -230,4 +231,25 @@ protected static void setupInfoResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java index 4b1440b7eb..127d1763b8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -290,4 +291,25 @@ public ImportDanglingIndexRequest build() { false, ImportDanglingIndexResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acceptDataLoss); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.indexUuid.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + ImportDanglingIndexRequest other = (ImportDanglingIndexRequest) o; + return this.acceptDataLoss() == other.acceptDataLoss() + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.indexUuid, other.indexUuid) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java index eaef581983..586d116d62 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java @@ -101,4 +101,18 @@ public ImportDanglingIndexResponse build() { protected static void setupImportDanglingIndexResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java index 641bb9b012..5452b35c3b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java @@ -72,4 +72,15 @@ public ListDanglingIndicesRequest() {} false, ListDanglingIndicesResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 54acd845ff..6b15626049 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -230,4 +231,21 @@ protected static void setupListDanglingIndicesResponseDeserializer(ObjectDeseria op.add(Builder::danglingIndices, JsonpDeserializer.arrayDeserializer(DanglingIndex._DESERIALIZER), "dangling_indices"); op.add(Builder::nodes, NodeStatistics._DESERIALIZER, "_nodes"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterName); + result = 31 * result + this.danglingIndices.hashCode(); + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + ListDanglingIndicesResponse other = (ListDanglingIndicesResponse) o; + return Objects.equals(this.clusterName, other.clusterName) + && Objects.equals(this.danglingIndices, other.danglingIndices) + && Objects.equals(this.nodes, other.nodes); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index c18d275f82..a3b848732b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -249,4 +250,25 @@ protected static void setupDanglingIndexDeserializer(ObjectDeserializer op.add(Builder::requestBody, JsonpDeserializer.stringDeserializer(), "request_body"); op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.actionType); + result = 31 * result + Objects.hashCode(this.headers); + result = 31 * result + Objects.hashCode(this.method); + result = 31 * result + Objects.hashCode(this.postProcessFunction); + result = 31 * result + Objects.hashCode(this.preProcessFunction); + result = 31 * result + Objects.hashCode(this.requestBody); + result = 31 * result + Objects.hashCode(this.url); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Action other = (Action) o; + return Objects.equals(this.actionType, other.actionType) + && Objects.equals(this.headers, other.headers) + && Objects.equals(this.method, other.method) + && Objects.equals(this.postProcessFunction, other.postProcessFunction) + && Objects.equals(this.preProcessFunction, other.preProcessFunction) + && Objects.equals(this.requestBody, other.requestBody) + && Objects.equals(this.url, other.url); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java index e3907e7f59..0a3fa1a853 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -279,4 +280,29 @@ protected static void setupClientConfigDeserializer(ObjectDeserializer op) { op.add(Builder::connectorId, JsonpDeserializer.stringDeserializer(), "connector_id"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.connectorId); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + CreateConnectorResponse other = (CreateConnectorResponse) o; + return Objects.equals(this.connectorId, other.connectorId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java index 8e32830e5e..1e465e9f59 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -214,4 +215,23 @@ protected static void setupCredentialDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java index 30e0f7d202..b108f9b63e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -98,4 +99,17 @@ public DeleteConnectorRequest build() { false, DeleteConnectorResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.connectorId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteConnectorRequest other = (DeleteConnectorRequest) o; + return Objects.equals(this.connectorId, other.connectorId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java index 1ba0900cc8..9119d195e6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteConnectorResponse.java @@ -73,4 +73,18 @@ public DeleteConnectorResponse build() { protected static void setupDeleteConnectorResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java index 181a605275..7575637baf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -98,4 +99,17 @@ public DeleteModelGroupRequest build() { false, DeleteModelGroupResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelGroupId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteModelGroupRequest other = (DeleteModelGroupRequest) o; + return Objects.equals(this.modelGroupId, other.modelGroupId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java index 742257bf99..5315f6739b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelGroupResponse.java @@ -73,4 +73,18 @@ public DeleteModelGroupResponse build() { protected static void setupDeleteModelGroupResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java index f9be99c118..f14d9eb0cd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -98,4 +99,17 @@ public DeleteModelRequest build() { false, DeleteModelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteModelRequest other = (DeleteModelRequest) o; + return Objects.equals(this.modelId, other.modelId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java index 1395e93e08..feb2c322d6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteModelResponse.java @@ -73,4 +73,18 @@ public DeleteModelResponse build() { protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java index a378f83fde..9620b90898 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -98,4 +99,17 @@ public DeleteTaskRequest build() { false, DeleteTaskResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.taskId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeleteTaskRequest other = (DeleteTaskRequest) o; + return Objects.equals(this.taskId, other.taskId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java index 93e33ffd2c..ee52e15754 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteTaskResponse.java @@ -73,4 +73,18 @@ public DeleteTaskResponse build() { protected static void setupDeleteTaskResponseDeserializer(ObjectDeserializer op) { WriteResponseBase.setupWriteResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java index 2230cb1d82..dc823dd744 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -99,4 +100,17 @@ public DeployModelRequest build() { false, DeployModelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + DeployModelRequest other = (DeployModelRequest) o; + return Objects.equals(this.modelId, other.modelId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java index 23b01f8025..2d436560f4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeployModelResponse.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -158,4 +159,21 @@ protected static void setupDeployModelResponseDeserializer(ObjectDeserializer op) { op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.parameters); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + LLM other = (LLM) o; + return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.parameters, other.parameters); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java index dfc0a9083c..3ae6dcaf1e 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -111,4 +112,17 @@ public Memory build() { protected static void setupMemoryDeserializer(ObjectDeserializer op) { op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.type); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Memory other = (Memory) o; + return Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java index 155e0de881..1924edac77 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -386,4 +387,31 @@ protected static void setupRegisterAgentsRequestDeserializer(ObjectDeserializer< true, RegisterAgentsResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.appType); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.llm); + result = 31 * result + Objects.hashCode(this.memory); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.parameters); + result = 31 * result + Objects.hashCode(this.tools); + result = 31 * result + this.type.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterAgentsRequest other = (RegisterAgentsRequest) o; + return Objects.equals(this.appType, other.appType) + && Objects.equals(this.description, other.description) + && Objects.equals(this.llm, other.llm) + && Objects.equals(this.memory, other.memory) + && Objects.equals(this.name, other.name) + && Objects.equals(this.parameters, other.parameters) + && Objects.equals(this.tools, other.tools) + && Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java index e69ff9e0de..199ae5fde6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -111,4 +112,17 @@ public RegisterAgentsResponse build() { protected static void setupRegisterAgentsResponseDeserializer(ObjectDeserializer op) { op.add(Builder::agentId, JsonpDeserializer.stringDeserializer(), "agent_id"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.agentId); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterAgentsResponse other = (RegisterAgentsResponse) o; + return Objects.equals(this.agentId, other.agentId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java index 2cf102fca7..b9f1b069fd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java @@ -14,6 +14,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -294,4 +295,25 @@ protected static void setupRegisterModelGroupRequestDeserializer(ObjectDeseriali true, RegisterModelGroupResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.accessMode); + result = 31 * result + Boolean.hashCode(this.addAllBackendRoles); + result = 31 * result + Objects.hashCode(this.backendRoles); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.name.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterModelGroupRequest other = (RegisterModelGroupRequest) o; + return Objects.equals(this.accessMode, other.accessMode) + && this.addAllBackendRoles() == other.addAllBackendRoles() + && Objects.equals(this.backendRoles, other.backendRoles) + && Objects.equals(this.description, other.description) + && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index 240993a8c8..6ee1aab4cf 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; @@ -143,4 +144,18 @@ protected static void setupRegisterModelGroupResponseDeserializer(ObjectDeserial op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); } + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelGroupId.hashCode(); + result = 31 * result + this.status.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + RegisterModelGroupResponse other = (RegisterModelGroupResponse) o; + return Objects.equals(this.modelGroupId, other.modelGroupId) && Objects.equals(this.status, other.status); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java index 98fb7909fd..9536644078 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -13,6 +13,7 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -262,4 +263,25 @@ protected static void setupRegisterModelRequestDeserializer(ObjectDeserializer op) { op.add(Builder::stats, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "stats"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.stats); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + UndeployModelNode other = (UndeployModelNode) o; + return Objects.equals(this.stats, other.stats); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java index 4ae83cb5b5..0b9f760371 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java @@ -12,6 +12,7 @@ package org.opensearch.client.opensearch.ml; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -99,4 +100,17 @@ public UndeployModelRequest build() { false, UndeployModelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + UndeployModelRequest other = (UndeployModelRequest) o; + return Objects.equals(this.modelId, other.modelId); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java index 83128a460a..74cd159526 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelResponse.java @@ -15,6 +15,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -140,4 +141,17 @@ protected static void setupUndeployModelResponseDeserializer(ObjectDeserializer< builder.nodes.put(name, UndeployModelNode._DESERIALIZER.deserialize(parser, mapper)); }); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + UndeployModelResponse other = (UndeployModelResponse) o; + return Objects.equals(this.nodes, other.nodes); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java index 44b99ef7a0..383f28b8eb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelRequest.java @@ -39,6 +39,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -310,4 +311,25 @@ public CancelRequest build() { false, CancelResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.actions); + result = 31 * result + Objects.hashCode(this.nodes); + result = 31 * result + Objects.hashCode(this.parentTaskId); + result = 31 * result + Objects.hashCode(this.taskId); + result = 31 * result + Boolean.hashCode(this.waitForCompletion); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + CancelRequest other = (CancelRequest) o; + return Objects.equals(this.actions, other.actions) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.parentTaskId, other.parentTaskId) + && Objects.equals(this.taskId, other.taskId) + && this.waitForCompletion() == other.waitForCompletion(); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java index c8b3e3f539..0f96ce30d4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/CancelResponse.java @@ -96,4 +96,18 @@ public CancelResponse build() { protected static void setupCancelResponseDeserializer(ObjectDeserializer op) { TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java index 7f120b8d9e..2c27e75efc 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksRequest.java @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -207,4 +208,21 @@ public GetTasksRequest build() { false, GetTasksResponse._DESERIALIZER ); + + public int hashCode() { + int result = 17; + result = 31 * result + this.taskId.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Boolean.hashCode(this.waitForCompletion); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + GetTasksRequest other = (GetTasksRequest) o; + return Objects.equals(this.taskId, other.taskId) + && Objects.equals(this.timeout, other.timeout) + && this.waitForCompletion() == other.waitForCompletion(); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java index 929d2ebbf0..13c285185f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/GetTasksResponse.java @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch.tasks; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -232,4 +233,23 @@ protected static void setupGetTasksResponseDeserializer(ObjectDeserializer op) { TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java index 743796d107..eb052d1f47 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/Status.java @@ -40,6 +40,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -767,4 +768,53 @@ protected static void setupStatusDeserializer(ObjectDeserializer builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); }); } + + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.batches); + result = 31 * result + Objects.hashCode(this.canceled); + result = 31 * result + Long.hashCode(this.created); + result = 31 * result + Long.hashCode(this.deleted); + result = 31 * result + Long.hashCode(this.noops); + result = 31 * result + Objects.hashCode(this.phase); + result = 31 * result + Float.hashCode(this.requestsPerSecond); + result = 31 * result + Objects.hashCode(this.retries); + result = 31 * result + Integer.hashCode(this.sliceId); + result = 31 * result + Objects.hashCode(this.slices); + result = 31 * result + Objects.hashCode(this.state); + result = 31 * result + Objects.hashCode(this.throttled); + result = 31 * result + Long.hashCode(this.throttledMillis); + result = 31 * result + Objects.hashCode(this.throttledUntil); + result = 31 * result + Long.hashCode(this.throttledUntilMillis); + result = 31 * result + Long.hashCode(this.total); + result = 31 * result + Long.hashCode(this.updated); + result = 31 * result + Long.hashCode(this.versionConflicts); + result = 31 * result + Objects.hashCode(this.metadata); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + Status other = (Status) o; + return this.batches() == other.batches() + && Objects.equals(this.canceled, other.canceled) + && this.created() == other.created() + && this.deleted() == other.deleted() + && this.noops() == other.noops() + && Objects.equals(this.phase, other.phase) + && this.requestsPerSecond() == other.requestsPerSecond() + && Objects.equals(this.retries, other.retries) + && this.sliceId() == other.sliceId() + && Objects.equals(this.slices, other.slices) + && Objects.equals(this.state, other.state) + && Objects.equals(this.throttled, other.throttled) + && this.throttledMillis() == other.throttledMillis() + && Objects.equals(this.throttledUntil, other.throttledUntil) + && this.throttledUntilMillis() == other.throttledUntilMillis() + && this.total() == other.total() + && this.updated() == other.updated() + && this.versionConflicts() == other.versionConflicts() + && Objects.equals(this.metadata, other.metadata); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java index 3f4c19e178..7a9d77716f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskExecutingNode.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; @@ -160,4 +161,20 @@ protected static void setupTaskExecutingNodeDeserializer(ObjectDeserializer> void setupTaskInfo op.add(AbstractBuilder::status, Status._DESERIALIZER, "status"); op.add(AbstractBuilder::type, JsonpDeserializer.stringDeserializer(), "type"); } + + public int hashCode() { + int result = 17; + result = 31 * result + this.action.hashCode(); + result = 31 * result + Boolean.hashCode(this.cancellable); + result = 31 * result + Boolean.hashCode(this.cancelled); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.headers.hashCode(); + result = 31 * result + Long.hashCode(this.id); + result = 31 * result + this.node.hashCode(); + result = 31 * result + Objects.hashCode(this.parentTaskId); + result = 31 * result + Objects.hashCode(this.runningTime); + result = 31 * result + Long.hashCode(this.runningTimeInNanos); + result = 31 * result + Long.hashCode(this.startTimeInMillis); + result = 31 * result + Objects.hashCode(this.status); + result = 31 * result + this.type.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskInfo other = (TaskInfo) o; + return Objects.equals(this.action, other.action) + && this.cancellable() == other.cancellable() + && this.cancelled() == other.cancelled() + && Objects.equals(this.description, other.description) + && Objects.equals(this.headers, other.headers) + && this.id() == other.id() + && Objects.equals(this.node, other.node) + && Objects.equals(this.parentTaskId, other.parentTaskId) + && Objects.equals(this.runningTime, other.runningTime) + && this.runningTimeInNanos() == other.runningTimeInNanos() + && this.startTimeInMillis() == other.startTimeInMillis() + && Objects.equals(this.status, other.status) + && Objects.equals(this.type, other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java index 9e394d3d7a..aeb0c0e298 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskInfos.java @@ -160,4 +160,19 @@ private static JsonpDeserializer buildTaskInfosDeserializer() { } public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(TaskInfos::buildTaskInfosDeserializer); + + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskInfos other = (TaskInfos) o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } + } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java index b67eb2965d..36ad3d85d3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskListResponseBase.java @@ -39,6 +39,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -306,4 +307,23 @@ protected static > void setupTaskList op.add(AbstractBuilder::taskFailures, JsonpDeserializer.arrayDeserializer(TaskFailure._DESERIALIZER), "task_failures"); op.add(AbstractBuilder::tasks, TaskInfos._DESERIALIZER, "tasks"); } + + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodeFailures); + result = 31 * result + Objects.hashCode(this.nodes); + result = 31 * result + Objects.hashCode(this.taskFailures); + result = 31 * result + Objects.hashCode(this.tasks); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (this.getClass() != o.getClass()) return false; + TaskListResponseBase other = (TaskListResponseBase) o; + return Objects.equals(this.nodeFailures, other.nodeFailures) + && Objects.equals(this.nodes, other.nodes) + && Objects.equals(this.taskFailures, other.taskFailures) + && Objects.equals(this.tasks, other.tasks); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java index 80edbb43d0..c737e57217 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/tasks/TaskResponse.java @@ -38,6 +38,7 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nullable; @@ -718,4 +719,53 @@ protected static void setupTaskResponseDeserializer(ObjectDeserializer getImplementsTypes() { return hasFieldsToSerialize() && !extendsOtherShape() ? List.of(Types.Client.Json.PlainJsonSerializable) : null; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index b0d93dcea8..136f8ead7b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -151,6 +151,10 @@ public boolean hasAnyRequiredFields() { return fields.values().stream().anyMatch(Field::isRequired); } + public boolean hasFields() { + return !fields.isEmpty(); + } + public Type getJsonEndpointType() { return Types.Client.Transport.JsonEndpoint(getType(), getResponseType(), Types.Client.OpenSearch._Types.ErrorResponse); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index 2e4391b787..d9123a7eaa 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -157,6 +157,18 @@ public boolean isPrimitive() { return PRIMITIVES.contains(name); } + public boolean isUnboxedPrimitive() { + return isPrimitive() + && !name.equals("String") + && !name.equals("Boolean") + && !name.equals("Character") + && !name.equals("Integer") + && !name.equals("Long") + && !name.equals("Float") + && !name.equals("Double") + && !name.equals("Number"); + } + public boolean isNumber() { return "Number".equals(name); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index 8d522a11f1..d5f4e9a750 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -72,6 +72,7 @@ public static final class Lang { public static final class Util { public static final String PACKAGE = Java.PACKAGE + ".util"; + public static final Type Objects = Type.builder().withPackage(PACKAGE).withName("Objects").build(); public static final Type HashMap = Type.builder().withPackage(PACKAGE).withName("HashMap").build(); public static Type Map(Type keyType, Type valueType) { diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache index 627af1db03..0cd936e3b4 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache @@ -19,4 +19,8 @@ // --------------------------------------------------------------------------------------------- {{>ObjectShape/Deserialize}} -} \ No newline at end of file + + {{>ObjectShape/HashCode}} + + {{>ObjectShape/Equals}} +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache new file mode 100644 index 0000000000..6e45e22d72 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -0,0 +1,27 @@ + public boolean equals(Object o) { + {{#extendsOtherShape}} + if(!super.equals(o)) { + return false; + } + {{/extendsOtherShape}} + if(this == o) return true; + if(this.getClass() != o.getClass()) return false; + {{^hasFields}} + return true; + {{/hasFields}} + {{#hasFields}} + {{className}} other = ({{className}})o; + return + {{#fields}} + {{#isUnboxedPrimitive}} + this.{{name}}() == other.{{name}}() + {{/isUnboxedPrimitive}} + {{^isUnboxedPrimitive}} + {{TYPES.Java.Util.Objects}}.equals(this.{{name}}, other.{{name}}) + {{/isUnboxedPrimitive}} + {{^-last}} + && + {{/-last}} + {{/fields}}; + {{/hasFields}} + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache new file mode 100644 index 0000000000..5418321cc6 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache @@ -0,0 +1,22 @@ + public int hashCode() { + {{#extendsOtherShape}} + int result = super.hashCode(); + {{/extendsOtherShape}} + {{^extendsOtherShape}} + int result = 17; + {{/extendsOtherShape}} + {{#fields}} + {{#isUnboxedPrimitive}} + result = 31 * result + {{getBoxedType}}.hashCode(this.{{name}}); + {{/isUnboxedPrimitive}} + {{^isUnboxedPrimitive}} + {{#isRequired}} + result = 31 * result + this.{{name}}.hashCode(); + {{/isRequired}} + {{^isRequired}} + result = 31 * result + {{TYPES.Java.Util.Objects}}.hashCode(this.{{name}}); + {{/isRequired}} + {{/isUnboxedPrimitive}} + {{/fields}} + return result; + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache new file mode 100644 index 0000000000..7a368dc538 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache @@ -0,0 +1,6 @@ + public boolean equals(Object o) { + if(this == o) return true; + if(this.getClass() != o.getClass()) return false; + {{className}} other = ({{className}})o; + return this._kind().equals(other._kind()) && this._get().equals(other._get()); + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache new file mode 100644 index 0000000000..8cd7137529 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache @@ -0,0 +1,6 @@ + public int hashCode() { + int result = 17; + result = 31 * result + _kind.hashCode(); + result = 31 * result + _value.hashCode(); + return result; + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache index 73c0960fea..f73f6dd4a2 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache @@ -96,4 +96,8 @@ {{hasRequestBody}}, {{responseType}}._DESERIALIZER ); -} \ No newline at end of file + + {{>ObjectShape/HashCode}} + + {{>ObjectShape/Equals}} +} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index 236daf9abb..c59a635d39 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -111,4 +111,9 @@ } public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = {{TYPES.Client.Json.JsonpDeserializer}}.lazy({{className}}::build{{className}}Deserializer); + + {{>ObjectShape/TaggedUnionHashCode}} + + {{>ObjectShape/TaggedUnionEquals}} + }