diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java similarity index 73% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java index a934ae5adb..83c1375376 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardsOperationResponseBase.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; @@ -43,20 +49,22 @@ // typedef: _types.ShardsOperationResponseBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class ShardsOperationResponseBase implements PlainJsonSerializable { + + @Nonnull private final ShardStatistics shards; // --------------------------------------------------------------------------------------------- protected ShardsOperationResponseBase(AbstractBuilder builder) { - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - } /** * Required - API name: {@code _shards} */ + @Nonnull public final ShardStatistics shards() { return this.shards; } @@ -64,6 +72,7 @@ public final ShardStatistics shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -71,18 +80,32 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("_shards"); this.shards.serialize(generator, mapper); - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { private ShardStatistics shards; + protected AbstractBuilder() {} + + protected AbstractBuilder(ShardsOperationResponseBase o) { + this.shards = o.shards; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.shards = o.shards; + } + + @Nonnull + protected abstract BuilderT self(); + /** * Required - API name: {@code _shards} */ + @Nonnull public final BuilderT shards(ShardStatistics value) { this.shards = value; return self(); @@ -91,21 +114,32 @@ public final BuilderT shards(ShardStatistics value) { /** * Required - API name: {@code _shards} */ + @Nonnull public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } - - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- + protected static > void setupShardsOperationResponseBaseDeserializer( ObjectDeserializer op ) { - op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardsOperationResponseBase other = (ShardsOperationResponseBase) o; + return this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java similarity index 53% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java index d49e35482b..bcdb1e5454 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -44,30 +51,38 @@ 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.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.clear_cache.Request /** - * Clears all or specific caches for one or more indices. - * + * Clears all or specific caches for one or more indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClearCacheRequest extends RequestBase implements ToCopyableBuilder { -public class ClearCacheRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nonnull private final List expandWildcards; @Nullable private final Boolean fielddata; + @Nonnull private final List fields; + @Nullable + private final Boolean file; + @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -79,28 +94,27 @@ public class ClearCacheRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private ClearCacheRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.fielddata = builder.fielddata; this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.file = builder.file; this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.query = builder.query; this.request = builder.request; - } - public static ClearCacheRequest of(Function> fn) { + public static ClearCacheRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -108,19 +122,23 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Clear field data + * If true, clears the fields cache. Use the fields parameter to clear the cache of specific fields only. *

* API name: {@code fielddata} + *

*/ @Nullable public final Boolean fielddata() { @@ -128,20 +146,32 @@ public final Boolean fielddata() { } /** - * A comma-separated list of fields to clear when using the - * fielddata parameter (default: all) + * Comma-separated list of field names used to limit the fielddata parameter. *

* API name: {@code fields} + *

*/ + @Nonnull public final List fields() { return this.fields; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If true, clears the unused entries from the file cache on nodes with the Search role. + *

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

+ */ + @Nullable + public final Boolean file() { + return this.file; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -149,18 +179,22 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index name to limit the operation + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Clear query caches + * If true, clears the query cache. *

* API name: {@code query} + *

*/ @Nullable public final Boolean query() { @@ -168,9 +202,10 @@ public final Boolean query() { } /** - * Clear request cache + * If true, clears the request cache. *

* API name: {@code request} + *

*/ @Nullable public final Boolean request() { @@ -179,159 +214,242 @@ public final Boolean request() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClearCacheRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - @Nullable private List expandWildcards; - @Nullable private Boolean fielddata; - @Nullable private List fields; - + @Nullable + private Boolean file; @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Boolean query; - @Nullable private Boolean request; + public Builder() {} + + private Builder(ClearCacheRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.fielddata = o.fielddata; + this.fields = _listCopy(o.fields); + this.file = o.file; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.query = o.query; + this.request = o.request; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.expandWildcards = _listCopy(o.expandWildcards); + this.fielddata = o.fielddata; + this.fields = _listCopy(o.fields); + this.file = o.file; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.query = o.query; + this.request = o.request; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Clear field data + * If true, clears the fields cache. Use the fields parameter to clear the cache of specific fields only. *

* API name: {@code fielddata} + *

*/ + @Nonnull public final Builder fielddata(@Nullable Boolean value) { this.fielddata = value; return this; } /** - * A comma-separated list of fields to clear when using the - * fielddata parameter (default: all) + * Comma-separated list of field names used to limit the fielddata parameter. *

* API name: {@code fields} + *

+ * *

* Adds all elements of list to fields. + *

*/ + @Nonnull public final Builder fields(List list) { this.fields = _listAddAll(this.fields, list); return this; } /** - * A comma-separated list of fields to clear when using the - * fielddata parameter (default: all) + * Comma-separated list of field names used to limit the fielddata parameter. *

* API name: {@code fields} + *

+ * *

* Adds one or more values to fields. + *

*/ + @Nonnull public final Builder fields(String value, String... values) { this.fields = _listAdd(this.fields, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If true, clears the unused entries from the file cache on nodes with the Search role. + *

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

+ */ + @Nonnull + public final Builder file(@Nullable Boolean value) { + this.file = value; + return this; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index name to limit the operation + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index name to limit the operation + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Clear query caches + * If true, clears the query cache. *

* API name: {@code query} + *

*/ + @Nonnull public final Builder query(@Nullable Boolean value) { this.query = value; return this; } /** - * Clear request cache + * If true, clears the request cache. *

* API name: {@code request} + *

*/ + @Nonnull public final Builder request(@Nullable Boolean value) { this.request = value; return this; @@ -340,9 +458,10 @@ public final Builder request(@Nullable Boolean value) { /** * Builds a {@link ClearCacheRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClearCacheRequest build() { _checkSingleUse(); @@ -356,13 +475,8 @@ public ClearCacheRequest build() { * Endpoint "{@code indices.clear_cache}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _index = 1 << 0; @@ -372,52 +486,80 @@ public ClearCacheRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_cache"); - buf.append("/clear"); - return buf.toString(); + return "/_cache/clear"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_cache"); - buf.append("/clear"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_cache/clear"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.request != null) { - params.put("request", String.valueOf(request.request)); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } if (request.fielddata != null) { params.put("fielddata", String.valueOf(request.fielddata)); } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + if (ApiTypeHelper.isDefined(request.fields)) { + params.put("fields", String.join(",", request.fields)); + } + if (request.file != null) { + params.put("file", String.valueOf(request.file)); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (request.query != null) { params.put("query", String.valueOf(request.query)); } - if (ApiTypeHelper.isDefined(request.fields)) { - params.put("fields", request.fields.stream().map(v -> v).collect(Collectors.joining(","))); + if (request.request != null) { + params.put("request", String.valueOf(request.request)); } return params; - }, SimpleEndpoint.emptyMap(), false, ClearCacheResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.fielddata); + result = 31 * result + Objects.hashCode(this.fields); + result = 31 * result + Objects.hashCode(this.file); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.query); + result = 31 * result + Objects.hashCode(this.request); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClearCacheRequest other = (ClearCacheRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.fielddata, other.fielddata) + && Objects.equals(this.fields, other.fields) + && Objects.equals(this.file, other.file) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.query, other.query) + && Objects.equals(this.request, other.request); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java index 59c73cca02..3c9c144f0a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ClearCacheResponse.java @@ -30,39 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; 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.ShardsOperationResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.clear_cache.Response @JsonpDeserializable -public class ClearCacheResponse extends ShardsOperationResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClearCacheResponse extends ShardsOperationResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private ClearCacheResponse(Builder builder) { super(builder); - } - public static ClearCacheResponse of(Function> fn) { + public static ClearCacheResponse 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 ClearCacheResponse}. */ + public static class Builder extends ShardsOperationResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(ClearCacheResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends ShardsOperationResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +111,10 @@ protected Builder self() { /** * Builds a {@link ClearCacheResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClearCacheResponse build() { _checkSingleUse(); @@ -91,8 +133,22 @@ public ClearCacheResponse build() { ); protected static void setupClearCacheResponseDeserializer(ObjectDeserializer op) { - ShardsOperationResponseBase.setupShardsOperationResponseBaseDeserializer(op); + setupShardsOperationResponseBaseDeserializer(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/indices/OpenSearchIndicesAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java index a4f049b6ff..6ef9e102c2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java @@ -104,6 +104,32 @@ public final CompletableFuture analyze() throws IOException, Op return analyze(new AnalyzeRequest.Builder().build()); } + // ----- Endpoint: indices.clear_cache + + /** + * Clears all or specific caches for one or more indexes. + */ + public CompletableFuture clearCache(ClearCacheRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ClearCacheRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clears all or specific caches for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link ClearCacheRequest} + */ + public final CompletableFuture clearCache(Function> fn) + throws IOException, OpenSearchException { + return clearCache(fn.apply(new ClearCacheRequest.Builder()).build()); + } + + /** + * Clears all or specific caches for one or more indexes. + */ + public final CompletableFuture clearCache() throws IOException, OpenSearchException { + return clearCache(new ClearCacheRequest.Builder().build()); + } + // ----- Endpoint: indices.create /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java index 28b05f2466..129c1e0e6a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java @@ -103,6 +103,32 @@ public final AnalyzeResponse analyze() throws IOException, OpenSearchException { return analyze(new AnalyzeRequest.Builder().build()); } + // ----- Endpoint: indices.clear_cache + + /** + * Clears all or specific caches for one or more indexes. + */ + public ClearCacheResponse clearCache(ClearCacheRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ClearCacheRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clears all or specific caches for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link ClearCacheRequest} + */ + public final ClearCacheResponse clearCache(Function> fn) throws IOException, + OpenSearchException { + return clearCache(fn.apply(new ClearCacheRequest.Builder()).build()); + } + + /** + * Clears all or specific caches for one or more indexes. + */ + public final ClearCacheResponse clearCache() throws IOException, OpenSearchException { + return clearCache(new ClearCacheRequest.Builder().build()); + } + // ----- Endpoint: indices.create /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java index 4ed3d69935..35aad945db 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java @@ -61,52 +61,6 @@ public OpenSearchIndicesAsyncClient withTransportOptions(@Nullable TransportOpti return new OpenSearchIndicesAsyncClient(this.transport, transportOptions); } - // ----- Endpoint: indices.clear_cache - - /** - * Clears all or specific caches for one or more indices. - * - * - */ - - public CompletableFuture clearCache(ClearCacheRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ClearCacheRequest, - ClearCacheResponse, - ErrorResponse>) ClearCacheRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Clears all or specific caches for one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearCacheRequest} - * - */ - - public final CompletableFuture clearCache(Function> fn) - throws IOException, OpenSearchException { - return clearCache(fn.apply(new ClearCacheRequest.Builder()).build()); - } - - /** - * Clears all or specific caches for one or more indices. - * - * - */ - - public CompletableFuture clearCache() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ClearCacheRequest.Builder().build(), - ClearCacheRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.clone /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java index c84ff0775f..dc545b6ab4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java @@ -60,45 +60,6 @@ public OpenSearchIndicesClient withTransportOptions(@Nullable TransportOptions t return new OpenSearchIndicesClient(this.transport, transportOptions); } - // ----- Endpoint: indices.clear_cache - - /** - * Clears all or specific caches for one or more indices. - * - */ - - public ClearCacheResponse clearCache(ClearCacheRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ClearCacheRequest, - ClearCacheResponse, - ErrorResponse>) ClearCacheRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Clears all or specific caches for one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearCacheRequest} - */ - - public final ClearCacheResponse clearCache(Function> fn) throws IOException, - OpenSearchException { - return clearCache(fn.apply(new ClearCacheRequest.Builder()).build()); - } - - /** - * Clears all or specific caches for one or more indices. - * - */ - - public ClearCacheResponse clearCache() throws IOException, OpenSearchException { - return this.transport.performRequest(new ClearCacheRequest.Builder().build(), ClearCacheRequest._ENDPOINT, this.transportOptions); - } - // ----- Endpoint: indices.clone /** diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 928fafbf1d..229063da67 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -53,7 +53,7 @@ public class CodeGenerator { namespace(is("indices")), name( or( - isOneOf("add_block", "analyze", "create", "delete", "exists", "get"), + isOneOf("add_block", "analyze", "clear_cache", "create", "delete", "exists", "get"), contains("alias"), contains("data_stream"), and(endsWith("mapping"), isNot("get_field_mapping")),