From 22784c0686541f437fde40664b3654a94fcb21e3 Mon Sep 17 00:00:00 2001
From: Andriy Redko
Date: Sun, 22 Feb 2026 15:43:36 -0500
Subject: [PATCH] Update Specification and Re-generate Code (#1890)
Signed-off-by: Andriy Redko
(cherry picked from commit 779e31a2e579f684e608610a8e010b574ea00ef8)
Signed-off-by: Andriy Redko
---
.../opensearch/_types/ClusterStatistics.java | 79 +-
.../opensearch/_types/ShardSearchFailure.java | 308 +++++++
.../opensearch/_types/ShardStatistics.java | 18 +-
.../core/search/CompletionSuggest.java | 175 +++-
.../core/search/CompletionSuggestOption.java | 270 ++++--
.../opensearch/core/search/PhraseSuggest.java | 145 +++-
.../core/search/ProcessorExecutionDetail.java | 389 +++++++++
.../opensearch/core/search/Suggest.java | 89 +-
.../opensearch/core/search/SuggestBase.java | 64 +-
.../core/search/SuggestBuilders.java | 68 ++
.../core/search/SuggestVariant.java | 16 +-
.../opensearch/core/search/TermSuggest.java | 145 +++-
.../client/opensearch/ml/DataAsMap.java | 207 +++++
.../ml/ExecuteAgentStreamRequest.java | 256 ++++++
.../ml/ExecuteAgentStreamResponse.java | 121 +++
.../ml/OpenSearchMlAsyncClient.java | 42 +
.../opensearch/ml/OpenSearchMlClient.java | 40 +
.../client/opensearch/ml/Output.java | 66 +-
.../ml/PredictModelStreamRequest.java | 256 ++++++
.../ml/PredictModelStreamResponse.java | 121 +++
.../DeleteExperimentsResponse.java | 61 +-
.../DeleteJudgmentsResponse.java | 61 +-
.../DeleteQuerySetsResponse.java | 61 +-
.../DeleteScheduledExperimentsRequest.java | 202 +++++
.../DeleteScheduledExperimentsResponse.java | 158 ++++
.../DeleteSearchConfigurationsResponse.java | 63 +-
.../GetExperimentsRequest.java | 13 +-
.../GetExperimentsResponse.java | 727 +++++++++-------
.../search_relevance/GetJudgmentsRequest.java | 13 +-
.../GetJudgmentsResponse.java | 701 +++++++++------
.../GetNodeStatsResponse.java | 253 +++++-
.../search_relevance/GetQuerySetsRequest.java | 13 +-
.../GetQuerySetsResponse.java | 682 ++++++++++-----
.../GetScheduledExperimentsRequest.java | 229 +++++
.../GetScheduledExperimentsResponse.java | 818 ++++++++++++++++++
.../GetSearchConfigurationsRequest.java | 78 +-
.../GetSearchConfigurationsResponse.java | 692 ++++++++++-----
.../search_relevance/GetStatsResponse.java | 247 +++++-
.../OpenSearchSearchRelevanceAsyncClient.java | 208 ++++-
.../OpenSearchSearchRelevanceClient.java | 205 ++++-
.../PostScheduledExperimentsRequest.java | 265 ++++++
.../PostScheduledExperimentsResponse.java | 226 +++++
.../PutExperimentsRequest.java | 49 +-
.../PutExperimentsResponse.java | 97 ++-
.../json/PlainJsonSerializableTest.java | 4 +-
java-codegen/opensearch-openapi.yaml | 654 ++++++++++----
.../client/codegen/openapi/MimeType.java | 1 +
.../transformer/overrides/Overrides.java | 1 -
48 files changed, 7951 insertions(+), 1706 deletions(-)
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java (70%)
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardSearchFailure.java
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java (52%)
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java (61%)
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java (51%)
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/core/search/ProcessorExecutionDetail.java
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/Suggest.java (70%)
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/SuggestBase.java (74%)
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBuilders.java
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java (76%)
rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/core/search/TermSuggest.java (51%)
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/DataAsMap.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamRequest.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamResponse.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamRequest.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamResponse.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsRequest.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsResponse.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsRequest.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsResponse.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsRequest.java
create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsResponse.java
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java
similarity index 70%
rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java
index b4ae6ae3fd..526c969e02 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java
@@ -30,10 +30,16 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch._types;
import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
@@ -41,13 +47,17 @@
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
// typedef: _types.ClusterStatistics
@JsonpDeserializable
-public class ClusterStatistics implements PlainJsonSerializable {
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class ClusterStatistics implements PlainJsonSerializable, ToCopyableBuilder {
+
private final int skipped;
private final int successful;
@@ -57,14 +67,12 @@ public class ClusterStatistics implements PlainJsonSerializable {
// ---------------------------------------------------------------------------------------------
private ClusterStatistics(Builder builder) {
-
this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped");
this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful");
this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");
-
}
- public static ClusterStatistics of(Function> fn) {
+ public static ClusterStatistics of(Function> fn) {
return fn.apply(new Builder()).build();
}
@@ -92,6 +100,7 @@ public final int total() {
/**
* Serialize this object to JSON.
*/
+ @Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
@@ -99,7 +108,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
generator.writeKey("skipped");
generator.write(this.skipped);
@@ -108,25 +116,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("total");
generator.write(this.total);
-
}
// ---------------------------------------------------------------------------------------------
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
/**
* Builder for {@link ClusterStatistics}.
*/
-
- public static class Builder extends ObjectBuilderBase implements ObjectBuilder {
+ public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
private Integer skipped;
-
private Integer successful;
-
private Integer total;
+ public Builder() {}
+
+ private Builder(ClusterStatistics o) {
+ this.skipped = o.skipped;
+ this.successful = o.successful;
+ this.total = o.total;
+ }
+
+ private Builder(Builder o) {
+ this.skipped = o.skipped;
+ this.successful = o.successful;
+ this.total = o.total;
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
/**
* Required - API name: {@code skipped}
*/
+ @Nonnull
public final Builder skipped(int value) {
this.skipped = value;
return this;
@@ -135,6 +171,7 @@ public final Builder skipped(int value) {
/**
* Required - API name: {@code successful}
*/
+ @Nonnull
public final Builder successful(int value) {
this.successful = value;
return this;
@@ -143,6 +180,7 @@ public final Builder successful(int value) {
/**
* Required - API name: {@code total}
*/
+ @Nonnull
public final Builder total(int value) {
this.total = value;
return this;
@@ -151,9 +189,10 @@ public final Builder total(int value) {
/**
* Builds a {@link ClusterStatistics}.
*
- * @throws NullPointerException
- * if some of the required fields are null.
+ * @throws NullPointerException if some of the required fields are null.
*/
+ @Override
+ @Nonnull
public ClusterStatistics build() {
_checkSingleUse();
@@ -172,11 +211,25 @@ public ClusterStatistics build() {
);
protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) {
-
op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped");
op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful");
op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total");
+ }
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Integer.hashCode(this.skipped);
+ result = 31 * result + Integer.hashCode(this.successful);
+ result = 31 * result + Integer.hashCode(this.total);
+ return result;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ ClusterStatistics other = (ClusterStatistics) o;
+ return this.skipped == other.skipped && this.successful == other.successful && this.total == other.total;
+ }
}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardSearchFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardSearchFailure.java
new file mode 100644
index 0000000000..7ebed2637f
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardSearchFailure.java
@@ -0,0 +1,308 @@
+/*
+ * 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.Objects;
+import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opensearch.client.json.JsonpDeserializable;
+import org.opensearch.client.json.JsonpDeserializer;
+import org.opensearch.client.json.JsonpMapper;
+import org.opensearch.client.json.ObjectBuilderDeserializer;
+import org.opensearch.client.json.ObjectDeserializer;
+import org.opensearch.client.json.PlainJsonSerializable;
+import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: _types.ShardSearchFailure
+
+/**
+ * Represents a failure to search on a specific shard. Used in search responses.
+ */
+@JsonpDeserializable
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class ShardSearchFailure implements PlainJsonSerializable, ToCopyableBuilder {
+
+ @Nullable
+ private final String index;
+
+ @Nullable
+ private final String node;
+
+ @Nonnull
+ private final ErrorCause reason;
+
+ private final int shard;
+
+ // ---------------------------------------------------------------------------------------------
+
+ private ShardSearchFailure(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");
+ }
+
+ public static ShardSearchFailure of(Function> fn) {
+ return fn.apply(new Builder()).build();
+ }
+
+ /**
+ * The index name where the failure occurred.
+ *
+ * API name: {@code index}
+ *
+ */
+ @Nullable
+ public final String index() {
+ return this.index;
+ }
+
+ /**
+ * The node id where the failure occurred.
+ *
+ * API name: {@code node}
+ *
+ */
+ @Nullable
+ public final String node() {
+ return this.node;
+ }
+
+ /**
+ * Required - API name: {@code reason}
+ */
+ @Nonnull
+ public final ErrorCause reason() {
+ return this.reason;
+ }
+
+ /**
+ * Required - The shard id where the failure occurred.
+ *
+ * API name: {@code shard}
+ *
+ */
+ public final int shard() {
+ return this.shard;
+ }
+
+ /**
+ * 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.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);
+
+ generator.writeKey("shard");
+ generator.write(this.shard);
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link ShardSearchFailure}.
+ */
+ public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
+ @Nullable
+ private String index;
+ @Nullable
+ private String node;
+ private ErrorCause reason;
+ private Integer shard;
+
+ public Builder() {}
+
+ private Builder(ShardSearchFailure o) {
+ this.index = o.index;
+ this.node = o.node;
+ this.reason = o.reason;
+ this.shard = o.shard;
+ }
+
+ private Builder(Builder o) {
+ this.index = o.index;
+ this.node = o.node;
+ this.reason = o.reason;
+ this.shard = o.shard;
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ /**
+ * The index name where the failure occurred.
+ *
+ * API name: {@code index}
+ *
+ */
+ @Nonnull
+ public final Builder index(@Nullable String value) {
+ this.index = value;
+ return this;
+ }
+
+ /**
+ * The node id where the failure occurred.
+ *
+ * API name: {@code node}
+ *
+ */
+ @Nonnull
+ public final Builder node(@Nullable String value) {
+ this.node = value;
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code reason}
+ */
+ @Nonnull
+ public final Builder reason(ErrorCause value) {
+ this.reason = value;
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code reason}
+ */
+ @Nonnull
+ public final Builder reason(Function> fn) {
+ return reason(fn.apply(new ErrorCause.Builder()).build());
+ }
+
+ /**
+ * Required - The shard id where the failure occurred.
+ *
+ * API name: {@code shard}
+ *
+ */
+ @Nonnull
+ public final Builder shard(int value) {
+ this.shard = value;
+ return this;
+ }
+
+ /**
+ * Builds a {@link ShardSearchFailure}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
+ @Override
+ @Nonnull
+ public ShardSearchFailure build() {
+ _checkSingleUse();
+
+ return new ShardSearchFailure(this);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link ShardSearchFailure}
+ */
+ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
+ Builder::new,
+ ShardSearchFailure::setupShardSearchFailureDeserializer
+ );
+
+ protected static void setupShardSearchFailureDeserializer(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");
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Objects.hashCode(this.index);
+ result = 31 * result + Objects.hashCode(this.node);
+ result = 31 * result + this.reason.hashCode();
+ result = 31 * result + Integer.hashCode(this.shard);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ ShardSearchFailure other = (ShardSearchFailure) o;
+ return Objects.equals(this.index, other.index)
+ && Objects.equals(this.node, other.node)
+ && this.reason.equals(other.reason)
+ && this.shard == other.shard;
+ }
+}
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 57fc99f388..ef64450839 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
@@ -64,7 +64,7 @@ public class ShardStatistics implements PlainJsonSerializable, ToCopyableBuilder
private final int failed;
@Nonnull
- private final List failures;
+ private final List failures;
@Nullable
private final Integer skipped;
@@ -98,7 +98,7 @@ public final int failed() {
* API name: {@code failures}
*/
@Nonnull
- public final List failures() {
+ public final List failures() {
return this.failures;
}
@@ -141,7 +141,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (ApiTypeHelper.isDefined(this.failures)) {
generator.writeKey("failures");
generator.writeStartArray();
- for (ShardFailure item0 : this.failures) {
+ for (ShardSearchFailure item0 : this.failures) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
@@ -178,7 +178,7 @@ public static Builder builder() {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
private Integer failed;
@Nullable
- private List failures;
+ private List failures;
@Nullable
private Integer skipped;
private Integer successful;
@@ -225,7 +225,7 @@ public final Builder failed(int value) {
*
*/
@Nonnull
- public final Builder failures(List list) {
+ public final Builder failures(List list) {
this.failures = _listAddAll(this.failures, list);
return this;
}
@@ -238,7 +238,7 @@ public final Builder failures(List list) {
*
*/
@Nonnull
- public final Builder failures(ShardFailure value, ShardFailure... values) {
+ public final Builder failures(ShardSearchFailure value, ShardSearchFailure... values) {
this.failures = _listAdd(this.failures, value, values);
return this;
}
@@ -251,8 +251,8 @@ public final Builder failures(ShardFailure value, ShardFailure... values) {
*
*/
@Nonnull
- public final Builder failures(Function> fn) {
- return failures(fn.apply(new ShardFailure.Builder()).build());
+ public final Builder failures(Function> fn) {
+ return failures(fn.apply(new ShardSearchFailure.Builder()).build());
}
/**
@@ -308,7 +308,7 @@ public ShardStatistics build() {
protected static void setupShardStatisticsDeserializer(ObjectDeserializer op) {
op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed");
- op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures");
+ op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardSearchFailure._DESERIALIZER), "failures");
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/core/search/CompletionSuggest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java
similarity index 52%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java
index 94e0efd7ae..b1d20505ca 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggest.java
@@ -30,137 +30,216 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.function.Function;
-import java.util.function.Supplier;
-import javax.annotation.Nullable;
-import org.opensearch.client.json.JsonpDeserializable;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
-import org.opensearch.client.json.JsonpSerializer;
-import org.opensearch.client.json.NamedDeserializer;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
-import org.opensearch.client.opensearch.core.search.Suggest.Kind;
import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: core.search.CompletionSuggest
+
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class CompletionSuggest extends SuggestBase
+ implements
+ SuggestVariant,
+ ToCopyableBuilder, CompletionSuggest> {
-@JsonpDeserializable
-public class CompletionSuggest extends SuggestBase implements SuggestVariant {
+ @Nonnull
private final List> options;
- @Nullable
- private final JsonpSerializer tDocumentSerializer;
+ // ---------------------------------------------------------------------------------------------
private CompletionSuggest(Builder builder) {
super(builder);
-
this.options = ApiTypeHelper.unmodifiableRequired(builder.options, this, "options");
- this.tDocumentSerializer = builder.tDocumentSerializer;
-
}
public static CompletionSuggest of(
- Function, ObjectBuilder>> fn
+ Function, ObjectBuilder>> fn
) {
return fn.apply(new Builder<>()).build();
}
+ /**
+ * {@link Suggest} variant kind.
+ */
+ @Override
+ public Suggest.Kind _suggestKind() {
+ return Suggest.Kind.Completion;
+ }
+
+ /**
+ * Required - API name: {@code options}
+ */
+ @Nonnull
public final List> options() {
return this.options;
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
super.serializeInternal(generator, mapper);
- if (ApiTypeHelper.isDefined(this.options)) {
- generator.writeKey("options");
- generator.writeStartArray();
- for (CompletionSuggestOption item0 : this.options) {
- item0.serialize(generator, mapper);
+ generator.writeKey("options");
+ generator.writeStartArray();
+ for (CompletionSuggestOption item0 : this.options) {
+ item0.serialize(generator, mapper);
+ }
+ generator.writeEnd();
+ }
- }
- generator.writeEnd();
+ // ---------------------------------------------------------------------------------------------
- }
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder<>(this);
+ }
+ @Nonnull
+ public static Builder builder() {
+ return new Builder<>();
}
+ /**
+ * Builder for {@link CompletionSuggest}.
+ */
public static class Builder extends SuggestBase.AbstractBuilder>
implements
- ObjectBuilder> {
+ CopyableBuilder, CompletionSuggest> {
private List> options;
- @Nullable
- private JsonpSerializer tDocumentSerializer;
+ public Builder() {}
+
+ private Builder(CompletionSuggest o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ private Builder(Builder o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder<>(this);
+ }
+
+ @Override
+ @Nonnull
+ protected Builder self() {
+ return this;
+ }
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds all elements of list to options.
+ *
+ */
+ @Nonnull
public final Builder options(List> list) {
this.options = _listAddAll(this.options, list);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds one or more values to options.
+ *
+ */
+ @Nonnull
public final Builder options(CompletionSuggestOption value, CompletionSuggestOption... values) {
this.options = _listAdd(this.options, value, values);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds a value to options using a builder lambda.
+ *
+ */
+ @Nonnull
public final Builder options(
Function, ObjectBuilder>> fn
) {
return options(fn.apply(new CompletionSuggestOption.Builder()).build());
}
- public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) {
- this.tDocumentSerializer = value;
- return this;
- }
-
+ /**
+ * Builds a {@link CompletionSuggest}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
@Override
- protected Builder self() {
- return this;
- }
-
+ @Nonnull
public CompletionSuggest build() {
_checkSingleUse();
- return new CompletionSuggest(this);
+ return new CompletionSuggest<>(this);
}
}
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Create a JSON deserializer for CompletionSuggest.
+ */
public static JsonpDeserializer> createCompletionSuggestDeserializer(
JsonpDeserializer tDocumentDeserializer
) {
return ObjectBuilderDeserializer.createForObject(
- (Supplier>) Builder::new,
+ Builder::new,
op -> CompletionSuggest.setupCompletionSuggestDeserializer(op, tDocumentDeserializer)
);
- };
-
- public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer.lazy(
- () -> createCompletionSuggestDeserializer(
- new NamedDeserializer<>("org.opensearch.client:Deserializer:_global.search._types.TDocument")
- )
- );
+ }
protected static void setupCompletionSuggestDeserializer(
ObjectDeserializer> op,
JsonpDeserializer tDocumentDeserializer
) {
- SuggestBase.setupSuggestBaseDeserializer(op);
+ setupSuggestBaseDeserializer(op);
op.add(
Builder::options,
JsonpDeserializer.arrayDeserializer(CompletionSuggestOption.createCompletionSuggestOptionDeserializer(tDocumentDeserializer)),
"options"
);
-
}
@Override
- public Kind _suggestionKind() {
- return Suggest.Kind.Completion;
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + this.options.hashCode();
+ return result;
}
+ @Override
+ public boolean equals(Object o) {
+ if (!super.equals(o)) {
+ return false;
+ }
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ CompletionSuggest> other = (CompletionSuggest>) o;
+ return this.options.equals(other.options);
+ }
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java
similarity index 61%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java
index 5ed1460637..4efc5fca09 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/CompletionSuggestOption.java
@@ -30,13 +30,19 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.function.Function;
-import java.util.function.Supplier;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.JsonpDeserializer;
@@ -47,54 +53,66 @@
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: core.search.CompletionSuggestOption
-// typedef: _global.search._types.CompletionSuggestOption
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class CompletionSuggestOption
+ implements
+ PlainJsonSerializable,
+ ToCopyableBuilder, CompletionSuggestOption> {
-public class CompletionSuggestOption implements PlainJsonSerializable {
@Nullable
private final Boolean collateMatch;
+ @Nonnull
private final Map> contexts;
+ @Nonnull
private final Map fields;
+ @Nullable
private final String id;
+ @Nullable
private final String index;
@Nullable
private final String routing;
- private final double score;
+ @Nullable
+ private final Float score;
+ @Nullable
private final TDocument source;
- private final String text;
-
@Nullable
private final JsonpSerializer tDocumentSerializer;
+ @Nonnull
+ private final String text;
+
// ---------------------------------------------------------------------------------------------
private CompletionSuggestOption(Builder builder) {
-
this.collateMatch = builder.collateMatch;
this.contexts = ApiTypeHelper.unmodifiable(builder.contexts);
this.fields = ApiTypeHelper.unmodifiable(builder.fields);
- this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
- this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index");
+ this.id = builder.id;
+ this.index = builder.index;
this.routing = builder.routing;
- this.score = ApiTypeHelper.requireNonNull(builder.score, this, "score");
- this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source");
- this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text");
+ this.score = builder.score;
+ this.source = builder.source;
this.tDocumentSerializer = builder.tDocumentSerializer;
-
+ this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text");
}
public static CompletionSuggestOption of(
- Function, ObjectBuilder>> fn
+ Function, ObjectBuilder>> fn
) {
return fn.apply(new Builder<>()).build();
}
@@ -110,6 +128,7 @@ public final Boolean collateMatch() {
/**
* API name: {@code contexts}
*/
+ @Nonnull
public final Map> contexts() {
return this.contexts;
}
@@ -117,20 +136,23 @@ public final Map> contexts() {
/**
* API name: {@code fields}
*/
+ @Nonnull
public final Map fields() {
return this.fields;
}
/**
- * Required - API name: {@code _id}
+ * API name: {@code _id}
*/
+ @Nullable
public final String id() {
return this.id;
}
/**
- * Required - API name: {@code _index}
+ * API name: {@code _index}
*/
+ @Nullable
public final String index() {
return this.index;
}
@@ -144,22 +166,33 @@ public final String routing() {
}
/**
- * Required - API name: {@code _score}
+ * API name: {@code _score}
*/
- public final double score() {
+ @Nullable
+ public final Float score() {
return this.score;
}
/**
- * Required - API name: {@code _source}
+ * API name: {@code _source}
*/
+ @Nullable
public final TDocument source() {
return this.source;
}
+ /**
+ * Serializer for {@code TDocument}. If not set, an attempt will be made to find a serializer from the JSON context.
+ */
+ @Nullable
+ public final JsonpSerializer tDocumentSerializer() {
+ return this.tDocumentSerializer;
+ }
+
/**
* Required - API name: {@code text}
*/
+ @Nonnull
public final String text() {
return this.text;
}
@@ -167,6 +200,7 @@ public final String text() {
/**
* Serialize this object to JSON.
*/
+ @Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
@@ -174,12 +208,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
if (this.collateMatch != null) {
generator.writeKey("collate_match");
generator.write(this.collateMatch);
-
}
+
if (ApiTypeHelper.isDefined(this.contexts)) {
generator.writeKey("contexts");
generator.writeStartObject();
@@ -189,83 +222,129 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (item0.getValue() != null) {
for (Context item1 : item0.getValue()) {
item1.serialize(generator, mapper);
-
}
}
generator.writeEnd();
-
}
generator.writeEnd();
-
}
+
if (ApiTypeHelper.isDefined(this.fields)) {
generator.writeKey("fields");
generator.writeStartObject();
for (Map.Entry item0 : this.fields.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
-
}
generator.writeEnd();
+ }
+ if (this.id != null) {
+ generator.writeKey("_id");
+ generator.write(this.id);
}
- generator.writeKey("_id");
- generator.write(this.id);
- generator.writeKey("_index");
- generator.write(this.index);
+ if (this.index != null) {
+ generator.writeKey("_index");
+ generator.write(this.index);
+ }
if (this.routing != null) {
generator.writeKey("_routing");
generator.write(this.routing);
+ }
+ if (this.score != null) {
+ generator.writeKey("_score");
+ generator.write(this.score);
}
- generator.writeKey("_score");
- generator.write(this.score);
- generator.writeKey("_source");
- JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);
+ if (this.source != null) {
+ generator.writeKey("_source");
+ JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);
+ }
generator.writeKey("text");
generator.write(this.text);
-
}
// ---------------------------------------------------------------------------------------------
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder<>(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder<>();
+ }
+
/**
* Builder for {@link CompletionSuggestOption}.
*/
-
- public static class Builder extends ObjectBuilderBase implements ObjectBuilder> {
+ public static class Builder extends ObjectBuilderBase
+ implements
+ CopyableBuilder, CompletionSuggestOption> {
@Nullable
private Boolean collateMatch;
-
@Nullable
private Map> contexts;
-
@Nullable
private Map fields;
-
+ @Nullable
private String id;
-
+ @Nullable
private String index;
-
@Nullable
private String routing;
-
- private Double score;
-
+ @Nullable
+ private Float score;
+ @Nullable
private TDocument source;
-
- private String text;
-
@Nullable
private JsonpSerializer tDocumentSerializer;
+ private String text;
+
+ public Builder() {}
+
+ private Builder(CompletionSuggestOption o) {
+ this.collateMatch = o.collateMatch;
+ this.contexts = _mapCopy(o.contexts);
+ this.fields = _mapCopy(o.fields);
+ this.id = o.id;
+ this.index = o.index;
+ this.routing = o.routing;
+ this.score = o.score;
+ this.source = o.source;
+ this.tDocumentSerializer = o.tDocumentSerializer;
+ this.text = o.text;
+ }
+
+ private Builder(Builder o) {
+ this.collateMatch = o.collateMatch;
+ this.contexts = _mapCopy(o.contexts);
+ this.fields = _mapCopy(o.fields);
+ this.id = o.id;
+ this.index = o.index;
+ this.routing = o.routing;
+ this.score = o.score;
+ this.source = o.source;
+ this.tDocumentSerializer = o.tDocumentSerializer;
+ this.text = o.text;
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder<>(this);
+ }
/**
* API name: {@code collate_match}
*/
+ @Nonnull
public final Builder collateMatch(@Nullable Boolean value) {
this.collateMatch = value;
return this;
@@ -273,9 +352,12 @@ public final Builder collateMatch(@Nullable Boolean value) {
/**
* API name: {@code contexts}
+ *
*
- * Adds all entries of map to contexts.
+ * Adds all elements of map to contexts.
+ *
*/
+ @Nonnull
public final Builder contexts(Map> map) {
this.contexts = _mapPutAll(this.contexts, map);
return this;
@@ -283,9 +365,12 @@ public final Builder contexts(Map> map) {
/**
* API name: {@code contexts}
+ *
*
* Adds an entry to contexts.
+ *
*/
+ @Nonnull
public final Builder contexts(String key, List value) {
this.contexts = _mapPut(this.contexts, key, value);
return this;
@@ -293,9 +378,12 @@ public final Builder contexts(String key, List value) {
/**
* API name: {@code fields}
+ *
*
- * Adds all entries of map to fields.
+ * Adds all elements of map to fields.
+ *
*/
+ @Nonnull
public final Builder fields(Map map) {
this.fields = _mapPutAll(this.fields, map);
return this;
@@ -303,26 +391,31 @@ public final Builder fields(Map map) {
/**
* API name: {@code fields}
+ *
*
* Adds an entry to fields.
+ *
*/
+ @Nonnull
public final Builder fields(String key, JsonData value) {
this.fields = _mapPut(this.fields, key, value);
return this;
}
/**
- * Required - API name: {@code _id}
+ * API name: {@code _id}
*/
- public final Builder id(String value) {
+ @Nonnull
+ public final Builder id(@Nullable String value) {
this.id = value;
return this;
}
/**
- * Required - API name: {@code _index}
+ * API name: {@code _index}
*/
- public final Builder index(String value) {
+ @Nonnull
+ public final Builder index(@Nullable String value) {
this.index = value;
return this;
}
@@ -330,76 +423,80 @@ public final Builder index(String value) {
/**
* API name: {@code _routing}
*/
+ @Nonnull
public final Builder routing(@Nullable String value) {
this.routing = value;
return this;
}
/**
- * Required - API name: {@code _score}
+ * API name: {@code _score}
*/
- public final Builder score(double value) {
+ @Nonnull
+ public final Builder score(@Nullable Float value) {
this.score = value;
return this;
}
/**
- * Required - API name: {@code _source}
+ * API name: {@code _source}
*/
- public final Builder source(TDocument value) {
+ @Nonnull
+ public final Builder source(@Nullable TDocument value) {
this.source = value;
return this;
}
/**
- * Required - API name: {@code text}
+ * Serializer for {@code TDocument}. If not set, an attempt will be made to find a serializer from the JSON context.
*/
- public final Builder text(String value) {
- this.text = value;
+ @Nonnull
+ public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) {
+ this.tDocumentSerializer = value;
return this;
}
/**
- * Serializer for TDocument. If not set, an attempt will be made to find a
- * serializer from the JSON context.
+ * Required - API name: {@code text}
*/
- public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) {
- this.tDocumentSerializer = value;
+ @Nonnull
+ public final Builder text(String value) {
+ this.text = value;
return this;
}
/**
* Builds a {@link CompletionSuggestOption}.
*
- * @throws NullPointerException
- * if some of the required fields are null.
+ * @throws NullPointerException if some of the required fields are null.
*/
+ @Override
+ @Nonnull
public CompletionSuggestOption build() {
_checkSingleUse();
- return new CompletionSuggestOption(this);
+ return new CompletionSuggestOption<>(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
- * Create a JSON deserializer for CompletionSuggestOption
+ * Create a JSON deserializer for CompletionSuggestOption.
*/
public static JsonpDeserializer> createCompletionSuggestOptionDeserializer(
JsonpDeserializer tDocumentDeserializer
) {
return ObjectBuilderDeserializer.createForObject(
- (Supplier>) Builder::new,
+ Builder::new,
op -> CompletionSuggestOption.setupCompletionSuggestOptionDeserializer(op, tDocumentDeserializer)
);
- };
+ }
protected static void setupCompletionSuggestOptionDeserializer(
ObjectDeserializer> op,
JsonpDeserializer tDocumentDeserializer
) {
-
op.add(Builder::collateMatch, JsonpDeserializer.booleanDeserializer(), "collate_match");
op.add(
Builder::contexts,
@@ -410,10 +507,39 @@ protected static void setupCompletionSuggestOptionDeserializer(
op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id");
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index");
op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing");
- op.add(Builder::score, JsonpDeserializer.doubleDeserializer(), "_score");
+ op.add(Builder::score, JsonpDeserializer.floatDeserializer(), "_score");
op.add(Builder::source, tDocumentDeserializer, "_source");
op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text");
+ }
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Objects.hashCode(this.collateMatch);
+ result = 31 * result + Objects.hashCode(this.contexts);
+ result = 31 * result + Objects.hashCode(this.fields);
+ result = 31 * result + Objects.hashCode(this.id);
+ result = 31 * result + Objects.hashCode(this.index);
+ result = 31 * result + Objects.hashCode(this.routing);
+ result = 31 * result + Objects.hashCode(this.score);
+ result = 31 * result + Objects.hashCode(this.source);
+ result = 31 * result + this.text.hashCode();
+ return result;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ CompletionSuggestOption> other = (CompletionSuggestOption>) o;
+ return Objects.equals(this.collateMatch, other.collateMatch)
+ && Objects.equals(this.contexts, other.contexts)
+ && Objects.equals(this.fields, other.fields)
+ && Objects.equals(this.id, other.id)
+ && Objects.equals(this.index, other.index)
+ && Objects.equals(this.routing, other.routing)
+ && Objects.equals(this.score, other.score)
+ && Objects.equals(this.source, other.source)
+ && this.text.equals(other.text);
+ }
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java
similarity index 51%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java
index 2b9429f67d..3250555880 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/PhraseSuggest.java
@@ -30,77 +30,161 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
-import org.opensearch.client.opensearch.core.search.Suggest.Kind;
import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: core.search.PhraseSuggest
@JsonpDeserializable
-public class PhraseSuggest extends SuggestBase implements SuggestVariant {
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class PhraseSuggest extends SuggestBase implements SuggestVariant, ToCopyableBuilder {
+
+ @Nonnull
private final List options;
+ // ---------------------------------------------------------------------------------------------
+
private PhraseSuggest(Builder builder) {
super(builder);
-
this.options = ApiTypeHelper.unmodifiableRequired(builder.options, this, "options");
-
}
- public static PhraseSuggest of(Function> fn) {
+ public static PhraseSuggest of(Function> fn) {
return fn.apply(new Builder()).build();
}
+ /**
+ * {@link Suggest} variant kind.
+ */
+ @Override
+ public Suggest.Kind _suggestKind() {
+ return Suggest.Kind.Phrase;
+ }
+
+ /**
+ * Required - API name: {@code options}
+ */
+ @Nonnull
public final List options() {
return this.options;
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
super.serializeInternal(generator, mapper);
- if (ApiTypeHelper.isDefined(this.options)) {
- generator.writeKey("options");
- generator.writeStartArray();
- for (PhraseSuggestOption item0 : this.options) {
- item0.serialize(generator, mapper);
+ generator.writeKey("options");
+ generator.writeStartArray();
+ for (PhraseSuggestOption item0 : this.options) {
+ item0.serialize(generator, mapper);
+ }
+ generator.writeEnd();
+ }
- }
- generator.writeEnd();
+ // ---------------------------------------------------------------------------------------------
- }
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
}
- public static class Builder extends SuggestBase.AbstractBuilder implements ObjectBuilder {
+ /**
+ * Builder for {@link PhraseSuggest}.
+ */
+ public static class Builder extends SuggestBase.AbstractBuilder implements CopyableBuilder {
private List options;
+ public Builder() {}
+
+ private Builder(PhraseSuggest o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ private Builder(Builder o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ @Override
+ @Nonnull
+ protected Builder self() {
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds all elements of list to options.
+ *
+ */
+ @Nonnull
public final Builder options(List list) {
this.options = _listAddAll(this.options, list);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds one or more values to options.
+ *
+ */
+ @Nonnull
public final Builder options(PhraseSuggestOption value, PhraseSuggestOption... values) {
this.options = _listAdd(this.options, value, values);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds a value to options using a builder lambda.
+ *
+ */
+ @Nonnull
public final Builder options(Function> fn) {
return options(fn.apply(new PhraseSuggestOption.Builder()).build());
}
+ /**
+ * Builds a {@link PhraseSuggest}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
@Override
- protected Builder self() {
- return this;
- }
-
+ @Nonnull
public PhraseSuggest build() {
_checkSingleUse();
@@ -108,19 +192,36 @@ public PhraseSuggest build() {
}
}
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link PhraseSuggest}
+ */
public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
Builder::new,
PhraseSuggest::setupPhraseSuggestDeserializer
);
protected static void setupPhraseSuggestDeserializer(ObjectDeserializer op) {
- SuggestBase.setupSuggestBaseDeserializer(op);
+ setupSuggestBaseDeserializer(op);
op.add(Builder::options, JsonpDeserializer.arrayDeserializer(PhraseSuggestOption._DESERIALIZER), "options");
+ }
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + this.options.hashCode();
+ return result;
}
@Override
- public Kind _suggestionKind() {
- return Suggest.Kind.Phrase;
+ public boolean equals(Object o) {
+ if (!super.equals(o)) {
+ return false;
+ }
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ PhraseSuggest other = (PhraseSuggest) o;
+ return this.options.equals(other.options);
}
}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/ProcessorExecutionDetail.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/ProcessorExecutionDetail.java
new file mode 100644
index 0000000000..e9cf2caa98
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/ProcessorExecutionDetail.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.
+ */
+
+/*
+ * 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.core.search;
+
+import jakarta.json.stream.JsonGenerator;
+import java.util.Objects;
+import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opensearch.client.json.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.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: core.search.ProcessorExecutionDetail
+
+@JsonpDeserializable
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class ProcessorExecutionDetail
+ implements
+ PlainJsonSerializable,
+ ToCopyableBuilder {
+
+ @Nullable
+ private final Long durationMillis;
+
+ @Nullable
+ private final String error;
+
+ @Nullable
+ private final JsonData inputData;
+
+ @Nullable
+ private final JsonData outputData;
+
+ @Nullable
+ private final String processorName;
+
+ @Nullable
+ private final String status;
+
+ @Nullable
+ private final String tag;
+
+ // ---------------------------------------------------------------------------------------------
+
+ private ProcessorExecutionDetail(Builder builder) {
+ this.durationMillis = builder.durationMillis;
+ this.error = builder.error;
+ this.inputData = builder.inputData;
+ this.outputData = builder.outputData;
+ this.processorName = builder.processorName;
+ this.status = builder.status;
+ this.tag = builder.tag;
+ }
+
+ public static ProcessorExecutionDetail of(Function> fn) {
+ return fn.apply(new Builder()).build();
+ }
+
+ /**
+ * API name: {@code duration_millis}
+ */
+ @Nullable
+ public final Long durationMillis() {
+ return this.durationMillis;
+ }
+
+ /**
+ * API name: {@code error}
+ */
+ @Nullable
+ public final String error() {
+ return this.error;
+ }
+
+ /**
+ * API name: {@code input_data}
+ */
+ @Nullable
+ public final JsonData inputData() {
+ return this.inputData;
+ }
+
+ /**
+ * API name: {@code output_data}
+ */
+ @Nullable
+ public final JsonData outputData() {
+ return this.outputData;
+ }
+
+ /**
+ * API name: {@code processor_name}
+ */
+ @Nullable
+ public final String processorName() {
+ return this.processorName;
+ }
+
+ /**
+ * API name: {@code status}
+ */
+ @Nullable
+ public final String status() {
+ return this.status;
+ }
+
+ /**
+ * API name: {@code tag}
+ */
+ @Nullable
+ public final String tag() {
+ return this.tag;
+ }
+
+ /**
+ * 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.durationMillis != null) {
+ generator.writeKey("duration_millis");
+ generator.write(this.durationMillis);
+ }
+
+ if (this.error != null) {
+ generator.writeKey("error");
+ generator.write(this.error);
+ }
+
+ if (this.inputData != null) {
+ generator.writeKey("input_data");
+ this.inputData.serialize(generator, mapper);
+ }
+
+ if (this.outputData != null) {
+ generator.writeKey("output_data");
+ this.outputData.serialize(generator, mapper);
+ }
+
+ if (this.processorName != null) {
+ generator.writeKey("processor_name");
+ generator.write(this.processorName);
+ }
+
+ if (this.status != null) {
+ generator.writeKey("status");
+ generator.write(this.status);
+ }
+
+ if (this.tag != null) {
+ generator.writeKey("tag");
+ generator.write(this.tag);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link ProcessorExecutionDetail}.
+ */
+ public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
+ @Nullable
+ private Long durationMillis;
+ @Nullable
+ private String error;
+ @Nullable
+ private JsonData inputData;
+ @Nullable
+ private JsonData outputData;
+ @Nullable
+ private String processorName;
+ @Nullable
+ private String status;
+ @Nullable
+ private String tag;
+
+ public Builder() {}
+
+ private Builder(ProcessorExecutionDetail o) {
+ this.durationMillis = o.durationMillis;
+ this.error = o.error;
+ this.inputData = o.inputData;
+ this.outputData = o.outputData;
+ this.processorName = o.processorName;
+ this.status = o.status;
+ this.tag = o.tag;
+ }
+
+ private Builder(Builder o) {
+ this.durationMillis = o.durationMillis;
+ this.error = o.error;
+ this.inputData = o.inputData;
+ this.outputData = o.outputData;
+ this.processorName = o.processorName;
+ this.status = o.status;
+ this.tag = o.tag;
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ /**
+ * API name: {@code duration_millis}
+ */
+ @Nonnull
+ public final Builder durationMillis(@Nullable Long value) {
+ this.durationMillis = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code error}
+ */
+ @Nonnull
+ public final Builder error(@Nullable String value) {
+ this.error = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code input_data}
+ */
+ @Nonnull
+ public final Builder inputData(@Nullable JsonData value) {
+ this.inputData = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code output_data}
+ */
+ @Nonnull
+ public final Builder outputData(@Nullable JsonData value) {
+ this.outputData = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code processor_name}
+ */
+ @Nonnull
+ public final Builder processorName(@Nullable String value) {
+ this.processorName = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code status}
+ */
+ @Nonnull
+ public final Builder status(@Nullable String value) {
+ this.status = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code tag}
+ */
+ @Nonnull
+ public final Builder tag(@Nullable String value) {
+ this.tag = value;
+ return this;
+ }
+
+ /**
+ * Builds a {@link ProcessorExecutionDetail}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
+ @Override
+ @Nonnull
+ public ProcessorExecutionDetail build() {
+ _checkSingleUse();
+
+ return new ProcessorExecutionDetail(this);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link ProcessorExecutionDetail}
+ */
+ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
+ Builder::new,
+ ProcessorExecutionDetail::setupProcessorExecutionDetailDeserializer
+ );
+
+ protected static void setupProcessorExecutionDetailDeserializer(ObjectDeserializer op) {
+ op.add(Builder::durationMillis, JsonpDeserializer.longDeserializer(), "duration_millis");
+ op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error");
+ op.add(Builder::inputData, JsonData._DESERIALIZER, "input_data");
+ op.add(Builder::outputData, JsonData._DESERIALIZER, "output_data");
+ op.add(Builder::processorName, JsonpDeserializer.stringDeserializer(), "processor_name");
+ op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status");
+ op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag");
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Objects.hashCode(this.durationMillis);
+ result = 31 * result + Objects.hashCode(this.error);
+ result = 31 * result + Objects.hashCode(this.inputData);
+ result = 31 * result + Objects.hashCode(this.outputData);
+ result = 31 * result + Objects.hashCode(this.processorName);
+ result = 31 * result + Objects.hashCode(this.status);
+ result = 31 * result + Objects.hashCode(this.tag);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ ProcessorExecutionDetail other = (ProcessorExecutionDetail) o;
+ return Objects.equals(this.durationMillis, other.durationMillis)
+ && Objects.equals(this.error, other.error)
+ && Objects.equals(this.inputData, other.inputData)
+ && Objects.equals(this.outputData, other.outputData)
+ && Objects.equals(this.processorName, other.processorName)
+ && Objects.equals(this.status, other.status)
+ && Objects.equals(this.tag, other.tag);
+ }
+}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/Suggest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Suggest.java
similarity index 70%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/Suggest.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Suggest.java
index f770d300ec..b7c437d513 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/Suggest.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Suggest.java
@@ -30,31 +30,52 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
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.Nonnull;
import org.opensearch.client.json.ExternallyTaggedUnion;
+import org.opensearch.client.json.JsonEnum;
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.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: _global.search._types.SuggestOption
+// typedef: core.search.Suggest
+
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class Suggest implements TaggedUnion, PlainJsonSerializable {
+ /**
+ * {@link Suggest} variant kinds.
+ */
+ public enum Kind implements JsonEnum {
+ Completion("completion"),
+ Phrase("phrase"),
+ Term("term");
-public class Suggest implements TaggedUnion, JsonpSerializable {
+ private final String jsonValue;
- public enum Kind {
- Completion,
- Phrase,
- Term
+ Kind(String jsonValue) {
+ this.jsonValue = jsonValue;
+ }
+ @Override
+ public String jsonValue() {
+ return jsonValue;
+ }
}
private final Kind _kind;
@@ -71,18 +92,16 @@ public final SuggestVariant _get() {
}
public Suggest(SuggestVariant value) {
- this._kind = ApiTypeHelper.requireNonNull(value._suggestionKind(), this, "");
+ this._kind = ApiTypeHelper.requireNonNull(value._suggestKind(), this, "");
this._value = ApiTypeHelper.requireNonNull(value, this, "");
}
private Suggest(Builder builder) {
-
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "");
this._value = ApiTypeHelper.requireNonNull(builder._value, builder, "");
-
}
- public static Suggest of(Function, ObjectBuilder>> fn) {
+ public static Suggest of(Function, ObjectBuilder>> fn) {
return fn.apply(new Builder<>()).build();
}
@@ -96,8 +115,7 @@ public boolean isCompletion() {
/**
* Get the {@code completion} variant value.
*
- * @throws IllegalStateException
- * if the current variant is not of the {@code completion} kind.
+ * @throws IllegalStateException if the current variant is not the {@code completion} kind.
*/
public CompletionSuggest completion() {
return TaggedUnionUtils.get(this, Kind.Completion);
@@ -113,8 +131,7 @@ public boolean isPhrase() {
/**
* Get the {@code phrase} variant value.
*
- * @throws IllegalStateException
- * if the current variant is not of the {@code phrase} kind.
+ * @throws IllegalStateException if the current variant is not the {@code phrase} kind.
*/
public PhraseSuggest phrase() {
return TaggedUnionUtils.get(this, Kind.Phrase);
@@ -130,8 +147,7 @@ public boolean isTerm() {
/**
* Get the {@code term} variant value.
*
- * @throws IllegalStateException
- * if the current variant is not of the {@code term} kind.
+ * @throws IllegalStateException if the current variant is not the {@code term} kind.
*/
public TermSuggest term() {
return TaggedUnionUtils.get(this, Kind.Term);
@@ -139,16 +155,30 @@ public TermSuggest term() {
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
- if (_value instanceof JsonpSerializable) {
- ((JsonpSerializable) _value).serialize(generator, mapper);
- }
+ mapper.serialize(_value, generator);
+ }
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder<>(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder<>();
}
public static class Builder extends ObjectBuilderBase implements ObjectBuilder> {
private Kind _kind;
private SuggestVariant _value;
+ public Builder() {}
+
+ private Builder(Suggest o) {
+ this._kind = o._kind;
+ this._value = o._value;
+ }
+
public ObjectBuilder> completion(CompletionSuggest v) {
this._kind = Kind.Completion;
this._value = v;
@@ -181,11 +211,11 @@ public ObjectBuilder> term(Function build() {
_checkSingleUse();
return new Suggest<>(this);
}
-
}
public static ExternallyTaggedUnion.TypedKeysDeserializer> createSuggestDeserializer(
@@ -196,7 +226,22 @@ public static ExternallyTaggedUnion.TypedKeysDeserializer, SuggestVariant>(deserializers, Suggest::new).typedKeys();
+ return new ExternallyTaggedUnion.Deserializer<>(deserializers, Suggest::new).typedKeys();
}
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Objects.hashCode(this._kind);
+ result = 31 * result + Objects.hashCode(this._value);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ Suggest> other = (Suggest>) o;
+ return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value);
+ }
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBase.java
similarity index 74%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestBase.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBase.java
index f42acd9993..7b472e6177 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestBase.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBase.java
@@ -30,9 +30,15 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
import jakarta.json.stream.JsonGenerator;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectDeserializer;
@@ -40,23 +46,24 @@
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilderBase;
-// typedef: _global.search._types.Suggest
+// typedef: core.search.SuggestBase
+@Generated("org.opensearch.client.codegen.CodeGenerator")
public abstract class SuggestBase implements PlainJsonSerializable {
+
private final int length;
private final int offset;
+ @Nonnull
private final String text;
// ---------------------------------------------------------------------------------------------
protected SuggestBase(AbstractBuilder> builder) {
-
this.length = ApiTypeHelper.requireNonNull(builder.length, this, "length");
this.offset = ApiTypeHelper.requireNonNull(builder.offset, this, "offset");
this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text");
-
}
/**
@@ -76,6 +83,7 @@ public final int offset() {
/**
* Required - API name: {@code text}
*/
+ @Nonnull
public final String text() {
return this.text;
}
@@ -83,6 +91,7 @@ public final String text() {
/**
* Serialize this object to JSON.
*/
+ @Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
@@ -90,7 +99,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
generator.writeKey("length");
generator.write(this.length);
@@ -99,25 +107,36 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("text");
generator.write(this.text);
-
}
// ---------------------------------------------------------------------------------------------
- /**
- * Builder for {@link SuggestBase}.
- */
-
public abstract static class AbstractBuilder> extends ObjectBuilderBase {
private Integer length;
-
private Integer offset;
-
private String text;
+ protected AbstractBuilder() {}
+
+ protected AbstractBuilder(SuggestBase o) {
+ this.length = o.length;
+ this.offset = o.offset;
+ this.text = o.text;
+ }
+
+ protected AbstractBuilder(AbstractBuilder o) {
+ this.length = o.length;
+ this.offset = o.offset;
+ this.text = o.text;
+ }
+
+ @Nonnull
+ protected abstract BuilderT self();
+
/**
* Required - API name: {@code length}
*/
+ @Nonnull
public final BuilderT length(int value) {
this.length = value;
return self();
@@ -126,6 +145,7 @@ public final BuilderT length(int value) {
/**
* Required - API name: {@code offset}
*/
+ @Nonnull
public final BuilderT offset(int value) {
this.offset = value;
return self();
@@ -134,21 +154,35 @@ public final BuilderT offset(int value) {
/**
* Required - API name: {@code text}
*/
+ @Nonnull
public final BuilderT text(String value) {
this.text = value;
return self();
}
-
- protected abstract BuilderT self();
-
}
- protected static > void setupSuggestBaseDeserializer(ObjectDeserializer op) {
+ // ---------------------------------------------------------------------------------------------
+ protected static > void setupSuggestBaseDeserializer(ObjectDeserializer op) {
op.add(AbstractBuilder::length, JsonpDeserializer.integerDeserializer(), "length");
op.add(AbstractBuilder::offset, JsonpDeserializer.integerDeserializer(), "offset");
op.add(AbstractBuilder::text, JsonpDeserializer.stringDeserializer(), "text");
+ }
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Integer.hashCode(this.length);
+ result = 31 * result + Integer.hashCode(this.offset);
+ result = 31 * result + this.text.hashCode();
+ return result;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ SuggestBase other = (SuggestBase) o;
+ return this.length == other.length && this.offset == other.offset && this.text.equals(other.text);
+ }
}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBuilders.java
new file mode 100644
index 0000000000..abfa150f7b
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestBuilders.java
@@ -0,0 +1,68 @@
+/*
+ * 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.core.search;
+
+import javax.annotation.Generated;
+
+/**
+ * Builders for {@link Suggest} variants.
+ */
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class SuggestBuilders {
+ private SuggestBuilders() {}
+
+ /**
+ * Creates a builder for the {@link CompletionSuggest completion} {@code Suggest} variant.
+ */
+ public static CompletionSuggest.Builder completion() {
+ return new CompletionSuggest.Builder();
+ }
+
+ /**
+ * Creates a builder for the {@link PhraseSuggest phrase} {@code Suggest} variant.
+ */
+ public static PhraseSuggest.Builder phrase() {
+ return new PhraseSuggest.Builder();
+ }
+
+ /**
+ * Creates a builder for the {@link TermSuggest term} {@code Suggest} variant.
+ */
+ public static TermSuggest.Builder term() {
+ return new TermSuggest.Builder();
+ }
+}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java
similarity index 76%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java
index 579e3a3296..70d6bf5c75 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SuggestVariant.java
@@ -30,14 +30,22 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
-public interface SuggestVariant {
+import javax.annotation.Generated;
- Suggest.Kind _suggestionKind();
+/**
+ * Base interface for {@link Suggest} variants.
+ */
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public interface SuggestVariant {
+ Suggest.Kind _suggestKind();
- default Suggest _toSuggestion() {
+ default Suggest toSuggest() {
return new Suggest(this);
}
-
}
diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/TermSuggest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/TermSuggest.java
similarity index 51%
rename from java-client/src/main/java/org/opensearch/client/opensearch/core/search/TermSuggest.java
rename to java-client/src/generated/java/org/opensearch/client/opensearch/core/search/TermSuggest.java
index 27df92fcad..e34d7af615 100644
--- a/java-client/src/main/java/org/opensearch/client/opensearch/core/search/TermSuggest.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/TermSuggest.java
@@ -30,77 +30,161 @@
* GitHub history for details.
*/
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
package org.opensearch.client.opensearch.core.search;
import jakarta.json.stream.JsonGenerator;
import java.util.List;
import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
-import org.opensearch.client.opensearch.core.search.Suggest.Kind;
import org.opensearch.client.util.ApiTypeHelper;
+import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: core.search.TermSuggest
@JsonpDeserializable
-public class TermSuggest extends SuggestBase implements SuggestVariant {
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class TermSuggest extends SuggestBase implements SuggestVariant, ToCopyableBuilder {
+
+ @Nonnull
private final List options;
+ // ---------------------------------------------------------------------------------------------
+
private TermSuggest(Builder builder) {
super(builder);
-
this.options = ApiTypeHelper.unmodifiableRequired(builder.options, this, "options");
-
}
- public static TermSuggest of(Function> fn) {
+ public static TermSuggest of(Function> fn) {
return fn.apply(new Builder()).build();
}
+ /**
+ * {@link Suggest} variant kind.
+ */
+ @Override
+ public Suggest.Kind _suggestKind() {
+ return Suggest.Kind.Term;
+ }
+
+ /**
+ * Required - API name: {@code options}
+ */
+ @Nonnull
public final List options() {
return this.options;
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
-
super.serializeInternal(generator, mapper);
- if (ApiTypeHelper.isDefined(this.options)) {
- generator.writeKey("options");
- generator.writeStartArray();
- for (TermSuggestOption item0 : this.options) {
- item0.serialize(generator, mapper);
+ generator.writeKey("options");
+ generator.writeStartArray();
+ for (TermSuggestOption item0 : this.options) {
+ item0.serialize(generator, mapper);
+ }
+ generator.writeEnd();
+ }
- }
- generator.writeEnd();
+ // ---------------------------------------------------------------------------------------------
- }
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
}
- public static class Builder extends SuggestBase.AbstractBuilder implements ObjectBuilder {
+ /**
+ * Builder for {@link TermSuggest}.
+ */
+ public static class Builder extends SuggestBase.AbstractBuilder implements CopyableBuilder {
private List options;
+ public Builder() {}
+
+ private Builder(TermSuggest o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ private Builder(Builder o) {
+ super(o);
+ this.options = _listCopy(o.options);
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ @Override
+ @Nonnull
+ protected Builder self() {
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds all elements of list to options.
+ *
+ */
+ @Nonnull
public final Builder options(List list) {
this.options = _listAddAll(this.options, list);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds one or more values to options.
+ *
+ */
+ @Nonnull
public final Builder options(TermSuggestOption value, TermSuggestOption... values) {
this.options = _listAdd(this.options, value, values);
return this;
}
+ /**
+ * Required - API name: {@code options}
+ *
+ *
+ * Adds a value to options using a builder lambda.
+ *
+ */
+ @Nonnull
public final Builder options(Function> fn) {
return options(fn.apply(new TermSuggestOption.Builder()).build());
}
+ /**
+ * Builds a {@link TermSuggest}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
@Override
- protected Builder self() {
- return this;
- }
-
+ @Nonnull
public TermSuggest build() {
_checkSingleUse();
@@ -108,19 +192,36 @@ public TermSuggest build() {
}
}
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link TermSuggest}
+ */
public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
Builder::new,
TermSuggest::setupTermSuggestDeserializer
);
protected static void setupTermSuggestDeserializer(ObjectDeserializer op) {
- SuggestBase.setupSuggestBaseDeserializer(op);
+ setupSuggestBaseDeserializer(op);
op.add(Builder::options, JsonpDeserializer.arrayDeserializer(TermSuggestOption._DESERIALIZER), "options");
+ }
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + this.options.hashCode();
+ return result;
}
@Override
- public Kind _suggestionKind() {
- return Suggest.Kind.Term;
+ public boolean equals(Object o) {
+ if (!super.equals(o)) {
+ return false;
+ }
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ TermSuggest other = (TermSuggest) o;
+ return this.options.equals(other.options);
}
}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DataAsMap.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DataAsMap.java
new file mode 100644
index 0000000000..6941738496
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DataAsMap.java
@@ -0,0 +1,207 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * The OpenSearch Contributors require contributions made to
+ * this file be licensed under the Apache-2.0 license or a
+ * compatible open source license.
+ */
+
+//----------------------------------------------------
+// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
+//----------------------------------------------------
+
+package org.opensearch.client.opensearch.ml;
+
+import jakarta.json.stream.JsonGenerator;
+import java.util.Objects;
+import java.util.function.Function;
+import javax.annotation.Generated;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opensearch.client.json.JsonpDeserializable;
+import org.opensearch.client.json.JsonpDeserializer;
+import org.opensearch.client.json.JsonpMapper;
+import org.opensearch.client.json.ObjectBuilderDeserializer;
+import org.opensearch.client.json.ObjectDeserializer;
+import org.opensearch.client.json.PlainJsonSerializable;
+import org.opensearch.client.util.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: ml.DataAsMap
+
+@JsonpDeserializable
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class DataAsMap implements PlainJsonSerializable, ToCopyableBuilder {
+
+ @Nullable
+ private final String content;
+
+ @Nullable
+ private final Boolean isLast;
+
+ // ---------------------------------------------------------------------------------------------
+
+ private DataAsMap(Builder builder) {
+ this.content = builder.content;
+ this.isLast = builder.isLast;
+ }
+
+ public static DataAsMap of(Function> fn) {
+ return fn.apply(new Builder()).build();
+ }
+
+ /**
+ * The streaming content chunk.
+ *
+ * API name: {@code content}
+ *
+ */
+ @Nullable
+ public final String content() {
+ return this.content;
+ }
+
+ /**
+ * Whether this is the last chunk.
+ *
+ * API name: {@code is_last}
+ *
+ */
+ @Nullable
+ public final Boolean isLast() {
+ return this.isLast;
+ }
+
+ /**
+ * 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.content != null) {
+ generator.writeKey("content");
+ generator.write(this.content);
+ }
+
+ if (this.isLast != null) {
+ generator.writeKey("is_last");
+ generator.write(this.isLast);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link DataAsMap}.
+ */
+ public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
+ @Nullable
+ private String content;
+ @Nullable
+ private Boolean isLast;
+
+ public Builder() {}
+
+ private Builder(DataAsMap o) {
+ this.content = o.content;
+ this.isLast = o.isLast;
+ }
+
+ private Builder(Builder o) {
+ this.content = o.content;
+ this.isLast = o.isLast;
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ /**
+ * The streaming content chunk.
+ *
+ * API name: {@code content}
+ *
+ */
+ @Nonnull
+ public final Builder content(@Nullable String value) {
+ this.content = value;
+ return this;
+ }
+
+ /**
+ * Whether this is the last chunk.
+ *
+ * API name: {@code is_last}
+ *
+ */
+ @Nonnull
+ public final Builder isLast(@Nullable Boolean value) {
+ this.isLast = value;
+ return this;
+ }
+
+ /**
+ * Builds a {@link DataAsMap}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
+ @Override
+ @Nonnull
+ public DataAsMap build() {
+ _checkSingleUse();
+
+ return new DataAsMap(this);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link DataAsMap}
+ */
+ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
+ Builder::new,
+ DataAsMap::setupDataAsMapDeserializer
+ );
+
+ protected static void setupDataAsMapDeserializer(ObjectDeserializer op) {
+ op.add(Builder::content, JsonpDeserializer.stringDeserializer(), "content");
+ op.add(Builder::isLast, JsonpDeserializer.booleanDeserializer(), "is_last");
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Objects.hashCode(this.content);
+ result = 31 * result + Objects.hashCode(this.isLast);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ DataAsMap other = (DataAsMap) o;
+ return Objects.equals(this.content, other.content) && Objects.equals(this.isLast, other.isLast);
+ }
+}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamRequest.java
new file mode 100644
index 0000000000..2e4cd24e03
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamRequest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.Nonnull;
+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.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: ml.execute_agent_stream.Request
+
+/**
+ * Execute an agent in streaming mode.
+ */
+@JsonpDeserializable
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public final class ExecuteAgentStreamRequest extends RequestBase
+ implements
+ PlainJsonSerializable,
+ ToCopyableBuilder {
+
+ @Nonnull
+ private final String agentId;
+
+ @Nonnull
+ private final Map parameters;
+
+ // ---------------------------------------------------------------------------------------------
+
+ private ExecuteAgentStreamRequest(Builder builder) {
+ super(builder);
+ this.agentId = ApiTypeHelper.requireNonNull(builder.agentId, this, "agentId");
+ this.parameters = ApiTypeHelper.unmodifiableRequired(builder.parameters, this, "parameters");
+ }
+
+ public static ExecuteAgentStreamRequest of(Function> fn) {
+ return fn.apply(new Builder()).build();
+ }
+
+ /**
+ * Required - API name: {@code agent_id}
+ */
+ @Nonnull
+ public final String agentId() {
+ return this.agentId;
+ }
+
+ /**
+ * Required - API name: {@code parameters}
+ */
+ @Nonnull
+ 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) {
+ generator.writeKey("parameters");
+ generator.writeStartObject();
+ for (Map.Entry item0 : this.parameters.entrySet()) {
+ generator.writeKey(item0.getKey());
+ item0.getValue().serialize(generator, mapper);
+ }
+ generator.writeEnd();
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link ExecuteAgentStreamRequest}.
+ */
+ public static class Builder extends RequestBase.AbstractBuilder
+ implements
+ CopyableBuilder {
+ private String agentId;
+ private Map parameters;
+
+ public Builder() {}
+
+ private Builder(ExecuteAgentStreamRequest o) {
+ super(o);
+ this.agentId = o.agentId;
+ this.parameters = _mapCopy(o.parameters);
+ }
+
+ private Builder(Builder o) {
+ super(o);
+ this.agentId = o.agentId;
+ this.parameters = _mapCopy(o.parameters);
+ }
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ @Override
+ @Nonnull
+ protected Builder self() {
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code agent_id}
+ */
+ @Nonnull
+ public final Builder agentId(String value) {
+ this.agentId = value;
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code parameters}
+ *
+ *
+ * Adds all elements of map to parameters.
+ *
+ */
+ @Nonnull
+ public final Builder parameters(Map map) {
+ this.parameters = _mapPutAll(this.parameters, map);
+ return this;
+ }
+
+ /**
+ * Required - API name: {@code parameters}
+ *
+ *
+ * Adds an entry to parameters.
+ *
+ */
+ @Nonnull
+ public final Builder parameters(String key, JsonData value) {
+ this.parameters = _mapPut(this.parameters, key, value);
+ return this;
+ }
+
+ /**
+ * Builds a {@link ExecuteAgentStreamRequest}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
+ @Override
+ @Nonnull
+ public ExecuteAgentStreamRequest build() {
+ _checkSingleUse();
+
+ return new ExecuteAgentStreamRequest(this);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Json deserializer for {@link ExecuteAgentStreamRequest}
+ */
+ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(
+ Builder::new,
+ ExecuteAgentStreamRequest::setupExecuteAgentStreamRequestDeserializer
+ );
+
+ protected static void setupExecuteAgentStreamRequestDeserializer(ObjectDeserializer op) {
+ op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters");
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Endpoint "{@code ml.execute_agent_stream}".
+ */
+ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>(
+ // Request method
+ request -> "POST",
+ // Request path
+ request -> {
+ StringBuilder buf = new StringBuilder();
+ buf.append("/_plugins/_ml/agents/");
+ SimpleEndpoint.pathEncode(request.agentId, buf);
+ buf.append("/_execute/stream");
+ return buf.toString();
+ },
+ // Request parameters
+ request -> {
+ Map params = new HashMap<>();
+ request.applyQueryParameters(params);
+ return params;
+ },
+ SimpleEndpoint.emptyMap(),
+ true,
+ ExecuteAgentStreamResponse._DESERIALIZER
+ );
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + this.agentId.hashCode();
+ result = 31 * result + this.parameters.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ ExecuteAgentStreamRequest other = (ExecuteAgentStreamRequest) o;
+ return this.agentId.equals(other.agentId) && this.parameters.equals(other.parameters);
+ }
+}
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamResponse.java
new file mode 100644
index 0000000000..8ef748015d
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ExecuteAgentStreamResponse.java
@@ -0,0 +1,121 @@
+/*
+ * 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.Nonnull;
+import org.opensearch.client.json.JsonpDeserializer;
+import org.opensearch.client.json.JsonpMapper;
+import org.opensearch.client.json.PlainJsonSerializable;
+import org.opensearch.client.util.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ObjectBuilderBase;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: ml.execute_agent_stream.Response
+
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public class ExecuteAgentStreamResponse
+ implements
+ PlainJsonSerializable,
+ ToCopyableBuilder {
+
+ // ---------------------------------------------------------------------------------------------
+
+ private ExecuteAgentStreamResponse(Builder builder) {}
+
+ public static ExecuteAgentStreamResponse of(
+ Function> fn
+ ) {
+ return fn.apply(new Builder()).build();
+ }
+
+ /**
+ * Serialize this object to JSON.
+ */
+ @Override
+ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
+ generator.writeStartObject();
+ generator.writeEnd();
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ @Override
+ @Nonnull
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ @Nonnull
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link ExecuteAgentStreamResponse}.
+ */
+ public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
+
+ public Builder() {}
+
+ private Builder(ExecuteAgentStreamResponse o) {}
+
+ private Builder(Builder o) {}
+
+ @Override
+ @Nonnull
+ public Builder copy() {
+ return new Builder(this);
+ }
+
+ /**
+ * Builds a {@link ExecuteAgentStreamResponse}.
+ *
+ * @throws NullPointerException if some of the required fields are null.
+ */
+ @Override
+ @Nonnull
+ public ExecuteAgentStreamResponse build() {
+ _checkSingleUse();
+
+ return new ExecuteAgentStreamResponse(this);
+ }
+ }
+
+ // ---------------------------------------------------------------------------------------------
+
+ /**
+ * Singleton instance for {@link ExecuteAgentStreamResponse}.
+ */
+ public static final ExecuteAgentStreamResponse _INSTANCE = builder().build();
+
+ public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(
+ ExecuteAgentStreamResponse._INSTANCE
+ );
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || this.getClass() != o.getClass()) return false;
+ return true;
+ }
+}
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 bb7616ad2e..2044d9b608 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
@@ -335,6 +335,27 @@ public final CompletableFuture executeAgent(
return executeAgent(fn.apply(new ExecuteAgentRequest.Builder()).build());
}
+ // ----- Endpoint: ml.execute_agent_stream
+
+ /**
+ * Execute an agent in streaming mode.
+ */
+ public CompletableFuture executeAgentStream(ExecuteAgentStreamRequest request) throws IOException,
+ OpenSearchException {
+ return this.transport.performRequestAsync(request, ExecuteAgentStreamRequest._ENDPOINT, this.transportOptions);
+ }
+
+ /**
+ * Execute an agent in streaming mode.
+ *
+ * @param fn a function that initializes a builder to create the {@link ExecuteAgentStreamRequest}
+ */
+ public final CompletableFuture executeAgentStream(
+ Function> fn
+ ) throws IOException, OpenSearchException {
+ return executeAgentStream(fn.apply(new ExecuteAgentStreamRequest.Builder()).build());
+ }
+
// ----- Endpoint: ml.get_agent
/**
@@ -733,6 +754,27 @@ public final CompletableFuture loadModel(Function predictModelStream(PredictModelStreamRequest request) throws IOException,
+ OpenSearchException {
+ return this.transport.performRequestAsync(request, PredictModelStreamRequest._ENDPOINT, this.transportOptions);
+ }
+
+ /**
+ * Predicts a model in streaming mode.
+ *
+ * @param fn a function that initializes a builder to create the {@link PredictModelStreamRequest}
+ */
+ public final CompletableFuture predictModelStream(
+ Function> fn
+ ) throws IOException, OpenSearchException {
+ return predictModelStream(fn.apply(new PredictModelStreamRequest.Builder()).build());
+ }
+
// ----- Endpoint: ml.register_agents
/**
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 84927903c5..c886743f58 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
@@ -318,6 +318,26 @@ public final ExecuteAgentResponse executeAgent(Function> fn
+ ) throws IOException, OpenSearchException {
+ return executeAgentStream(fn.apply(new ExecuteAgentStreamRequest.Builder()).build());
+ }
+
// ----- Endpoint: ml.get_agent
/**
@@ -706,6 +726,26 @@ public final LoadModelResponse loadModel(Function> fn
+ ) throws IOException, OpenSearchException {
+ return predictModelStream(fn.apply(new PredictModelStreamRequest.Builder()).build());
+ }
+
// ----- Endpoint: ml.register_agents
/**
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Output.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Output.java
index 4ba3990e32..e41154e553 100644
--- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Output.java
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Output.java
@@ -43,6 +43,9 @@ public class Output implements PlainJsonSerializable, ToCopyableBuilder data;
+ @Nullable
+ private final DataAsMap dataAsMap;
+
@Nullable
private final String dataType;
@@ -59,7 +62,8 @@ public class Output implements PlainJsonSerializable, ToCopyableBuilder data() {
return this.data;
}
+ /**
+ * API name: {@code dataAsMap}
+ */
+ @Nullable
+ public final DataAsMap dataAsMap() {
+ return this.dataAsMap;
+ }
+
/**
* API name: {@code data_type}
*/
@@ -140,12 +152,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.byteBuffer.serialize(generator, mapper);
}
- generator.writeKey("data");
- generator.writeStartArray();
- for (Double item0 : this.data) {
- generator.write(item0);
+ if (ApiTypeHelper.isDefined(this.data)) {
+ generator.writeKey("data");
+ generator.writeStartArray();
+ for (Double item0 : this.data) {
+ generator.write(item0);
+ }
+ generator.writeEnd();
+ }
+
+ if (this.dataAsMap != null) {
+ generator.writeKey("dataAsMap");
+ this.dataAsMap.serialize(generator, mapper);
}
- generator.writeEnd();
if (this.dataType != null) {
generator.writeKey("data_type");
@@ -191,8 +210,11 @@ public static Builder builder() {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder {
@Nullable
private ByteBuffer byteBuffer;
+ @Nullable
private List data;
@Nullable
+ private DataAsMap dataAsMap;
+ @Nullable
private String dataType;
@Nullable
private String name;
@@ -206,6 +228,7 @@ public Builder() {}
private Builder(Output o) {
this.byteBuffer = o.byteBuffer;
this.data = _listCopy(o.data);
+ this.dataAsMap = o.dataAsMap;
this.dataType = o.dataType;
this.name = o.name;
this.result = o.result;
@@ -215,6 +238,7 @@ private Builder(Output o) {
private Builder(Builder o) {
this.byteBuffer = o.byteBuffer;
this.data = _listCopy(o.data);
+ this.dataAsMap = o.dataAsMap;
this.dataType = o.dataType;
this.name = o.name;
this.result = o.result;
@@ -245,7 +269,7 @@ public final Builder byteBuffer(Function
* Adds all elements of list to data.
@@ -258,7 +282,7 @@ public final Builder data(List list) {
}
/**
- * Required - API name: {@code data}
+ * API name: {@code data}
*
*
* Adds one or more values to data.
@@ -270,6 +294,23 @@ public final Builder data(Double value, Double... values) {
return this;
}
+ /**
+ * API name: {@code dataAsMap}
+ */
+ @Nonnull
+ public final Builder dataAsMap(@Nullable DataAsMap value) {
+ this.dataAsMap = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code dataAsMap}
+ */
+ @Nonnull
+ public final Builder dataAsMap(Function> fn) {
+ return dataAsMap(fn.apply(new DataAsMap.Builder()).build());
+ }
+
/**
* API name: {@code data_type}
*/
@@ -356,6 +397,7 @@ public Output build() {
protected static void setupOutputDeserializer(ObjectDeserializer op) {
op.add(Builder::byteBuffer, ByteBuffer._DESERIALIZER, "byte_buffer");
op.add(Builder::data, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "data");
+ op.add(Builder::dataAsMap, DataAsMap._DESERIALIZER, "dataAsMap");
op.add(Builder::dataType, JsonpDeserializer.stringDeserializer(), "data_type");
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(Builder::result, JsonpDeserializer.stringDeserializer(), "result");
@@ -366,7 +408,8 @@ protected static void setupOutputDeserializer(ObjectDeserializer
public int hashCode() {
int result = 17;
result = 31 * result + Objects.hashCode(this.byteBuffer);
- result = 31 * result + this.data.hashCode();
+ result = 31 * result + Objects.hashCode(this.data);
+ result = 31 * result + Objects.hashCode(this.dataAsMap);
result = 31 * result + Objects.hashCode(this.dataType);
result = 31 * result + Objects.hashCode(this.name);
result = 31 * result + Objects.hashCode(this.result);
@@ -380,7 +423,8 @@ public boolean equals(Object o) {
if (o == null || this.getClass() != o.getClass()) return false;
Output other = (Output) o;
return Objects.equals(this.byteBuffer, other.byteBuffer)
- && this.data.equals(other.data)
+ && Objects.equals(this.data, other.data)
+ && Objects.equals(this.dataAsMap, other.dataAsMap)
&& Objects.equals(this.dataType, other.dataType)
&& Objects.equals(this.name, other.name)
&& Objects.equals(this.result, other.result)
diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamRequest.java
new file mode 100644
index 0000000000..ed3f164fd1
--- /dev/null
+++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamRequest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.Nonnull;
+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.CopyableBuilder;
+import org.opensearch.client.util.ObjectBuilder;
+import org.opensearch.client.util.ToCopyableBuilder;
+
+// typedef: ml.predict_model_stream.Request
+
+/**
+ * Predicts a model in streaming mode.
+ */
+@JsonpDeserializable
+@Generated("org.opensearch.client.codegen.CodeGenerator")
+public final class PredictModelStreamRequest extends RequestBase
+ implements
+ PlainJsonSerializable,
+ ToCopyableBuilder {
+
+ @Nonnull
+ private final String modelId;
+
+ @Nonnull
+ private final Map parameters;
+
+ // ---------------------------------------------------------------------------------------------
+
+ private PredictModelStreamRequest(Builder builder) {
+ super(builder);
+ this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId");
+ this.parameters = ApiTypeHelper.unmodifiableRequired(builder.parameters, this, "parameters");
+ }
+
+ public static PredictModelStreamRequest of(Function