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/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 dc52333065..28bc5185ff 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 @@ -461,6 +461,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.execute_tool /** @@ -921,6 +942,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 f8dbb0098d..a2c629f176 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 @@ -442,6 +442,26 @@ public final ExecuteAgentResponse executeAgent(Function> fn + ) throws IOException, OpenSearchException { + return executeAgentStream(fn.apply(new ExecuteAgentStreamRequest.Builder()).build()); + } + // ----- Endpoint: ml.execute_tool /** @@ -889,6 +909,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 0a8793c5b3..dec0a727f8 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 MlResultDataType dataType; @@ -60,6 +63,7 @@ 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} */ @@ -149,6 +161,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.dataAsMap != null) { + generator.writeKey("dataAsMap"); + this.dataAsMap.serialize(generator, mapper); + } + if (this.dataType != null) { generator.writeKey("data_type"); this.dataType.serialize(generator, mapper); @@ -196,6 +213,8 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder @Nullable private List data; @Nullable + private DataAsMap dataAsMap; + @Nullable private MlResultDataType dataType; @Nullable private String name; @@ -209,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; @@ -218,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; @@ -273,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} */ @@ -359,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, MlResultDataType._DESERIALIZER, "data_type"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::result, JsonpDeserializer.stringDeserializer(), "result"); @@ -370,6 +409,7 @@ public int hashCode() { int result = 17; result = 31 * result + Objects.hashCode(this.byteBuffer); 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); @@ -384,6 +424,7 @@ public boolean equals(Object o) { Output other = (Output) o; return Objects.equals(this.byteBuffer, other.byteBuffer) && 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> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * 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 PredictModelStreamRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder + implements + CopyableBuilder { + private String modelId; + private Map parameters; + + public Builder() {} + + private Builder(PredictModelStreamRequest o) { + super(o); + this.modelId = o.modelId; + this.parameters = _mapCopy(o.parameters); + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + 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 model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = 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 PredictModelStreamRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PredictModelStreamRequest build() { + _checkSingleUse(); + + return new PredictModelStreamRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PredictModelStreamRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PredictModelStreamRequest::setupPredictModelStreamRequestDeserializer + ); + + protected static void setupPredictModelStreamRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.predict_model_stream}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_predict/stream"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + PredictModelStreamResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.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; + PredictModelStreamRequest other = (PredictModelStreamRequest) o; + return this.modelId.equals(other.modelId) && this.parameters.equals(other.parameters); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamResponse.java new file mode 100644 index 0000000000..d72fd39b2d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictModelStreamResponse.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.predict_model_stream.Response + +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PredictModelStreamResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private PredictModelStreamResponse(Builder builder) {} + + public static PredictModelStreamResponse 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 PredictModelStreamResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + + public Builder() {} + + private Builder(PredictModelStreamResponse o) {} + + private Builder(Builder o) {} + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Builds a {@link PredictModelStreamResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PredictModelStreamResponse build() { + _checkSingleUse(); + + return new PredictModelStreamResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Singleton instance for {@link PredictModelStreamResponse}. + */ + public static final PredictModelStreamResponse _INSTANCE = builder().build(); + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( + PredictModelStreamResponse._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/search_relevance/DeleteExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteExperimentsResponse.java index 1272be8356..29e8ccd3f1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteExperimentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteExperimentsResponse.java @@ -36,43 +36,36 @@ package org.opensearch.client.opensearch.search_relevance; -import jakarta.json.stream.JsonGenerator; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; 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: search_relevance.delete_experiments.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class DeleteExperimentsResponse +public class DeleteExperimentsResponse extends WriteResponseBase implements - PlainJsonSerializable, ToCopyableBuilder { // --------------------------------------------------------------------------------------------- - private DeleteExperimentsResponse(Builder builder) {} + private DeleteExperimentsResponse(Builder builder) { + super(builder); + } public static DeleteExperimentsResponse 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 @@ -89,13 +82,19 @@ public static Builder builder() { /** * Builder for {@link DeleteExperimentsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { public Builder() {} - private Builder(DeleteExperimentsResponse o) {} + private Builder(DeleteExperimentsResponse o) { + super(o); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + } @Override @Nonnull @@ -103,6 +102,12 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Builds a {@link DeleteExperimentsResponse}. * @@ -120,22 +125,28 @@ public DeleteExperimentsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link DeleteExperimentsResponse}. + * Json deserializer for {@link DeleteExperimentsResponse} */ - public static final DeleteExperimentsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - DeleteExperimentsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteExperimentsResponse::setupDeleteExperimentsResponseDeserializer ); + protected static void setupDeleteExperimentsResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteJudgmentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteJudgmentsResponse.java index ef7c412ea5..99a08729ef 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteJudgmentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteJudgmentsResponse.java @@ -36,43 +36,36 @@ package org.opensearch.client.opensearch.search_relevance; -import jakarta.json.stream.JsonGenerator; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; 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: search_relevance.delete_judgments.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class DeleteJudgmentsResponse +public class DeleteJudgmentsResponse extends WriteResponseBase implements - PlainJsonSerializable, ToCopyableBuilder { // --------------------------------------------------------------------------------------------- - private DeleteJudgmentsResponse(Builder builder) {} + private DeleteJudgmentsResponse(Builder builder) { + super(builder); + } public static DeleteJudgmentsResponse 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 @@ -89,13 +82,19 @@ public static Builder builder() { /** * Builder for {@link DeleteJudgmentsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { public Builder() {} - private Builder(DeleteJudgmentsResponse o) {} + private Builder(DeleteJudgmentsResponse o) { + super(o); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + } @Override @Nonnull @@ -103,6 +102,12 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Builds a {@link DeleteJudgmentsResponse}. * @@ -120,22 +125,28 @@ public DeleteJudgmentsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link DeleteJudgmentsResponse}. + * Json deserializer for {@link DeleteJudgmentsResponse} */ - public static final DeleteJudgmentsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - DeleteJudgmentsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteJudgmentsResponse::setupDeleteJudgmentsResponseDeserializer ); + protected static void setupDeleteJudgmentsResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteQuerySetsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteQuerySetsResponse.java index e10c9adfbc..0bf4b769c6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteQuerySetsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteQuerySetsResponse.java @@ -36,43 +36,36 @@ package org.opensearch.client.opensearch.search_relevance; -import jakarta.json.stream.JsonGenerator; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; 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: search_relevance.delete_query_sets.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class DeleteQuerySetsResponse +public class DeleteQuerySetsResponse extends WriteResponseBase implements - PlainJsonSerializable, ToCopyableBuilder { // --------------------------------------------------------------------------------------------- - private DeleteQuerySetsResponse(Builder builder) {} + private DeleteQuerySetsResponse(Builder builder) { + super(builder); + } public static DeleteQuerySetsResponse 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 @@ -89,13 +82,19 @@ public static Builder builder() { /** * Builder for {@link DeleteQuerySetsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { public Builder() {} - private Builder(DeleteQuerySetsResponse o) {} + private Builder(DeleteQuerySetsResponse o) { + super(o); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + } @Override @Nonnull @@ -103,6 +102,12 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Builds a {@link DeleteQuerySetsResponse}. * @@ -120,22 +125,28 @@ public DeleteQuerySetsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link DeleteQuerySetsResponse}. + * Json deserializer for {@link DeleteQuerySetsResponse} */ - public static final DeleteQuerySetsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - DeleteQuerySetsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteQuerySetsResponse::setupDeleteQuerySetsResponseDeserializer ); + protected static void setupDeleteQuerySetsResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsRequest.java new file mode 100644 index 0000000000..a6e7a16786 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsRequest.java @@ -0,0 +1,202 @@ +/* + * 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.search_relevance; + +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.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: search_relevance.delete_scheduled_experiments.Request + +/** + * Deletes a specified scheduled experiment. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class DeleteScheduledExperimentsRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final String experimentId; + + // --------------------------------------------------------------------------------------------- + + private DeleteScheduledExperimentsRequest(Builder builder) { + super(builder); + this.experimentId = ApiTypeHelper.requireNonNull(builder.experimentId, this, "experimentId"); + } + + public static DeleteScheduledExperimentsRequest of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The experiment id + *

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

+ */ + @Nonnull + public final String experimentId() { + return this.experimentId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteScheduledExperimentsRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder + implements + CopyableBuilder { + private String experimentId; + + public Builder() {} + + private Builder(DeleteScheduledExperimentsRequest o) { + super(o); + this.experimentId = o.experimentId; + } + + private Builder(Builder o) { + super(o); + this.experimentId = o.experimentId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - The experiment id + *

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

+ */ + @Nonnull + public final Builder experimentId(String value) { + this.experimentId = value; + return this; + } + + /** + * Builds a {@link DeleteScheduledExperimentsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteScheduledExperimentsRequest build() { + _checkSingleUse(); + + return new DeleteScheduledExperimentsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_relevance.delete_scheduled_experiments}". + */ + public static final Endpoint _ENDPOINT = + new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_search_relevance/experiments/schedule/"); + SimpleEndpoint.pathEncode(request.experimentId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + DeleteScheduledExperimentsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.experimentId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteScheduledExperimentsRequest other = (DeleteScheduledExperimentsRequest) o; + return this.experimentId.equals(other.experimentId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsResponse.java new file mode 100644 index 0000000000..e7b516f831 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteScheduledExperimentsResponse.java @@ -0,0 +1,158 @@ +/* + * 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.search_relevance; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_relevance.delete_scheduled_experiments.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteScheduledExperimentsResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private DeleteScheduledExperimentsResponse(Builder builder) { + super(builder); + } + + public static DeleteScheduledExperimentsResponse of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteScheduledExperimentsResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteScheduledExperimentsResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteScheduledExperimentsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteScheduledExperimentsResponse build() { + _checkSingleUse(); + + return new DeleteScheduledExperimentsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteScheduledExperimentsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteScheduledExperimentsResponse::setupDeleteScheduledExperimentsResponseDeserializer + ); + + protected static void setupDeleteScheduledExperimentsResponseDeserializer( + ObjectDeserializer op + ) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteSearchConfigurationsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteSearchConfigurationsResponse.java index 23d8bfe4f1..e8804d0ce4 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteSearchConfigurationsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/DeleteSearchConfigurationsResponse.java @@ -36,29 +36,31 @@ package org.opensearch.client.opensearch.search_relevance; -import jakarta.json.stream.JsonGenerator; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; 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: search_relevance.delete_search_configurations.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class DeleteSearchConfigurationsResponse +public class DeleteSearchConfigurationsResponse extends WriteResponseBase implements - PlainJsonSerializable, ToCopyableBuilder { // --------------------------------------------------------------------------------------------- - private DeleteSearchConfigurationsResponse(Builder builder) {} + private DeleteSearchConfigurationsResponse(Builder builder) { + super(builder); + } public static DeleteSearchConfigurationsResponse of( Function> fn @@ -66,15 +68,6 @@ public static DeleteSearchConfigurationsResponse of( return fn.apply(new Builder()).build(); } - /** - * Serialize this object to JSON. - */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } - // --------------------------------------------------------------------------------------------- @Override @@ -91,13 +84,19 @@ public static Builder builder() { /** * Builder for {@link DeleteSearchConfigurationsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { public Builder() {} - private Builder(DeleteSearchConfigurationsResponse o) {} + private Builder(DeleteSearchConfigurationsResponse o) { + super(o); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + } @Override @Nonnull @@ -105,6 +104,12 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Builds a {@link DeleteSearchConfigurationsResponse}. * @@ -122,22 +127,30 @@ public DeleteSearchConfigurationsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link DeleteSearchConfigurationsResponse}. + * Json deserializer for {@link DeleteSearchConfigurationsResponse} */ - public static final DeleteSearchConfigurationsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - DeleteSearchConfigurationsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteSearchConfigurationsResponse::setupDeleteSearchConfigurationsResponseDeserializer ); + protected static void setupDeleteSearchConfigurationsResponseDeserializer( + ObjectDeserializer op + ) { + setupWriteResponseBaseDeserializer(op); + } + @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; return true; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsRequest.java index b1e82bc12a..c479314d19 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsRequest.java @@ -43,6 +43,7 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -161,7 +162,7 @@ public GetExperimentsRequest build() { /** * Endpoint "{@code search_relevance.get_experiments}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> "GET", // Request path @@ -195,6 +196,16 @@ public GetExperimentsRequest build() { GetExperimentsResponse._DESERIALIZER ); + /** + * Create an "{@code search_relevance.get_experiments}" endpoint. + */ + public static < + TDocument> + Endpoint, ErrorResponse> + createSearchRelevanceGetExperimentsEndpoint(JsonpDeserializer tDocumentDeserializer) { + return _ENDPOINT.withResponseDeserializer(GetExperimentsResponse.createGetExperimentsResponseDeserializer(tDocumentDeserializer)); + } + @Override public int hashCode() { int result = 17; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsResponse.java index e415227d9f..7d7edfdab9 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetExperimentsResponse.java @@ -44,13 +44,23 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; 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.NamedDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ClusterStatistics; +import org.opensearch.client.opensearch._types.PhaseTook; +import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch._types.aggregations.Aggregate; +import org.opensearch.client.opensearch.core.search.HitsMetadata; +import org.opensearch.client.opensearch.core.search.ProcessorExecutionDetail; +import org.opensearch.client.opensearch.core.search.Profile; +import org.opensearch.client.opensearch.core.search.Suggest; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; @@ -61,174 +71,184 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetExperimentsResponse +public class GetExperimentsResponse implements PlainJsonSerializable, - ToCopyableBuilder { + ToCopyableBuilder, GetExperimentsResponse> { @Nonnull - private final Map hits; + private final Map aggregations; @Nullable - private final String id; + private final ClusterStatistics clusters; @Nonnull - private final List judgmentList; + private final HitsMetadata hits; @Nullable - private final String querySetId; + private final Integer numReducePhases; - @Nonnull - private final Map results; + @Nullable + private final PhaseTook phaseTook; - @Nonnull - private final List searchConfigurationList; + @Nullable + private final String pitId; @Nonnull - private final Map shards; + private final List processorResults; @Nullable - private final Integer size; + private final Profile profile; @Nullable - private final String status; + private final String scrollId; - @Nullable - private final Boolean timedOut; + @Nonnull + private final ShardStatistics shards; - @Nullable - private final String timestamp; + @Nonnull + private final Map>> suggest; @Nullable - private final Integer took; + private final Boolean terminatedEarly; - @Nullable - private final String type; + private final boolean timedOut; + + private final long took; // --------------------------------------------------------------------------------------------- - private GetExperimentsResponse(Builder builder) { - this.hits = ApiTypeHelper.unmodifiable(builder.hits); - this.id = builder.id; - this.judgmentList = ApiTypeHelper.unmodifiable(builder.judgmentList); - this.querySetId = builder.querySetId; - this.results = ApiTypeHelper.unmodifiable(builder.results); - this.searchConfigurationList = ApiTypeHelper.unmodifiable(builder.searchConfigurationList); - this.shards = ApiTypeHelper.unmodifiable(builder.shards); - this.size = builder.size; - this.status = builder.status; - this.timedOut = builder.timedOut; - this.timestamp = builder.timestamp; - this.took = builder.took; - this.type = builder.type; + private GetExperimentsResponse(Builder builder) { + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.clusters = builder.clusters; + this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.numReducePhases = builder.numReducePhases; + this.phaseTook = builder.phaseTook; + this.pitId = builder.pitId; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + this.profile = builder.profile; + this.scrollId = builder.scrollId; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.suggest = ApiTypeHelper.unmodifiable(builder.suggest); + this.terminatedEarly = builder.terminatedEarly; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); } - public static GetExperimentsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); + public static GetExperimentsResponse of( + Function, ObjectBuilder>> fn + ) { + return fn.apply(new Builder<>()).build(); } /** - * API name: {@code hits} + * API name: {@code aggregations} */ @Nonnull - public final Map hits() { - return this.hits; + public final Map aggregations() { + return this.aggregations; } /** - * API name: {@code id} + * API name: {@code _clusters} */ @Nullable - public final String id() { - return this.id; + public final ClusterStatistics clusters() { + return this.clusters; } /** - * API name: {@code judgmentList} + * Required - API name: {@code hits} */ @Nonnull - public final List judgmentList() { - return this.judgmentList; + public final HitsMetadata hits() { + return this.hits; } /** - * API name: {@code querySetId} + * API name: {@code num_reduce_phases} */ @Nullable - public final String querySetId() { - return this.querySetId; + public final Integer numReducePhases() { + return this.numReducePhases; } /** - * API name: {@code results} + * API name: {@code phase_took} */ - @Nonnull - public final Map results() { - return this.results; + @Nullable + public final PhaseTook phaseTook() { + return this.phaseTook; } /** - * API name: {@code searchConfigurationList} + * API name: {@code pit_id} */ - @Nonnull - public final List searchConfigurationList() { - return this.searchConfigurationList; + @Nullable + public final String pitId() { + return this.pitId; } /** - * API name: {@code _shards} + * API name: {@code processor_results} */ @Nonnull - public final Map shards() { - return this.shards; + public final List processorResults() { + return this.processorResults; } /** - * API name: {@code size} + * API name: {@code profile} */ @Nullable - public final Integer size() { - return this.size; + public final Profile profile() { + return this.profile; } /** - * API name: {@code status} + * API name: {@code _scroll_id} */ @Nullable - public final String status() { - return this.status; + public final String scrollId() { + return this.scrollId; } /** - * API name: {@code timed_out} + * Required - API name: {@code _shards} */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; + @Nonnull + public final ShardStatistics shards() { + return this.shards; } /** - * API name: {@code timestamp} + * API name: {@code suggest} */ - @Nullable - public final String timestamp() { - return this.timestamp; + @Nonnull + public final Map>> suggest() { + return this.suggest; } /** - * API name: {@code took} + * API name: {@code terminated_early} */ @Nullable - public final Integer took() { - return this.took; + public final Boolean terminatedEarly() { + return this.terminatedEarly; } /** - * API name: {@code type} + * Required - API name: {@code timed_out} */ - @Nullable - public final String type() { - return this.type; + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { + return this.took; } /** @@ -242,378 +262,399 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.hits)) { - generator.writeKey("hits"); - generator.writeStartObject(); - for (Map.Entry item0 : this.hits.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + ExternallyTaggedUnion.serializeTypedKeys(this.aggregations, generator, mapper); } - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.judgmentList)) { - generator.writeKey("judgmentList"); - generator.writeStartArray(); - for (String item0 : this.judgmentList) { - generator.write(item0); - } - generator.writeEnd(); + generator.writeKey("hits"); + this.hits.serialize(generator, mapper); + + if (this.numReducePhases != null) { + generator.writeKey("num_reduce_phases"); + generator.write(this.numReducePhases); } - if (this.querySetId != null) { - generator.writeKey("querySetId"); - generator.write(this.querySetId); + if (this.phaseTook != null) { + generator.writeKey("phase_took"); + this.phaseTook.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.results)) { - generator.writeKey("results"); - generator.writeStartObject(); - for (Map.Entry item0 : this.results.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (this.pitId != null) { + generator.writeKey("pit_id"); + generator.write(this.pitId); } - if (ApiTypeHelper.isDefined(this.searchConfigurationList)) { - generator.writeKey("searchConfigurationList"); + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); generator.writeStartArray(); - for (String item0 : this.searchConfigurationList) { - generator.write(item0); + for (ProcessorExecutionDetail item0 : this.processorResults) { + item0.serialize(generator, mapper); } generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("_shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (this.profile != null) { + generator.writeKey("profile"); + this.profile.serialize(generator, mapper); } - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); + if (this.scrollId != null) { + generator.writeKey("_scroll_id"); + generator.write(this.scrollId); } - if (this.status != null) { - generator.writeKey("status"); - generator.write(this.status); - } + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); + if (ApiTypeHelper.isDefined(this.suggest)) { + generator.writeKey("suggest"); + ExternallyTaggedUnion.serializeTypedKeysArray(this.suggest, generator, mapper); } - if (this.timestamp != null) { - generator.writeKey("timestamp"); - generator.write(this.timestamp); + if (this.terminatedEarly != null) { + generator.writeKey("terminated_early"); + generator.write(this.terminatedEarly); } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - } + generator.writeKey("timed_out"); + generator.write(this.timedOut); - if (this.type != null) { - generator.writeKey("type"); - generator.write(this.type); - } + generator.writeKey("took"); + generator.write(this.took); } // --------------------------------------------------------------------------------------------- @Override @Nonnull - public Builder toBuilder() { - return new Builder(this); + public Builder toBuilder() { + return new Builder<>(this); } @Nonnull - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new Builder<>(); } /** * Builder for {@link GetExperimentsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder, GetExperimentsResponse> { @Nullable - private Map hits; + private Map aggregations; @Nullable - private String id; + private ClusterStatistics clusters; + private HitsMetadata hits; @Nullable - private List judgmentList; + private Integer numReducePhases; @Nullable - private String querySetId; + private PhaseTook phaseTook; @Nullable - private Map results; + private String pitId; @Nullable - private List searchConfigurationList; + private List processorResults; @Nullable - private Map shards; + private Profile profile; @Nullable - private Integer size; + private String scrollId; + private ShardStatistics shards; @Nullable - private String status; + private Map>> suggest; @Nullable + private Boolean terminatedEarly; private Boolean timedOut; - @Nullable - private String timestamp; - @Nullable - private Integer took; - @Nullable - private String type; + private Long took; public Builder() {} - private Builder(GetExperimentsResponse o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.judgmentList = _listCopy(o.judgmentList); - this.querySetId = o.querySetId; - this.results = _mapCopy(o.results); - this.searchConfigurationList = _listCopy(o.searchConfigurationList); - this.shards = _mapCopy(o.shards); - this.size = o.size; - this.status = o.status; + private Builder(GetExperimentsResponse o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; - this.type = o.type; - } - - private Builder(Builder o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.judgmentList = _listCopy(o.judgmentList); - this.querySetId = o.querySetId; - this.results = _mapCopy(o.results); - this.searchConfigurationList = _listCopy(o.searchConfigurationList); - this.shards = _mapCopy(o.shards); - this.size = o.size; - this.status = o.status; + } + + private Builder(Builder o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; - this.type = o.type; } @Override @Nonnull - public Builder copy() { - return new Builder(this); + public Builder copy() { + return new Builder<>(this); } /** - * API name: {@code hits} + * API name: {@code aggregations} * *

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

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

- * Adds an entry to hits. + * Adds an entry to aggregations. *

*/ @Nonnull - public final Builder hits(String key, JsonData value) { - this.hits = _mapPut(this.hits, key, value); + public final Builder aggregations(String key, Aggregate value) { + this.aggregations = _mapPut(this.aggregations, key, value); return this; } /** - * API name: {@code id} + * API name: {@code aggregations} + * + *

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

*/ @Nonnull - public final Builder id(@Nullable String value) { - this.id = value; - return this; + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregate.Builder()).build()); } /** - * API name: {@code judgmentList} - * - *

- * Adds all elements of list to judgmentList. - *

+ * API name: {@code _clusters} */ @Nonnull - public final Builder judgmentList(List list) { - this.judgmentList = _listAddAll(this.judgmentList, list); + public final Builder clusters(@Nullable ClusterStatistics value) { + this.clusters = value; return this; } /** - * API name: {@code judgmentList} - * - *

- * Adds one or more values to judgmentList. - *

+ * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(Function> fn) { + return clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code hits} */ @Nonnull - public final Builder judgmentList(String value, String... values) { - this.judgmentList = _listAdd(this.judgmentList, value, values); + public final Builder hits(HitsMetadata value) { + this.hits = value; return this; } /** - * API name: {@code querySetId} + * Required - API name: {@code hits} */ @Nonnull - public final Builder querySetId(@Nullable String value) { - this.querySetId = value; + public final Builder hits(Function, ObjectBuilder>> fn) { + return hits(fn.apply(new HitsMetadata.Builder()).build()); + } + + /** + * API name: {@code num_reduce_phases} + */ + @Nonnull + public final Builder numReducePhases(@Nullable Integer value) { + this.numReducePhases = value; return this; } /** - * API name: {@code results} - * - *

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

+ * API name: {@code phase_took} */ @Nonnull - public final Builder results(Map map) { - this.results = _mapPutAll(this.results, map); + public final Builder phaseTook(@Nullable PhaseTook value) { + this.phaseTook = value; return this; } /** - * API name: {@code results} - * - *

- * Adds an entry to results. - *

+ * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(Function> fn) { + return phaseTook(fn.apply(new PhaseTook.Builder()).build()); + } + + /** + * API name: {@code pit_id} */ @Nonnull - public final Builder results(String key, JsonData value) { - this.results = _mapPut(this.results, key, value); + public final Builder pitId(@Nullable String value) { + this.pitId = value; return this; } /** - * API name: {@code searchConfigurationList} + * API name: {@code processor_results} * *

- * Adds all elements of list to searchConfigurationList. + * Adds all elements of list to processorResults. *

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

- * Adds one or more values to searchConfigurationList. + * Adds one or more values to processorResults. *

*/ @Nonnull - public final Builder searchConfigurationList(String value, String... values) { - this.searchConfigurationList = _listAdd(this.searchConfigurationList, value, values); + public final Builder processorResults(ProcessorExecutionDetail value, ProcessorExecutionDetail... values) { + this.processorResults = _listAdd(this.processorResults, value, values); return this; } /** - * API name: {@code _shards} + * API name: {@code processor_results} * *

- * Adds all elements of map to shards. + * Adds a value to processorResults using a builder lambda. *

*/ @Nonnull - public final Builder shards(Map map) { - this.shards = _mapPutAll(this.shards, map); + public final Builder processorResults( + Function> fn + ) { + return processorResults(fn.apply(new ProcessorExecutionDetail.Builder()).build()); + } + + /** + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(@Nullable Profile value) { + this.profile = value; return this; } /** - * API name: {@code _shards} - * - *

- * Adds an entry to shards. - *

+ * API name: {@code profile} + */ + @Nonnull + public final Builder profile(Function> fn) { + return profile(fn.apply(new Profile.Builder()).build()); + } + + /** + * API name: {@code _scroll_id} */ @Nonnull - public final Builder shards(String key, JsonData value) { - this.shards = _mapPut(this.shards, key, value); + public final Builder scrollId(@Nullable String value) { + this.scrollId = value; return this; } /** - * API name: {@code size} + * Required - API name: {@code _shards} */ @Nonnull - public final Builder size(@Nullable Integer value) { - this.size = value; + public final Builder shards(ShardStatistics value) { + this.shards = value; return this; } /** - * API name: {@code status} + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code suggest} + * + *

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

*/ @Nonnull - public final Builder status(@Nullable String value) { - this.status = value; + public final Builder suggest(Map>> map) { + this.suggest = _mapPutAll(this.suggest, map); return this; } /** - * API name: {@code timed_out} + * API name: {@code suggest} + * + *

+ * Adds an entry to suggest. + *

*/ @Nonnull - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; + public final Builder suggest(String key, List> value) { + this.suggest = _mapPut(this.suggest, key, value); return this; } /** - * API name: {@code timestamp} + * API name: {@code terminated_early} */ @Nonnull - public final Builder timestamp(@Nullable String value) { - this.timestamp = value; + public final Builder terminatedEarly(@Nullable Boolean value) { + this.terminatedEarly = value; return this; } /** - * API name: {@code took} + * Required - API name: {@code timed_out} */ @Nonnull - public final Builder took(@Nullable Integer value) { - this.took = value; + public final Builder timedOut(boolean value) { + this.timedOut = value; return this; } /** - * API name: {@code type} + * Required - API name: {@code took} */ @Nonnull - public final Builder type(@Nullable String value) { - this.type = value; + public final Builder took(long value) { + this.took = value; return this; } @@ -624,59 +665,75 @@ public final Builder type(@Nullable String value) { */ @Override @Nonnull - public GetExperimentsResponse build() { + public GetExperimentsResponse build() { _checkSingleUse(); - return new GetExperimentsResponse(this); + return new GetExperimentsResponse<>(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link GetExperimentsResponse} + * Create a JSON deserializer for GetExperimentsResponse. + */ + public static JsonpDeserializer> createGetExperimentsResponseDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + Builder::new, + op -> GetExperimentsResponse.setupGetExperimentsResponseDeserializer(op, tDocumentDeserializer) + ); + } + + /** + * Json deserializer for {@link GetExperimentsResponse} based on named deserializers provided by the calling {@code JsonMapper}. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetExperimentsResponse::setupGetExperimentsResponseDeserializer + public static final JsonpDeserializer> _DESERIALIZER = createGetExperimentsResponseDeserializer( + new NamedDeserializer<>("org.opensearch.client:Deserializer:search_relevance.get_experiments.TDocument") ); - protected static void setupGetExperimentsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::hits, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "hits"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::judgmentList, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "judgmentList"); - op.add(Builder::querySetId, JsonpDeserializer.stringDeserializer(), "querySetId"); - op.add(Builder::results, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "results"); + protected static void setupGetExperimentsResponseDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + op.add(Builder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations"); + op.add(Builder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); + op.add(Builder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits"); + op.add(Builder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases"); + op.add(Builder::phaseTook, PhaseTook._DESERIALIZER, "phase_took"); + op.add(Builder::pitId, JsonpDeserializer.stringDeserializer(), "pit_id"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(ProcessorExecutionDetail._DESERIALIZER), "processor_results"); + op.add(Builder::profile, Profile._DESERIALIZER, "profile"); + op.add(Builder::scrollId, JsonpDeserializer.stringDeserializer(), "_scroll_id"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add( - Builder::searchConfigurationList, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "searchConfigurationList" + Builder::suggest, + ExternallyTaggedUnion.arrayDeserializer(Suggest.createSuggestDeserializer(JsonData._DESERIALIZER)), + "suggest" ); - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_shards"); - op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); - op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::terminatedEarly, JsonpDeserializer.booleanDeserializer(), "terminated_early"); op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); - op.add(Builder::took, JsonpDeserializer.integerDeserializer(), "took"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); } @Override public int hashCode() { int result = 17; - result = 31 * result + Objects.hashCode(this.hits); - result = 31 * result + Objects.hashCode(this.id); - result = 31 * result + Objects.hashCode(this.judgmentList); - result = 31 * result + Objects.hashCode(this.querySetId); - result = 31 * result + Objects.hashCode(this.results); - result = 31 * result + Objects.hashCode(this.searchConfigurationList); - result = 31 * result + Objects.hashCode(this.shards); - result = 31 * result + Objects.hashCode(this.size); - result = 31 * result + Objects.hashCode(this.status); - result = 31 * result + Objects.hashCode(this.timedOut); - result = 31 * result + Objects.hashCode(this.timestamp); - result = 31 * result + Objects.hashCode(this.took); - result = 31 * result + Objects.hashCode(this.type); + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.clusters); + result = 31 * result + this.hits.hashCode(); + result = 31 * result + Objects.hashCode(this.numReducePhases); + result = 31 * result + Objects.hashCode(this.phaseTook); + result = 31 * result + Objects.hashCode(this.pitId); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.profile); + result = 31 * result + Objects.hashCode(this.scrollId); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.suggest); + result = 31 * result + Objects.hashCode(this.terminatedEarly); + result = 31 * result + Boolean.hashCode(this.timedOut); + result = 31 * result + Long.hashCode(this.took); return result; } @@ -684,19 +741,20 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - GetExperimentsResponse other = (GetExperimentsResponse) o; - return Objects.equals(this.hits, other.hits) - && Objects.equals(this.id, other.id) - && Objects.equals(this.judgmentList, other.judgmentList) - && Objects.equals(this.querySetId, other.querySetId) - && Objects.equals(this.results, other.results) - && Objects.equals(this.searchConfigurationList, other.searchConfigurationList) - && Objects.equals(this.shards, other.shards) - && Objects.equals(this.size, other.size) - && Objects.equals(this.status, other.status) - && Objects.equals(this.timedOut, other.timedOut) - && Objects.equals(this.timestamp, other.timestamp) - && Objects.equals(this.took, other.took) - && Objects.equals(this.type, other.type); + GetExperimentsResponse other = (GetExperimentsResponse) o; + return Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.clusters, other.clusters) + && this.hits.equals(other.hits) + && Objects.equals(this.numReducePhases, other.numReducePhases) + && Objects.equals(this.phaseTook, other.phaseTook) + && Objects.equals(this.pitId, other.pitId) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.profile, other.profile) + && Objects.equals(this.scrollId, other.scrollId) + && this.shards.equals(other.shards) + && Objects.equals(this.suggest, other.suggest) + && Objects.equals(this.terminatedEarly, other.terminatedEarly) + && this.timedOut == other.timedOut + && this.took == other.took; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsRequest.java index 00cc849109..14eaded7a3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsRequest.java @@ -43,6 +43,7 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -159,7 +160,7 @@ public GetJudgmentsRequest build() { /** * Endpoint "{@code search_relevance.get_judgments}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> "GET", // Request path @@ -193,6 +194,16 @@ public GetJudgmentsRequest build() { GetJudgmentsResponse._DESERIALIZER ); + /** + * Create an "{@code search_relevance.get_judgments}" endpoint. + */ + public static < + TDocument> Endpoint, ErrorResponse> createSearchRelevanceGetJudgmentsEndpoint( + JsonpDeserializer tDocumentDeserializer + ) { + return _ENDPOINT.withResponseDeserializer(GetJudgmentsResponse.createGetJudgmentsResponseDeserializer(tDocumentDeserializer)); + } + @Override public int hashCode() { int result = 17; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsResponse.java index 9565a6f474..54eec79956 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetJudgmentsResponse.java @@ -37,19 +37,30 @@ package org.opensearch.client.opensearch.search_relevance; import jakarta.json.stream.JsonGenerator; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; 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.NamedDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ClusterStatistics; +import org.opensearch.client.opensearch._types.PhaseTook; +import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch._types.aggregations.Aggregate; +import org.opensearch.client.opensearch.core.search.HitsMetadata; +import org.opensearch.client.opensearch.core.search.ProcessorExecutionDetail; +import org.opensearch.client.opensearch.core.search.Profile; +import org.opensearch.client.opensearch.core.search.Suggest; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; @@ -60,147 +71,184 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetJudgmentsResponse implements PlainJsonSerializable, ToCopyableBuilder { +public class GetJudgmentsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder, GetJudgmentsResponse> { @Nonnull - private final Map hits; + private final Map aggregations; @Nullable - private final String id; + private final ClusterStatistics clusters; @Nonnull - private final Map judgmentScores; + private final HitsMetadata hits; - @Nonnull - private final Map metadata; + @Nullable + private final Integer numReducePhases; + + @Nullable + private final PhaseTook phaseTook; @Nullable - private final String name; + private final String pitId; @Nonnull - private final Map shards; + private final List processorResults; @Nullable - private final String status; + private final Profile profile; @Nullable - private final Boolean timedOut; + private final String scrollId; - @Nullable - private final String timestamp; + @Nonnull + private final ShardStatistics shards; - @Nullable - private final Integer took; + @Nonnull + private final Map>> suggest; @Nullable - private final String type; + private final Boolean terminatedEarly; + + private final boolean timedOut; + + private final long took; // --------------------------------------------------------------------------------------------- - private GetJudgmentsResponse(Builder builder) { - this.hits = ApiTypeHelper.unmodifiable(builder.hits); - this.id = builder.id; - this.judgmentScores = ApiTypeHelper.unmodifiable(builder.judgmentScores); - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - this.name = builder.name; - this.shards = ApiTypeHelper.unmodifiable(builder.shards); - this.status = builder.status; - this.timedOut = builder.timedOut; - this.timestamp = builder.timestamp; - this.took = builder.took; - this.type = builder.type; + private GetJudgmentsResponse(Builder builder) { + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.clusters = builder.clusters; + this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.numReducePhases = builder.numReducePhases; + this.phaseTook = builder.phaseTook; + this.pitId = builder.pitId; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + this.profile = builder.profile; + this.scrollId = builder.scrollId; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.suggest = ApiTypeHelper.unmodifiable(builder.suggest); + this.terminatedEarly = builder.terminatedEarly; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); } - public static GetJudgmentsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); + public static GetJudgmentsResponse of( + Function, ObjectBuilder>> fn + ) { + return fn.apply(new Builder<>()).build(); } /** - * API name: {@code hits} + * API name: {@code aggregations} */ @Nonnull - public final Map hits() { - return this.hits; + public final Map aggregations() { + return this.aggregations; } /** - * API name: {@code id} + * API name: {@code _clusters} */ @Nullable - public final String id() { - return this.id; + public final ClusterStatistics clusters() { + return this.clusters; } /** - * API name: {@code judgmentScores} + * Required - API name: {@code hits} */ @Nonnull - public final Map judgmentScores() { - return this.judgmentScores; + public final HitsMetadata hits() { + return this.hits; } /** - * API name: {@code metadata} + * API name: {@code num_reduce_phases} */ - @Nonnull - public final Map metadata() { - return this.metadata; + @Nullable + public final Integer numReducePhases() { + return this.numReducePhases; + } + + /** + * API name: {@code phase_took} + */ + @Nullable + public final PhaseTook phaseTook() { + return this.phaseTook; } /** - * API name: {@code name} + * API name: {@code pit_id} */ @Nullable - public final String name() { - return this.name; + public final String pitId() { + return this.pitId; } /** - * API name: {@code _shards} + * API name: {@code processor_results} */ @Nonnull - public final Map shards() { - return this.shards; + public final List processorResults() { + return this.processorResults; } /** - * API name: {@code status} + * API name: {@code profile} */ @Nullable - public final String status() { - return this.status; + public final Profile profile() { + return this.profile; } /** - * API name: {@code timed_out} + * API name: {@code _scroll_id} */ @Nullable - public final Boolean timedOut() { - return this.timedOut; + public final String scrollId() { + return this.scrollId; } /** - * API name: {@code timestamp} + * Required - API name: {@code _shards} */ - @Nullable - public final String timestamp() { - return this.timestamp; + @Nonnull + public final ShardStatistics shards() { + return this.shards; } /** - * API name: {@code took} + * API name: {@code suggest} */ - @Nullable - public final Integer took() { - return this.took; + @Nonnull + public final Map>> suggest() { + return this.suggest; } /** - * API name: {@code type} + * API name: {@code terminated_early} */ @Nullable - public final String type() { - return this.type; + public final Boolean terminatedEarly() { + return this.terminatedEarly; + } + + /** + * Required - API name: {@code timed_out} + */ + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { + return this.took; } /** @@ -214,322 +262,399 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.hits)) { - generator.writeKey("hits"); - generator.writeStartObject(); - for (Map.Entry item0 : this.hits.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + ExternallyTaggedUnion.serializeTypedKeys(this.aggregations, generator, mapper); } - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.judgmentScores)) { - generator.writeKey("judgmentScores"); - generator.writeStartObject(); - for (Map.Entry item0 : this.judgmentScores.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + generator.writeKey("hits"); + this.hits.serialize(generator, mapper); + + if (this.numReducePhases != null) { + generator.writeKey("num_reduce_phases"); + generator.write(this.numReducePhases); } - if (ApiTypeHelper.isDefined(this.metadata)) { - generator.writeKey("metadata"); - generator.writeStartObject(); - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (this.phaseTook != null) { + generator.writeKey("phase_took"); + this.phaseTook.serialize(generator, mapper); } - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); + if (this.pitId != null) { + generator.writeKey("pit_id"); + generator.write(this.pitId); } - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("_shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); + generator.writeStartArray(); + for (ProcessorExecutionDetail item0 : this.processorResults) { + item0.serialize(generator, mapper); } generator.writeEnd(); } - if (this.status != null) { - generator.writeKey("status"); - generator.write(this.status); + if (this.profile != null) { + generator.writeKey("profile"); + this.profile.serialize(generator, mapper); } - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); + if (this.scrollId != null) { + generator.writeKey("_scroll_id"); + generator.write(this.scrollId); } - if (this.timestamp != null) { - generator.writeKey("timestamp"); - generator.write(this.timestamp); - } + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); + if (ApiTypeHelper.isDefined(this.suggest)) { + generator.writeKey("suggest"); + ExternallyTaggedUnion.serializeTypedKeysArray(this.suggest, generator, mapper); } - if (this.type != null) { - generator.writeKey("type"); - generator.write(this.type); + if (this.terminatedEarly != null) { + generator.writeKey("terminated_early"); + generator.write(this.terminatedEarly); } + + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + generator.writeKey("took"); + generator.write(this.took); } // --------------------------------------------------------------------------------------------- @Override @Nonnull - public Builder toBuilder() { - return new Builder(this); + public Builder toBuilder() { + return new Builder<>(this); } @Nonnull - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new Builder<>(); } /** * Builder for {@link GetJudgmentsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder, GetJudgmentsResponse> { @Nullable - private Map hits; + private Map aggregations; @Nullable - private String id; + private ClusterStatistics clusters; + private HitsMetadata hits; @Nullable - private Map judgmentScores; + private Integer numReducePhases; @Nullable - private Map metadata; + private PhaseTook phaseTook; @Nullable - private String name; + private String pitId; @Nullable - private Map shards; + private List processorResults; @Nullable - private String status; + private Profile profile; @Nullable - private Boolean timedOut; + private String scrollId; + private ShardStatistics shards; @Nullable - private String timestamp; + private Map>> suggest; @Nullable - private Integer took; - @Nullable - private String type; + private Boolean terminatedEarly; + private Boolean timedOut; + private Long took; public Builder() {} - private Builder(GetJudgmentsResponse o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.judgmentScores = _mapCopy(o.judgmentScores); - this.metadata = _mapCopy(o.metadata); - this.name = o.name; - this.shards = _mapCopy(o.shards); - this.status = o.status; + private Builder(GetJudgmentsResponse o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; - this.type = o.type; } - private Builder(Builder o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.judgmentScores = _mapCopy(o.judgmentScores); - this.metadata = _mapCopy(o.metadata); - this.name = o.name; - this.shards = _mapCopy(o.shards); - this.status = o.status; + private Builder(Builder o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; - this.type = o.type; } @Override @Nonnull - public Builder copy() { - return new Builder(this); + public Builder copy() { + return new Builder<>(this); } /** - * API name: {@code hits} + * API name: {@code aggregations} * *

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

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

- * Adds an entry to hits. + * Adds an entry to aggregations. *

*/ @Nonnull - public final Builder hits(String key, JsonData value) { - this.hits = _mapPut(this.hits, key, value); + public final Builder aggregations(String key, Aggregate value) { + this.aggregations = _mapPut(this.aggregations, key, value); return this; } /** - * API name: {@code id} + * API name: {@code aggregations} + * + *

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

*/ @Nonnull - public final Builder id(@Nullable String value) { - this.id = value; + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregate.Builder()).build()); + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(@Nullable ClusterStatistics value) { + this.clusters = value; return this; } /** - * API name: {@code judgmentScores} - * - *

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

+ * API name: {@code _clusters} */ @Nonnull - public final Builder judgmentScores(Map map) { - this.judgmentScores = _mapPutAll(this.judgmentScores, map); + public final Builder clusters(Function> fn) { + return clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(HitsMetadata value) { + this.hits = value; + return this; + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(Function, ObjectBuilder>> fn) { + return hits(fn.apply(new HitsMetadata.Builder()).build()); + } + + /** + * API name: {@code num_reduce_phases} + */ + @Nonnull + public final Builder numReducePhases(@Nullable Integer value) { + this.numReducePhases = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(@Nullable PhaseTook value) { + this.phaseTook = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(Function> fn) { + return phaseTook(fn.apply(new PhaseTook.Builder()).build()); + } + + /** + * API name: {@code pit_id} + */ + @Nonnull + public final Builder pitId(@Nullable String value) { + this.pitId = value; return this; } /** - * API name: {@code judgmentScores} + * API name: {@code processor_results} * *

- * Adds an entry to judgmentScores. + * Adds all elements of list to processorResults. *

*/ @Nonnull - public final Builder judgmentScores(String key, JsonData value) { - this.judgmentScores = _mapPut(this.judgmentScores, key, value); + public final Builder processorResults(List list) { + this.processorResults = _listAddAll(this.processorResults, list); return this; } /** - * API name: {@code metadata} + * API name: {@code processor_results} * *

- * Adds all elements of map to metadata. + * Adds one or more values to processorResults. *

*/ @Nonnull - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); + public final Builder processorResults(ProcessorExecutionDetail value, ProcessorExecutionDetail... values) { + this.processorResults = _listAdd(this.processorResults, value, values); return this; } /** - * API name: {@code metadata} + * API name: {@code processor_results} * *

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

*/ @Nonnull - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; + public final Builder processorResults( + Function> fn + ) { + return processorResults(fn.apply(new ProcessorExecutionDetail.Builder()).build()); } /** - * API name: {@code name} + * API name: {@code profile} */ @Nonnull - public final Builder name(@Nullable String value) { - this.name = value; + public final Builder profile(@Nullable Profile value) { + this.profile = value; return this; } /** - * API name: {@code _shards} - * - *

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

+ * API name: {@code profile} + */ + @Nonnull + public final Builder profile(Function> fn) { + return profile(fn.apply(new Profile.Builder()).build()); + } + + /** + * API name: {@code _scroll_id} */ @Nonnull - public final Builder shards(Map map) { - this.shards = _mapPutAll(this.shards, map); + public final Builder scrollId(@Nullable String value) { + this.scrollId = value; return this; } /** - * API name: {@code _shards} - * - *

- * Adds an entry to shards. - *

+ * Required - API name: {@code _shards} */ @Nonnull - public final Builder shards(String key, JsonData value) { - this.shards = _mapPut(this.shards, key, value); + public final Builder shards(ShardStatistics value) { + this.shards = value; return this; } /** - * API name: {@code status} + * Required - API name: {@code _shards} */ @Nonnull - public final Builder status(@Nullable String value) { - this.status = value; + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code suggest} + * + *

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

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

+ * Adds an entry to suggest. + *

*/ @Nonnull - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; + public final Builder suggest(String key, List> value) { + this.suggest = _mapPut(this.suggest, key, value); return this; } /** - * API name: {@code timestamp} + * API name: {@code terminated_early} */ @Nonnull - public final Builder timestamp(@Nullable String value) { - this.timestamp = value; + public final Builder terminatedEarly(@Nullable Boolean value) { + this.terminatedEarly = value; return this; } /** - * API name: {@code took} + * Required - API name: {@code timed_out} */ @Nonnull - public final Builder took(@Nullable Integer value) { - this.took = value; + public final Builder timedOut(boolean value) { + this.timedOut = value; return this; } /** - * API name: {@code type} + * Required - API name: {@code took} */ @Nonnull - public final Builder type(@Nullable String value) { - this.type = value; + public final Builder took(long value) { + this.took = value; return this; } @@ -540,51 +665,75 @@ public final Builder type(@Nullable String value) { */ @Override @Nonnull - public GetJudgmentsResponse build() { + public GetJudgmentsResponse build() { _checkSingleUse(); - return new GetJudgmentsResponse(this); + return new GetJudgmentsResponse<>(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link GetJudgmentsResponse} + * Create a JSON deserializer for GetJudgmentsResponse. + */ + public static JsonpDeserializer> createGetJudgmentsResponseDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + Builder::new, + op -> GetJudgmentsResponse.setupGetJudgmentsResponseDeserializer(op, tDocumentDeserializer) + ); + } + + /** + * Json deserializer for {@link GetJudgmentsResponse} based on named deserializers provided by the calling {@code JsonMapper}. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetJudgmentsResponse::setupGetJudgmentsResponseDeserializer + public static final JsonpDeserializer> _DESERIALIZER = createGetJudgmentsResponseDeserializer( + new NamedDeserializer<>("org.opensearch.client:Deserializer:search_relevance.get_judgments.TDocument") ); - protected static void setupGetJudgmentsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::hits, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "hits"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::judgmentScores, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "judgmentScores"); - op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_shards"); - op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + protected static void setupGetJudgmentsResponseDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + op.add(Builder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations"); + op.add(Builder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); + op.add(Builder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits"); + op.add(Builder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases"); + op.add(Builder::phaseTook, PhaseTook._DESERIALIZER, "phase_took"); + op.add(Builder::pitId, JsonpDeserializer.stringDeserializer(), "pit_id"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(ProcessorExecutionDetail._DESERIALIZER), "processor_results"); + op.add(Builder::profile, Profile._DESERIALIZER, "profile"); + op.add(Builder::scrollId, JsonpDeserializer.stringDeserializer(), "_scroll_id"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add( + Builder::suggest, + ExternallyTaggedUnion.arrayDeserializer(Suggest.createSuggestDeserializer(JsonData._DESERIALIZER)), + "suggest" + ); + op.add(Builder::terminatedEarly, JsonpDeserializer.booleanDeserializer(), "terminated_early"); op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); - op.add(Builder::took, JsonpDeserializer.integerDeserializer(), "took"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); } @Override public int hashCode() { int result = 17; - result = 31 * result + Objects.hashCode(this.hits); - result = 31 * result + Objects.hashCode(this.id); - result = 31 * result + Objects.hashCode(this.judgmentScores); - result = 31 * result + Objects.hashCode(this.metadata); - result = 31 * result + Objects.hashCode(this.name); - result = 31 * result + Objects.hashCode(this.shards); - result = 31 * result + Objects.hashCode(this.status); - result = 31 * result + Objects.hashCode(this.timedOut); - result = 31 * result + Objects.hashCode(this.timestamp); - result = 31 * result + Objects.hashCode(this.took); - result = 31 * result + Objects.hashCode(this.type); + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.clusters); + result = 31 * result + this.hits.hashCode(); + result = 31 * result + Objects.hashCode(this.numReducePhases); + result = 31 * result + Objects.hashCode(this.phaseTook); + result = 31 * result + Objects.hashCode(this.pitId); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.profile); + result = 31 * result + Objects.hashCode(this.scrollId); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.suggest); + result = 31 * result + Objects.hashCode(this.terminatedEarly); + result = 31 * result + Boolean.hashCode(this.timedOut); + result = 31 * result + Long.hashCode(this.took); return result; } @@ -592,17 +741,20 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - GetJudgmentsResponse other = (GetJudgmentsResponse) o; - return Objects.equals(this.hits, other.hits) - && Objects.equals(this.id, other.id) - && Objects.equals(this.judgmentScores, other.judgmentScores) - && Objects.equals(this.metadata, other.metadata) - && Objects.equals(this.name, other.name) - && Objects.equals(this.shards, other.shards) - && Objects.equals(this.status, other.status) - && Objects.equals(this.timedOut, other.timedOut) - && Objects.equals(this.timestamp, other.timestamp) - && Objects.equals(this.took, other.took) - && Objects.equals(this.type, other.type); + GetJudgmentsResponse other = (GetJudgmentsResponse) o; + return Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.clusters, other.clusters) + && this.hits.equals(other.hits) + && Objects.equals(this.numReducePhases, other.numReducePhases) + && Objects.equals(this.phaseTook, other.phaseTook) + && Objects.equals(this.pitId, other.pitId) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.profile, other.profile) + && Objects.equals(this.scrollId, other.scrollId) + && this.shards.equals(other.shards) + && Objects.equals(this.suggest, other.suggest) + && Objects.equals(this.terminatedEarly, other.terminatedEarly) + && this.timedOut == other.timedOut + && this.took == other.took; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetNodeStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetNodeStatsResponse.java index f31a03a92d..ca490aa0f7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetNodeStatsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetNodeStatsResponse.java @@ -37,36 +37,123 @@ package org.opensearch.client.opensearch.search_relevance; import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch.nodes.NodesResponseBase; +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: search_relevance.get_node_stats.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetNodeStatsResponse implements PlainJsonSerializable, ToCopyableBuilder { +public class GetNodeStatsResponse extends NodesResponseBase + implements + ToCopyableBuilder { + + @Nonnull + private final Map allNodes; + + @Nullable + private final String clusterName; + + @Nonnull + private final Map info; + + @Nonnull + private final Map nodes; // --------------------------------------------------------------------------------------------- - private GetNodeStatsResponse(Builder builder) {} + private GetNodeStatsResponse(Builder builder) { + super(builder); + this.allNodes = ApiTypeHelper.unmodifiable(builder.allNodes); + this.clusterName = builder.clusterName; + this.info = ApiTypeHelper.unmodifiable(builder.info); + this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); + } public static GetNodeStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Serialize this object to JSON. + * API name: {@code all_nodes} */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { + @Nonnull + public final Map allNodes() { + return this.allNodes; + } + + /** + * API name: {@code cluster_name} + */ + @Nullable + public final String clusterName() { + return this.clusterName; + } + + /** + * API name: {@code info} + */ + @Nonnull + public final Map info() { + return this.info; + } + + /** + * Required - API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.allNodes)) { + generator.writeKey("all_nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.allNodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.clusterName != null) { + generator.writeKey("cluster_name"); + generator.write(this.clusterName); + } + + if (ApiTypeHelper.isDefined(this.info)) { + generator.writeKey("info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.info.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("nodes"); generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } generator.writeEnd(); } @@ -86,13 +173,34 @@ public static Builder builder() { /** * Builder for {@link GetNodeStatsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends NodesResponseBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private Map allNodes; + @Nullable + private String clusterName; + @Nullable + private Map info; + private Map nodes; public Builder() {} - private Builder(GetNodeStatsResponse o) {} + private Builder(GetNodeStatsResponse o) { + super(o); + this.allNodes = _mapCopy(o.allNodes); + this.clusterName = o.clusterName; + this.info = _mapCopy(o.info); + this.nodes = _mapCopy(o.nodes); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + this.allNodes = _mapCopy(o.allNodes); + this.clusterName = o.clusterName; + this.info = _mapCopy(o.info); + this.nodes = _mapCopy(o.nodes); + } @Override @Nonnull @@ -100,6 +208,99 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code all_nodes} + * + *

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

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

+ * Adds an entry to allNodes. + *

+ */ + @Nonnull + public final Builder allNodes(String key, JsonData value) { + this.allNodes = _mapPut(this.allNodes, key, value); + return this; + } + + /** + * API name: {@code cluster_name} + */ + @Nonnull + public final Builder clusterName(@Nullable String value) { + this.clusterName = value; + return this; + } + + /** + * API name: {@code info} + * + *

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

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

+ * Adds an entry to info. + *

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

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

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

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, JsonData value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + /** * Builds a {@link GetNodeStatsResponse}. * @@ -117,24 +318,42 @@ public GetNodeStatsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link GetNodeStatsResponse}. + * Json deserializer for {@link GetNodeStatsResponse} */ - public static final GetNodeStatsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - GetNodeStatsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetNodeStatsResponse::setupGetNodeStatsResponseDeserializer ); + protected static void setupGetNodeStatsResponseDeserializer(ObjectDeserializer op) { + setupNodesResponseBaseDeserializer(op); + op.add(Builder::allNodes, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "all_nodes"); + op.add(Builder::clusterName, JsonpDeserializer.stringDeserializer(), "cluster_name"); + op.add(Builder::info, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "info"); + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "nodes"); + } + @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.allNodes); + result = 31 * result + Objects.hashCode(this.clusterName); + result = 31 * result + Objects.hashCode(this.info); + result = 31 * result + this.nodes.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - return true; + GetNodeStatsResponse other = (GetNodeStatsResponse) o; + return Objects.equals(this.allNodes, other.allNodes) + && Objects.equals(this.clusterName, other.clusterName) + && Objects.equals(this.info, other.info) + && this.nodes.equals(other.nodes); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsRequest.java index ff4cde71d9..1779407276 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsRequest.java @@ -43,6 +43,7 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -159,7 +160,7 @@ public GetQuerySetsRequest build() { /** * Endpoint "{@code search_relevance.get_query_sets}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> "GET", // Request path @@ -193,6 +194,16 @@ public GetQuerySetsRequest build() { GetQuerySetsResponse._DESERIALIZER ); + /** + * Create an "{@code search_relevance.get_query_sets}" endpoint. + */ + public static < + TDocument> Endpoint, ErrorResponse> createSearchRelevanceGetQuerySetsEndpoint( + JsonpDeserializer tDocumentDeserializer + ) { + return _ENDPOINT.withResponseDeserializer(GetQuerySetsResponse.createGetQuerySetsResponseDeserializer(tDocumentDeserializer)); + } + @Override public int hashCode() { int result = 17; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsResponse.java index a2de27842d..4e2f0b6ea8 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetQuerySetsResponse.java @@ -37,19 +37,30 @@ package org.opensearch.client.opensearch.search_relevance; import jakarta.json.stream.JsonGenerator; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; 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.NamedDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ClusterStatistics; +import org.opensearch.client.opensearch._types.PhaseTook; +import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch._types.aggregations.Aggregate; +import org.opensearch.client.opensearch.core.search.HitsMetadata; +import org.opensearch.client.opensearch.core.search.ProcessorExecutionDetail; +import org.opensearch.client.opensearch.core.search.Profile; +import org.opensearch.client.opensearch.core.search.Suggest; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; @@ -60,134 +71,183 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetQuerySetsResponse implements PlainJsonSerializable, ToCopyableBuilder { +public class GetQuerySetsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder, GetQuerySetsResponse> { + + @Nonnull + private final Map aggregations; @Nullable - private final String description; + private final ClusterStatistics clusters; @Nonnull - private final Map hits; + private final HitsMetadata hits; @Nullable - private final String id; + private final Integer numReducePhases; @Nullable - private final String name; - - @Nonnull - private final Map querySetQueries; + private final PhaseTook phaseTook; @Nullable - private final String sampling; + private final String pitId; @Nonnull - private final Map shards; + private final List processorResults; @Nullable - private final Boolean timedOut; + private final Profile profile; @Nullable - private final String timestamp; + private final String scrollId; + + @Nonnull + private final ShardStatistics shards; + + @Nonnull + private final Map>> suggest; @Nullable - private final Integer took; + private final Boolean terminatedEarly; + + private final boolean timedOut; + + private final long took; // --------------------------------------------------------------------------------------------- - private GetQuerySetsResponse(Builder builder) { - this.description = builder.description; - this.hits = ApiTypeHelper.unmodifiable(builder.hits); - this.id = builder.id; - this.name = builder.name; - this.querySetQueries = ApiTypeHelper.unmodifiable(builder.querySetQueries); - this.sampling = builder.sampling; - this.shards = ApiTypeHelper.unmodifiable(builder.shards); - this.timedOut = builder.timedOut; - this.timestamp = builder.timestamp; - this.took = builder.took; + private GetQuerySetsResponse(Builder builder) { + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.clusters = builder.clusters; + this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.numReducePhases = builder.numReducePhases; + this.phaseTook = builder.phaseTook; + this.pitId = builder.pitId; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + this.profile = builder.profile; + this.scrollId = builder.scrollId; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.suggest = ApiTypeHelper.unmodifiable(builder.suggest); + this.terminatedEarly = builder.terminatedEarly; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); + } + + public static GetQuerySetsResponse of( + Function, ObjectBuilder>> fn + ) { + return fn.apply(new Builder<>()).build(); } - public static GetQuerySetsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); + /** + * API name: {@code aggregations} + */ + @Nonnull + public final Map aggregations() { + return this.aggregations; } /** - * API name: {@code description} + * API name: {@code _clusters} */ @Nullable - public final String description() { - return this.description; + public final ClusterStatistics clusters() { + return this.clusters; } /** - * API name: {@code hits} + * Required - API name: {@code hits} */ @Nonnull - public final Map hits() { + public final HitsMetadata hits() { return this.hits; } /** - * API name: {@code id} + * API name: {@code num_reduce_phases} */ @Nullable - public final String id() { - return this.id; + public final Integer numReducePhases() { + return this.numReducePhases; } /** - * API name: {@code name} + * API name: {@code phase_took} */ @Nullable - public final String name() { - return this.name; + public final PhaseTook phaseTook() { + return this.phaseTook; } /** - * API name: {@code querySetQueries} + * API name: {@code pit_id} + */ + @Nullable + public final String pitId() { + return this.pitId; + } + + /** + * API name: {@code processor_results} */ @Nonnull - public final Map querySetQueries() { - return this.querySetQueries; + public final List processorResults() { + return this.processorResults; } /** - * API name: {@code sampling} + * API name: {@code profile} */ @Nullable - public final String sampling() { - return this.sampling; + public final Profile profile() { + return this.profile; } /** - * API name: {@code _shards} + * API name: {@code _scroll_id} + */ + @Nullable + public final String scrollId() { + return this.scrollId; + } + + /** + * Required - API name: {@code _shards} */ @Nonnull - public final Map shards() { + public final ShardStatistics shards() { return this.shards; } /** - * API name: {@code timed_out} + * API name: {@code suggest} */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; + @Nonnull + public final Map>> suggest() { + return this.suggest; } /** - * API name: {@code timestamp} + * API name: {@code terminated_early} */ @Nullable - public final String timestamp() { - return this.timestamp; + public final Boolean terminatedEarly() { + return this.terminatedEarly; } /** - * API name: {@code took} + * Required - API name: {@code timed_out} */ - @Nullable - public final Integer took() { + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { return this.took; } @@ -202,281 +262,398 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.description != null) { - generator.writeKey("description"); - generator.write(this.description); + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + ExternallyTaggedUnion.serializeTypedKeys(this.aggregations, generator, mapper); } - if (ApiTypeHelper.isDefined(this.hits)) { - generator.writeKey("hits"); - generator.writeStartObject(); - for (Map.Entry item0 : this.hits.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); } - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); - } + generator.writeKey("hits"); + this.hits.serialize(generator, mapper); - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); + if (this.numReducePhases != null) { + generator.writeKey("num_reduce_phases"); + generator.write(this.numReducePhases); } - if (ApiTypeHelper.isDefined(this.querySetQueries)) { - generator.writeKey("querySetQueries"); - generator.writeStartObject(); - for (Map.Entry item0 : this.querySetQueries.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (this.phaseTook != null) { + generator.writeKey("phase_took"); + this.phaseTook.serialize(generator, mapper); } - if (this.sampling != null) { - generator.writeKey("sampling"); - generator.write(this.sampling); + if (this.pitId != null) { + generator.writeKey("pit_id"); + generator.write(this.pitId); } - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("_shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); + generator.writeStartArray(); + for (ProcessorExecutionDetail item0 : this.processorResults) { + item0.serialize(generator, mapper); } generator.writeEnd(); } - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); + if (this.profile != null) { + generator.writeKey("profile"); + this.profile.serialize(generator, mapper); + } + + if (this.scrollId != null) { + generator.writeKey("_scroll_id"); + generator.write(this.scrollId); } - if (this.timestamp != null) { - generator.writeKey("timestamp"); - generator.write(this.timestamp); + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.suggest)) { + generator.writeKey("suggest"); + ExternallyTaggedUnion.serializeTypedKeysArray(this.suggest, generator, mapper); } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); + if (this.terminatedEarly != null) { + generator.writeKey("terminated_early"); + generator.write(this.terminatedEarly); } + + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + generator.writeKey("took"); + generator.write(this.took); } // --------------------------------------------------------------------------------------------- @Override @Nonnull - public Builder toBuilder() { - return new Builder(this); + public Builder toBuilder() { + return new Builder<>(this); } @Nonnull - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new Builder<>(); } /** * Builder for {@link GetQuerySetsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder, GetQuerySetsResponse> { @Nullable - private String description; + private Map aggregations; @Nullable - private Map hits; + private ClusterStatistics clusters; + private HitsMetadata hits; @Nullable - private String id; + private Integer numReducePhases; @Nullable - private String name; + private PhaseTook phaseTook; @Nullable - private Map querySetQueries; + private String pitId; @Nullable - private String sampling; + private List processorResults; @Nullable - private Map shards; + private Profile profile; @Nullable - private Boolean timedOut; + private String scrollId; + private ShardStatistics shards; @Nullable - private String timestamp; + private Map>> suggest; @Nullable - private Integer took; + private Boolean terminatedEarly; + private Boolean timedOut; + private Long took; public Builder() {} - private Builder(GetQuerySetsResponse o) { - this.description = o.description; - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.name = o.name; - this.querySetQueries = _mapCopy(o.querySetQueries); - this.sampling = o.sampling; - this.shards = _mapCopy(o.shards); + private Builder(GetQuerySetsResponse o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; } - private Builder(Builder o) { - this.description = o.description; - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.name = o.name; - this.querySetQueries = _mapCopy(o.querySetQueries); - this.sampling = o.sampling; - this.shards = _mapCopy(o.shards); + private Builder(Builder o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; } @Override @Nonnull - public Builder copy() { - return new Builder(this); + public Builder copy() { + return new Builder<>(this); } /** - * API name: {@code description} + * API name: {@code aggregations} + * + *

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

*/ @Nonnull - public final Builder description(@Nullable String value) { - this.description = value; + public final Builder aggregations(Map map) { + this.aggregations = _mapPutAll(this.aggregations, map); return this; } /** - * API name: {@code hits} + * API name: {@code aggregations} * *

- * Adds all elements of map to hits. + * Adds an entry to aggregations. *

*/ @Nonnull - public final Builder hits(Map map) { - this.hits = _mapPutAll(this.hits, map); + public final Builder aggregations(String key, Aggregate value) { + this.aggregations = _mapPut(this.aggregations, key, value); return this; } /** - * API name: {@code hits} + * API name: {@code aggregations} * *

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

*/ @Nonnull - public final Builder hits(String key, JsonData value) { - this.hits = _mapPut(this.hits, key, value); + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregate.Builder()).build()); + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(@Nullable ClusterStatistics value) { + this.clusters = value; return this; } /** - * API name: {@code id} + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(Function> fn) { + return clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code hits} */ @Nonnull - public final Builder id(@Nullable String value) { - this.id = value; + public final Builder hits(HitsMetadata value) { + this.hits = value; return this; } /** - * API name: {@code name} + * Required - API name: {@code hits} */ @Nonnull - public final Builder name(@Nullable String value) { - this.name = value; + public final Builder hits(Function, ObjectBuilder>> fn) { + return hits(fn.apply(new HitsMetadata.Builder()).build()); + } + + /** + * API name: {@code num_reduce_phases} + */ + @Nonnull + public final Builder numReducePhases(@Nullable Integer value) { + this.numReducePhases = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(@Nullable PhaseTook value) { + this.phaseTook = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(Function> fn) { + return phaseTook(fn.apply(new PhaseTook.Builder()).build()); + } + + /** + * API name: {@code pit_id} + */ + @Nonnull + public final Builder pitId(@Nullable String value) { + this.pitId = value; + return this; + } + + /** + * API name: {@code processor_results} + * + *

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

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

- * Adds all elements of map to querySetQueries. + * Adds one or more values to processorResults. *

*/ @Nonnull - public final Builder querySetQueries(Map map) { - this.querySetQueries = _mapPutAll(this.querySetQueries, map); + public final Builder processorResults(ProcessorExecutionDetail value, ProcessorExecutionDetail... values) { + this.processorResults = _listAdd(this.processorResults, value, values); return this; } /** - * API name: {@code querySetQueries} + * API name: {@code processor_results} * *

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

*/ @Nonnull - public final Builder querySetQueries(String key, JsonData value) { - this.querySetQueries = _mapPut(this.querySetQueries, key, value); + public final Builder processorResults( + Function> fn + ) { + return processorResults(fn.apply(new ProcessorExecutionDetail.Builder()).build()); + } + + /** + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(@Nullable Profile value) { + this.profile = value; return this; } /** - * API name: {@code sampling} + * API name: {@code profile} */ @Nonnull - public final Builder sampling(@Nullable String value) { - this.sampling = value; + public final Builder profile(Function> fn) { + return profile(fn.apply(new Profile.Builder()).build()); + } + + /** + * API name: {@code _scroll_id} + */ + @Nonnull + public final Builder scrollId(@Nullable String value) { + this.scrollId = value; return this; } /** - * API name: {@code _shards} + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code suggest} * *

- * Adds all elements of map to shards. + * Adds all elements of map to suggest. *

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

- * Adds an entry to shards. + * Adds an entry to suggest. *

*/ @Nonnull - public final Builder shards(String key, JsonData value) { - this.shards = _mapPut(this.shards, key, value); + public final Builder suggest(String key, List> value) { + this.suggest = _mapPut(this.suggest, key, value); return this; } /** - * API name: {@code timed_out} + * API name: {@code terminated_early} */ @Nonnull - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; + public final Builder terminatedEarly(@Nullable Boolean value) { + this.terminatedEarly = value; return this; } /** - * API name: {@code timestamp} + * Required - API name: {@code timed_out} */ @Nonnull - public final Builder timestamp(@Nullable String value) { - this.timestamp = value; + public final Builder timedOut(boolean value) { + this.timedOut = value; return this; } /** - * API name: {@code took} + * Required - API name: {@code took} */ @Nonnull - public final Builder took(@Nullable Integer value) { + public final Builder took(long value) { this.took = value; return this; } @@ -488,49 +665,75 @@ public final Builder took(@Nullable Integer value) { */ @Override @Nonnull - public GetQuerySetsResponse build() { + public GetQuerySetsResponse build() { _checkSingleUse(); - return new GetQuerySetsResponse(this); + return new GetQuerySetsResponse<>(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link GetQuerySetsResponse} + * Create a JSON deserializer for GetQuerySetsResponse. + */ + public static JsonpDeserializer> createGetQuerySetsResponseDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + Builder::new, + op -> GetQuerySetsResponse.setupGetQuerySetsResponseDeserializer(op, tDocumentDeserializer) + ); + } + + /** + * Json deserializer for {@link GetQuerySetsResponse} based on named deserializers provided by the calling {@code JsonMapper}. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetQuerySetsResponse::setupGetQuerySetsResponseDeserializer + public static final JsonpDeserializer> _DESERIALIZER = createGetQuerySetsResponseDeserializer( + new NamedDeserializer<>("org.opensearch.client:Deserializer:search_relevance.get_query_sets.TDocument") ); - protected static void setupGetQuerySetsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::hits, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "hits"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::querySetQueries, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "querySetQueries"); - op.add(Builder::sampling, JsonpDeserializer.stringDeserializer(), "sampling"); - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_shards"); + protected static void setupGetQuerySetsResponseDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + op.add(Builder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations"); + op.add(Builder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); + op.add(Builder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits"); + op.add(Builder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases"); + op.add(Builder::phaseTook, PhaseTook._DESERIALIZER, "phase_took"); + op.add(Builder::pitId, JsonpDeserializer.stringDeserializer(), "pit_id"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(ProcessorExecutionDetail._DESERIALIZER), "processor_results"); + op.add(Builder::profile, Profile._DESERIALIZER, "profile"); + op.add(Builder::scrollId, JsonpDeserializer.stringDeserializer(), "_scroll_id"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add( + Builder::suggest, + ExternallyTaggedUnion.arrayDeserializer(Suggest.createSuggestDeserializer(JsonData._DESERIALIZER)), + "suggest" + ); + op.add(Builder::terminatedEarly, JsonpDeserializer.booleanDeserializer(), "terminated_early"); op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); - op.add(Builder::took, JsonpDeserializer.integerDeserializer(), "took"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); } @Override public int hashCode() { int result = 17; - result = 31 * result + Objects.hashCode(this.description); - result = 31 * result + Objects.hashCode(this.hits); - result = 31 * result + Objects.hashCode(this.id); - result = 31 * result + Objects.hashCode(this.name); - result = 31 * result + Objects.hashCode(this.querySetQueries); - result = 31 * result + Objects.hashCode(this.sampling); - result = 31 * result + Objects.hashCode(this.shards); - result = 31 * result + Objects.hashCode(this.timedOut); - result = 31 * result + Objects.hashCode(this.timestamp); - result = 31 * result + Objects.hashCode(this.took); + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.clusters); + result = 31 * result + this.hits.hashCode(); + result = 31 * result + Objects.hashCode(this.numReducePhases); + result = 31 * result + Objects.hashCode(this.phaseTook); + result = 31 * result + Objects.hashCode(this.pitId); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.profile); + result = 31 * result + Objects.hashCode(this.scrollId); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.suggest); + result = 31 * result + Objects.hashCode(this.terminatedEarly); + result = 31 * result + Boolean.hashCode(this.timedOut); + result = 31 * result + Long.hashCode(this.took); return result; } @@ -538,16 +741,20 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - GetQuerySetsResponse other = (GetQuerySetsResponse) o; - return Objects.equals(this.description, other.description) - && Objects.equals(this.hits, other.hits) - && Objects.equals(this.id, other.id) - && Objects.equals(this.name, other.name) - && Objects.equals(this.querySetQueries, other.querySetQueries) - && Objects.equals(this.sampling, other.sampling) - && Objects.equals(this.shards, other.shards) - && Objects.equals(this.timedOut, other.timedOut) - && Objects.equals(this.timestamp, other.timestamp) - && Objects.equals(this.took, other.took); + GetQuerySetsResponse other = (GetQuerySetsResponse) o; + return Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.clusters, other.clusters) + && this.hits.equals(other.hits) + && Objects.equals(this.numReducePhases, other.numReducePhases) + && Objects.equals(this.phaseTook, other.phaseTook) + && Objects.equals(this.pitId, other.pitId) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.profile, other.profile) + && Objects.equals(this.scrollId, other.scrollId) + && this.shards.equals(other.shards) + && Objects.equals(this.suggest, other.suggest) + && Objects.equals(this.terminatedEarly, other.terminatedEarly) + && this.timedOut == other.timedOut + && this.took == other.took; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsRequest.java new file mode 100644 index 0000000000..0a61ec5dab --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsRequest.java @@ -0,0 +1,229 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.search_relevance; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_relevance.get_scheduled_experiments.Request + +/** + * Gets the scheduled experiments. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetScheduledExperimentsRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final String experimentId; + + // --------------------------------------------------------------------------------------------- + + private GetScheduledExperimentsRequest(Builder builder) { + super(builder); + this.experimentId = builder.experimentId; + } + + public static GetScheduledExperimentsRequest of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * The experiment id + *

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

+ */ + @Nullable + public final String experimentId() { + return this.experimentId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetScheduledExperimentsRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private String experimentId; + + public Builder() {} + + private Builder(GetScheduledExperimentsRequest o) { + super(o); + this.experimentId = o.experimentId; + } + + private Builder(Builder o) { + super(o); + this.experimentId = o.experimentId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The experiment id + *

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

+ */ + @Nonnull + public final Builder experimentId(@Nullable String value) { + this.experimentId = value; + return this; + } + + /** + * Builds a {@link GetScheduledExperimentsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetScheduledExperimentsRequest build() { + _checkSingleUse(); + + return new GetScheduledExperimentsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_relevance.get_scheduled_experiments}". + */ + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _experimentId = 1 << 0; + + int propsSet = 0; + + if (request.experimentId() != null) propsSet |= _experimentId; + + if (propsSet == 0) { + return "/_plugins/_search_relevance/experiments/schedule"; + } + if (propsSet == (_experimentId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_search_relevance/experiments/schedule/"); + SimpleEndpoint.pathEncode(request.experimentId, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetScheduledExperimentsResponse._DESERIALIZER + ); + + /** + * Create an "{@code search_relevance.get_scheduled_experiments}" endpoint. + */ + public static < + TDocument> + Endpoint, ErrorResponse> + createSearchRelevanceGetScheduledExperimentsEndpoint(JsonpDeserializer tDocumentDeserializer) { + return _ENDPOINT.withResponseDeserializer( + GetScheduledExperimentsResponse.createGetScheduledExperimentsResponseDeserializer(tDocumentDeserializer) + ); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.experimentId); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetScheduledExperimentsRequest other = (GetScheduledExperimentsRequest) o; + return Objects.equals(this.experimentId, other.experimentId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsResponse.java new file mode 100644 index 0000000000..47e125a282 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetScheduledExperimentsResponse.java @@ -0,0 +1,763 @@ +/* + * 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.search_relevance; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; +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.NamedDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ClusterStatistics; +import org.opensearch.client.opensearch._types.PhaseTook; +import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch._types.aggregations.Aggregate; +import org.opensearch.client.opensearch.core.search.HitsMetadata; +import org.opensearch.client.opensearch.core.search.ProcessorExecutionDetail; +import org.opensearch.client.opensearch.core.search.Profile; +import org.opensearch.client.opensearch.core.search.Suggest; +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: search_relevance.get_scheduled_experiments.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetScheduledExperimentsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder, GetScheduledExperimentsResponse> { + + @Nonnull + private final Map aggregations; + + @Nullable + private final ClusterStatistics clusters; + + @Nonnull + private final HitsMetadata hits; + + @Nullable + private final Integer numReducePhases; + + @Nullable + private final PhaseTook phaseTook; + + @Nullable + private final String pitId; + + @Nonnull + private final List processorResults; + + @Nullable + private final Profile profile; + + @Nullable + private final String scrollId; + + @Nonnull + private final ShardStatistics shards; + + @Nonnull + private final Map>> suggest; + + @Nullable + private final Boolean terminatedEarly; + + private final boolean timedOut; + + private final long took; + + // --------------------------------------------------------------------------------------------- + + private GetScheduledExperimentsResponse(Builder builder) { + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.clusters = builder.clusters; + this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.numReducePhases = builder.numReducePhases; + this.phaseTook = builder.phaseTook; + this.pitId = builder.pitId; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + this.profile = builder.profile; + this.scrollId = builder.scrollId; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.suggest = ApiTypeHelper.unmodifiable(builder.suggest); + this.terminatedEarly = builder.terminatedEarly; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); + } + + public static GetScheduledExperimentsResponse of( + Function, ObjectBuilder>> fn + ) { + return fn.apply(new Builder<>()).build(); + } + + /** + * API name: {@code aggregations} + */ + @Nonnull + public final Map aggregations() { + return this.aggregations; + } + + /** + * API name: {@code _clusters} + */ + @Nullable + public final ClusterStatistics clusters() { + return this.clusters; + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final HitsMetadata hits() { + return this.hits; + } + + /** + * API name: {@code num_reduce_phases} + */ + @Nullable + public final Integer numReducePhases() { + return this.numReducePhases; + } + + /** + * API name: {@code phase_took} + */ + @Nullable + public final PhaseTook phaseTook() { + return this.phaseTook; + } + + /** + * API name: {@code pit_id} + */ + @Nullable + public final String pitId() { + return this.pitId; + } + + /** + * API name: {@code processor_results} + */ + @Nonnull + public final List processorResults() { + return this.processorResults; + } + + /** + * API name: {@code profile} + */ + @Nullable + public final Profile profile() { + return this.profile; + } + + /** + * API name: {@code _scroll_id} + */ + @Nullable + public final String scrollId() { + return this.scrollId; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final ShardStatistics shards() { + return this.shards; + } + + /** + * API name: {@code suggest} + */ + @Nonnull + public final Map>> suggest() { + return this.suggest; + } + + /** + * API name: {@code terminated_early} + */ + @Nullable + public final Boolean terminatedEarly() { + return this.terminatedEarly; + } + + /** + * Required - API name: {@code timed_out} + */ + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { + return this.took; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + ExternallyTaggedUnion.serializeTypedKeys(this.aggregations, generator, mapper); + } + + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); + } + + generator.writeKey("hits"); + this.hits.serialize(generator, mapper); + + if (this.numReducePhases != null) { + generator.writeKey("num_reduce_phases"); + generator.write(this.numReducePhases); + } + + if (this.phaseTook != null) { + generator.writeKey("phase_took"); + this.phaseTook.serialize(generator, mapper); + } + + if (this.pitId != null) { + generator.writeKey("pit_id"); + generator.write(this.pitId); + } + + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); + generator.writeStartArray(); + for (ProcessorExecutionDetail item0 : this.processorResults) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.profile != null) { + generator.writeKey("profile"); + this.profile.serialize(generator, mapper); + } + + if (this.scrollId != null) { + generator.writeKey("_scroll_id"); + generator.write(this.scrollId); + } + + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.suggest)) { + generator.writeKey("suggest"); + ExternallyTaggedUnion.serializeTypedKeysArray(this.suggest, generator, mapper); + } + + if (this.terminatedEarly != null) { + generator.writeKey("terminated_early"); + generator.write(this.terminatedEarly); + } + + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + generator.writeKey("took"); + generator.write(this.took); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder<>(this); + } + + @Nonnull + public static Builder builder() { + return new Builder<>(); + } + + /** + * Builder for {@link GetScheduledExperimentsResponse}. + */ + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder, GetScheduledExperimentsResponse> { + @Nullable + private Map aggregations; + @Nullable + private ClusterStatistics clusters; + private HitsMetadata hits; + @Nullable + private Integer numReducePhases; + @Nullable + private PhaseTook phaseTook; + @Nullable + private String pitId; + @Nullable + private List processorResults; + @Nullable + private Profile profile; + @Nullable + private String scrollId; + private ShardStatistics shards; + @Nullable + private Map>> suggest; + @Nullable + private Boolean terminatedEarly; + private Boolean timedOut; + private Long took; + + public Builder() {} + + private Builder(GetScheduledExperimentsResponse o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; + this.timedOut = o.timedOut; + this.took = o.took; + } + + private Builder(Builder o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; + this.timedOut = o.timedOut; + this.took = o.took; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder<>(this); + } + + /** + * API name: {@code aggregations} + * + *

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

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

+ * Adds an entry to aggregations. + *

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

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

+ */ + @Nonnull + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregate.Builder()).build()); + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(@Nullable ClusterStatistics value) { + this.clusters = value; + return this; + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(Function> fn) { + return clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(HitsMetadata value) { + this.hits = value; + return this; + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(Function, ObjectBuilder>> fn) { + return hits(fn.apply(new HitsMetadata.Builder()).build()); + } + + /** + * API name: {@code num_reduce_phases} + */ + @Nonnull + public final Builder numReducePhases(@Nullable Integer value) { + this.numReducePhases = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(@Nullable PhaseTook value) { + this.phaseTook = value; + return this; + } + + /** + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(Function> fn) { + return phaseTook(fn.apply(new PhaseTook.Builder()).build()); + } + + /** + * API name: {@code pit_id} + */ + @Nonnull + public final Builder pitId(@Nullable String value) { + this.pitId = value; + return this; + } + + /** + * API name: {@code processor_results} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder processorResults( + Function> fn + ) { + return processorResults(fn.apply(new ProcessorExecutionDetail.Builder()).build()); + } + + /** + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(@Nullable Profile value) { + this.profile = value; + return this; + } + + /** + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(Function> fn) { + return profile(fn.apply(new Profile.Builder()).build()); + } + + /** + * API name: {@code _scroll_id} + */ + @Nonnull + public final Builder scrollId(@Nullable String value) { + this.scrollId = value; + return this; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code suggest} + * + *

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

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

+ * Adds an entry to suggest. + *

+ */ + @Nonnull + public final Builder suggest(String key, List> value) { + this.suggest = _mapPut(this.suggest, key, value); + return this; + } + + /** + * API name: {@code terminated_early} + */ + @Nonnull + public final Builder terminatedEarly(@Nullable Boolean value) { + this.terminatedEarly = value; + return this; + } + + /** + * Required - API name: {@code timed_out} + */ + @Nonnull + public final Builder timedOut(boolean value) { + this.timedOut = value; + return this; + } + + /** + * Required - API name: {@code took} + */ + @Nonnull + public final Builder took(long value) { + this.took = value; + return this; + } + + /** + * Builds a {@link GetScheduledExperimentsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetScheduledExperimentsResponse build() { + _checkSingleUse(); + + return new GetScheduledExperimentsResponse<>(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Create a JSON deserializer for GetScheduledExperimentsResponse. + */ + public static < + TDocument> JsonpDeserializer> createGetScheduledExperimentsResponseDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + Builder::new, + op -> GetScheduledExperimentsResponse.setupGetScheduledExperimentsResponseDeserializer(op, tDocumentDeserializer) + ); + } + + /** + * Json deserializer for {@link GetScheduledExperimentsResponse} based on named deserializers provided by the calling + * {@code JsonMapper}. + */ + public static final JsonpDeserializer> _DESERIALIZER = + createGetScheduledExperimentsResponseDeserializer( + new NamedDeserializer<>("org.opensearch.client:Deserializer:search_relevance.get_scheduled_experiments.TDocument") + ); + + protected static void setupGetScheduledExperimentsResponseDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + op.add(Builder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations"); + op.add(Builder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); + op.add(Builder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits"); + op.add(Builder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases"); + op.add(Builder::phaseTook, PhaseTook._DESERIALIZER, "phase_took"); + op.add(Builder::pitId, JsonpDeserializer.stringDeserializer(), "pit_id"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(ProcessorExecutionDetail._DESERIALIZER), "processor_results"); + op.add(Builder::profile, Profile._DESERIALIZER, "profile"); + op.add(Builder::scrollId, JsonpDeserializer.stringDeserializer(), "_scroll_id"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add( + Builder::suggest, + ExternallyTaggedUnion.arrayDeserializer(Suggest.createSuggestDeserializer(JsonData._DESERIALIZER)), + "suggest" + ); + op.add(Builder::terminatedEarly, JsonpDeserializer.booleanDeserializer(), "terminated_early"); + op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.clusters); + result = 31 * result + this.hits.hashCode(); + result = 31 * result + Objects.hashCode(this.numReducePhases); + result = 31 * result + Objects.hashCode(this.phaseTook); + result = 31 * result + Objects.hashCode(this.pitId); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.profile); + result = 31 * result + Objects.hashCode(this.scrollId); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.suggest); + result = 31 * result + Objects.hashCode(this.terminatedEarly); + result = 31 * result + Boolean.hashCode(this.timedOut); + result = 31 * result + Long.hashCode(this.took); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetScheduledExperimentsResponse other = (GetScheduledExperimentsResponse) o; + return Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.clusters, other.clusters) + && this.hits.equals(other.hits) + && Objects.equals(this.numReducePhases, other.numReducePhases) + && Objects.equals(this.phaseTook, other.phaseTook) + && Objects.equals(this.pitId, other.pitId) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.profile, other.profile) + && Objects.equals(this.scrollId, other.scrollId) + && this.shards.equals(other.shards) + && Objects.equals(this.suggest, other.suggest) + && Objects.equals(this.terminatedEarly, other.terminatedEarly) + && this.timedOut == other.timedOut + && this.took == other.took; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsRequest.java index 9aa6674947..9d5c48e5ca 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsRequest.java @@ -43,6 +43,7 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -165,40 +166,51 @@ public GetSearchConfigurationsRequest build() { /** * Endpoint "{@code search_relevance.get_search_configurations}". */ - public static final Endpoint _ENDPOINT = - new SimpleEndpoint<>( - // Request method - request -> "GET", - // Request path - request -> { - final int _searchConfigurationId = 1 << 0; - - int propsSet = 0; - - if (request.searchConfigurationId() != null) propsSet |= _searchConfigurationId; - - if (propsSet == 0) { - return "/_plugins/_search_relevance/search_configurations"; - } - if (propsSet == (_searchConfigurationId)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_plugins/_search_relevance/search_configurations/"); - SimpleEndpoint.pathEncode(request.searchConfigurationId, buf); - return buf.toString(); - } - - throw SimpleEndpoint.noPathTemplateFound("path"); - }, - // Request parameters - request -> { - Map params = new HashMap<>(); - request.applyQueryParameters(params); - return params; - }, - SimpleEndpoint.emptyMap(), - false, - GetSearchConfigurationsResponse._DESERIALIZER + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _searchConfigurationId = 1 << 0; + + int propsSet = 0; + + if (request.searchConfigurationId() != null) propsSet |= _searchConfigurationId; + + if (propsSet == 0) { + return "/_plugins/_search_relevance/search_configurations"; + } + if (propsSet == (_searchConfigurationId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_search_relevance/search_configurations/"); + SimpleEndpoint.pathEncode(request.searchConfigurationId, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetSearchConfigurationsResponse._DESERIALIZER + ); + + /** + * Create an "{@code search_relevance.get_search_configurations}" endpoint. + */ + public static < + TDocument> + Endpoint, ErrorResponse> + createSearchRelevanceGetSearchConfigurationsEndpoint(JsonpDeserializer tDocumentDeserializer) { + return _ENDPOINT.withResponseDeserializer( + GetSearchConfigurationsResponse.createGetSearchConfigurationsResponseDeserializer(tDocumentDeserializer) ); + } @Override public int hashCode() { diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsResponse.java index 2af48aa76a..d355d1efa1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetSearchConfigurationsResponse.java @@ -37,19 +37,30 @@ package org.opensearch.client.opensearch.search_relevance; import jakarta.json.stream.JsonGenerator; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; 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.NamedDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ClusterStatistics; +import org.opensearch.client.opensearch._types.PhaseTook; +import org.opensearch.client.opensearch._types.ShardStatistics; +import org.opensearch.client.opensearch._types.aggregations.Aggregate; +import org.opensearch.client.opensearch.core.search.HitsMetadata; +import org.opensearch.client.opensearch.core.search.ProcessorExecutionDetail; +import org.opensearch.client.opensearch.core.search.Profile; +import org.opensearch.client.opensearch.core.search.Suggest; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; @@ -60,139 +71,183 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetSearchConfigurationsResponse +public class GetSearchConfigurationsResponse implements PlainJsonSerializable, - ToCopyableBuilder { + ToCopyableBuilder, GetSearchConfigurationsResponse> { @Nonnull - private final Map hits; + private final Map aggregations; @Nullable - private final String id; + private final ClusterStatistics clusters; - @Nullable - private final String index; + @Nonnull + private final HitsMetadata hits; @Nullable - private final String name; + private final Integer numReducePhases; @Nullable - private final String query; + private final PhaseTook phaseTook; @Nullable - private final String searchPipeline; + private final String pitId; @Nonnull - private final Map shards; + private final List processorResults; @Nullable - private final Boolean timedOut; + private final Profile profile; @Nullable - private final String timestamp; + private final String scrollId; + + @Nonnull + private final ShardStatistics shards; + + @Nonnull + private final Map>> suggest; @Nullable - private final Integer took; + private final Boolean terminatedEarly; + + private final boolean timedOut; + + private final long took; // --------------------------------------------------------------------------------------------- - private GetSearchConfigurationsResponse(Builder builder) { - this.hits = ApiTypeHelper.unmodifiable(builder.hits); - this.id = builder.id; - this.index = builder.index; - this.name = builder.name; - this.query = builder.query; - this.searchPipeline = builder.searchPipeline; - this.shards = ApiTypeHelper.unmodifiable(builder.shards); - this.timedOut = builder.timedOut; - this.timestamp = builder.timestamp; - this.took = builder.took; + private GetSearchConfigurationsResponse(Builder builder) { + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.clusters = builder.clusters; + this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); + this.numReducePhases = builder.numReducePhases; + this.phaseTook = builder.phaseTook; + this.pitId = builder.pitId; + this.processorResults = ApiTypeHelper.unmodifiable(builder.processorResults); + this.profile = builder.profile; + this.scrollId = builder.scrollId; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.suggest = ApiTypeHelper.unmodifiable(builder.suggest); + this.terminatedEarly = builder.terminatedEarly; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); } - public static GetSearchConfigurationsResponse of( - Function> fn + public static GetSearchConfigurationsResponse of( + Function, ObjectBuilder>> fn ) { - return fn.apply(new Builder()).build(); + return fn.apply(new Builder<>()).build(); + } + + /** + * API name: {@code aggregations} + */ + @Nonnull + public final Map aggregations() { + return this.aggregations; + } + + /** + * API name: {@code _clusters} + */ + @Nullable + public final ClusterStatistics clusters() { + return this.clusters; } /** - * API name: {@code hits} + * Required - API name: {@code hits} */ @Nonnull - public final Map hits() { + public final HitsMetadata hits() { return this.hits; } /** - * API name: {@code id} + * API name: {@code num_reduce_phases} */ @Nullable - public final String id() { - return this.id; + public final Integer numReducePhases() { + return this.numReducePhases; } /** - * API name: {@code index} + * API name: {@code phase_took} */ @Nullable - public final String index() { - return this.index; + public final PhaseTook phaseTook() { + return this.phaseTook; } /** - * API name: {@code name} + * API name: {@code pit_id} */ @Nullable - public final String name() { - return this.name; + public final String pitId() { + return this.pitId; + } + + /** + * API name: {@code processor_results} + */ + @Nonnull + public final List processorResults() { + return this.processorResults; } /** - * API name: {@code query} + * API name: {@code profile} */ @Nullable - public final String query() { - return this.query; + public final Profile profile() { + return this.profile; } /** - * API name: {@code searchPipeline} + * API name: {@code _scroll_id} */ @Nullable - public final String searchPipeline() { - return this.searchPipeline; + public final String scrollId() { + return this.scrollId; } /** - * API name: {@code _shards} + * Required - API name: {@code _shards} */ @Nonnull - public final Map shards() { + public final ShardStatistics shards() { return this.shards; } /** - * API name: {@code timed_out} + * API name: {@code suggest} */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; + @Nonnull + public final Map>> suggest() { + return this.suggest; } /** - * API name: {@code timestamp} + * API name: {@code terminated_early} */ @Nullable - public final String timestamp() { - return this.timestamp; + public final Boolean terminatedEarly() { + return this.terminatedEarly; } /** - * API name: {@code took} + * Required - API name: {@code timed_out} */ - @Nullable - public final Integer took() { + public final boolean timedOut() { + return this.timedOut; + } + + /** + * Required - API name: {@code took} + */ + public final long took() { return this.took; } @@ -207,259 +262,398 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.hits)) { - generator.writeKey("hits"); - generator.writeStartObject(); - for (Map.Entry item0 : this.hits.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + ExternallyTaggedUnion.serializeTypedKeys(this.aggregations, generator, mapper); } - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); + if (this.clusters != null) { + generator.writeKey("_clusters"); + this.clusters.serialize(generator, mapper); } - if (this.index != null) { - generator.writeKey("index"); - generator.write(this.index); - } + generator.writeKey("hits"); + this.hits.serialize(generator, mapper); - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); + if (this.numReducePhases != null) { + generator.writeKey("num_reduce_phases"); + generator.write(this.numReducePhases); } - if (this.query != null) { - generator.writeKey("query"); - generator.write(this.query); + if (this.phaseTook != null) { + generator.writeKey("phase_took"); + this.phaseTook.serialize(generator, mapper); } - if (this.searchPipeline != null) { - generator.writeKey("searchPipeline"); - generator.write(this.searchPipeline); + if (this.pitId != null) { + generator.writeKey("pit_id"); + generator.write(this.pitId); } - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("_shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.processorResults)) { + generator.writeKey("processor_results"); + generator.writeStartArray(); + for (ProcessorExecutionDetail item0 : this.processorResults) { + item0.serialize(generator, mapper); } generator.writeEnd(); } - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); + if (this.profile != null) { + generator.writeKey("profile"); + this.profile.serialize(generator, mapper); + } + + if (this.scrollId != null) { + generator.writeKey("_scroll_id"); + generator.write(this.scrollId); } - if (this.timestamp != null) { - generator.writeKey("timestamp"); - generator.write(this.timestamp); + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.suggest)) { + generator.writeKey("suggest"); + ExternallyTaggedUnion.serializeTypedKeysArray(this.suggest, generator, mapper); } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); + if (this.terminatedEarly != null) { + generator.writeKey("terminated_early"); + generator.write(this.terminatedEarly); } + + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + generator.writeKey("took"); + generator.write(this.took); } // --------------------------------------------------------------------------------------------- @Override @Nonnull - public Builder toBuilder() { - return new Builder(this); + public Builder toBuilder() { + return new Builder<>(this); } @Nonnull - public static Builder builder() { - return new Builder(); + public static Builder builder() { + return new Builder<>(); } /** * Builder for {@link GetSearchConfigurationsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder, GetSearchConfigurationsResponse> { @Nullable - private Map hits; + private Map aggregations; @Nullable - private String id; + private ClusterStatistics clusters; + private HitsMetadata hits; @Nullable - private String index; + private Integer numReducePhases; @Nullable - private String name; + private PhaseTook phaseTook; @Nullable - private String query; + private String pitId; @Nullable - private String searchPipeline; + private List processorResults; @Nullable - private Map shards; + private Profile profile; @Nullable - private Boolean timedOut; + private String scrollId; + private ShardStatistics shards; @Nullable - private String timestamp; + private Map>> suggest; @Nullable - private Integer took; + private Boolean terminatedEarly; + private Boolean timedOut; + private Long took; public Builder() {} - private Builder(GetSearchConfigurationsResponse o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.index = o.index; - this.name = o.name; - this.query = o.query; - this.searchPipeline = o.searchPipeline; - this.shards = _mapCopy(o.shards); + private Builder(GetSearchConfigurationsResponse o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; } - private Builder(Builder o) { - this.hits = _mapCopy(o.hits); - this.id = o.id; - this.index = o.index; - this.name = o.name; - this.query = o.query; - this.searchPipeline = o.searchPipeline; - this.shards = _mapCopy(o.shards); + private Builder(Builder o) { + this.aggregations = _mapCopy(o.aggregations); + this.clusters = o.clusters; + this.hits = o.hits; + this.numReducePhases = o.numReducePhases; + this.phaseTook = o.phaseTook; + this.pitId = o.pitId; + this.processorResults = _listCopy(o.processorResults); + this.profile = o.profile; + this.scrollId = o.scrollId; + this.shards = o.shards; + this.suggest = _mapCopy(o.suggest); + this.terminatedEarly = o.terminatedEarly; this.timedOut = o.timedOut; - this.timestamp = o.timestamp; this.took = o.took; } @Override @Nonnull - public Builder copy() { - return new Builder(this); + public Builder copy() { + return new Builder<>(this); } /** - * API name: {@code hits} + * API name: {@code aggregations} * *

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

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

- * Adds an entry to hits. + * Adds an entry to aggregations. *

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

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

+ */ + @Nonnull + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregate.Builder()).build()); + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(@Nullable ClusterStatistics value) { + this.clusters = value; + return this; + } + + /** + * API name: {@code _clusters} + */ + @Nonnull + public final Builder clusters(Function> fn) { + return clusters(fn.apply(new ClusterStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(HitsMetadata value) { + this.hits = value; return this; } /** - * API name: {@code id} + * Required - API name: {@code hits} + */ + @Nonnull + public final Builder hits(Function, ObjectBuilder>> fn) { + return hits(fn.apply(new HitsMetadata.Builder()).build()); + } + + /** + * API name: {@code num_reduce_phases} */ @Nonnull - public final Builder id(@Nullable String value) { - this.id = value; + public final Builder numReducePhases(@Nullable Integer value) { + this.numReducePhases = value; return this; } /** - * API name: {@code index} + * API name: {@code phase_took} */ @Nonnull - public final Builder index(@Nullable String value) { - this.index = value; + public final Builder phaseTook(@Nullable PhaseTook value) { + this.phaseTook = value; return this; } /** - * API name: {@code name} + * API name: {@code phase_took} + */ + @Nonnull + public final Builder phaseTook(Function> fn) { + return phaseTook(fn.apply(new PhaseTook.Builder()).build()); + } + + /** + * API name: {@code pit_id} */ @Nonnull - public final Builder name(@Nullable String value) { - this.name = value; + public final Builder pitId(@Nullable String value) { + this.pitId = value; return this; } /** - * API name: {@code query} + * API name: {@code processor_results} + * + *

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

*/ @Nonnull - public final Builder query(@Nullable String value) { - this.query = value; + public final Builder processorResults(List list) { + this.processorResults = _listAddAll(this.processorResults, list); return this; } /** - * API name: {@code searchPipeline} + * API name: {@code processor_results} + * + *

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

*/ @Nonnull - public final Builder searchPipeline(@Nullable String value) { - this.searchPipeline = value; + public final Builder processorResults(ProcessorExecutionDetail value, ProcessorExecutionDetail... values) { + this.processorResults = _listAdd(this.processorResults, value, values); return this; } /** - * API name: {@code _shards} + * API name: {@code processor_results} * *

- * Adds all elements of map to shards. + * Adds a value to processorResults using a builder lambda. *

*/ @Nonnull - public final Builder shards(Map map) { - this.shards = _mapPutAll(this.shards, map); + public final Builder processorResults( + Function> fn + ) { + return processorResults(fn.apply(new ProcessorExecutionDetail.Builder()).build()); + } + + /** + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(@Nullable Profile value) { + this.profile = value; return this; } /** - * API name: {@code _shards} + * API name: {@code profile} + */ + @Nonnull + public final Builder profile(Function> fn) { + return profile(fn.apply(new Profile.Builder()).build()); + } + + /** + * API name: {@code _scroll_id} + */ + @Nonnull + public final Builder scrollId(@Nullable String value) { + this.scrollId = value; + return this; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * Required - API name: {@code _shards} + */ + @Nonnull + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code suggest} * *

- * Adds an entry to shards. + * Adds all elements of map to suggest. *

*/ @Nonnull - public final Builder shards(String key, JsonData value) { - this.shards = _mapPut(this.shards, key, value); + public final Builder suggest(Map>> map) { + this.suggest = _mapPutAll(this.suggest, map); return this; } /** - * API name: {@code timed_out} + * API name: {@code suggest} + * + *

+ * Adds an entry to suggest. + *

*/ @Nonnull - public final Builder timedOut(@Nullable Boolean value) { - this.timedOut = value; + public final Builder suggest(String key, List> value) { + this.suggest = _mapPut(this.suggest, key, value); return this; } /** - * API name: {@code timestamp} + * API name: {@code terminated_early} */ @Nonnull - public final Builder timestamp(@Nullable String value) { - this.timestamp = value; + public final Builder terminatedEarly(@Nullable Boolean value) { + this.terminatedEarly = value; return this; } /** - * API name: {@code took} + * Required - API name: {@code timed_out} */ @Nonnull - public final Builder took(@Nullable Integer value) { + public final Builder timedOut(boolean value) { + this.timedOut = value; + return this; + } + + /** + * Required - API name: {@code took} + */ + @Nonnull + public final Builder took(long value) { this.took = value; return this; } @@ -471,49 +665,78 @@ public final Builder took(@Nullable Integer value) { */ @Override @Nonnull - public GetSearchConfigurationsResponse build() { + public GetSearchConfigurationsResponse build() { _checkSingleUse(); - return new GetSearchConfigurationsResponse(this); + return new GetSearchConfigurationsResponse<>(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link GetSearchConfigurationsResponse} + * Create a JSON deserializer for GetSearchConfigurationsResponse. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetSearchConfigurationsResponse::setupGetSearchConfigurationsResponseDeserializer - ); - - protected static void setupGetSearchConfigurationsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::hits, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "hits"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::query, JsonpDeserializer.stringDeserializer(), "query"); - op.add(Builder::searchPipeline, JsonpDeserializer.stringDeserializer(), "searchPipeline"); - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_shards"); + public static < + TDocument> JsonpDeserializer> createGetSearchConfigurationsResponseDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + Builder::new, + op -> GetSearchConfigurationsResponse.setupGetSearchConfigurationsResponseDeserializer(op, tDocumentDeserializer) + ); + } + + /** + * Json deserializer for {@link GetSearchConfigurationsResponse} based on named deserializers provided by the calling + * {@code JsonMapper}. + */ + public static final JsonpDeserializer> _DESERIALIZER = + createGetSearchConfigurationsResponseDeserializer( + new NamedDeserializer<>("org.opensearch.client:Deserializer:search_relevance.get_search_configurations.TDocument") + ); + + protected static void setupGetSearchConfigurationsResponseDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + op.add(Builder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations"); + op.add(Builder::clusters, ClusterStatistics._DESERIALIZER, "_clusters"); + op.add(Builder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits"); + op.add(Builder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases"); + op.add(Builder::phaseTook, PhaseTook._DESERIALIZER, "phase_took"); + op.add(Builder::pitId, JsonpDeserializer.stringDeserializer(), "pit_id"); + op.add(Builder::processorResults, JsonpDeserializer.arrayDeserializer(ProcessorExecutionDetail._DESERIALIZER), "processor_results"); + op.add(Builder::profile, Profile._DESERIALIZER, "profile"); + op.add(Builder::scrollId, JsonpDeserializer.stringDeserializer(), "_scroll_id"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add( + Builder::suggest, + ExternallyTaggedUnion.arrayDeserializer(Suggest.createSuggestDeserializer(JsonData._DESERIALIZER)), + "suggest" + ); + op.add(Builder::terminatedEarly, JsonpDeserializer.booleanDeserializer(), "terminated_early"); op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp"); - op.add(Builder::took, JsonpDeserializer.integerDeserializer(), "took"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); } @Override public int hashCode() { int result = 17; - result = 31 * result + Objects.hashCode(this.hits); - result = 31 * result + Objects.hashCode(this.id); - result = 31 * result + Objects.hashCode(this.index); - result = 31 * result + Objects.hashCode(this.name); - result = 31 * result + Objects.hashCode(this.query); - result = 31 * result + Objects.hashCode(this.searchPipeline); - result = 31 * result + Objects.hashCode(this.shards); - result = 31 * result + Objects.hashCode(this.timedOut); - result = 31 * result + Objects.hashCode(this.timestamp); - result = 31 * result + Objects.hashCode(this.took); + result = 31 * result + Objects.hashCode(this.aggregations); + result = 31 * result + Objects.hashCode(this.clusters); + result = 31 * result + this.hits.hashCode(); + result = 31 * result + Objects.hashCode(this.numReducePhases); + result = 31 * result + Objects.hashCode(this.phaseTook); + result = 31 * result + Objects.hashCode(this.pitId); + result = 31 * result + Objects.hashCode(this.processorResults); + result = 31 * result + Objects.hashCode(this.profile); + result = 31 * result + Objects.hashCode(this.scrollId); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.suggest); + result = 31 * result + Objects.hashCode(this.terminatedEarly); + result = 31 * result + Boolean.hashCode(this.timedOut); + result = 31 * result + Long.hashCode(this.took); return result; } @@ -521,16 +744,20 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - GetSearchConfigurationsResponse other = (GetSearchConfigurationsResponse) o; - return Objects.equals(this.hits, other.hits) - && Objects.equals(this.id, other.id) - && Objects.equals(this.index, other.index) - && Objects.equals(this.name, other.name) - && Objects.equals(this.query, other.query) - && Objects.equals(this.searchPipeline, other.searchPipeline) - && Objects.equals(this.shards, other.shards) - && Objects.equals(this.timedOut, other.timedOut) - && Objects.equals(this.timestamp, other.timestamp) - && Objects.equals(this.took, other.took); + GetSearchConfigurationsResponse other = (GetSearchConfigurationsResponse) o; + return Objects.equals(this.aggregations, other.aggregations) + && Objects.equals(this.clusters, other.clusters) + && this.hits.equals(other.hits) + && Objects.equals(this.numReducePhases, other.numReducePhases) + && Objects.equals(this.phaseTook, other.phaseTook) + && Objects.equals(this.pitId, other.pitId) + && Objects.equals(this.processorResults, other.processorResults) + && Objects.equals(this.profile, other.profile) + && Objects.equals(this.scrollId, other.scrollId) + && this.shards.equals(other.shards) + && Objects.equals(this.suggest, other.suggest) + && Objects.equals(this.terminatedEarly, other.terminatedEarly) + && this.timedOut == other.timedOut + && this.took == other.took; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetStatsResponse.java index 3824293701..7ec1e70a14 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetStatsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/GetStatsResponse.java @@ -37,36 +37,121 @@ package org.opensearch.client.opensearch.search_relevance; import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch.nodes.NodesResponseBase; +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: search_relevance.get_stats.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class GetStatsResponse implements PlainJsonSerializable, ToCopyableBuilder { +public class GetStatsResponse extends NodesResponseBase implements ToCopyableBuilder { + + @Nonnull + private final Map allNodes; + + @Nullable + private final String clusterName; + + @Nonnull + private final Map info; + + @Nonnull + private final Map nodes; // --------------------------------------------------------------------------------------------- - private GetStatsResponse(Builder builder) {} + private GetStatsResponse(Builder builder) { + super(builder); + this.allNodes = ApiTypeHelper.unmodifiable(builder.allNodes); + this.clusterName = builder.clusterName; + this.info = ApiTypeHelper.unmodifiable(builder.info); + this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); + } public static GetStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Serialize this object to JSON. + * API name: {@code all_nodes} */ - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { + @Nonnull + public final Map allNodes() { + return this.allNodes; + } + + /** + * API name: {@code cluster_name} + */ + @Nullable + public final String clusterName() { + return this.clusterName; + } + + /** + * API name: {@code info} + */ + @Nonnull + public final Map info() { + return this.info; + } + + /** + * Required - API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.allNodes)) { + generator.writeKey("all_nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.allNodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.clusterName != null) { + generator.writeKey("cluster_name"); + generator.write(this.clusterName); + } + + if (ApiTypeHelper.isDefined(this.info)) { + generator.writeKey("info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.info.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("nodes"); generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } generator.writeEnd(); } @@ -86,13 +171,32 @@ public static Builder builder() { /** * Builder for {@link GetStatsResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends NodesResponseBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Map allNodes; + @Nullable + private String clusterName; + @Nullable + private Map info; + private Map nodes; public Builder() {} - private Builder(GetStatsResponse o) {} + private Builder(GetStatsResponse o) { + super(o); + this.allNodes = _mapCopy(o.allNodes); + this.clusterName = o.clusterName; + this.info = _mapCopy(o.info); + this.nodes = _mapCopy(o.nodes); + } - private Builder(Builder o) {} + private Builder(Builder o) { + super(o); + this.allNodes = _mapCopy(o.allNodes); + this.clusterName = o.clusterName; + this.info = _mapCopy(o.info); + this.nodes = _mapCopy(o.nodes); + } @Override @Nonnull @@ -100,6 +204,99 @@ public Builder copy() { return new Builder(this); } + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code all_nodes} + * + *

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

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

+ * Adds an entry to allNodes. + *

+ */ + @Nonnull + public final Builder allNodes(String key, JsonData value) { + this.allNodes = _mapPut(this.allNodes, key, value); + return this; + } + + /** + * API name: {@code cluster_name} + */ + @Nonnull + public final Builder clusterName(@Nullable String value) { + this.clusterName = value; + return this; + } + + /** + * API name: {@code info} + * + *

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

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

+ * Adds an entry to info. + *

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

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

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

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, JsonData value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + /** * Builds a {@link GetStatsResponse}. * @@ -117,22 +314,42 @@ public GetStatsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link GetStatsResponse}. + * Json deserializer for {@link GetStatsResponse} */ - public static final GetStatsResponse _INSTANCE = builder().build(); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetStatsResponse::setupGetStatsResponseDeserializer + ); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(GetStatsResponse._INSTANCE); + protected static void setupGetStatsResponseDeserializer(ObjectDeserializer op) { + setupNodesResponseBaseDeserializer(op); + op.add(Builder::allNodes, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "all_nodes"); + op.add(Builder::clusterName, JsonpDeserializer.stringDeserializer(), "cluster_name"); + op.add(Builder::info, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "info"); + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "nodes"); + } @Override public int hashCode() { - int result = 17; + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.allNodes); + result = 31 * result + Objects.hashCode(this.clusterName); + result = 31 * result + Objects.hashCode(this.info); + result = 31 * result + this.nodes.hashCode(); return result; } @Override public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - return true; + GetStatsResponse other = (GetStatsResponse) o; + return Objects.equals(this.allNodes, other.allNodes) + && Objects.equals(this.clusterName, other.clusterName) + && Objects.equals(this.info, other.info) + && this.nodes.equals(other.nodes); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceAsyncClient.java index 1cbcb968c4..2522e00b32 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceAsyncClient.java @@ -42,9 +42,12 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr; import org.opensearch.client.util.ObjectBuilder; /** @@ -128,6 +131,27 @@ public final CompletableFuture deleteQuerySets( return deleteQuerySets(fn.apply(new DeleteQuerySetsRequest.Builder()).build()); } + // ----- Endpoint: search_relevance.delete_scheduled_experiments + + /** + * Deletes a specified scheduled experiment. + */ + public CompletableFuture deleteScheduledExperiments(DeleteScheduledExperimentsRequest request) + throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteScheduledExperimentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a specified scheduled experiment. + * + * @param fn a function that initializes a builder to create the {@link DeleteScheduledExperimentsRequest} + */ + public final CompletableFuture deleteScheduledExperiments( + Function> fn + ) throws IOException, OpenSearchException { + return deleteScheduledExperiments(fn.apply(new DeleteScheduledExperimentsRequest.Builder()).build()); + } + // ----- Endpoint: search_relevance.delete_search_configurations /** @@ -154,8 +178,22 @@ public final CompletableFuture deleteSearchC /** * Gets experiments. */ - public CompletableFuture getExperiments(GetExperimentsRequest request) throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, GetExperimentsRequest._ENDPOINT, this.transportOptions); + public CompletableFuture> getExperiments( + GetExperimentsRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetExperimentsRequest, + GetExperimentsResponse, + ErrorResponse>) GetExperimentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_experiments.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** @@ -163,17 +201,11 @@ public CompletableFuture getExperiments(GetExperimentsRe * * @param fn a function that initializes a builder to create the {@link GetExperimentsRequest} */ - public final CompletableFuture getExperiments( - Function> fn + public final CompletableFuture> getExperiments( + Function> fn, + Class tDocumentClass ) throws IOException, OpenSearchException { - return getExperiments(fn.apply(new GetExperimentsRequest.Builder()).build()); - } - - /** - * Gets experiments. - */ - public final CompletableFuture getExperiments() throws IOException, OpenSearchException { - return getExperiments(new GetExperimentsRequest.Builder().build()); + return getExperiments(fn.apply(new GetExperimentsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_judgments @@ -181,8 +213,22 @@ public final CompletableFuture getExperiments() throws I /** * Gets judgments. */ - public CompletableFuture getJudgments(GetJudgmentsRequest request) throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, GetJudgmentsRequest._ENDPOINT, this.transportOptions); + public CompletableFuture> getJudgments( + GetJudgmentsRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetJudgmentsRequest, + GetJudgmentsResponse, + ErrorResponse>) GetJudgmentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_judgments.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** @@ -190,17 +236,11 @@ public CompletableFuture getJudgments(GetJudgmentsRequest * * @param fn a function that initializes a builder to create the {@link GetJudgmentsRequest} */ - public final CompletableFuture getJudgments( - Function> fn + public final CompletableFuture> getJudgments( + Function> fn, + Class tDocumentClass ) throws IOException, OpenSearchException { - return getJudgments(fn.apply(new GetJudgmentsRequest.Builder()).build()); - } - - /** - * Gets judgments. - */ - public final CompletableFuture getJudgments() throws IOException, OpenSearchException { - return getJudgments(new GetJudgmentsRequest.Builder().build()); + return getJudgments(fn.apply(new GetJudgmentsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_node_stats @@ -228,8 +268,22 @@ public final CompletableFuture getNodeStats( /** * Lists the current query sets available. */ - public CompletableFuture getQuerySets(GetQuerySetsRequest request) throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, GetQuerySetsRequest._ENDPOINT, this.transportOptions); + public CompletableFuture> getQuerySets( + GetQuerySetsRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetQuerySetsRequest, + GetQuerySetsResponse, + ErrorResponse>) GetQuerySetsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_query_sets.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** @@ -237,45 +291,81 @@ public CompletableFuture getQuerySets(GetQuerySetsRequest * * @param fn a function that initializes a builder to create the {@link GetQuerySetsRequest} */ - public final CompletableFuture getQuerySets( - Function> fn + public final CompletableFuture> getQuerySets( + Function> fn, + Class tDocumentClass ) throws IOException, OpenSearchException { - return getQuerySets(fn.apply(new GetQuerySetsRequest.Builder()).build()); + return getQuerySets(fn.apply(new GetQuerySetsRequest.Builder()).build(), tDocumentClass); } + // ----- Endpoint: search_relevance.get_scheduled_experiments + /** - * Lists the current query sets available. + * Gets the scheduled experiments. */ - public final CompletableFuture getQuerySets() throws IOException, OpenSearchException { - return getQuerySets(new GetQuerySetsRequest.Builder().build()); - } + public CompletableFuture> getScheduledExperiments( + GetScheduledExperimentsRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetScheduledExperimentsRequest, + GetScheduledExperimentsResponse, + ErrorResponse>) GetScheduledExperimentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_scheduled_experiments.TDocument", + getDeserializer(tDocumentClass) + ); - // ----- Endpoint: search_relevance.get_search_configurations + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } /** - * Gets the search configurations. + * Gets the scheduled experiments. + * + * @param fn a function that initializes a builder to create the {@link GetScheduledExperimentsRequest} */ - public CompletableFuture getSearchConfigurations(GetSearchConfigurationsRequest request) - throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, GetSearchConfigurationsRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture> getScheduledExperiments( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getScheduledExperiments(fn.apply(new GetScheduledExperimentsRequest.Builder()).build(), tDocumentClass); } + // ----- Endpoint: search_relevance.get_search_configurations + /** * Gets the search configurations. - * - * @param fn a function that initializes a builder to create the {@link GetSearchConfigurationsRequest} */ - public final CompletableFuture getSearchConfigurations( - Function> fn + public CompletableFuture> getSearchConfigurations( + GetSearchConfigurationsRequest request, + Class tDocumentClass ) throws IOException, OpenSearchException { - return getSearchConfigurations(fn.apply(new GetSearchConfigurationsRequest.Builder()).build()); + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetSearchConfigurationsRequest, + GetSearchConfigurationsResponse, + ErrorResponse>) GetSearchConfigurationsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_search_configurations.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Gets the search configurations. + * + * @param fn a function that initializes a builder to create the {@link GetSearchConfigurationsRequest} */ - public final CompletableFuture getSearchConfigurations() throws IOException, OpenSearchException { - return getSearchConfigurations(new GetSearchConfigurationsRequest.Builder().build()); + public final CompletableFuture> getSearchConfigurations( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getSearchConfigurations(fn.apply(new GetSearchConfigurationsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_stats @@ -331,6 +421,34 @@ public final CompletableFuture postQuerySets() throws IOE return postQuerySets(new PostQuerySetsRequest.Builder().build()); } + // ----- Endpoint: search_relevance.post_scheduled_experiments + + /** + * Creates a scheduled experiment. + */ + public CompletableFuture postScheduledExperiments(PostScheduledExperimentsRequest request) + throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, PostScheduledExperimentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a scheduled experiment. + * + * @param fn a function that initializes a builder to create the {@link PostScheduledExperimentsRequest} + */ + public final CompletableFuture postScheduledExperiments( + Function> fn + ) throws IOException, OpenSearchException { + return postScheduledExperiments(fn.apply(new PostScheduledExperimentsRequest.Builder()).build()); + } + + /** + * Creates a scheduled experiment. + */ + public final CompletableFuture postScheduledExperiments() throws IOException, OpenSearchException { + return postScheduledExperiments(new PostScheduledExperimentsRequest.Builder().build()); + } + // ----- Endpoint: search_relevance.put_experiments /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceClient.java index 932f03d847..b6f0fccdc5 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/OpenSearchSearchRelevanceClient.java @@ -41,9 +41,12 @@ import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.transport.endpoints.EndpointWithResponseMapperAttr; import org.opensearch.client.util.ObjectBuilder; /** @@ -122,6 +125,27 @@ public final DeleteQuerySetsResponse deleteQuerySets(Function> fn + ) throws IOException, OpenSearchException { + return deleteScheduledExperiments(fn.apply(new DeleteScheduledExperimentsRequest.Builder()).build()); + } + // ----- Endpoint: search_relevance.delete_search_configurations /** @@ -148,8 +172,20 @@ public final DeleteSearchConfigurationsResponse deleteSearchConfigurations( /** * Gets experiments. */ - public GetExperimentsResponse getExperiments(GetExperimentsRequest request) throws IOException, OpenSearchException { - return this.transport.performRequest(request, GetExperimentsRequest._ENDPOINT, this.transportOptions); + public GetExperimentsResponse getExperiments(GetExperimentsRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetExperimentsRequest, + GetExperimentsResponse, + ErrorResponse>) GetExperimentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_experiments.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); } /** @@ -157,16 +193,11 @@ public GetExperimentsResponse getExperiments(GetExperimentsRequest request) thro * * @param fn a function that initializes a builder to create the {@link GetExperimentsRequest} */ - public final GetExperimentsResponse getExperiments(Function> fn) - throws IOException, OpenSearchException { - return getExperiments(fn.apply(new GetExperimentsRequest.Builder()).build()); - } - - /** - * Gets experiments. - */ - public final GetExperimentsResponse getExperiments() throws IOException, OpenSearchException { - return getExperiments(new GetExperimentsRequest.Builder().build()); + public final GetExperimentsResponse getExperiments( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getExperiments(fn.apply(new GetExperimentsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_judgments @@ -174,8 +205,20 @@ public final GetExperimentsResponse getExperiments() throws IOException, OpenSea /** * Gets judgments. */ - public GetJudgmentsResponse getJudgments(GetJudgmentsRequest request) throws IOException, OpenSearchException { - return this.transport.performRequest(request, GetJudgmentsRequest._ENDPOINT, this.transportOptions); + public GetJudgmentsResponse getJudgments(GetJudgmentsRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetJudgmentsRequest, + GetJudgmentsResponse, + ErrorResponse>) GetJudgmentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_judgments.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); } /** @@ -183,16 +226,11 @@ public GetJudgmentsResponse getJudgments(GetJudgmentsRequest request) throws IOE * * @param fn a function that initializes a builder to create the {@link GetJudgmentsRequest} */ - public final GetJudgmentsResponse getJudgments(Function> fn) - throws IOException, OpenSearchException { - return getJudgments(fn.apply(new GetJudgmentsRequest.Builder()).build()); - } - - /** - * Gets judgments. - */ - public final GetJudgmentsResponse getJudgments() throws IOException, OpenSearchException { - return getJudgments(new GetJudgmentsRequest.Builder().build()); + public final GetJudgmentsResponse getJudgments( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getJudgments(fn.apply(new GetJudgmentsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_node_stats @@ -219,8 +257,20 @@ public final GetNodeStatsResponse getNodeStats(Function GetQuerySetsResponse getQuerySets(GetQuerySetsRequest request, Class tDocumentClass) + throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetQuerySetsRequest, + GetQuerySetsResponse, + ErrorResponse>) GetQuerySetsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_query_sets.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); } /** @@ -228,44 +278,81 @@ public GetQuerySetsResponse getQuerySets(GetQuerySetsRequest request) throws IOE * * @param fn a function that initializes a builder to create the {@link GetQuerySetsRequest} */ - public final GetQuerySetsResponse getQuerySets(Function> fn) - throws IOException, OpenSearchException { - return getQuerySets(fn.apply(new GetQuerySetsRequest.Builder()).build()); + public final GetQuerySetsResponse getQuerySets( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getQuerySets(fn.apply(new GetQuerySetsRequest.Builder()).build(), tDocumentClass); } + // ----- Endpoint: search_relevance.get_scheduled_experiments + /** - * Lists the current query sets available. + * Gets the scheduled experiments. */ - public final GetQuerySetsResponse getQuerySets() throws IOException, OpenSearchException { - return getQuerySets(new GetQuerySetsRequest.Builder().build()); - } + public GetScheduledExperimentsResponse getScheduledExperiments( + GetScheduledExperimentsRequest request, + Class tDocumentClass + ) throws IOException, OpenSearchException { + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetScheduledExperimentsRequest, + GetScheduledExperimentsResponse, + ErrorResponse>) GetScheduledExperimentsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_scheduled_experiments.TDocument", + getDeserializer(tDocumentClass) + ); - // ----- Endpoint: search_relevance.get_search_configurations + return this.transport.performRequest(request, endpoint, this.transportOptions); + } /** - * Gets the search configurations. + * Gets the scheduled experiments. + * + * @param fn a function that initializes a builder to create the {@link GetScheduledExperimentsRequest} */ - public GetSearchConfigurationsResponse getSearchConfigurations(GetSearchConfigurationsRequest request) throws IOException, - OpenSearchException { - return this.transport.performRequest(request, GetSearchConfigurationsRequest._ENDPOINT, this.transportOptions); + public final GetScheduledExperimentsResponse getScheduledExperiments( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getScheduledExperiments(fn.apply(new GetScheduledExperimentsRequest.Builder()).build(), tDocumentClass); } + // ----- Endpoint: search_relevance.get_search_configurations + /** * Gets the search configurations. - * - * @param fn a function that initializes a builder to create the {@link GetSearchConfigurationsRequest} */ - public final GetSearchConfigurationsResponse getSearchConfigurations( - Function> fn + public GetSearchConfigurationsResponse getSearchConfigurations( + GetSearchConfigurationsRequest request, + Class tDocumentClass ) throws IOException, OpenSearchException { - return getSearchConfigurations(fn.apply(new GetSearchConfigurationsRequest.Builder()).build()); + @SuppressWarnings("unchecked") + JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint< + GetSearchConfigurationsRequest, + GetSearchConfigurationsResponse, + ErrorResponse>) GetSearchConfigurationsRequest._ENDPOINT; + endpoint = new EndpointWithResponseMapperAttr<>( + endpoint, + "org.opensearch.client:Deserializer:search_relevance.get_search_configurations.TDocument", + getDeserializer(tDocumentClass) + ); + + return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Gets the search configurations. + * + * @param fn a function that initializes a builder to create the {@link GetSearchConfigurationsRequest} */ - public final GetSearchConfigurationsResponse getSearchConfigurations() throws IOException, OpenSearchException { - return getSearchConfigurations(new GetSearchConfigurationsRequest.Builder().build()); + public final GetSearchConfigurationsResponse getSearchConfigurations( + Function> fn, + Class tDocumentClass + ) throws IOException, OpenSearchException { + return getSearchConfigurations(fn.apply(new GetSearchConfigurationsRequest.Builder()).build(), tDocumentClass); } // ----- Endpoint: search_relevance.get_stats @@ -320,6 +407,34 @@ public final PostQuerySetsResponse postQuerySets() throws IOException, OpenSearc return postQuerySets(new PostQuerySetsRequest.Builder().build()); } + // ----- Endpoint: search_relevance.post_scheduled_experiments + + /** + * Creates a scheduled experiment. + */ + public PostScheduledExperimentsResponse postScheduledExperiments(PostScheduledExperimentsRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequest(request, PostScheduledExperimentsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a scheduled experiment. + * + * @param fn a function that initializes a builder to create the {@link PostScheduledExperimentsRequest} + */ + public final PostScheduledExperimentsResponse postScheduledExperiments( + Function> fn + ) throws IOException, OpenSearchException { + return postScheduledExperiments(fn.apply(new PostScheduledExperimentsRequest.Builder()).build()); + } + + /** + * Creates a scheduled experiment. + */ + public final PostScheduledExperimentsResponse postScheduledExperiments() throws IOException, OpenSearchException { + return postScheduledExperiments(new PostScheduledExperimentsRequest.Builder().build()); + } + // ----- Endpoint: search_relevance.put_experiments /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsRequest.java new file mode 100644 index 0000000000..d573181f58 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsRequest.java @@ -0,0 +1,265 @@ +/* + * 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.search_relevance; + +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 javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_relevance.post_scheduled_experiments.Request + +/** + * Creates a scheduled experiment. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class PostScheduledExperimentsRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String cronExpression; + + @Nullable + private final String experimentId; + + // --------------------------------------------------------------------------------------------- + + private PostScheduledExperimentsRequest(Builder builder) { + super(builder); + this.cronExpression = builder.cronExpression; + this.experimentId = builder.experimentId; + } + + public static PostScheduledExperimentsRequest of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code cronExpression} + */ + @Nullable + public final String cronExpression() { + return this.cronExpression; + } + + /** + * API name: {@code experimentId} + */ + @Nullable + public final String experimentId() { + return this.experimentId; + } + + /** + * 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.cronExpression != null) { + generator.writeKey("cronExpression"); + generator.write(this.cronExpression); + } + + if (this.experimentId != null) { + generator.writeKey("experimentId"); + generator.write(this.experimentId); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PostScheduledExperimentsRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private String cronExpression; + @Nullable + private String experimentId; + + public Builder() {} + + private Builder(PostScheduledExperimentsRequest o) { + super(o); + this.cronExpression = o.cronExpression; + this.experimentId = o.experimentId; + } + + private Builder(Builder o) { + super(o); + this.cronExpression = o.cronExpression; + this.experimentId = o.experimentId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code cronExpression} + */ + @Nonnull + public final Builder cronExpression(@Nullable String value) { + this.cronExpression = value; + return this; + } + + /** + * API name: {@code experimentId} + */ + @Nonnull + public final Builder experimentId(@Nullable String value) { + this.experimentId = value; + return this; + } + + /** + * Builds a {@link PostScheduledExperimentsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PostScheduledExperimentsRequest build() { + _checkSingleUse(); + + return new PostScheduledExperimentsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PostScheduledExperimentsRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PostScheduledExperimentsRequest::setupPostScheduledExperimentsRequestDeserializer + ); + + protected static void setupPostScheduledExperimentsRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::cronExpression, JsonpDeserializer.stringDeserializer(), "cronExpression"); + op.add(Builder::experimentId, JsonpDeserializer.stringDeserializer(), "experimentId"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_relevance.post_scheduled_experiments}". + */ + public static final Endpoint _ENDPOINT = + new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_search_relevance/experiments/schedule", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + PostScheduledExperimentsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.cronExpression); + result = 31 * result + Objects.hashCode(this.experimentId); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PostScheduledExperimentsRequest other = (PostScheduledExperimentsRequest) o; + return Objects.equals(this.cronExpression, other.cronExpression) && Objects.equals(this.experimentId, other.experimentId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsResponse.java new file mode 100644 index 0000000000..434c52c6e4 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PostScheduledExperimentsResponse.java @@ -0,0 +1,226 @@ +/* + * 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.search_relevance; + +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: search_relevance.post_scheduled_experiments.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PostScheduledExperimentsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String jobId; + + @Nullable + private final String jobResult; + + // --------------------------------------------------------------------------------------------- + + private PostScheduledExperimentsResponse(Builder builder) { + this.jobId = builder.jobId; + this.jobResult = builder.jobResult; + } + + public static PostScheduledExperimentsResponse of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code job_id} + */ + @Nullable + public final String jobId() { + return this.jobId; + } + + /** + * API name: {@code job_result} + */ + @Nullable + public final String jobResult() { + return this.jobResult; + } + + /** + * 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.jobId != null) { + generator.writeKey("job_id"); + generator.write(this.jobId); + } + + if (this.jobResult != null) { + generator.writeKey("job_result"); + generator.write(this.jobResult); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PostScheduledExperimentsResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String jobId; + @Nullable + private String jobResult; + + public Builder() {} + + private Builder(PostScheduledExperimentsResponse o) { + this.jobId = o.jobId; + this.jobResult = o.jobResult; + } + + private Builder(Builder o) { + this.jobId = o.jobId; + this.jobResult = o.jobResult; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code job_id} + */ + @Nonnull + public final Builder jobId(@Nullable String value) { + this.jobId = value; + return this; + } + + /** + * API name: {@code job_result} + */ + @Nonnull + public final Builder jobResult(@Nullable String value) { + this.jobResult = value; + return this; + } + + /** + * Builds a {@link PostScheduledExperimentsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PostScheduledExperimentsResponse build() { + _checkSingleUse(); + + return new PostScheduledExperimentsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PostScheduledExperimentsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PostScheduledExperimentsResponse::setupPostScheduledExperimentsResponseDeserializer + ); + + protected static void setupPostScheduledExperimentsResponseDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::jobId, JsonpDeserializer.stringDeserializer(), "job_id"); + op.add(Builder::jobResult, JsonpDeserializer.stringDeserializer(), "job_result"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.jobId); + result = 31 * result + Objects.hashCode(this.jobResult); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PostScheduledExperimentsResponse other = (PostScheduledExperimentsResponse) o; + return Objects.equals(this.jobId, other.jobId) && Objects.equals(this.jobResult, other.jobResult); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsRequest.java index 03a9506830..61bf2959cb 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsRequest.java @@ -38,7 +38,6 @@ import jakarta.json.stream.JsonGenerator; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -56,7 +55,6 @@ 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; @@ -73,8 +71,8 @@ public final class PutExperimentsRequest extends RequestBase PlainJsonSerializable, ToCopyableBuilder { - @Nonnull - private final List judgmentList; + @Nullable + private final JsonData judgmentList; @Nullable private final String querySetId; @@ -92,7 +90,7 @@ public final class PutExperimentsRequest extends RequestBase private PutExperimentsRequest(Builder builder) { super(builder); - this.judgmentList = ApiTypeHelper.unmodifiable(builder.judgmentList); + this.judgmentList = builder.judgmentList; this.querySetId = builder.querySetId; this.searchConfigurationList = builder.searchConfigurationList; this.size = builder.size; @@ -106,8 +104,8 @@ public static PutExperimentsRequest of(Function judgmentList() { + @Nullable + public final JsonData judgmentList() { return this.judgmentList; } @@ -154,13 +152,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.judgmentList)) { + if (this.judgmentList != null) { generator.writeKey("judgmentList"); - generator.writeStartArray(); - for (String item0 : this.judgmentList) { - generator.write(item0); - } - generator.writeEnd(); + this.judgmentList.serialize(generator, mapper); } if (this.querySetId != null) { @@ -202,7 +196,7 @@ public static Builder builder() { */ public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { @Nullable - private List judgmentList; + private JsonData judgmentList; @Nullable private String querySetId; @Nullable @@ -216,7 +210,7 @@ public Builder() {} private Builder(PutExperimentsRequest o) { super(o); - this.judgmentList = _listCopy(o.judgmentList); + this.judgmentList = o.judgmentList; this.querySetId = o.querySetId; this.searchConfigurationList = o.searchConfigurationList; this.size = o.size; @@ -225,7 +219,7 @@ private Builder(PutExperimentsRequest o) { private Builder(Builder o) { super(o); - this.judgmentList = _listCopy(o.judgmentList); + this.judgmentList = o.judgmentList; this.querySetId = o.querySetId; this.searchConfigurationList = o.searchConfigurationList; this.size = o.size; @@ -246,27 +240,10 @@ protected Builder self() { /** * API name: {@code judgmentList} - * - *

- * Adds all elements of list to judgmentList. - *

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

- * Adds one or more values to judgmentList. - *

*/ @Nonnull - public final Builder judgmentList(String value, String... values) { - this.judgmentList = _listAdd(this.judgmentList, value, values); + public final Builder judgmentList(@Nullable JsonData value) { + this.judgmentList = value; return this; } @@ -331,7 +308,7 @@ public PutExperimentsRequest build() { ); protected static void setupPutExperimentsRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::judgmentList, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "judgmentList"); + op.add(Builder::judgmentList, JsonData._DESERIALIZER, "judgmentList"); op.add(Builder::querySetId, JsonpDeserializer.stringDeserializer(), "querySetId"); op.add(Builder::searchConfigurationList, JsonData._DESERIALIZER, "searchConfigurationList"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsResponse.java index cc5dfd189b..d150627137 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_relevance/PutExperimentsResponse.java @@ -37,11 +37,16 @@ package org.opensearch.client.opensearch.search_relevance; 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; @@ -50,29 +55,68 @@ // typedef: search_relevance.put_experiments.Response +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") public class PutExperimentsResponse implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable + private final String experimentId; + + @Nullable + private final String experimentResult; + // --------------------------------------------------------------------------------------------- - private PutExperimentsResponse(Builder builder) {} + private PutExperimentsResponse(Builder builder) { + this.experimentId = builder.experimentId; + this.experimentResult = builder.experimentResult; + } public static PutExperimentsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code experiment_id} + */ + @Nullable + public final String experimentId() { + return this.experimentId; + } + + /** + * API name: {@code experiment_result} + */ + @Nullable + public final String experimentResult() { + return this.experimentResult; + } + /** * 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.experimentId != null) { + generator.writeKey("experiment_id"); + generator.write(this.experimentId); + } + + if (this.experimentResult != null) { + generator.writeKey("experiment_result"); + generator.write(this.experimentResult); + } + } + // --------------------------------------------------------------------------------------------- @Override @@ -90,12 +134,22 @@ public static Builder builder() { * Builder for {@link PutExperimentsResponse}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String experimentId; + @Nullable + private String experimentResult; public Builder() {} - private Builder(PutExperimentsResponse o) {} + private Builder(PutExperimentsResponse o) { + this.experimentId = o.experimentId; + this.experimentResult = o.experimentResult; + } - private Builder(Builder o) {} + private Builder(Builder o) { + this.experimentId = o.experimentId; + this.experimentResult = o.experimentResult; + } @Override @Nonnull @@ -103,6 +157,24 @@ public Builder copy() { return new Builder(this); } + /** + * API name: {@code experiment_id} + */ + @Nonnull + public final Builder experimentId(@Nullable String value) { + this.experimentId = value; + return this; + } + + /** + * API name: {@code experiment_result} + */ + @Nonnull + public final Builder experimentResult(@Nullable String value) { + this.experimentResult = value; + return this; + } + /** * Builds a {@link PutExperimentsResponse}. * @@ -120,17 +192,23 @@ public PutExperimentsResponse build() { // --------------------------------------------------------------------------------------------- /** - * Singleton instance for {@link PutExperimentsResponse}. + * Json deserializer for {@link PutExperimentsResponse} */ - public static final PutExperimentsResponse _INSTANCE = builder().build(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject( - PutExperimentsResponse._INSTANCE + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PutExperimentsResponse::setupPutExperimentsResponseDeserializer ); + protected static void setupPutExperimentsResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::experimentId, JsonpDeserializer.stringDeserializer(), "experiment_id"); + op.add(Builder::experimentResult, JsonpDeserializer.stringDeserializer(), "experiment_result"); + } + @Override public int hashCode() { int result = 17; + result = 31 * result + Objects.hashCode(this.experimentId); + result = 31 * result + Objects.hashCode(this.experimentResult); return result; } @@ -138,6 +216,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - return true; + PutExperimentsResponse other = (PutExperimentsResponse) o; + return Objects.equals(this.experimentId, other.experimentId) && Objects.equals(this.experimentResult, other.experimentResult); } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java index 0b22cf3479..3925fa8434 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java @@ -23,7 +23,7 @@ public class PlainJsonSerializableTest extends Assert { public void testIndexResponse() { String expectedStringValue = - "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"primary\":true,\"reason\":{\"reason\":\"Failed to create query.\",\"type\":\"query_shard_exception\"},\"shard\":1,\"status\":\"Failed\"}],\"skipped\":1,\"successful\":1,\"total\":3},\"_version\":3}"; + "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"reason\":{\"reason\":\"Failed to create query.\",\"type\":\"query_shard_exception\"},\"shard\":1}],\"skipped\":1,\"successful\":1,\"total\":3},\"_version\":3}"; IndexResponse indexResponse = IndexResponse.of( response -> response.result(Result.Created) .index("index") @@ -40,9 +40,7 @@ public void testIndexResponse() { shardFailure -> shardFailure.index("index") .node("node") .shard(1) - .status("Failed") .reason(cause -> cause.type("query_shard_exception").reason("Failed to create query.")) - .primary(true) ) ) ); diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 0a241d0dbf..db2b553d46 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -5766,6 +5766,24 @@ paths: responses: '200': $ref: '#/components/responses/ml.execute_agent___200' + /_plugins/_ml/agents/{agent_id}/_execute/stream: + post: + operationId: ml.execute_agent_stream.0 + x-operation-group: ml.execute_agent_stream + x-version-added: '3.3' + description: Execute an agent in streaming mode. + parameters: + - $ref: '#/components/parameters/ml.execute_agent_stream___path.agent_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.execute_agent_stream' + responses: + '200': + $ref: '#/components/responses/ml.execute_agent_stream___200' /_plugins/_ml/connectors/_create: post: operationId: ml.create_connector.0 @@ -6707,6 +6725,24 @@ paths: responses: '200': $ref: '#/components/responses/ml.predict_model___200' + /_plugins/_ml/models/{model_id}/_predict/stream: + post: + operationId: ml.predict_model_stream.0 + x-operation-group: ml.predict_model_stream + x-version-added: '3.3' + description: Predicts a model in streaming mode. + parameters: + - $ref: '#/components/parameters/ml.predict_model_stream___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.predict_model_stream' + responses: + '200': + $ref: '#/components/responses/ml.predict_model_stream___200' /_plugins/_ml/models/{model_id}/_undeploy: post: operationId: ml.undeploy_model.0 @@ -8079,6 +8115,68 @@ paths: responses: '200': $ref: '#/components/responses/search_relevance.get_experiments___200' + /_plugins/_search_relevance/experiments/schedule: + get: + operationId: search_relevance.get_scheduled_experiments.0 + x-operation-group: search_relevance.get_scheduled_experiments + x-version-added: '3.4' + description: Gets the scheduled experiments. + responses: + '200': + $ref: '#/components/responses/search_relevance.get_scheduled_experiments___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + post: + operationId: search_relevance.post_scheduled_experiments.0 + x-operation-group: search_relevance.post_scheduled_experiments + x-version-added: '3.4' + description: Creates a scheduled experiment. + requestBody: + $ref: '#/components/requestBodies/search_relevance.post_scheduled_experiments' + responses: + '200': + $ref: '#/components/responses/search_relevance.post_scheduled_experiments___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_search_relevance/experiments/schedule/{experiment_id}: + delete: + operationId: search_relevance.delete_scheduled_experiments.0 + x-operation-group: search_relevance.delete_scheduled_experiments + x-version-added: '3.4' + description: Deletes a specified scheduled experiment. + parameters: + - $ref: '#/components/parameters/search_relevance.delete_scheduled_experiments___path.experiment_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/search_relevance.delete_scheduled_experiments___200' + get: + operationId: search_relevance.get_scheduled_experiments.1 + x-operation-group: search_relevance.get_scheduled_experiments + x-version-added: '3.4' + description: Gets the scheduled experiments. + parameters: + - $ref: '#/components/parameters/search_relevance.get_scheduled_experiments___path.experiment_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/search_relevance.get_scheduled_experiments___200' /_plugins/_search_relevance/judgments: get: operationId: search_relevance.get_judgments.0 @@ -26375,6 +26473,12 @@ components: required: true schema: type: string + ml.execute_agent_stream___path.agent_id: + name: agent_id + in: path + required: true + schema: + type: string ml.execute_agent___path.agent_id: name: agent_id in: path @@ -26561,6 +26665,12 @@ components: required: true schema: type: string + ml.predict_model_stream___path.model_id: + name: model_id + in: path + required: true + schema: + type: string ml.predict_model___path.model_id: name: model_id in: path @@ -27994,6 +28104,13 @@ components: description: The query set id schema: type: string + search_relevance.delete_scheduled_experiments___path.experiment_id: + name: experiment_id + in: path + required: true + description: The experiment id + schema: + type: string search_relevance.delete_search_configurations___path.search_configuration_id: name: search_configuration_id in: path @@ -28071,6 +28188,13 @@ components: description: The query set id schema: type: string + search_relevance.get_scheduled_experiments___path.experiment_id: + name: experiment_id + in: path + required: true + description: The experiment id + schema: + type: string search_relevance.get_search_configurations___path.search_configuration_id: name: search_configuration_id in: path @@ -31639,6 +31763,16 @@ components: description: Whether to provide verbose output. required: - parameters + ml.execute_agent_stream: + content: + application/json: + schema: + type: object + properties: + parameters: + $ref: '#/components/schemas/ml._common___Parameters' + required: + - parameters ml.execute_algorithm: content: application/json: @@ -31756,6 +31890,16 @@ components: description: The text documents. required: - text_docs + ml.predict_model_stream: + content: + application/json: + schema: + type: object + properties: + parameters: + $ref: '#/components/schemas/ml._common___Parameters' + required: + - parameters ml.register_agents: content: application/json: @@ -32738,137 +32882,38 @@ components: content: application/json: schema: - type: object - properties: - name: - type: string - description: - type: string - sampling: - type: string - querySetSize: - type: integer + $ref: '#/components/schemas/search_relevance._common___PostQuerySetsRequest' + search_relevance.post_scheduled_experiments: + content: + application/json: + schema: + $ref: '#/components/schemas/search_relevance._common___PostScheduledExperimentsRequest' search_relevance.put_experiments: content: application/json: schema: anyOf: - - type: object - description: The schema for a pointwise and hybrid optimizer experiment - properties: - querySetId: - type: string - searchConfigurationList: - type: array - items: - type: string - judgmentList: - type: array - items: - type: string - size: - type: integer - type: - type: string - - type: object - description: The schema for a pairwise experiment - properties: - querySetId: - type: string - searchConfigurationList: - type: array - items: - type: string - size: - type: integer - type: - type: string + - $ref: '#/components/schemas/search_relevance._common___PutHybridOptimizerExperimentRequest' + - $ref: '#/components/schemas/search_relevance._common___PutPointwiseExperimentRequest' + - $ref: '#/components/schemas/search_relevance._common___PutPairwiseExperimentRequest' search_relevance.put_judgments: content: application/json: schema: oneOf: - - type: object - description: The schema for a LLM judgment - properties: - name: - type: string - description: - type: string - type: - type: string - modelId: - type: string - querySetId: - type: string - searchConfigurationList: - type: array - items: - type: string - size: - type: integer - ignoreFailure: - type: boolean - contextFields: - type: array - items: - type: string - - type: object - description: The schema for a UBI judgment - properties: - name: - type: string - description: - type: string - type: - type: string - clickModel: - type: string - maxRank: - type: integer - - type: object - description: The schema for an import judgment - properties: - name: - type: string - description: - type: string - type: - type: string - judgmentRatings: - type: array - items: - type: object + - $ref: '#/components/schemas/search_relevance._common___PutLLMJudgmentsRequest' + - $ref: '#/components/schemas/search_relevance._common___PutUBIJudgmentsRequest' + - $ref: '#/components/schemas/search_relevance._common___PutImportJudgmentsRequest' search_relevance.put_query_sets: content: application/json: schema: - type: object - properties: - name: - type: string - description: - type: string - sampling: - type: string - querySetQueries: - type: array - items: - type: object + $ref: '#/components/schemas/search_relevance._common___PutQuerySetsRequest' search_relevance.put_search_configurations: content: application/json: schema: - type: object - properties: - name: - type: string - index: - type: string - query: - type: string - searchPipeline: - type: string + $ref: '#/components/schemas/search_relevance._common___PutSearchConfigurationRequest' search_shards: content: application/json: @@ -36060,6 +36105,12 @@ components: - status - task_id description: '' + ml.execute_agent_stream___200: + content: + text/event-stream: + schema: + $ref: '#/components/schemas/ml._common___PredictResponse' + description: '' ml.execute_agent___200: content: application/json: @@ -36250,6 +36301,12 @@ components: - task_id - task_type description: '' + ml.predict_model_stream___200: + content: + text/event-stream: + schema: + $ref: '#/components/schemas/ml._common___PredictResponse' + description: '' ml.predict_model___200: content: application/json: @@ -37052,117 +37109,135 @@ components: content: application/json: schema: - type: object + $ref: '#/components/schemas/_common___WriteResponseBase' description: '' search_relevance.delete_judgments___200: content: application/json: schema: - type: object + $ref: '#/components/schemas/_common___WriteResponseBase' description: '' search_relevance.delete_query_sets___200: content: application/json: schema: - type: object + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' + search_relevance.delete_scheduled_experiments___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' description: '' search_relevance.delete_search_configurations___200: content: application/json: schema: - type: object + $ref: '#/components/schemas/_common___WriteResponseBase' description: '' search_relevance.get_experiments___200: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/search_relevance._common___Experiment' - - $ref: '#/components/schemas/search_relevance._common___GenericObject' + $ref: '#/components/schemas/_core.search___SearchResult' description: '' search_relevance.get_judgments___200: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/search_relevance._common___Judgment' - - $ref: '#/components/schemas/search_relevance._common___GenericObject' + $ref: '#/components/schemas/_core.search___SearchResult' description: '' search_relevance.get_node_stats___200: content: application/json: schema: - type: object + allOf: + - $ref: '#/components/schemas/nodes._common___NodesResponseBase' + - type: object + properties: + cluster_name: + $ref: '#/components/schemas/_common___Name' + info: + type: object + all_nodes: + type: object + nodes: + type: object + required: + - nodes description: '' search_relevance.get_query_sets___200: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/search_relevance._common___QuerySet' - - $ref: '#/components/schemas/search_relevance._common___GenericObject' + $ref: '#/components/schemas/_core.search___SearchResult' + description: '' + search_relevance.get_scheduled_experiments___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_core.search___SearchResult' description: '' search_relevance.get_search_configurations___200: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/search_relevance._common___SearchConfiguration' - - $ref: '#/components/schemas/search_relevance._common___GenericObject' + $ref: '#/components/schemas/_core.search___SearchResult' description: '' search_relevance.get_stats___200: content: application/json: schema: - type: object + allOf: + - $ref: '#/components/schemas/nodes._common___NodesResponseBase' + - type: object + properties: + cluster_name: + $ref: '#/components/schemas/_common___Name' + info: + type: object + all_nodes: + type: object + nodes: + type: object + required: + - nodes description: '' search_relevance.post_query_sets___200: content: application/json: schema: - type: object - properties: - query_set_id: - type: string - query_set_result: - type: string + $ref: '#/components/schemas/search_relevance._common___PostQuerySetsResponse' + description: '' + search_relevance.post_scheduled_experiments___200: + content: + application/json: + schema: + $ref: '#/components/schemas/search_relevance._common___PostScheduledExperimentsResponse' description: '' search_relevance.put_experiments___200: content: application/json: schema: - type: object + $ref: '#/components/schemas/search_relevance._common___PutExperimentResponse' description: '' search_relevance.put_judgments___200: content: application/json: schema: - type: object - properties: - judgment_id: - type: string + $ref: '#/components/schemas/search_relevance._common___PutJudgmentsResponse' description: '' search_relevance.put_query_sets___200: content: application/json: schema: - type: object - properties: - query_set_id: - type: string - query_set_result: - type: string + $ref: '#/components/schemas/search_relevance._common___PutQuerySetsResponse' description: '' search_relevance.put_search_configurations___200: content: application/json: schema: - type: object - properties: - search_configuration_id: - type: string - search_configuration_result: - type: string + $ref: '#/components/schemas/search_relevance._common___PutSearchConfigurationResponse' description: '' search_shards___200: content: @@ -40777,6 +40852,24 @@ components: - failed - successful - total + _common___ShardSearchFailure: + type: object + description: Represents a failure to search on a specific shard. Used in search responses. + properties: + shard: + type: integer + description: The shard id where the failure occurred. + index: + type: string + description: The index name where the failure occurred. + node: + type: string + description: The node id where the failure occurred. + reason: + $ref: '#/components/schemas/_common___ErrorCause' + required: + - reason + - shard _common___ShardsOperationResponseBase: description: The base response for operations involving shards. type: object @@ -40797,7 +40890,7 @@ components: failures: type: array items: - $ref: '#/components/schemas/_common___ShardFailure' + $ref: '#/components/schemas/_common___ShardSearchFailure' skipped: $ref: '#/components/schemas/_common___uint' required: @@ -62440,6 +62533,15 @@ components: session_token: type: string additionalProperties: true + ml._common___DataAsMap: + type: object + properties: + content: + type: string + description: The streaming content chunk. + is_last: + type: boolean + description: Whether this is the last chunk. ml._common___DeleteAgenticMemoryResponse: type: object properties: @@ -63325,6 +63427,8 @@ components: result: type: string description: The output result. + dataAsMap: + $ref: '#/components/schemas/ml._common___DataAsMap' ml._common___Owner: type: object properties: @@ -68581,17 +68685,51 @@ components: format: int32 context_prefix: type: string - search_relevance._common___Experiment: + search_relevance._common___PostQuerySetsRequest: type: object + description: The schema for creating a query set. properties: - id: + name: type: string - timestamp: + description: type: string - type: + sampling: type: string - status: + querySetSize: + type: integer + search_relevance._common___PostQuerySetsResponse: + type: object + properties: + query_set_id: + type: string + query_set_result: + type: string + search_relevance._common___PostScheduledExperimentsRequest: + type: object + description: The schema for scheduling experiments. + properties: + experimentId: + type: string + cronExpression: + type: string + search_relevance._common___PostScheduledExperimentsResponse: + type: object + properties: + job_id: + type: string + job_result: type: string + search_relevance._common___PutExperimentResponse: + type: object + properties: + experiment_id: + type: string + experiment_result: + type: string + search_relevance._common___PutHybridOptimizerExperimentRequest: + type: object + description: The schema for a hybrid optimizer experiment. + properties: querySetId: type: string searchConfigurationList: @@ -68604,59 +68742,110 @@ components: type: string size: type: integer - results: - type: object - search_relevance._common___GenericObject: + type: + type: string + search_relevance._common___PutImportJudgmentsRequest: type: object + description: The schema for an import judgment. properties: - took: - type: integer - timed_out: - type: boolean - _shards: - type: object - hits: - type: object - search_relevance._common___Judgment: + name: + type: string + description: + type: string + type: + type: string + judgmentRatings: + type: array + items: + type: object + search_relevance._common___PutJudgmentsResponse: type: object properties: - id: - type: string - timestamp: + judgment_id: type: string + search_relevance._common___PutLLMJudgmentsRequest: + type: object + description: The schema for a LLM judgment. + properties: name: type: string - status: + description: type: string type: type: string - metadata: - type: object - judgmentScores: - type: object - search_relevance._common___QuerySet: + modelId: + type: string + querySetId: + type: string + searchConfigurationList: + type: array + items: + type: string + size: + type: integer + ignoreFailure: + type: boolean + contextFields: + type: array + items: + type: string + search_relevance._common___PutPairwiseExperimentRequest: type: object + description: The schema for a pairwise experiment. properties: - id: + querySetId: type: string + searchConfigurationList: + type: array + items: + type: string + size: + type: integer + type: + type: string + search_relevance._common___PutPointwiseExperimentRequest: + type: object + description: The schema for a pointwise experiment. + properties: + querySetId: + type: string + searchConfigurationList: + type: array + items: + type: string + judgmentList: + type: array + items: + type: string + size: + type: integer + type: + type: string + search_relevance._common___PutQuerySetsRequest: + type: object + description: The schema for updating a query set. + properties: name: type: string description: type: string sampling: type: string - timestamp: - type: string querySetQueries: - type: object - search_relevance._common___SearchConfiguration: + type: array + items: + type: object + search_relevance._common___PutQuerySetsResponse: type: object properties: - id: + query_set_id: type: string - name: + query_set_result: type: string - timestamp: + search_relevance._common___PutSearchConfigurationRequest: + type: object + properties: + name: type: string index: type: string @@ -68664,6 +68853,27 @@ components: type: string searchPipeline: type: string + search_relevance._common___PutSearchConfigurationResponse: + type: object + properties: + search_configuration_id: + type: string + search_configuration_result: + type: string + search_relevance._common___PutUBIJudgmentsRequest: + type: object + description: The schema for a UBI judgment. + properties: + name: + type: string + description: + type: string + type: + type: string + clickModel: + type: string + maxRank: + type: integer security_analytics.alerts___ActionExecutionResult: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/MimeType.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/MimeType.java index 1dd2add4ca..8b30a6cfd8 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/MimeType.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/MimeType.java @@ -14,6 +14,7 @@ import org.opensearch.client.codegen.utils.Strings; public enum MimeType { + Sse("text/event-stream"), Cbor("application/cbor"), Json("application/json"), NdJson("application/x-ndjson"),