diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FlattenedProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FlattenedProperty.java index 781d5aeae4..b8749024c1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FlattenedProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FlattenedProperty.java @@ -82,6 +82,9 @@ public class FlattenedProperty extends PropertyBase implements PropertyVariant { @Nullable private final String nullValue; + @Nullable + private final PreserveLeafArrays preserveLeafArrays; + @Nullable private final String similarity; @@ -102,6 +105,7 @@ private FlattenedProperty(Builder builder) { this.index = builder.index; this.indexOptions = builder.indexOptions; this.nullValue = builder.nullValue; + this.preserveLeafArrays = builder.preserveLeafArrays; this.similarity = builder.similarity; this.splitQueriesOnWhitespace = builder.splitQueriesOnWhitespace; this.timeSeriesDimensions = ApiTypeHelper.unmodifiable(builder.timeSeriesDimensions); @@ -176,6 +180,19 @@ public final String nullValue() { return this.nullValue; } + /** + * How leaf arrays are represented in synthetic source. When set to + * lossy, leaf arrays are sorted, de-nulled, and deduplicated in + * the returned synthetic source. When set to exact, leaf arrays + * preserve order, nulls, and duplicates. + *

+ * API name: {@code preserve_leaf_arrays} + */ + @Nullable + public final PreserveLeafArrays preserveLeafArrays() { + return this.preserveLeafArrays; + } + /** * API name: {@code similarity} */ @@ -237,6 +254,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.nullValue); } + if (this.preserveLeafArrays != null) { + generator.writeKey("preserve_leaf_arrays"); + this.preserveLeafArrays.serialize(generator, mapper); + } if (this.similarity != null) { generator.writeKey("similarity"); generator.write(this.similarity); @@ -290,6 +311,9 @@ public static class Builder extends PropertyBase.AbstractBuilder @Nullable private String nullValue; + @Nullable + private PreserveLeafArrays preserveLeafArrays; + @Nullable private String similarity; @@ -309,6 +333,7 @@ private Builder(FlattenedProperty instance) { this.index = instance.index; this.indexOptions = instance.indexOptions; this.nullValue = instance.nullValue; + this.preserveLeafArrays = instance.preserveLeafArrays; this.similarity = instance.similarity; this.splitQueriesOnWhitespace = instance.splitQueriesOnWhitespace; this.timeSeriesDimensions = instance.timeSeriesDimensions; @@ -370,6 +395,19 @@ public final Builder nullValue(@Nullable String value) { return this; } + /** + * How leaf arrays are represented in synthetic source. When set to + * lossy, leaf arrays are sorted, de-nulled, and deduplicated in + * the returned synthetic source. When set to exact, leaf arrays + * preserve order, nulls, and duplicates. + *

+ * API name: {@code preserve_leaf_arrays} + */ + public final Builder preserveLeafArrays(@Nullable PreserveLeafArrays value) { + this.preserveLeafArrays = value; + return this; + } + /** * API name: {@code similarity} */ @@ -447,6 +485,7 @@ protected static void setupFlattenedPropertyDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public enum PreserveLeafArrays implements JsonEnum { + Lossy("lossy"), + + Exact("exact"), + + ; + + private final String jsonValue; + + PreserveLeafArrays(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + PreserveLeafArrays.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java index 0f3a7b1518..59508b445f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeField.java @@ -81,6 +81,9 @@ public class RuntimeField implements DynamicTemplateVariant, JsonpSerializable { @Nullable private final Script script; + @Nullable + private final OnScriptError onScriptError; + private final RuntimeFieldType type; // --------------------------------------------------------------------------------------------- @@ -94,6 +97,7 @@ private RuntimeField(Builder builder) { this.targetField = builder.targetField; this.targetIndex = builder.targetIndex; this.script = builder.script; + this.onScriptError = builder.onScriptError; this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); } @@ -178,6 +182,14 @@ public final Script script() { return this.script; } + /** + * API name: {@code on_script_error} + */ + @Nullable + public final OnScriptError onScriptError() { + return this.onScriptError; + } + /** * Required - Field type, which can be: boolean, * composite, date, double, @@ -247,6 +259,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.script.serialize(generator, mapper); } + if (this.onScriptError != null) { + generator.writeKey("on_script_error"); + this.onScriptError.serialize(generator, mapper); + } generator.writeKey("type"); this.type.serialize(generator, mapper); @@ -285,6 +301,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Script script; + @Nullable + private OnScriptError onScriptError; + private RuntimeFieldType type; public Builder() { @@ -297,6 +316,7 @@ private Builder(RuntimeField instance) { this.targetField = instance.targetField; this.targetIndex = instance.targetIndex; this.script = instance.script; + this.onScriptError = instance.onScriptError; this.type = instance.type; } @@ -431,6 +451,14 @@ public final Builder script(Function> fn) return this.script(fn.apply(new Script.Builder()).build()); } + /** + * API name: {@code on_script_error} + */ + public final Builder onScriptError(@Nullable OnScriptError value) { + this.onScriptError = value; + return this; + } + /** * Required - Field type, which can be: boolean, * composite, date, double, @@ -486,6 +514,7 @@ protected static void setupRuntimeFieldDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/22c7eb88e9919e130aa40d86bf0dccd5de355673/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/76ba95c939b3564233489ad5e45596c936997853/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/IndexSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java index cfa48e30d0..cc0b19929e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java @@ -167,6 +167,9 @@ public class IndexSettings implements JsonpSerializable { @Nullable private final IndexRouting routing; + @Nullable + private final IndexSettingsUnassigned unassigned; + @Nullable private final Time gcDeletes; @@ -279,6 +282,7 @@ private IndexSettings(Builder builder) { this.maxTermsCount = builder.maxTermsCount; this.maxRegexLength = builder.maxRegexLength; this.routing = builder.routing; + this.unassigned = builder.unassigned; this.gcDeletes = builder.gcDeletes; this.defaultPipeline = builder.defaultPipeline; this.finalPipeline = builder.finalPipeline; @@ -572,6 +576,14 @@ public final IndexRouting routing() { return this.routing; } + /** + * API name: {@code unassigned} + */ + @Nullable + public final IndexSettingsUnassigned unassigned() { + return this.unassigned; + } + /** * API name: {@code gc_deletes} */ @@ -962,6 +974,11 @@ else if (isExpNullAutoExpandReplicas) { generator.writeKey("routing"); this.routing.serialize(generator, mapper); + } + if (this.unassigned != null) { + generator.writeKey("unassigned"); + this.unassigned.serialize(generator, mapper); + } if (this.gcDeletes != null) { generator.writeKey("gc_deletes"); @@ -1232,6 +1249,9 @@ public final Builder otherSettings(String key, JsonData value) { @Nullable private IndexRouting routing; + @Nullable + private IndexSettingsUnassigned unassigned; + @Nullable private Time gcDeletes; @@ -1341,6 +1361,7 @@ private Builder(IndexSettings instance) { this.maxTermsCount = instance.maxTermsCount; this.maxRegexLength = instance.maxRegexLength; this.routing = instance.routing; + this.unassigned = instance.unassigned; this.gcDeletes = instance.gcDeletes; this.defaultPipeline = instance.defaultPipeline; this.finalPipeline = instance.finalPipeline; @@ -1717,6 +1738,22 @@ public final Builder routing(Function> fn) { + return this.unassigned(fn.apply(new IndexSettingsUnassigned.Builder()).build()); + } + /** * API name: {@code gc_deletes} */ @@ -2124,6 +2161,7 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializerkeyword dimension field; if the setting is unset + * or the field is missing or invalid, the metric temporality resolves to null. + *

+ * API name: {@code temporality_field} + */ + @Nullable + public final String temporalityField() { + return this.temporalityField; + } + /** * Serialize this object to JSON. */ @@ -113,6 +130,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("start_time"); this.startTime.serialize(generator, mapper); } + if (this.temporalityField != null) { + generator.writeKey("temporality_field"); + generator.write(this.temporalityField); + + } } @@ -136,11 +158,15 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private DateTime startTime; + @Nullable + private String temporalityField; + public Builder() { } private Builder(IndexSettingsTimeSeries instance) { this.endTime = instance.endTime; this.startTime = instance.startTime; + this.temporalityField = instance.temporalityField; } /** @@ -159,6 +185,18 @@ public final Builder startTime(@Nullable DateTime value) { return this; } + /** + * The name of the field that stores the temporality of a metric. The referenced + * field must be a keyword dimension field; if the setting is unset + * or the field is missing or invalid, the metric temporality resolves to null. + *

+ * API name: {@code temporality_field} + */ + public final Builder temporalityField(@Nullable String value) { + this.temporalityField = value; + return this; + } + @Override protected Builder self() { return this; @@ -196,6 +234,7 @@ protected static void setupIndexSettingsTimeSeriesDeserializer( op.add(Builder::endTime, DateTime._DESERIALIZER, "end_time"); op.add(Builder::startTime, DateTime._DESERIALIZER, "start_time"); + op.add(Builder::temporalityField, JsonpDeserializer.stringDeserializer(), "temporality_field"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.java new file mode 100644 index 0000000000..25e55d63cb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.java @@ -0,0 +1,181 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: indices._types.IndexSettingsUnassigned + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndexSettingsUnassigned implements JsonpSerializable { + @Nullable + private final IndexSettingsUnassignedNodeLeft nodeLeft; + + // --------------------------------------------------------------------------------------------- + + private IndexSettingsUnassigned(Builder builder) { + + this.nodeLeft = builder.nodeLeft; + + } + + public static IndexSettingsUnassigned of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code node_left} + */ + @Nullable + public final IndexSettingsUnassignedNodeLeft nodeLeft() { + return this.nodeLeft; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.nodeLeft != null) { + generator.writeKey("node_left"); + this.nodeLeft.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexSettingsUnassigned}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private IndexSettingsUnassignedNodeLeft nodeLeft; + + public Builder() { + } + private Builder(IndexSettingsUnassigned instance) { + this.nodeLeft = instance.nodeLeft; + + } + /** + * API name: {@code node_left} + */ + public final Builder nodeLeft(@Nullable IndexSettingsUnassignedNodeLeft value) { + this.nodeLeft = value; + return this; + } + + /** + * API name: {@code node_left} + */ + public final Builder nodeLeft( + Function> fn) { + return this.nodeLeft(fn.apply(new IndexSettingsUnassignedNodeLeft.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexSettingsUnassigned}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexSettingsUnassigned build() { + _checkSingleUse(); + + return new IndexSettingsUnassigned(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexSettingsUnassigned} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IndexSettingsUnassigned::setupIndexSettingsUnassignedDeserializer); + + protected static void setupIndexSettingsUnassignedDeserializer( + ObjectDeserializer op) { + + op.add(Builder::nodeLeft, IndexSettingsUnassignedNodeLeft._DESERIALIZER, "node_left"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java new file mode 100644 index 0000000000..21de1ea8a1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java @@ -0,0 +1,191 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: indices._types.IndexSettingsUnassignedNodeLeft + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndexSettingsUnassignedNodeLeft implements JsonpSerializable { + @Nullable + private final Time delayedTimeout; + + // --------------------------------------------------------------------------------------------- + + private IndexSettingsUnassignedNodeLeft(Builder builder) { + + this.delayedTimeout = builder.delayedTimeout; + + } + + public static IndexSettingsUnassignedNodeLeft of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + @Nullable + public final Time delayedTimeout() { + return this.delayedTimeout; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.delayedTimeout != null) { + generator.writeKey("delayed_timeout"); + this.delayedTimeout.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexSettingsUnassignedNodeLeft}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Time delayedTimeout; + + public Builder() { + } + private Builder(IndexSettingsUnassignedNodeLeft instance) { + this.delayedTimeout = instance.delayedTimeout; + + } + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + public final Builder delayedTimeout(@Nullable Time value) { + this.delayedTimeout = value; + return this; + } + + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + public final Builder delayedTimeout(Function> fn) { + return this.delayedTimeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexSettingsUnassignedNodeLeft}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexSettingsUnassignedNodeLeft build() { + _checkSingleUse(); + + return new IndexSettingsUnassignedNodeLeft(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexSettingsUnassignedNodeLeft} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IndexSettingsUnassignedNodeLeft::setupIndexSettingsUnassignedNodeLeftDeserializer); + + protected static void setupIndexSettingsUnassignedNodeLeftDeserializer( + ObjectDeserializer op) { + + op.add(Builder::delayedTimeout, Time._DESERIALIZER, "delayed_timeout"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java index f0ddcddf2f..b65ffcce1f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java @@ -89,6 +89,14 @@ public static CustomTaskSettings of(Function * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} */ @@ -157,6 +165,14 @@ private Builder(CustomTaskSettings instance) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

@@ -180,6 +196,14 @@ public final Builder parameters(Map map) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

@@ -203,6 +227,14 @@ public final Builder parameters(String key, FieldValue value) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java new file mode 100644 index 0000000000..43c9a863ff --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java @@ -0,0 +1,313 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.nodes; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Double; +import java.lang.Integer; +import java.lang.Long; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: nodes._types.Allocations + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Allocations implements JsonpSerializable { + @Nullable + private final Integer shards; + + @Nullable + private final Integer undesiredShards; + + @Nullable + private final Double forecastedIngestLoad; + + @Nullable + private final Long forecastedDiskUsageInBytes; + + @Nullable + private final Long currentDiskUsageInBytes; + + // --------------------------------------------------------------------------------------------- + + private Allocations(Builder builder) { + + this.shards = builder.shards; + this.undesiredShards = builder.undesiredShards; + this.forecastedIngestLoad = builder.forecastedIngestLoad; + this.forecastedDiskUsageInBytes = builder.forecastedDiskUsageInBytes; + this.currentDiskUsageInBytes = builder.currentDiskUsageInBytes; + + } + + public static Allocations of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Number of shards allocated to the node. + *

+ * API name: {@code shards} + */ + @Nullable + public final Integer shards() { + return this.shards; + } + + /** + * Number of shards allocated to the node that are currently undesired. + *

+ * API name: {@code undesired_shards} + */ + @Nullable + public final Integer undesiredShards() { + return this.undesiredShards; + } + + /** + * Forecasted ingest load for the node. + *

+ * API name: {@code forecasted_ingest_load} + */ + @Nullable + public final Double forecastedIngestLoad() { + return this.forecastedIngestLoad; + } + + /** + * Forecasted disk usage, in bytes, for the node. + *

+ * API name: {@code forecasted_disk_usage_in_bytes} + */ + @Nullable + public final Long forecastedDiskUsageInBytes() { + return this.forecastedDiskUsageInBytes; + } + + /** + * Current disk usage, in bytes, for the node. + *

+ * API name: {@code current_disk_usage_in_bytes} + */ + @Nullable + public final Long currentDiskUsageInBytes() { + return this.currentDiskUsageInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.shards != null) { + generator.writeKey("shards"); + generator.write(this.shards); + + } + if (this.undesiredShards != null) { + generator.writeKey("undesired_shards"); + generator.write(this.undesiredShards); + + } + if (this.forecastedIngestLoad != null) { + generator.writeKey("forecasted_ingest_load"); + generator.write(this.forecastedIngestLoad); + + } + if (this.forecastedDiskUsageInBytes != null) { + generator.writeKey("forecasted_disk_usage_in_bytes"); + generator.write(this.forecastedDiskUsageInBytes); + + } + if (this.currentDiskUsageInBytes != null) { + generator.writeKey("current_disk_usage_in_bytes"); + generator.write(this.currentDiskUsageInBytes); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Allocations}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer shards; + + @Nullable + private Integer undesiredShards; + + @Nullable + private Double forecastedIngestLoad; + + @Nullable + private Long forecastedDiskUsageInBytes; + + @Nullable + private Long currentDiskUsageInBytes; + + public Builder() { + } + private Builder(Allocations instance) { + this.shards = instance.shards; + this.undesiredShards = instance.undesiredShards; + this.forecastedIngestLoad = instance.forecastedIngestLoad; + this.forecastedDiskUsageInBytes = instance.forecastedDiskUsageInBytes; + this.currentDiskUsageInBytes = instance.currentDiskUsageInBytes; + + } + /** + * Number of shards allocated to the node. + *

+ * API name: {@code shards} + */ + public final Builder shards(@Nullable Integer value) { + this.shards = value; + return this; + } + + /** + * Number of shards allocated to the node that are currently undesired. + *

+ * API name: {@code undesired_shards} + */ + public final Builder undesiredShards(@Nullable Integer value) { + this.undesiredShards = value; + return this; + } + + /** + * Forecasted ingest load for the node. + *

+ * API name: {@code forecasted_ingest_load} + */ + public final Builder forecastedIngestLoad(@Nullable Double value) { + this.forecastedIngestLoad = value; + return this; + } + + /** + * Forecasted disk usage, in bytes, for the node. + *

+ * API name: {@code forecasted_disk_usage_in_bytes} + */ + public final Builder forecastedDiskUsageInBytes(@Nullable Long value) { + this.forecastedDiskUsageInBytes = value; + return this; + } + + /** + * Current disk usage, in bytes, for the node. + *

+ * API name: {@code current_disk_usage_in_bytes} + */ + public final Builder currentDiskUsageInBytes(@Nullable Long value) { + this.currentDiskUsageInBytes = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Allocations}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Allocations build() { + _checkSingleUse(); + + return new Allocations(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Allocations} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Allocations::setupAllocationsDeserializer); + + protected static void setupAllocationsDeserializer(ObjectDeserializer op) { + + op.add(Builder::shards, JsonpDeserializer.integerDeserializer(), "shards"); + op.add(Builder::undesiredShards, JsonpDeserializer.integerDeserializer(), "undesired_shards"); + op.add(Builder::forecastedIngestLoad, JsonpDeserializer.doubleDeserializer(), "forecasted_ingest_load"); + op.add(Builder::forecastedDiskUsageInBytes, JsonpDeserializer.longDeserializer(), + "forecasted_disk_usage_in_bytes"); + op.add(Builder::currentDiskUsageInBytes, JsonpDeserializer.longDeserializer(), "current_disk_usage_in_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java index 59e6006b68..1f01f0a8b8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java @@ -66,6 +66,9 @@ public class Stats implements JsonpSerializable { private final Map adaptiveSelection; + @Nullable + private final Allocations allocations; + private final Map breakers; @Nullable @@ -128,6 +131,7 @@ public class Stats implements JsonpSerializable { private Stats(Builder builder) { this.adaptiveSelection = ApiTypeHelper.unmodifiable(builder.adaptiveSelection); + this.allocations = builder.allocations; this.breakers = ApiTypeHelper.unmodifiable(builder.breakers); this.fs = builder.fs; this.host = builder.host; @@ -165,6 +169,16 @@ public final Map adaptiveSelection() { return this.adaptiveSelection; } + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + @Nullable + public final Allocations allocations() { + return this.allocations; + } + /** * Statistics about the field data circuit breaker. *

@@ -390,6 +404,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.allocations != null) { + generator.writeKey("allocations"); + this.allocations.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.breakers)) { generator.writeKey("breakers"); @@ -554,6 +573,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Map adaptiveSelection; + @Nullable + private Allocations allocations; + @Nullable private Map breakers; @@ -621,6 +643,7 @@ public Builder() { } private Builder(Stats instance) { this.adaptiveSelection = instance.adaptiveSelection; + this.allocations = instance.allocations; this.breakers = instance.breakers; this.fs = instance.fs; this.host = instance.host; @@ -680,6 +703,25 @@ public final Builder adaptiveSelection(String key, return adaptiveSelection(key, fn.apply(new AdaptiveSelection.Builder()).build()); } + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + public final Builder allocations(@Nullable Allocations value) { + this.allocations = value; + return this; + } + + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + public final Builder allocations(Function> fn) { + return this.allocations(fn.apply(new Allocations.Builder()).build()); + } + /** * Statistics about the field data circuit breaker. *

@@ -1133,6 +1175,7 @@ protected static void setupStatsDeserializer(ObjectDeserializer o op.add(Builder::adaptiveSelection, JsonpDeserializer.stringMapDeserializer(AdaptiveSelection._DESERIALIZER), "adaptive_selection"); + op.add(Builder::allocations, Allocations._DESERIALIZER, "allocations"); op.add(Builder::breakers, JsonpDeserializer.stringMapDeserializer(Breaker._DESERIALIZER), "breakers"); op.add(Builder::fs, FileSystem._DESERIALIZER, "fs"); op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java index 7c2be9d723..18ccc39d00 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java @@ -73,6 +73,9 @@ public class GetTransformStatsRequest extends RequestBase { @Nullable private final Boolean allowNoMatch; + @Nullable + private final Boolean basic; + @Nullable private final Long from; @@ -89,6 +92,7 @@ public class GetTransformStatsRequest extends RequestBase { private GetTransformStatsRequest(Builder builder) { this.allowNoMatch = builder.allowNoMatch; + this.basic = builder.basic; this.from = builder.from; this.size = builder.size; this.timeout = builder.timeout; @@ -119,6 +123,22 @@ public final Boolean allowNoMatch() { return this.allowNoMatch; } + /** + * If true, the response includes id, state, + * node, stats, health, and basic + * checkpointing information (the last and next checkpoint numbers, + * and the next checkpoint's position and progress). + * Skips statistics that require heavy computations to calculate: + * operations_behind, changes_last_detected_at, + * last_search_time, and the checkpoint timestamps. + *

+ * API name: {@code basic} + */ + @Nullable + public final Boolean basic() { + return this.basic; + } + /** * Skips the specified number of transforms. *

@@ -174,6 +194,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean allowNoMatch; + @Nullable + private Boolean basic; + @Nullable private Long from; @@ -189,6 +212,7 @@ public Builder() { } private Builder(GetTransformStatsRequest instance) { this.allowNoMatch = instance.allowNoMatch; + this.basic = instance.basic; this.from = instance.from; this.size = instance.size; this.timeout = instance.timeout; @@ -214,6 +238,22 @@ public final Builder allowNoMatch(@Nullable Boolean value) { return this; } + /** + * If true, the response includes id, state, + * node, stats, health, and basic + * checkpointing information (the last and next checkpoint numbers, + * and the next checkpoint's position and progress). + * Skips statistics that require heavy computations to calculate: + * operations_behind, changes_last_detected_at, + * last_search_time, and the checkpoint timestamps. + *

+ * API name: {@code basic} + */ + public final Builder basic(@Nullable Boolean value) { + this.basic = value; + return this; + } + /** * Skips the specified number of transforms. *

@@ -369,6 +409,9 @@ public Builder rebuild() { if (request.from != null) { params.put("from", String.valueOf(request.from)); } + if (request.basic != null) { + params.put("basic", String.valueOf(request.basic)); + } if (request.allowNoMatch != null) { params.put("allow_no_match", String.valueOf(request.allowNoMatch)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java index 706da3aa76..36ace5404a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java @@ -30,6 +30,7 @@ import co.elastic.clients.elasticsearch.xpack.usage.GpuVectorIndexing; import co.elastic.clients.elasticsearch.xpack.usage.HealthStatistics; import co.elastic.clients.elasticsearch.xpack.usage.Ilm; +import co.elastic.clients.elasticsearch.xpack.usage.Logging; import co.elastic.clients.elasticsearch.xpack.usage.MachineLearning; import co.elastic.clients.elasticsearch.xpack.usage.Monitoring; import co.elastic.clients.elasticsearch.xpack.usage.RuntimeFieldTypes; @@ -117,6 +118,9 @@ public class XpackUsageResponse implements JsonpSerializable { private final Ilm ilm; + @Nullable + private final Logging logging; + private final Base logstash; private final MachineLearning ml; @@ -165,6 +169,7 @@ private XpackUsageResponse(Builder builder) { this.gpuVectorIndexing = builder.gpuVectorIndexing; this.healthApi = builder.healthApi; this.ilm = ApiTypeHelper.requireNonNull(builder.ilm, this, "ilm"); + this.logging = builder.logging; this.logstash = ApiTypeHelper.requireNonNull(builder.logstash, this, "logstash"); this.ml = ApiTypeHelper.requireNonNull(builder.ml, this, "ml"); this.monitoring = ApiTypeHelper.requireNonNull(builder.monitoring, this, "monitoring"); @@ -305,6 +310,14 @@ public final Ilm ilm() { return this.ilm; } + /** + * API name: {@code logging} + */ + @Nullable + public final Logging logging() { + return this.logging; + } + /** * Required - API name: {@code logstash} */ @@ -471,6 +484,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("ilm"); this.ilm.serialize(generator, mapper); + if (this.logging != null) { + generator.writeKey("logging"); + this.logging.serialize(generator, mapper); + + } generator.writeKey("logstash"); this.logstash.serialize(generator, mapper); @@ -569,6 +587,9 @@ public static class Builder extends WithJsonObjectBuilderBase private Ilm ilm; + @Nullable + private Logging logging; + private Base logstash; private MachineLearning ml; @@ -838,6 +859,21 @@ public final Builder ilm(Function> fn) { return this.ilm(fn.apply(new Ilm.Builder()).build()); } + /** + * API name: {@code logging} + */ + public final Builder logging(@Nullable Logging value) { + this.logging = value; + return this; + } + + /** + * API name: {@code logging} + */ + public final Builder logging(Function> fn) { + return this.logging(fn.apply(new Logging.Builder()).build()); + } + /** * Required - API name: {@code logstash} */ @@ -1078,6 +1114,7 @@ protected static void setupXpackUsageResponseDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class EsqlLoggingConfig implements JsonpSerializable { + private final boolean enabled; + + private final boolean user; + + private final Map thresholds; + + // --------------------------------------------------------------------------------------------- + + private EsqlLoggingConfig(Builder builder) { + + this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled", false); + this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user", false); + this.thresholds = ApiTypeHelper.unmodifiable(builder.thresholds); + + } + + public static EsqlLoggingConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether ES|QL query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final boolean enabled() { + return this.enabled; + } + + /** + * Required - Whether user information is included in the ES|QL query log. + *

+ * API name: {@code user} + */ + public final boolean user() { + return this.user; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

+ * API name: {@code thresholds} + */ + public final Map thresholds() { + return this.thresholds; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("enabled"); + generator.write(this.enabled); + + generator.writeKey("user"); + generator.write(this.user); + + if (ApiTypeHelper.isDefined(this.thresholds)) { + generator.writeKey("thresholds"); + generator.writeStartObject(); + for (Map.Entry item0 : this.thresholds.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EsqlLoggingConfig}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Boolean enabled; + + private Boolean user; + + @Nullable + private Map thresholds; + + public Builder() { + } + private Builder(EsqlLoggingConfig instance) { + this.enabled = instance.enabled; + this.user = instance.user; + this.thresholds = instance.thresholds; + + } + /** + * Required - Whether ES|QL query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final Builder enabled(boolean value) { + this.enabled = value; + return this; + } + + /** + * Required - Whether user information is included in the ES|QL query log. + *

+ * API name: {@code user} + */ + public final Builder user(boolean value) { + this.user = value; + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds all entries of map to thresholds. + */ + public final Builder thresholds(Map map) { + this.thresholds = _mapPutAll(this.thresholds, map); + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds an entry to thresholds. + */ + public final Builder thresholds(String key, Time value) { + this.thresholds = _mapPut(this.thresholds, key, value); + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds an entry to thresholds using a builder lambda. + */ + public final Builder thresholds(String key, Function> fn) { + return thresholds(key, fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EsqlLoggingConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EsqlLoggingConfig build() { + _checkSingleUse(); + + return new EsqlLoggingConfig(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EsqlLoggingConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EsqlLoggingConfig::setupEsqlLoggingConfigDeserializer); + + protected static void setupEsqlLoggingConfigDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + op.add(Builder::user, JsonpDeserializer.booleanDeserializer(), "user"); + op.add(Builder::thresholds, JsonpDeserializer.stringMapDeserializer(Time._DESERIALIZER), "thresholds"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java new file mode 100644 index 0000000000..051b39c4f1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java @@ -0,0 +1,217 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.xpack.usage; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: xpack.usage.Logging + +/** + * Usage statistics about logging configuration reported by + * _xpack/usage. + * + * @see API + * specification + */ +@JsonpDeserializable +public class Logging implements JsonpSerializable { + private final QueryLoggingConfig querylog; + + private final EsqlLoggingConfig esql; + + // --------------------------------------------------------------------------------------------- + + private Logging(Builder builder) { + + this.querylog = ApiTypeHelper.requireNonNull(builder.querylog, this, "querylog"); + this.esql = ApiTypeHelper.requireNonNull(builder.esql, this, "esql"); + + } + + public static Logging of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final QueryLoggingConfig querylog() { + return this.querylog; + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final EsqlLoggingConfig esql() { + return this.esql; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("querylog"); + this.querylog.serialize(generator, mapper); + + generator.writeKey("esql"); + this.esql.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Logging}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private QueryLoggingConfig querylog; + + private EsqlLoggingConfig esql; + + public Builder() { + } + private Builder(Logging instance) { + this.querylog = instance.querylog; + this.esql = instance.esql; + + } + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final Builder querylog(QueryLoggingConfig value) { + this.querylog = value; + return this; + } + + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final Builder querylog(Function> fn) { + return this.querylog(fn.apply(new QueryLoggingConfig.Builder()).build()); + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final Builder esql(EsqlLoggingConfig value) { + this.esql = value; + return this; + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final Builder esql(Function> fn) { + return this.esql(fn.apply(new EsqlLoggingConfig.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Logging}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Logging build() { + _checkSingleUse(); + + return new Logging(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Logging} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Logging::setupLoggingDeserializer); + + protected static void setupLoggingDeserializer(ObjectDeserializer op) { + + op.add(Builder::querylog, QueryLoggingConfig._DESERIALIZER, "querylog"); + op.add(Builder::esql, EsqlLoggingConfig._DESERIALIZER, "esql"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java new file mode 100644 index 0000000000..b4e2541c5c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java @@ -0,0 +1,275 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.xpack.usage; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: xpack.usage.QueryLoggingConfig + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryLoggingConfig implements JsonpSerializable { + private final boolean enabled; + + private final boolean user; + + private final boolean system; + + @Nullable + private final Time threshold; + + // --------------------------------------------------------------------------------------------- + + private QueryLoggingConfig(Builder builder) { + + this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled", false); + this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user", false); + this.system = ApiTypeHelper.requireNonNull(builder.system, this, "system", false); + this.threshold = builder.threshold; + + } + + public static QueryLoggingConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final boolean enabled() { + return this.enabled; + } + + /** + * Required - Whether user information is included in the query log. + *

+ * API name: {@code user} + */ + public final boolean user() { + return this.user; + } + + /** + * Required - Whether system queries are included in the query log. + *

+ * API name: {@code system} + */ + public final boolean system() { + return this.system; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + @Nullable + public final Time threshold() { + return this.threshold; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("enabled"); + generator.write(this.enabled); + + generator.writeKey("user"); + generator.write(this.user); + + generator.writeKey("system"); + generator.write(this.system); + + if (this.threshold != null) { + generator.writeKey("threshold"); + this.threshold.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryLoggingConfig}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Boolean enabled; + + private Boolean user; + + private Boolean system; + + @Nullable + private Time threshold; + + public Builder() { + } + private Builder(QueryLoggingConfig instance) { + this.enabled = instance.enabled; + this.user = instance.user; + this.system = instance.system; + this.threshold = instance.threshold; + + } + /** + * Required - Whether query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final Builder enabled(boolean value) { + this.enabled = value; + return this; + } + + /** + * Required - Whether user information is included in the query log. + *

+ * API name: {@code user} + */ + public final Builder user(boolean value) { + this.user = value; + return this; + } + + /** + * Required - Whether system queries are included in the query log. + *

+ * API name: {@code system} + */ + public final Builder system(boolean value) { + this.system = value; + return this; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + public final Builder threshold(@Nullable Time value) { + this.threshold = value; + return this; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + public final Builder threshold(Function> fn) { + return this.threshold(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryLoggingConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryLoggingConfig build() { + _checkSingleUse(); + + return new QueryLoggingConfig(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryLoggingConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, QueryLoggingConfig::setupQueryLoggingConfigDeserializer); + + protected static void setupQueryLoggingConfigDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + op.add(Builder::user, JsonpDeserializer.booleanDeserializer(), "user"); + op.add(Builder::system, JsonpDeserializer.booleanDeserializer(), "system"); + op.add(Builder::threshold, Time._DESERIALIZER, "threshold"); + + } + +}