diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java index ea571e5e8f..f074c7fc0f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java @@ -48,11 +48,12 @@ 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: cluster.state.Response @Generated("org.opensearch.client.codegen.CodeGenerator") -public class StateResponse implements PlainJsonSerializable { +public class StateResponse implements PlainJsonSerializable, ToCopyableBuilder { @Nonnull private final JsonData valueBody; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java index 55d5c07bc9..850b7ca7d4 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java @@ -47,6 +47,7 @@ public Collection getFields() { public Collection getImplementsTypes() { var types = new ArrayList<>(super.getImplementsTypes()); types.add(Types.Client.Json.PlainJsonSerializable); + types.add(Types.Client.Util.ToCopyableBuilder(getType().getBuilderType(), getType())); return types; } diff --git a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java index c540d45063..fd11165ba5 100644 --- a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java +++ b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java @@ -11,7 +11,6 @@ import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch.cluster.PutComponentTemplateRequest; import org.opensearch.client.opensearch.indices.CreateIndexRequest; import org.opensearch.client.opensearch.indices.DeleteIndexRequest; @@ -46,19 +45,21 @@ public static void main(String[] args) { final var indexSettingsComponentTemplate = "index-settings"; PutComponentTemplateRequest putComponentTemplateRequest = PutComponentTemplateRequest.of( c -> c.name(indexSettingsComponentTemplate) - .settings( - s -> s.numberOfShards(2) - .numberOfReplicas(1) - .indexing( - i -> i.slowlog( - sl -> sl.level("info") - .reformat(true) - .threshold(th -> th.index(ith -> ith.warn(Time.of(t -> t.time("2s"))))) + .template( + t -> t.settings( + s -> s.numberOfShards(2) + .numberOfReplicas(1) + .indexing( + i -> i.slowlog( + sl -> sl.level("info") + .reformat(true) + .threshold(th -> th.index(ith -> ith.warn(tt -> tt.time("2s")))) + ) ) - ) - .search( - se -> se.slowlog(sl -> sl.level("info").threshold(th -> th.query(q -> q.warn(Time.of(t -> t.time("2s")))))) - ) + .search( + se -> se.slowlog(sl -> sl.level("info").threshold(th -> th.query(q -> q.warn(tt -> tt.time("2s"))))) + ) + ) ) ); LOGGER.info("Creating component template {}", indexSettingsComponentTemplate); @@ -66,7 +67,7 @@ public static void main(String[] args) { final var indexMappingsComponentTemplate = "index-mappings"; putComponentTemplateRequest = PutComponentTemplateRequest.of( - c -> c.name(indexMappingsComponentTemplate).mappings(m -> m.properties("age", p -> p.integer(i -> i))) + c -> c.name(indexMappingsComponentTemplate).template(t -> t.mappings(m -> m.properties("age", p -> p.integer(i -> i)))) ); LOGGER.info("Creating component template {}", indexMappingsComponentTemplate); client.cluster().putComponentTemplate(putComponentTemplateRequest);