Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Dec 23, 2024
1 parent a6bb657 commit 6f9934b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<StateResponse.Builder, StateResponse> {

@Nonnull
private final JsonData valueBody;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Collection<Field> getFields() {
public Collection<Type> getImplementsTypes() {
var types = new ArrayList<>(super.getImplementsTypes());
types.add(Types.Client.Json.PlainJsonSerializable);
types.add(Types.Client.Util.ToCopyableBuilder(getType().getBuilderType(), getType()));
return types;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,27 +45,29 @@ 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);
client.cluster().putComponentTemplate(putComponentTemplateRequest);

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);
Expand Down

0 comments on commit 6f9934b

Please sign in to comment.