Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringAsyncClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesAsyncClient;
import co.elastic.clients.elasticsearch.project.ElasticsearchProjectAsyncClient;
import co.elastic.clients.elasticsearch.prometheus.ElasticsearchPrometheusAsyncClient;
import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesAsyncClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupAsyncClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationAsyncClient;
Expand Down Expand Up @@ -319,6 +320,10 @@ public ElasticsearchProjectAsyncClient project() {
return new ElasticsearchProjectAsyncClient(this.transport, this.transportOptions);
}

public ElasticsearchPrometheusAsyncClient prometheus() {
return new ElasticsearchPrometheusAsyncClient(this.transport, this.transportOptions);
}

public ElasticsearchQueryRulesAsyncClient queryRules() {
return new ElasticsearchQueryRulesAsyncClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient;
import co.elastic.clients.elasticsearch.project.ElasticsearchProjectClient;
import co.elastic.clients.elasticsearch.prometheus.ElasticsearchPrometheusClient;
import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationClient;
Expand Down Expand Up @@ -319,6 +320,10 @@ public ElasticsearchProjectClient project() {
return new ElasticsearchProjectClient(this.transport, this.transportOptions);
}

public ElasticsearchPrometheusClient prometheus() {
return new ElasticsearchPrometheusClient(this.transport, this.transportOptions);
}

public ElasticsearchQueryRulesClient queryRules() {
return new ElasticsearchQueryRulesClient(this.transport, this.transportOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import co.elastic.clients.elasticsearch.core.bulk.CreateOperation;
import co.elastic.clients.elasticsearch.core.bulk.DeleteOperation;
import co.elastic.clients.elasticsearch.core.bulk.IndexOperation;
import co.elastic.clients.elasticsearch.core.bulk.UpdateAction;
import co.elastic.clients.elasticsearch.core.bulk.UpdateOperation;
import co.elastic.clients.elasticsearch.core.bulk.WriteOperation;
import co.elastic.clients.json.JsonEnum;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.util.BinaryData;
Expand Down Expand Up @@ -83,11 +85,12 @@ public boolean canRetry() {
return repeatableOp.canRetry();
}

@SuppressWarnings("unchecked")
private static <Context> IngesterOperation<Context> createOperation(RetryableBulkOperation<Context> repeatableOp, JsonpMapper mapper) {
CreateOperation<?> create = repeatableOp.operation().create();
RetryableBulkOperation<Context> newOperation;

long size = basePropertiesSize(create);
long size = writePropertiesSize(create);

if (create.document() instanceof BinaryData) {
newOperation = repeatableOp;
Expand All @@ -96,20 +99,21 @@ private static <Context> IngesterOperation<Context> createOperation(RetryableBul
} else {
BinaryData binaryDoc = BinaryData.of(create.document(), mapper);
size += binaryDoc.size();
newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.create(idx -> {
copyCreateProperties(create, idx);
return idx.document(binaryDoc);
})),repeatableOp.context(),repeatableOp.retries());
newOperation = new RetryableBulkOperation<>(
BulkOperation.of(bo -> bo.create(create.rebuild().document(binaryDoc).build())),
repeatableOp.context(), repeatableOp.retries());
}

return new IngesterOperation<>(newOperation, size);
}

@SuppressWarnings("unchecked")
private static <Context> IngesterOperation<Context> indexOperation(RetryableBulkOperation<Context> repeatableOp, JsonpMapper mapper) {
IndexOperation<?> index = repeatableOp.operation().index();
RetryableBulkOperation<Context> newOperation;

long size = basePropertiesSize(index);
long size = writePropertiesSize(index) +
size("op_type", index.opType());

if (index.document() instanceof BinaryData) {
newOperation = repeatableOp;
Expand All @@ -118,22 +122,24 @@ private static <Context> IngesterOperation<Context> indexOperation(RetryableBulk
} else {
BinaryData binaryDoc = BinaryData.of(index.document(), mapper);
size += binaryDoc.size();
newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.index(idx -> {
copyIndexProperties(index, idx);
return idx.document(binaryDoc);
})),repeatableOp.context(),repeatableOp.retries());
newOperation = new RetryableBulkOperation<>(
BulkOperation.of(bo -> bo.index(index.rebuild().document(binaryDoc).build())),
repeatableOp.context(), repeatableOp.retries());
}

return new IngesterOperation<>(newOperation, size);
}

@SuppressWarnings("unchecked")
private static <Context> IngesterOperation<Context> updateOperation(RetryableBulkOperation<Context> repeatableOp, JsonpMapper mapper) {
UpdateOperation<?, ?> update = repeatableOp.operation().update();
RetryableBulkOperation<Context> newOperation;

long size = basePropertiesSize(update) +
size("retry_on_conflict", update.retryOnConflict()) +
size("require_alias", update.requireAlias());
size("require_alias", update.requireAlias()) +
size("pipeline", update.pipeline()) +
size("list_executed_pipelines", update.listExecutedPipelines());

if (update.binaryAction() != null) {
newOperation = repeatableOp;
Expand All @@ -142,45 +148,20 @@ private static <Context> IngesterOperation<Context> updateOperation(RetryableBul
} else {
BinaryData action = BinaryData.of(update.action(), mapper);
size += action.size();
newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.update(u -> {
copyBaseProperties(update, u);
return u
.binaryAction(action)
.requireAlias(update.requireAlias())
.retryOnConflict(update.retryOnConflict());
})),repeatableOp.context(),repeatableOp.retries());
newOperation = new RetryableBulkOperation<>(
BulkOperation.of(bo -> bo.update(update.rebuild().action((UpdateAction<?, ?>) null).binaryAction(action).build())),
repeatableOp.context(), repeatableOp.retries());
}

return new IngesterOperation<>(newOperation, size);
}

private static <Context> IngesterOperation<Context> deleteOperation(RetryableBulkOperation<Context> repeatableOp) {
DeleteOperation delete = repeatableOp.operation().delete();
return new IngesterOperation<>(repeatableOp, basePropertiesSize(delete));
}


private static void copyBaseProperties(BulkOperationBase op, BulkOperationBase.AbstractBuilder<?> builder) {
builder
.id(op.id())
.index(op.index())
.ifPrimaryTerm(op.ifPrimaryTerm())
.ifSeqNo(op.ifSeqNo())
.routing(op.routing())
.version(op.version())
.versionType(op.versionType());
}

private static void copyIndexProperties(IndexOperation<?> op, IndexOperation.Builder<?> builder) {
copyBaseProperties(op, builder);
builder.pipeline(op.pipeline());
builder.requireAlias(op.requireAlias());
}

private static void copyCreateProperties(CreateOperation<?> op, CreateOperation.Builder<?> builder) {
copyBaseProperties(op, builder);
builder.pipeline(op.pipeline());
builder.requireAlias(op.requireAlias());
long size = basePropertiesSize(delete) +
size("version", delete.version()) +
size("version_type", delete.versionType());
return new IngesterOperation<>(repeatableOp, size);
}

private static int size(String name, @Nullable Boolean value) {
Expand Down Expand Up @@ -253,8 +234,16 @@ private static int basePropertiesSize(BulkOperationBase op) {
size("if_primary_term", op.ifPrimaryTerm()) +
size("if_seq_no", op.ifSeqNo()) +
size("routing", op.routing()) +
size("version", op.version()) +
size("version_type", op.versionType()) +
4; // Open/closing brace, 2 newlines
}

private static int writePropertiesSize(WriteOperation op) {
return basePropertiesSize(op) +
size("version", op.version()) +
size("version_type", op.versionType()) +
size("pipeline", op.pipeline()) +
size("require_alias", op.requireAlias()) +
size("require_data_stream", op.requireDataStream()) +
size("list_executed_pipelines", op.listExecutedPipelines());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package co.elastic.clients.elasticsearch._types.query_dsl;

import co.elastic.clients.elasticsearch._types.VersionType;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
Expand All @@ -31,7 +30,6 @@
import java.lang.Boolean;
import java.lang.Double;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -100,19 +98,10 @@ public class MoreLikeThisQuery extends QueryBase implements QueryVariant {
@Nullable
private final Integer minWordLength;

@Nullable
private final String routing;

private final List<String> stopWords;

private final List<Like> unlike;

@Nullable
private final Long version;

@Nullable
private final VersionType versionType;

// ---------------------------------------------------------------------------------------------

private MoreLikeThisQuery(Builder builder) {
Expand All @@ -131,11 +120,8 @@ private MoreLikeThisQuery(Builder builder) {
this.minimumShouldMatch = builder.minimumShouldMatch;
this.minTermFreq = builder.minTermFreq;
this.minWordLength = builder.minWordLength;
this.routing = builder.routing;
this.stopWords = ApiTypeHelper.unmodifiable(builder.stopWords);
this.unlike = ApiTypeHelper.unmodifiable(builder.unlike);
this.version = builder.version;
this.versionType = builder.versionType;

}

Expand Down Expand Up @@ -293,14 +279,6 @@ public final Integer minWordLength() {
return this.minWordLength;
}

/**
* API name: {@code routing}
*/
@Nullable
public final String routing() {
return this.routing;
}

/**
* An array of stop words. Any word in this set is ignored.
* <p>
Expand All @@ -320,22 +298,6 @@ public final List<Like> unlike() {
return this.unlike;
}

/**
* API name: {@code version}
*/
@Nullable
public final Long version() {
return this.version;
}

/**
* API name: {@code version_type}
*/
@Nullable
public final VersionType versionType() {
return this.versionType;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

super.serializeInternal(generator, mapper);
Expand Down Expand Up @@ -413,11 +375,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("min_word_length");
generator.write(this.minWordLength);

}
if (this.routing != null) {
generator.writeKey("routing");
generator.write(this.routing);

}
if (ApiTypeHelper.isDefined(this.stopWords)) {
generator.writeKey("stop_words");
Expand All @@ -439,15 +396,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeEnd();

}
if (this.version != null) {
generator.writeKey("version");
generator.write(this.version);

}
if (this.versionType != null) {
generator.writeKey("version_type");
this.versionType.serialize(generator, mapper);
}

}

Expand Down Expand Up @@ -496,21 +444,12 @@ public static class Builder extends QueryBase.AbstractBuilder<Builder> implement
@Nullable
private Integer minWordLength;

@Nullable
private String routing;

@Nullable
private List<String> stopWords;

@Nullable
private List<Like> unlike;

@Nullable
private Long version;

@Nullable
private VersionType versionType;

public Builder() {
}
private Builder(MoreLikeThisQuery instance) {
Expand All @@ -528,11 +467,8 @@ private Builder(MoreLikeThisQuery instance) {
this.minimumShouldMatch = instance.minimumShouldMatch;
this.minTermFreq = instance.minTermFreq;
this.minWordLength = instance.minWordLength;
this.routing = instance.routing;
this.stopWords = instance.stopWords;
this.unlike = instance.unlike;
this.version = instance.version;
this.versionType = instance.versionType;

}
/**
Expand Down Expand Up @@ -722,14 +658,6 @@ public final Builder minWordLength(@Nullable Integer value) {
return this;
}

/**
* API name: {@code routing}
*/
public final Builder routing(@Nullable String value) {
this.routing = value;
return this;
}

/**
* An array of stop words. Any word in this set is ignored.
* <p>
Expand Down Expand Up @@ -792,22 +720,6 @@ public final Builder unlike(Function<Like.Builder, ObjectBuilder<Like>> fn) {
return unlike(fn.apply(new Like.Builder()).build());
}

/**
* API name: {@code version}
*/
public final Builder version(@Nullable Long value) {
this.version = value;
return this;
}

/**
* API name: {@code version_type}
*/
public final Builder versionType(@Nullable VersionType value) {
this.versionType = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -855,12 +767,9 @@ protected static void setupMoreLikeThisQueryDeserializer(ObjectDeserializer<More
op.add(Builder::minimumShouldMatch, JsonpDeserializer.stringDeserializer(), "minimum_should_match");
op.add(Builder::minTermFreq, JsonpDeserializer.integerDeserializer(), "min_term_freq");
op.add(Builder::minWordLength, JsonpDeserializer.integerDeserializer(), "min_word_length");
op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "routing");
op.add(Builder::stopWords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
"stop_words");
op.add(Builder::unlike, JsonpDeserializer.arrayDeserializer(Like._DESERIALIZER), "unlike");
op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version");
op.add(Builder::versionType, VersionType._DESERIALIZER, "version_type");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public enum CatAnomalyDetectorColumn implements JsonEnum {
* track which specific categories failed to be created. Therefore, you cannot
* use this value to determine the number of unique categories that were missed.
*/
ModelFailedCategoryCount("model.failed_category_count", "mdcc", "modelFailedCategoryCount"),
ModelFailedCategoryCount("model.failed_category_count", "mfcc", "modelFailedCategoryCount"),

/**
* The number of categories that match more than 1% of categorized documents.
Expand Down
Loading
Loading