From d6d463ac6b7c305e4b90a6502e70bf0e7c24f188 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 17 Mar 2026 12:44:01 +0000 Subject: [PATCH 1/2] [codegen] update to latest spec --- .../cluster/ComponentTemplateSummary.java | 17 +- .../cluster/PutComponentTemplateRequest.java | 16 +- .../elasticsearch/core/reindex/Source.java | 36 +- .../core/search/PhraseSuggester.java | 34 -- .../core/search/TermSuggester.java | 35 -- .../elasticsearch/doc-files/api-spec.html | 58 +-- .../indices/IndexTemplateSummary.java | 15 +- .../IndicesValidationExplanation.java | 48 +- .../elasticsearch/ml/AnalysisConfigRead.java | 434 ++++++++++-------- .../elasticsearch/ml/DetectorRead.java | 130 +++--- .../query_rules/QueryRuleCriteriaType.java | 2 - .../security/RoleDescriptorRead.java | 25 +- .../snapshot/GetSnapshotRequest.java | 4 +- .../synonyms/SynonymRuleRead.java | 16 +- 14 files changed, 450 insertions(+), 420 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java index 9cb227c73b..ec71d0adaa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.AliasDefinition; import co.elastic.clients.elasticsearch.indices.DataStreamLifecycleWithRollover; -import co.elastic.clients.elasticsearch.indices.DataStreamOptionsTemplate; +import co.elastic.clients.elasticsearch.indices.DataStreamOptions; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -39,6 +39,7 @@ import java.lang.Long; import java.lang.String; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -83,7 +84,7 @@ public class ComponentTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptionsTemplate dataStreamOptions; + private final DataStreamOptions dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -152,7 +153,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptionsTemplate dataStreamOptions() { + public final DataStreamOptions dataStreamOptions() { return this.dataStreamOptions; } @@ -256,7 +257,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptionsTemplate dataStreamOptions; + private DataStreamOptions dataStreamOptions; public Builder() { } @@ -390,7 +391,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { this.dataStreamOptions = value; return this; } @@ -399,8 +400,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); } @Override @@ -444,7 +445,7 @@ protected static void setupComponentTemplateSummaryDeserializer( op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::dataStreamOptions, DataStreamOptionsTemplate._DESERIALIZER, "data_stream_options"); + op.add(Builder::dataStreamOptions, DataStreamOptions._DESERIALIZER, "data_stream_options"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java index 17a0c4b2bd..e722a0079e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.IndexState; +import co.elastic.clients.elasticsearch.indices.put_index_template.IndexTemplateMapping; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -112,7 +112,7 @@ public class PutComponentTemplateRequest extends RequestBase implements JsonpSer private final String name; - private final IndexState template; + private final IndexTemplateMapping template; @Nullable private final Long version; @@ -218,7 +218,7 @@ public final String name() { *

* API name: {@code template} */ - public final IndexState template() { + public final IndexTemplateMapping template() { return this.template; } @@ -298,7 +298,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; - private IndexState template; + private IndexTemplateMapping template; @Nullable private Long version; @@ -428,7 +428,7 @@ public final Builder name(String value) { *

* API name: {@code template} */ - public final Builder template(IndexState value) { + public final Builder template(IndexTemplateMapping value) { this.template = value; return this; } @@ -439,8 +439,8 @@ public final Builder template(IndexState value) { *

* API name: {@code template} */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexState.Builder()).build()); + public final Builder template(Function> fn) { + return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); } /** @@ -492,7 +492,7 @@ protected static void setupPutComponentTemplateRequestDeserializer( op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::template, IndexState._DESERIALIZER, "template"); + op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex/Source.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex/Source.java index a81728437c..4303dcef36 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex/Source.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex/Source.java @@ -24,6 +24,7 @@ import co.elastic.clients.elasticsearch._types.mapping.RuntimeField; import co.elastic.clients.elasticsearch._types.query_dsl.Query; import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant; +import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -83,7 +84,8 @@ public class Source implements JsonpSerializable { private final List sort; - private final List sourceFields; + @Nullable + private final SourceConfig sourceFields; private final Map runtimeMappings; @@ -97,7 +99,7 @@ private Source(Builder builder) { this.size = builder.size; this.slice = builder.slice; this.sort = ApiTypeHelper.unmodifiable(builder.sort); - this.sourceFields = ApiTypeHelper.unmodifiable(builder.sourceFields); + this.sourceFields = builder.sourceFields; this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings); } @@ -185,7 +187,8 @@ public final List sort() { *

* API name: {@code _source} */ - public final List sourceFields() { + @Nullable + public final SourceConfig sourceFields() { return this.sourceFields; } @@ -247,14 +250,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.sourceFields)) { + if (this.sourceFields != null) { generator.writeKey("_source"); - generator.writeStartArray(); - for (String item0 : this.sourceFields) { - generator.write(item0); - - } - generator.writeEnd(); + this.sourceFields.serialize(generator, mapper); } if (ApiTypeHelper.isDefined(this.runtimeMappings)) { @@ -301,7 +299,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List sort; @Nullable - private List sourceFields; + private SourceConfig sourceFields; @Nullable private Map runtimeMappings; @@ -499,11 +497,9 @@ public final Builder sort(Function * API name: {@code _source} - *

- * Adds all elements of list to sourceFields. */ - public final Builder sourceFields(List list) { - this.sourceFields = _listAddAll(this.sourceFields, list); + public final Builder sourceFields(@Nullable SourceConfig value) { + this.sourceFields = value; return this; } @@ -512,12 +508,9 @@ public final Builder sourceFields(List list) { * select fields. *

* API name: {@code _source} - *

- * Adds one or more values to sourceFields. */ - public final Builder sourceFields(String value, String... values) { - this.sourceFields = _listAdd(this.sourceFields, value, values); - return this; + public final Builder sourceFields(Function> fn) { + return this.sourceFields(fn.apply(new SourceConfig.Builder()).build()); } /** @@ -590,8 +583,7 @@ protected static void setupSourceDeserializer(ObjectDeserializer op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::slice, SlicedScroll._DESERIALIZER, "slice"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); - op.add(Builder::sourceFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "_source"); + op.add(Builder::sourceFields, SourceConfig._DESERIALIZER, "_source"); op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), "runtime_mappings"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggester.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggester.java index e092319231..2c59b08eaa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggester.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggester.java @@ -93,9 +93,6 @@ public class PhraseSuggester extends SuggesterBase implements FieldSuggesterVari @Nullable private final SmoothingModel smoothing; - @Nullable - private final String text; - @Nullable private final Integer tokenLimit; @@ -115,7 +112,6 @@ private PhraseSuggester(Builder builder) { this.separator = builder.separator; this.shardSize = builder.shardSize; this.smoothing = builder.smoothing; - this.text = builder.text; this.tokenLimit = builder.tokenLimit; } @@ -255,16 +251,6 @@ public final SmoothingModel smoothing() { return this.smoothing; } - /** - * The text/query to provide suggestions for. - *

- * API name: {@code text} - */ - @Nullable - public final String text() { - return this.text; - } - /** * API name: {@code token_limit} */ @@ -335,11 +321,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("smoothing"); this.smoothing.serialize(generator, mapper); - } - if (this.text != null) { - generator.writeKey("text"); - generator.write(this.text); - } if (this.tokenLimit != null) { generator.writeKey("token_limit"); @@ -391,9 +372,6 @@ public static class Builder extends SuggesterBase.AbstractBuilder @Nullable private SmoothingModel smoothing; - @Nullable - private String text; - @Nullable private Integer tokenLimit; @@ -411,7 +389,6 @@ private Builder(PhraseSuggester instance) { this.separator = instance.separator; this.shardSize = instance.shardSize; this.smoothing = instance.smoothing; - this.text = instance.text; this.tokenLimit = instance.tokenLimit; } @@ -610,16 +587,6 @@ public final Builder smoothing(SmoothingModelVariant value) { return this; } - /** - * The text/query to provide suggestions for. - *

- * API name: {@code text} - */ - public final Builder text(@Nullable String value) { - this.text = value; - return this; - } - /** * API name: {@code token_limit} */ @@ -674,7 +641,6 @@ protected static void setupPhraseSuggesterDeserializer(ObjectDeserializer - * API name: {@code text} - */ - @Nullable - public final String text() { - return this.text; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -317,11 +302,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("suggest_mode"); this.suggestMode.serialize(generator, mapper); } - if (this.text != null) { - generator.writeKey("text"); - generator.write(this.text); - - } } @@ -365,9 +345,6 @@ public static class Builder extends SuggesterBase.AbstractBuilder imple @Nullable private SuggestMode suggestMode; - @Nullable - private String text; - public Builder() { } private Builder(TermSuggester instance) { @@ -382,7 +359,6 @@ private Builder(TermSuggester instance) { this.sort = instance.sort; this.stringDistance = instance.stringDistance; this.suggestMode = instance.suggestMode; - this.text = instance.text; } /** @@ -509,16 +485,6 @@ public final Builder suggestMode(@Nullable SuggestMode value) { return this; } - /** - * The suggest text. Needs to be set globally or per suggestion. - *

- * API name: {@code text} - */ - public final Builder text(@Nullable String value) { - this.text = value; - return this; - } - @Override protected Builder self() { return this; @@ -564,7 +530,6 @@ protected static void setupTermSuggesterDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/607d25c087d8a04e4447aab448a36423d3dc4fa0/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/3666dcf13c05c73516c9dd5fc0fcaeed0e557da2/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java index 0e3eb1c972..53089fe50f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java @@ -33,6 +33,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -73,7 +74,7 @@ public class IndexTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptionsTemplate dataStreamOptions; + private final DataStreamOptions dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -136,7 +137,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptionsTemplate dataStreamOptions() { + public final DataStreamOptions dataStreamOptions() { return this.dataStreamOptions; } @@ -212,7 +213,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptionsTemplate dataStreamOptions; + private DataStreamOptions dataStreamOptions; public Builder() { } @@ -327,7 +328,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { this.dataStreamOptions = value; return this; } @@ -336,8 +337,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); } @Override @@ -378,7 +379,7 @@ protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializer @Nullable private String explanation; + @Nullable private String index; + @Nullable + private Integer shard; + private Boolean valid; public Builder() { @@ -175,6 +201,7 @@ private Builder(IndicesValidationExplanation instance) { this.error = instance.error; this.explanation = instance.explanation; this.index = instance.index; + this.shard = instance.shard; this.valid = instance.valid; } @@ -195,13 +222,21 @@ public final Builder explanation(@Nullable String value) { } /** - * Required - API name: {@code index} + * API name: {@code index} */ - public final Builder index(String value) { + public final Builder index(@Nullable String value) { this.index = value; return this; } + /** + * API name: {@code shard} + */ + public final Builder shard(@Nullable Integer value) { + this.shard = value; + return this; + } + /** * Required - API name: {@code valid} */ @@ -248,6 +283,7 @@ protected static void setupIndicesValidationExplanationDeserializer( op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); op.add(Builder::explanation, JsonpDeserializer.stringDeserializer(), "explanation"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::valid, JsonpDeserializer.booleanDeserializer(), "valid"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java index a459adc79a..98ad1a1691 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java @@ -64,6 +64,10 @@ public class AnalysisConfigRead implements JsonpSerializable { private final Time bucketSpan; + private final List detectors; + + private final List influencers; + @Nullable private final CategorizationAnalyzer categorizationAnalyzer; @@ -72,15 +76,11 @@ public class AnalysisConfigRead implements JsonpSerializable { private final List categorizationFilters; - private final List detectors; - - private final List influencers; - @Nullable - private final Time modelPruneWindow; + private final Time latency; @Nullable - private final Time latency; + private final Time modelPruneWindow; @Nullable private final Boolean multivariateByFields; @@ -96,13 +96,13 @@ public class AnalysisConfigRead implements JsonpSerializable { private AnalysisConfigRead(Builder builder) { this.bucketSpan = ApiTypeHelper.requireNonNull(builder.bucketSpan, this, "bucketSpan"); + this.detectors = ApiTypeHelper.unmodifiableRequired(builder.detectors, this, "detectors"); + this.influencers = ApiTypeHelper.unmodifiableRequired(builder.influencers, this, "influencers"); this.categorizationAnalyzer = builder.categorizationAnalyzer; this.categorizationFieldName = builder.categorizationFieldName; this.categorizationFilters = ApiTypeHelper.unmodifiable(builder.categorizationFilters); - this.detectors = ApiTypeHelper.unmodifiableRequired(builder.detectors, this, "detectors"); - this.influencers = ApiTypeHelper.unmodifiableRequired(builder.influencers, this, "influencers"); - this.modelPruneWindow = builder.modelPruneWindow; this.latency = builder.latency; + this.modelPruneWindow = builder.modelPruneWindow; this.multivariateByFields = builder.multivariateByFields; this.perPartitionCategorization = builder.perPartitionCategorization; this.summaryCountFieldName = builder.summaryCountFieldName; @@ -115,7 +115,11 @@ public static AnalysisConfigRead of(Function5m and 1h. + * typically between 5m and 1h. This value should be + * either a whole number of days or equate to a whole number of buckets in one + * day. If the anomaly detection job uses a datafeed with aggregations, this + * value must also be divisible by the interval of the date histogram + * aggregation. *

* API name: {@code bucket_span} */ @@ -123,13 +127,41 @@ public final Time bucketSpan() { return this.bucketSpan; } + /** + * Required - Detector configuration objects specify which data fields a job + * analyzes. They also specify which analytical functions are used. You can + * specify multiple detectors for a job. If the detectors array does not contain + * at least one detector, no analysis can occur and an error is returned. + *

+ * API name: {@code detectors} + */ + public final List detectors() { + return this.detectors; + } + + /** + * Required - A comma separated list of influencer field names. Typically these + * can be the by, over, or partition fields that are used in the detector + * configuration. You might also want to use a field name that is not + * specifically named in a detector, but is available as part of the input data. + * When you use multiple detectors, the use of influencers is recommended as it + * aggregates results for each influencer entity. + *

+ * API name: {@code influencers} + */ + public final List influencers() { + return this.influencers; + } + /** * If categorization_field_name is specified, you can also define * the analyzer that is used to interpret the categorization field. This * property cannot be used at the same time as * categorization_filters. The categorization analyzer specifies * how the categorization_field is interpreted by the - * categorization process. + * categorization process. The categorization_analyzer field can be + * specified either as a string or as an object. If it is a string, it must + * refer to a built-in analyzer or one added by another plugin. *

* API name: {@code categorization_analyzer} */ @@ -155,7 +187,16 @@ public final String categorizationFieldName() { * If categorization_field_name is specified, you can also define * optional filters. This property expects an array of regular expressions. The * expressions are used to filter out matching sequences from the categorization - * field values. + * field values. You can use this functionality to fine tune the categorization + * by excluding sequences from consideration when categories are defined. For + * example, you can exclude SQL statements that appear in your log files. This + * property cannot be used at the same time as + * categorization_analyzer. If you only want to define simple + * regular expression filters that are applied prior to tokenization, setting + * this property is the easiest method. If you also want to customize the + * tokenizer or post-tokenization filtering, use the + * categorization_analyzer property instead and include the filters + * as pattern_replace character filters. The effect is exactly the same. *

* API name: {@code categorization_filters} */ @@ -164,37 +205,23 @@ public final List categorizationFilters() { } /** - * Required - An array of detector configuration objects. Detector configuration - * objects specify which data fields a job analyzes. They also specify which - * analytical functions are used. You can specify multiple detectors for a job. - *

- * API name: {@code detectors} - */ - public final List detectors() { - return this.detectors; - } - - /** - * Required - A comma separated list of influencer field names. Typically these - * can be the by, over, or partition fields that are used in the detector - * configuration. You might also want to use a field name that is not - * specifically named in a detector, but is available as part of the input data. - * When you use multiple detectors, the use of influencers is recommended as it - * aggregates results for each influencer entity. + * The size of the window in which to expect data that is out of time order. If + * you specify a non-zero value, it must be greater than or equal to one second. + * NOTE: Latency is applicable only when you send data by using the post data + * API. *

- * API name: {@code influencers} + * API name: {@code latency} */ - public final List influencers() { - return this.influencers; + @Nullable + public final Time latency() { + return this.latency; } /** * Advanced configuration option. Affects the pruning of models that have not * been updated for the given time duration. The value must be set to a multiple * of the bucket_span. If set too low, important information may be - * removed from the model. Typically, set to 30d or longer. If not - * set, model pruning only occurs if the model memory status reaches the soft - * limit or the hard limit. For jobs created in 8.1 and later, the default value + * removed from the model. For jobs created in 8.1 and later, the default value * is the greater of 30d or 20 times bucket_span. *

* API name: {@code model_prune_window} @@ -204,24 +231,20 @@ public final Time modelPruneWindow() { return this.modelPruneWindow; } - /** - * The size of the window in which to expect data that is out of time order. - * Defaults to no latency. If you specify a non-zero value, it must be greater - * than or equal to one second. - *

- * API name: {@code latency} - */ - @Nullable - public final Time latency() { - return this.latency; - } - /** * This functionality is reserved for internal use. It is not supported for use * in customer environments and is not subject to the support SLA of official GA * features. If set to true, the analysis will automatically find * correlations between metrics for a given by field value and report anomalies - * when those correlations cease to hold. + * when those correlations cease to hold. For example, suppose CPU and memory + * usage on host A is usually highly correlated with the same metrics on host B. + * Perhaps this correlation occurs because they are running a load-balanced + * application. If you enable this property, anomalies will be reported when, + * for example, CPU usage on host A is high and the value of CPU usage on host B + * is low. That is to say, you’ll see an anomaly when the CPU of host A is + * unusual given the CPU of host B. To use the + * multivariate_by_fields property, you must also specify + * by_field_name in your detector. *

* API name: {@code multivariate_by_fields} */ @@ -245,6 +268,8 @@ public final PerPartitionCategorization perPartitionCategorization() { * be pre-summarized. This property value is the name of the field that contains * the count of raw data points that have been summarized. The same * summary_count_field_name applies to all detectors in the job. + * NOTE: The summary_count_field_name property cannot be used with + * the metric function. *

* API name: {@code summary_count_field_name} */ @@ -267,26 +292,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("bucket_span"); this.bucketSpan.serialize(generator, mapper); - if (this.categorizationAnalyzer != null) { - generator.writeKey("categorization_analyzer"); - this.categorizationAnalyzer.serialize(generator, mapper); - - } - if (this.categorizationFieldName != null) { - generator.writeKey("categorization_field_name"); - generator.write(this.categorizationFieldName); - - } - if (ApiTypeHelper.isDefined(this.categorizationFilters)) { - generator.writeKey("categorization_filters"); - generator.writeStartArray(); - for (String item0 : this.categorizationFilters) { - generator.write(item0); - - } - generator.writeEnd(); - - } if (ApiTypeHelper.isDefined(this.detectors)) { generator.writeKey("detectors"); generator.writeStartArray(); @@ -307,15 +312,35 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.modelPruneWindow != null) { - generator.writeKey("model_prune_window"); - this.modelPruneWindow.serialize(generator, mapper); + if (this.categorizationAnalyzer != null) { + generator.writeKey("categorization_analyzer"); + this.categorizationAnalyzer.serialize(generator, mapper); + + } + if (this.categorizationFieldName != null) { + generator.writeKey("categorization_field_name"); + generator.write(this.categorizationFieldName); + + } + if (ApiTypeHelper.isDefined(this.categorizationFilters)) { + generator.writeKey("categorization_filters"); + generator.writeStartArray(); + for (String item0 : this.categorizationFilters) { + generator.write(item0); + + } + generator.writeEnd(); } if (this.latency != null) { generator.writeKey("latency"); this.latency.serialize(generator, mapper); + } + if (this.modelPruneWindow != null) { + generator.writeKey("model_prune_window"); + this.modelPruneWindow.serialize(generator, mapper); + } if (this.multivariateByFields != null) { generator.writeKey("multivariate_by_fields"); @@ -351,6 +376,10 @@ public static class Builder extends WithJsonObjectBuilderBase ObjectBuilder { private Time bucketSpan; + private List detectors; + + private List influencers; + @Nullable private CategorizationAnalyzer categorizationAnalyzer; @@ -360,15 +389,11 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private List categorizationFilters; - private List detectors; - - private List influencers; - @Nullable - private Time modelPruneWindow; + private Time latency; @Nullable - private Time latency; + private Time modelPruneWindow; @Nullable private Boolean multivariateByFields; @@ -383,13 +408,13 @@ public Builder() { } private Builder(AnalysisConfigRead instance) { this.bucketSpan = instance.bucketSpan; + this.detectors = instance.detectors; + this.influencers = instance.influencers; this.categorizationAnalyzer = instance.categorizationAnalyzer; this.categorizationFieldName = instance.categorizationFieldName; this.categorizationFilters = instance.categorizationFilters; - this.detectors = instance.detectors; - this.influencers = instance.influencers; - this.modelPruneWindow = instance.modelPruneWindow; this.latency = instance.latency; + this.modelPruneWindow = instance.modelPruneWindow; this.multivariateByFields = instance.multivariateByFields; this.perPartitionCategorization = instance.perPartitionCategorization; this.summaryCountFieldName = instance.summaryCountFieldName; @@ -397,7 +422,11 @@ private Builder(AnalysisConfigRead instance) { } /** * Required - The size of the interval that the analysis is aggregated into, - * typically between 5m and 1h. + * typically between 5m and 1h. This value should be + * either a whole number of days or equate to a whole number of buckets in one + * day. If the anomaly detection job uses a datafeed with aggregations, this + * value must also be divisible by the interval of the date histogram + * aggregation. *

* API name: {@code bucket_span} */ @@ -408,7 +437,11 @@ public final Builder bucketSpan(Time value) { /** * Required - The size of the interval that the analysis is aggregated into, - * typically between 5m and 1h. + * typically between 5m and 1h. This value should be + * either a whole number of days or equate to a whole number of buckets in one + * day. If the anomaly detection job uses a datafeed with aggregations, this + * value must also be divisible by the interval of the date histogram + * aggregation. *

* API name: {@code bucket_span} */ @@ -416,13 +449,93 @@ public final Builder bucketSpan(Function> fn) return this.bucketSpan(fn.apply(new Time.Builder()).build()); } + /** + * Required - Detector configuration objects specify which data fields a job + * analyzes. They also specify which analytical functions are used. You can + * specify multiple detectors for a job. If the detectors array does not contain + * at least one detector, no analysis can occur and an error is returned. + *

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

+ * Adds all elements of list to detectors. + */ + public final Builder detectors(List list) { + this.detectors = _listAddAll(this.detectors, list); + return this; + } + + /** + * Required - Detector configuration objects specify which data fields a job + * analyzes. They also specify which analytical functions are used. You can + * specify multiple detectors for a job. If the detectors array does not contain + * at least one detector, no analysis can occur and an error is returned. + *

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

+ * Adds one or more values to detectors. + */ + public final Builder detectors(DetectorRead value, DetectorRead... values) { + this.detectors = _listAdd(this.detectors, value, values); + return this; + } + + /** + * Required - Detector configuration objects specify which data fields a job + * analyzes. They also specify which analytical functions are used. You can + * specify multiple detectors for a job. If the detectors array does not contain + * at least one detector, no analysis can occur and an error is returned. + *

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

+ * Adds a value to detectors using a builder lambda. + */ + public final Builder detectors(Function> fn) { + return detectors(fn.apply(new DetectorRead.Builder()).build()); + } + + /** + * Required - A comma separated list of influencer field names. Typically these + * can be the by, over, or partition fields that are used in the detector + * configuration. You might also want to use a field name that is not + * specifically named in a detector, but is available as part of the input data. + * When you use multiple detectors, the use of influencers is recommended as it + * aggregates results for each influencer entity. + *

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

+ * Adds all elements of list to influencers. + */ + public final Builder influencers(List list) { + this.influencers = _listAddAll(this.influencers, list); + return this; + } + + /** + * Required - A comma separated list of influencer field names. Typically these + * can be the by, over, or partition fields that are used in the detector + * configuration. You might also want to use a field name that is not + * specifically named in a detector, but is available as part of the input data. + * When you use multiple detectors, the use of influencers is recommended as it + * aggregates results for each influencer entity. + *

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

+ * Adds one or more values to influencers. + */ + public final Builder influencers(String value, String... values) { + this.influencers = _listAdd(this.influencers, value, values); + return this; + } + /** * If categorization_field_name is specified, you can also define * the analyzer that is used to interpret the categorization field. This * property cannot be used at the same time as * categorization_filters. The categorization analyzer specifies * how the categorization_field is interpreted by the - * categorization process. + * categorization process. The categorization_analyzer field can be + * specified either as a string or as an object. If it is a string, it must + * refer to a built-in analyzer or one added by another plugin. *

* API name: {@code categorization_analyzer} */ @@ -437,7 +550,9 @@ public final Builder categorizationAnalyzer(@Nullable CategorizationAnalyzer val * property cannot be used at the same time as * categorization_filters. The categorization analyzer specifies * how the categorization_field is interpreted by the - * categorization process. + * categorization process. The categorization_analyzer field can be + * specified either as a string or as an object. If it is a string, it must + * refer to a built-in analyzer or one added by another plugin. *

* API name: {@code categorization_analyzer} */ @@ -463,7 +578,16 @@ public final Builder categorizationFieldName(@Nullable String value) { * If categorization_field_name is specified, you can also define * optional filters. This property expects an array of regular expressions. The * expressions are used to filter out matching sequences from the categorization - * field values. + * field values. You can use this functionality to fine tune the categorization + * by excluding sequences from consideration when categories are defined. For + * example, you can exclude SQL statements that appear in your log files. This + * property cannot be used at the same time as + * categorization_analyzer. If you only want to define simple + * regular expression filters that are applied prior to tokenization, setting + * this property is the easiest method. If you also want to customize the + * tokenizer or post-tokenization filtering, use the + * categorization_analyzer property instead and include the filters + * as pattern_replace character filters. The effect is exactly the same. *

* API name: {@code categorization_filters} *

@@ -478,7 +602,16 @@ public final Builder categorizationFilters(List list) { * If categorization_field_name is specified, you can also define * optional filters. This property expects an array of regular expressions. The * expressions are used to filter out matching sequences from the categorization - * field values. + * field values. You can use this functionality to fine tune the categorization + * by excluding sequences from consideration when categories are defined. For + * example, you can exclude SQL statements that appear in your log files. This + * property cannot be used at the same time as + * categorization_analyzer. If you only want to define simple + * regular expression filters that are applied prior to tokenization, setting + * this property is the easiest method. If you also want to customize the + * tokenizer or post-tokenization filtering, use the + * categorization_analyzer property instead and include the filters + * as pattern_replace character filters. The effect is exactly the same. *

* API name: {@code categorization_filters} *

@@ -490,87 +623,35 @@ public final Builder categorizationFilters(String value, String... values) { } /** - * Required - An array of detector configuration objects. Detector configuration - * objects specify which data fields a job analyzes. They also specify which - * analytical functions are used. You can specify multiple detectors for a job. - *

- * API name: {@code detectors} - *

- * Adds all elements of list to detectors. - */ - public final Builder detectors(List list) { - this.detectors = _listAddAll(this.detectors, list); - return this; - } - - /** - * Required - An array of detector configuration objects. Detector configuration - * objects specify which data fields a job analyzes. They also specify which - * analytical functions are used. You can specify multiple detectors for a job. - *

- * API name: {@code detectors} - *

- * Adds one or more values to detectors. - */ - public final Builder detectors(DetectorRead value, DetectorRead... values) { - this.detectors = _listAdd(this.detectors, value, values); - return this; - } - - /** - * Required - An array of detector configuration objects. Detector configuration - * objects specify which data fields a job analyzes. They also specify which - * analytical functions are used. You can specify multiple detectors for a job. - *

- * API name: {@code detectors} - *

- * Adds a value to detectors using a builder lambda. - */ - public final Builder detectors(Function> fn) { - return detectors(fn.apply(new DetectorRead.Builder()).build()); - } - - /** - * Required - A comma separated list of influencer field names. Typically these - * can be the by, over, or partition fields that are used in the detector - * configuration. You might also want to use a field name that is not - * specifically named in a detector, but is available as part of the input data. - * When you use multiple detectors, the use of influencers is recommended as it - * aggregates results for each influencer entity. - *

- * API name: {@code influencers} + * The size of the window in which to expect data that is out of time order. If + * you specify a non-zero value, it must be greater than or equal to one second. + * NOTE: Latency is applicable only when you send data by using the post data + * API. *

- * Adds all elements of list to influencers. + * API name: {@code latency} */ - public final Builder influencers(List list) { - this.influencers = _listAddAll(this.influencers, list); + public final Builder latency(@Nullable Time value) { + this.latency = value; return this; } /** - * Required - A comma separated list of influencer field names. Typically these - * can be the by, over, or partition fields that are used in the detector - * configuration. You might also want to use a field name that is not - * specifically named in a detector, but is available as part of the input data. - * When you use multiple detectors, the use of influencers is recommended as it - * aggregates results for each influencer entity. + * The size of the window in which to expect data that is out of time order. If + * you specify a non-zero value, it must be greater than or equal to one second. + * NOTE: Latency is applicable only when you send data by using the post data + * API. *

- * API name: {@code influencers} - *

- * Adds one or more values to influencers. + * API name: {@code latency} */ - public final Builder influencers(String value, String... values) { - this.influencers = _listAdd(this.influencers, value, values); - return this; + public final Builder latency(Function> fn) { + return this.latency(fn.apply(new Time.Builder()).build()); } /** * Advanced configuration option. Affects the pruning of models that have not * been updated for the given time duration. The value must be set to a multiple * of the bucket_span. If set too low, important information may be - * removed from the model. Typically, set to 30d or longer. If not - * set, model pruning only occurs if the model memory status reaches the soft - * limit or the hard limit. For jobs created in 8.1 and later, the default value + * removed from the model. For jobs created in 8.1 and later, the default value * is the greater of 30d or 20 times bucket_span. *

* API name: {@code model_prune_window} @@ -584,9 +665,7 @@ public final Builder modelPruneWindow(@Nullable Time value) { * Advanced configuration option. Affects the pruning of models that have not * been updated for the given time duration. The value must be set to a multiple * of the bucket_span. If set too low, important information may be - * removed from the model. Typically, set to 30d or longer. If not - * set, model pruning only occurs if the model memory status reaches the soft - * limit or the hard limit. For jobs created in 8.1 and later, the default value + * removed from the model. For jobs created in 8.1 and later, the default value * is the greater of 30d or 20 times bucket_span. *

* API name: {@code model_prune_window} @@ -595,35 +674,20 @@ public final Builder modelPruneWindow(Function return this.modelPruneWindow(fn.apply(new Time.Builder()).build()); } - /** - * The size of the window in which to expect data that is out of time order. - * Defaults to no latency. If you specify a non-zero value, it must be greater - * than or equal to one second. - *

- * API name: {@code latency} - */ - public final Builder latency(@Nullable Time value) { - this.latency = value; - return this; - } - - /** - * The size of the window in which to expect data that is out of time order. - * Defaults to no latency. If you specify a non-zero value, it must be greater - * than or equal to one second. - *

- * API name: {@code latency} - */ - public final Builder latency(Function> fn) { - return this.latency(fn.apply(new Time.Builder()).build()); - } - /** * This functionality is reserved for internal use. It is not supported for use * in customer environments and is not subject to the support SLA of official GA * features. If set to true, the analysis will automatically find * correlations between metrics for a given by field value and report anomalies - * when those correlations cease to hold. + * when those correlations cease to hold. For example, suppose CPU and memory + * usage on host A is usually highly correlated with the same metrics on host B. + * Perhaps this correlation occurs because they are running a load-balanced + * application. If you enable this property, anomalies will be reported when, + * for example, CPU usage on host A is high and the value of CPU usage on host B + * is low. That is to say, you’ll see an anomaly when the CPU of host A is + * unusual given the CPU of host B. To use the + * multivariate_by_fields property, you must also specify + * by_field_name in your detector. *

* API name: {@code multivariate_by_fields} */ @@ -657,6 +721,8 @@ public final Builder perPartitionCategorization( * be pre-summarized. This property value is the name of the field that contains * the count of raw data points that have been summarized. The same * summary_count_field_name applies to all detectors in the job. + * NOTE: The summary_count_field_name property cannot be used with + * the metric function. *

* API name: {@code summary_count_field_name} */ @@ -700,15 +766,15 @@ public Builder rebuild() { protected static void setupAnalysisConfigReadDeserializer(ObjectDeserializer op) { op.add(Builder::bucketSpan, Time._DESERIALIZER, "bucket_span"); + op.add(Builder::detectors, JsonpDeserializer.arrayDeserializer(DetectorRead._DESERIALIZER), "detectors"); + op.add(Builder::influencers, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "influencers"); op.add(Builder::categorizationAnalyzer, CategorizationAnalyzer._DESERIALIZER, "categorization_analyzer"); op.add(Builder::categorizationFieldName, JsonpDeserializer.stringDeserializer(), "categorization_field_name"); op.add(Builder::categorizationFilters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "categorization_filters"); - op.add(Builder::detectors, JsonpDeserializer.arrayDeserializer(DetectorRead._DESERIALIZER), "detectors"); - op.add(Builder::influencers, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "influencers"); - op.add(Builder::modelPruneWindow, Time._DESERIALIZER, "model_prune_window"); op.add(Builder::latency, Time._DESERIALIZER, "latency"); + op.add(Builder::modelPruneWindow, Time._DESERIALIZER, "model_prune_window"); op.add(Builder::multivariateByFields, JsonpDeserializer.booleanDeserializer(), "multivariate_by_fields"); op.add(Builder::perPartitionCategorization, PerPartitionCategorization._DESERIALIZER, "per_partition_categorization"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DetectorRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DetectorRead.java index 7e68208ce6..1311312026 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DetectorRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DetectorRead.java @@ -62,6 +62,8 @@ */ @JsonpDeserializable public class DetectorRead implements JsonpSerializable { + private final String function; + @Nullable private final String byFieldName; @@ -79,8 +81,6 @@ public class DetectorRead implements JsonpSerializable { @Nullable private final String fieldName; - private final String function; - @Nullable private final String overFieldName; @@ -94,13 +94,13 @@ public class DetectorRead implements JsonpSerializable { private DetectorRead(Builder builder) { + this.function = ApiTypeHelper.requireNonNull(builder.function, this, "function"); this.byFieldName = builder.byFieldName; this.customRules = ApiTypeHelper.unmodifiable(builder.customRules); this.detectorDescription = builder.detectorDescription; this.detectorIndex = builder.detectorIndex; this.excludeFrequent = builder.excludeFrequent; this.fieldName = builder.fieldName; - this.function = ApiTypeHelper.requireNonNull(builder.function, this, "function"); this.overFieldName = builder.overFieldName; this.partitionFieldName = builder.partitionFieldName; this.useNull = builder.useNull; @@ -111,6 +111,17 @@ public static DetectorRead of(Function> fn) return fn.apply(new Builder()).build(); } + /** + * Required - The analysis function that is used. For example, + * count, rare, mean, min, + * max, or sum. + *

+ * API name: {@code function} + */ + public final String function() { + return this.function; + } + /** * The field used to split the data. In particular, this property is used for * analyzing the splits with respect to their own history. It is used for @@ -124,10 +135,9 @@ public final String byFieldName() { } /** - * An array of custom rule objects, which enable you to customize the way - * detectors operate. For example, a rule may dictate to the detector conditions - * under which results should be skipped. Kibana refers to custom rules as job - * rules. + * Custom rules enable you to customize the way detectors operate. For example, + * a rule may dictate conditions under which results should be skipped. Kibana + * refers to custom rules as job rules. *

* API name: {@code custom_rules} */ @@ -147,7 +157,8 @@ public final String detectorDescription() { /** * A unique identifier for the detector. This identifier is based on the order - * of the detectors in the analysis_config, starting at zero. + * of the detectors in the analysis_config, starting at zero. If + * you specify a value for this property, it is ignored. *

* API name: {@code detector_index} */ @@ -157,12 +168,11 @@ public final Integer detectorIndex() { } /** - * Contains one of the following values: all, none, - * by, or over. If set, frequent entities are excluded - * from influencing the anomaly results. Entities can be considered frequent - * over time or frequent in a population. If you are working with both over and - * by fields, then you can set exclude_frequent to all for both - * fields, or to by or over for those specific fields. + * If set, frequent entities are excluded from influencing the anomaly results. + * Entities can be considered frequent over time or frequent in a population. If + * you are working with both over and by fields, you can set + * exclude_frequent to all for both fields, or to + * by or over for those specific fields. *

* API name: {@code exclude_frequent} */ @@ -173,8 +183,8 @@ public final ExcludeFrequent excludeFrequent() { /** * The field that the detector uses in the function. If you use an event rate - * function such as count or rare, do not specify this - * field. + * function such as count or rare, do not specify this field. The + * field_name cannot contain double quotes or backslashes. *

* API name: {@code field_name} */ @@ -183,17 +193,6 @@ public final String fieldName() { return this.fieldName; } - /** - * Required - The analysis function that is used. For example, - * count, rare, mean, min, - * max, and sum. - *

- * API name: {@code function} - */ - public final String function() { - return this.function; - } - /** * The field used to split the data. In particular, this property is used for * analyzing the splits with respect to the history of all splits. It is used @@ -239,6 +238,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("function"); + generator.write(this.function); + if (this.byFieldName != null) { generator.writeKey("by_field_name"); generator.write(this.byFieldName); @@ -273,9 +275,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.fieldName); } - generator.writeKey("function"); - generator.write(this.function); - if (this.overFieldName != null) { generator.writeKey("over_field_name"); generator.write(this.overFieldName); @@ -306,6 +305,8 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String function; + @Nullable private String byFieldName; @@ -324,8 +325,6 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String fieldName; - private String function; - @Nullable private String overFieldName; @@ -338,18 +337,30 @@ public static class Builder extends WithJsonObjectBuilderBase implement public Builder() { } private Builder(DetectorRead instance) { + this.function = instance.function; this.byFieldName = instance.byFieldName; this.customRules = instance.customRules; this.detectorDescription = instance.detectorDescription; this.detectorIndex = instance.detectorIndex; this.excludeFrequent = instance.excludeFrequent; this.fieldName = instance.fieldName; - this.function = instance.function; this.overFieldName = instance.overFieldName; this.partitionFieldName = instance.partitionFieldName; this.useNull = instance.useNull; } + /** + * Required - The analysis function that is used. For example, + * count, rare, mean, min, + * max, or sum. + *

+ * API name: {@code function} + */ + public final Builder function(String value) { + this.function = value; + return this; + } + /** * The field used to split the data. In particular, this property is used for * analyzing the splits with respect to their own history. It is used for @@ -363,10 +374,9 @@ public final Builder byFieldName(@Nullable String value) { } /** - * An array of custom rule objects, which enable you to customize the way - * detectors operate. For example, a rule may dictate to the detector conditions - * under which results should be skipped. Kibana refers to custom rules as job - * rules. + * Custom rules enable you to customize the way detectors operate. For example, + * a rule may dictate conditions under which results should be skipped. Kibana + * refers to custom rules as job rules. *

* API name: {@code custom_rules} *

@@ -378,10 +388,9 @@ public final Builder customRules(List list) { } /** - * An array of custom rule objects, which enable you to customize the way - * detectors operate. For example, a rule may dictate to the detector conditions - * under which results should be skipped. Kibana refers to custom rules as job - * rules. + * Custom rules enable you to customize the way detectors operate. For example, + * a rule may dictate conditions under which results should be skipped. Kibana + * refers to custom rules as job rules. *

* API name: {@code custom_rules} *

@@ -393,10 +402,9 @@ public final Builder customRules(DetectionRule value, DetectionRule... values) { } /** - * An array of custom rule objects, which enable you to customize the way - * detectors operate. For example, a rule may dictate to the detector conditions - * under which results should be skipped. Kibana refers to custom rules as job - * rules. + * Custom rules enable you to customize the way detectors operate. For example, + * a rule may dictate conditions under which results should be skipped. Kibana + * refers to custom rules as job rules. *

* API name: {@code custom_rules} *

@@ -418,7 +426,8 @@ public final Builder detectorDescription(@Nullable String value) { /** * A unique identifier for the detector. This identifier is based on the order - * of the detectors in the analysis_config, starting at zero. + * of the detectors in the analysis_config, starting at zero. If + * you specify a value for this property, it is ignored. *

* API name: {@code detector_index} */ @@ -428,12 +437,11 @@ public final Builder detectorIndex(@Nullable Integer value) { } /** - * Contains one of the following values: all, none, - * by, or over. If set, frequent entities are excluded - * from influencing the anomaly results. Entities can be considered frequent - * over time or frequent in a population. If you are working with both over and - * by fields, then you can set exclude_frequent to all for both - * fields, or to by or over for those specific fields. + * If set, frequent entities are excluded from influencing the anomaly results. + * Entities can be considered frequent over time or frequent in a population. If + * you are working with both over and by fields, you can set + * exclude_frequent to all for both fields, or to + * by or over for those specific fields. *

* API name: {@code exclude_frequent} */ @@ -444,8 +452,8 @@ public final Builder excludeFrequent(@Nullable ExcludeFrequent value) { /** * The field that the detector uses in the function. If you use an event rate - * function such as count or rare, do not specify this - * field. + * function such as count or rare, do not specify this field. The + * field_name cannot contain double quotes or backslashes. *

* API name: {@code field_name} */ @@ -454,18 +462,6 @@ public final Builder fieldName(@Nullable String value) { return this; } - /** - * Required - The analysis function that is used. For example, - * count, rare, mean, min, - * max, and sum. - *

- * API name: {@code function} - */ - public final Builder function(String value) { - this.function = value; - return this; - } - /** * The field used to split the data. In particular, this property is used for * analyzing the splits with respect to the history of all splits. It is used @@ -534,13 +530,13 @@ public Builder rebuild() { protected static void setupDetectorReadDeserializer(ObjectDeserializer op) { + op.add(Builder::function, JsonpDeserializer.stringDeserializer(), "function"); op.add(Builder::byFieldName, JsonpDeserializer.stringDeserializer(), "by_field_name"); op.add(Builder::customRules, JsonpDeserializer.arrayDeserializer(DetectionRule._DESERIALIZER), "custom_rules"); op.add(Builder::detectorDescription, JsonpDeserializer.stringDeserializer(), "detector_description"); op.add(Builder::detectorIndex, JsonpDeserializer.integerDeserializer(), "detector_index"); op.add(Builder::excludeFrequent, ExcludeFrequent._DESERIALIZER, "exclude_frequent"); op.add(Builder::fieldName, JsonpDeserializer.stringDeserializer(), "field_name"); - op.add(Builder::function, JsonpDeserializer.stringDeserializer(), "function"); op.add(Builder::overFieldName, JsonpDeserializer.stringDeserializer(), "over_field_name"); op.add(Builder::partitionFieldName, JsonpDeserializer.stringDeserializer(), "partition_field_name"); op.add(Builder::useNull, JsonpDeserializer.booleanDeserializer(), "use_null"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/QueryRuleCriteriaType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/QueryRuleCriteriaType.java index 8c8de04782..7e6e761c30 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/QueryRuleCriteriaType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/QueryRuleCriteriaType.java @@ -50,8 +50,6 @@ public enum QueryRuleCriteriaType implements JsonEnum { Exact("exact"), - ExactFuzzy("exact_fuzzy"), - Fuzzy("fuzzy"), Prefix("prefix"), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java index 0c4297645e..bcd6f0aaba 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java @@ -179,7 +179,10 @@ public final Map metadata() { } /** - * A list of users that the API keys can impersonate. + * A list of users that the API keys can impersonate. NOTE: In Elastic Cloud + * Serverless, the run-as feature is disabled. For API compatibility, you can + * still specify an empty run_as field, but a non-empty list will + * be rejected. *

* API name: {@code run_as} */ @@ -188,7 +191,7 @@ public final List runAs() { } /** - * An optional description of the role descriptor. + * Optional description of the role descriptor *

* API name: {@code description} */ @@ -198,7 +201,7 @@ public final String description() { } /** - * A restriction for when the role descriptor is allowed to be effective. + * Restriction for when the role descriptor is allowed to be effective. *

* API name: {@code restriction} */ @@ -645,7 +648,10 @@ public final Builder metadata(String key, JsonData value) { } /** - * A list of users that the API keys can impersonate. + * A list of users that the API keys can impersonate. NOTE: In Elastic Cloud + * Serverless, the run-as feature is disabled. For API compatibility, you can + * still specify an empty run_as field, but a non-empty list will + * be rejected. *

* API name: {@code run_as} *

@@ -657,7 +663,10 @@ public final Builder runAs(List list) { } /** - * A list of users that the API keys can impersonate. + * A list of users that the API keys can impersonate. NOTE: In Elastic Cloud + * Serverless, the run-as feature is disabled. For API compatibility, you can + * still specify an empty run_as field, but a non-empty list will + * be rejected. *

* API name: {@code run_as} *

@@ -669,7 +678,7 @@ public final Builder runAs(String value, String... values) { } /** - * An optional description of the role descriptor. + * Optional description of the role descriptor *

* API name: {@code description} */ @@ -679,7 +688,7 @@ public final Builder description(@Nullable String value) { } /** - * A restriction for when the role descriptor is allowed to be effective. + * Restriction for when the role descriptor is allowed to be effective. *

* API name: {@code restriction} */ @@ -689,7 +698,7 @@ public final Builder restriction(@Nullable Restriction value) { } /** - * A restriction for when the role descriptor is allowed to be effective. + * Restriction for when the role descriptor is allowed to be effective. *

* API name: {@code restriction} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GetSnapshotRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GetSnapshotRequest.java index 528cd24278..1be4779d16 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GetSnapshotRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GetSnapshotRequest.java @@ -261,7 +261,7 @@ public final String repository() { } /** - * The maximum number of snapshots to return. The default is 0, which means to + * The maximum number of snapshots to return. The default is -1, which means to * return all that match the request without limit. *

* API name: {@code size} @@ -537,7 +537,7 @@ public final Builder repository(String value) { } /** - * The maximum number of snapshots to return. The default is 0, which means to + * The maximum number of snapshots to return. The default is -1, which means to * return all that match the request without limit. *

* API name: {@code size} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/SynonymRuleRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/SynonymRuleRead.java index b9267ccf97..02df89f682 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/SynonymRuleRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/synonyms/SynonymRuleRead.java @@ -77,7 +77,9 @@ public static SynonymRuleRead synonymRuleReadOf(Function * API name: {@code id} */ @@ -86,9 +88,7 @@ public final String id() { } /** - * Required - Synonyms, in Solr format, that conform the synonym rule. See - * https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2 + * Required - The synonyms that conform the synonym rule in Solr format. *

* API name: {@code synonyms} */ @@ -155,7 +155,9 @@ public abstract static class AbstractBuilder * API name: {@code id} */ @@ -165,9 +167,7 @@ public final BuilderT id(String value) { } /** - * Required - Synonyms, in Solr format, that conform the synonym rule. See - * https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2 + * Required - The synonyms that conform the synonym rule in Solr format. *

* API name: {@code synonyms} */ From e0311d3babd7113b4b072e388d02db31e6245699 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Thu, 26 Feb 2026 15:32:34 +0100 Subject: [PATCH 2/2] revert unwanted changes --- .../cluster/ComponentTemplateSummary.java | 17 ++++++++--------- .../cluster/PutComponentTemplateRequest.java | 16 ++++++++-------- .../indices/IndexTemplateSummary.java | 15 +++++++-------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java index ec71d0adaa..9cb227c73b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.AliasDefinition; import co.elastic.clients.elasticsearch.indices.DataStreamLifecycleWithRollover; -import co.elastic.clients.elasticsearch.indices.DataStreamOptions; +import co.elastic.clients.elasticsearch.indices.DataStreamOptionsTemplate; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -39,7 +39,6 @@ import java.lang.Long; import java.lang.String; import java.util.Map; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -84,7 +83,7 @@ public class ComponentTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptions dataStreamOptions; + private final DataStreamOptionsTemplate dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -153,7 +152,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptions dataStreamOptions() { + public final DataStreamOptionsTemplate dataStreamOptions() { return this.dataStreamOptions; } @@ -257,7 +256,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptions dataStreamOptions; + private DataStreamOptionsTemplate dataStreamOptions; public Builder() { } @@ -391,7 +390,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { this.dataStreamOptions = value; return this; } @@ -400,8 +399,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); } @Override @@ -445,7 +444,7 @@ protected static void setupComponentTemplateSummaryDeserializer( op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::dataStreamOptions, DataStreamOptions._DESERIALIZER, "data_stream_options"); + op.add(Builder::dataStreamOptions, DataStreamOptionsTemplate._DESERIALIZER, "data_stream_options"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java index e722a0079e..17a0c4b2bd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/PutComponentTemplateRequest.java @@ -22,7 +22,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.put_index_template.IndexTemplateMapping; +import co.elastic.clients.elasticsearch.indices.IndexState; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -112,7 +112,7 @@ public class PutComponentTemplateRequest extends RequestBase implements JsonpSer private final String name; - private final IndexTemplateMapping template; + private final IndexState template; @Nullable private final Long version; @@ -218,7 +218,7 @@ public final String name() { *

* API name: {@code template} */ - public final IndexTemplateMapping template() { + public final IndexState template() { return this.template; } @@ -298,7 +298,7 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; - private IndexTemplateMapping template; + private IndexState template; @Nullable private Long version; @@ -428,7 +428,7 @@ public final Builder name(String value) { *

* API name: {@code template} */ - public final Builder template(IndexTemplateMapping value) { + public final Builder template(IndexState value) { this.template = value; return this; } @@ -439,8 +439,8 @@ public final Builder template(IndexTemplateMapping value) { *

* API name: {@code template} */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); + public final Builder template(Function> fn) { + return this.template(fn.apply(new IndexState.Builder()).build()); } /** @@ -492,7 +492,7 @@ protected static void setupPutComponentTemplateRequestDeserializer( op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); + op.add(Builder::template, IndexState._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java index 53089fe50f..0e3eb1c972 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java @@ -33,7 +33,6 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.Map; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -74,7 +73,7 @@ public class IndexTemplateSummary implements JsonpSerializable { private final DataStreamLifecycleWithRollover lifecycle; @Nullable - private final DataStreamOptions dataStreamOptions; + private final DataStreamOptionsTemplate dataStreamOptions; // --------------------------------------------------------------------------------------------- @@ -137,7 +136,7 @@ public final DataStreamLifecycleWithRollover lifecycle() { * API name: {@code data_stream_options} */ @Nullable - public final DataStreamOptions dataStreamOptions() { + public final DataStreamOptionsTemplate dataStreamOptions() { return this.dataStreamOptions; } @@ -213,7 +212,7 @@ public static class Builder extends WithJsonObjectBuilderBase private DataStreamLifecycleWithRollover lifecycle; @Nullable - private DataStreamOptions dataStreamOptions; + private DataStreamOptionsTemplate dataStreamOptions; public Builder() { } @@ -328,7 +327,7 @@ public final Builder lifecycle( /** * API name: {@code data_stream_options} */ - public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { + public final Builder dataStreamOptions(@Nullable DataStreamOptionsTemplate value) { this.dataStreamOptions = value; return this; } @@ -337,8 +336,8 @@ public final Builder dataStreamOptions(@Nullable DataStreamOptions value) { * API name: {@code data_stream_options} */ public final Builder dataStreamOptions( - Function> fn) { - return this.dataStreamOptions(fn.apply(new DataStreamOptions.Builder()).build()); + Function> fn) { + return this.dataStreamOptions(fn.apply(new DataStreamOptionsTemplate.Builder()).build()); } @Override @@ -379,7 +378,7 @@ protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializer