diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java index d9cd9b786..88626e8cf 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java @@ -80,6 +80,9 @@ public class GeoDistanceSort implements SortOptionsVariant, JsonpSerializable { @Nullable private final DistanceUnit unit; + @Nullable + private final NestedSortValue nested; + // --------------------------------------------------------------------------------------------- private GeoDistanceSort(Builder builder) { @@ -92,6 +95,7 @@ private GeoDistanceSort(Builder builder) { this.ignoreUnmapped = builder.ignoreUnmapped; this.order = builder.order; this.unit = builder.unit; + this.nested = builder.nested; } @@ -161,6 +165,14 @@ public final DistanceUnit unit() { return this.unit; } + /** + * API name: {@code nested} + */ + @Nullable + public final NestedSortValue nested() { + return this.nested; + } + /** * Serialize this object to JSON. */ @@ -200,6 +212,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("unit"); this.unit.serialize(generator, mapper); } + if (this.nested != null) { + generator.writeKey("nested"); + this.nested.serialize(generator, mapper); + + } } @@ -265,6 +282,9 @@ public final Builder location(Function> fn) { + return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -338,6 +373,7 @@ protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer { builder.field(name); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SnowballTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SnowballTokenFilter.java index 458e38b74..312629a57 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SnowballTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/SnowballTokenFilter.java @@ -24,7 +24,6 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.util.Objects; @@ -56,6 +55,7 @@ */ @JsonpDeserializable public class SnowballTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { + @Nullable private final SnowballLanguage language; // --------------------------------------------------------------------------------------------- @@ -63,7 +63,7 @@ public class SnowballTokenFilter extends TokenFilterBase implements TokenFilterD private SnowballTokenFilter(Builder builder) { super(builder); - this.language = ApiTypeHelper.requireNonNull(builder.language, this, "language"); + this.language = builder.language; } @@ -80,8 +80,9 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code language} + * API name: {@code language} */ + @Nullable public final SnowballLanguage language() { return this.language; } @@ -90,8 +91,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "snowball"); super.serializeInternal(generator, mapper); - generator.writeKey("language"); - this.language.serialize(generator, mapper); + if (this.language != null) { + generator.writeKey("language"); + this.language.serialize(generator, mapper); + } } @@ -104,12 +107,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private SnowballLanguage language; /** - * Required - API name: {@code language} + * API name: {@code language} */ - public final Builder language(SnowballLanguage value) { + public final Builder language(@Nullable SnowballLanguage value) { this.language = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/BoolQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/BoolQuery.java index e7af0105c..4cb2d4d36 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/BoolQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/BoolQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -58,7 +62,12 @@ * specification */ @JsonpDeserializable -public class BoolQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class BoolQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { private final List filter; @Nullable @@ -103,6 +112,22 @@ public Query.Kind _queryKind() { return Query.Kind.Bool; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Bool; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Bool; + } + /** * The clause (query) must appear in matching documents. However, unlike * must, the score of the query will be ignored. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDecayFunction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDecayFunction.java new file mode 100644 index 000000000..08659b176 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDecayFunction.java @@ -0,0 +1,120 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.DateDecayFunction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DateDecayFunction extends DecayFunctionBase implements DecayFunctionVariant { + // --------------------------------------------------------------------------------------------- + + private DateDecayFunction(Builder builder) { + super(builder); + + } + + public static DateDecayFunction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DecayFunction variant kind. + */ + @Override + public DecayFunction.Kind _decayFunctionKind() { + return DecayFunction.Kind.Date; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DateDecayFunction}. + */ + + public static class Builder extends DecayFunctionBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DateDecayFunction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DateDecayFunction build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tScaleSerializer(null); + + return new DateDecayFunction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DateDecayFunction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DateDecayFunction::setupDateDecayFunctionDeserializer); + + protected static void setupDateDecayFunctionDeserializer(ObjectDeserializer op) { + DecayFunctionBase.setupDecayFunctionBaseDeserializer(op, JsonpDeserializer.stringDeserializer(), + Time._DESERIALIZER); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDistanceFeatureQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDistanceFeatureQuery.java new file mode 100644 index 000000000..a63e06707 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateDistanceFeatureQuery.java @@ -0,0 +1,123 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.DateDistanceFeatureQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DateDistanceFeatureQuery extends DistanceFeatureQueryBase + implements + DistanceFeatureQueryVariant { + // --------------------------------------------------------------------------------------------- + + private DateDistanceFeatureQuery(Builder builder) { + super(builder); + + } + + public static DateDistanceFeatureQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DistanceFeatureQuery variant kind. + */ + @Override + public DistanceFeatureQuery.Kind _distanceFeatureQueryKind() { + return DistanceFeatureQuery.Kind.Date; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DateDistanceFeatureQuery}. + */ + + public static class Builder extends DistanceFeatureQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DateDistanceFeatureQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DateDistanceFeatureQuery build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tDistanceSerializer(null); + + return new DateDistanceFeatureQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DateDistanceFeatureQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DateDistanceFeatureQuery::setupDateDistanceFeatureQueryDeserializer); + + protected static void setupDateDistanceFeatureQueryDeserializer( + ObjectDeserializer op) { + DistanceFeatureQueryBase.setupDistanceFeatureQueryBaseDeserializer(op, JsonpDeserializer.stringDeserializer(), + Time._DESERIALIZER); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateRangeQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateRangeQuery.java new file mode 100644 index 000000000..2b44695d2 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DateRangeQuery.java @@ -0,0 +1,194 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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: _types.query_dsl.DateRangeQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DateRangeQuery extends RangeQueryBase implements RangeQueryVariant { + @Nullable + private final String format; + + @Nullable + private final String timeZone; + + // --------------------------------------------------------------------------------------------- + + private DateRangeQuery(Builder builder) { + super(builder); + + this.format = builder.format; + this.timeZone = builder.timeZone; + + } + + public static DateRangeQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * RangeQuery variant kind. + */ + @Override + public RangeQuery.Kind _rangeQueryKind() { + return RangeQuery.Kind.Date; + } + + /** + * Date format used to convert date values in the query. + *

+ * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * Coordinated Universal Time (UTC) offset or IANA time zone used to convert + * date values in the query to UTC. + *

+ * API name: {@code time_zone} + */ + @Nullable + public final String timeZone() { + return this.timeZone; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + if (this.timeZone != null) { + generator.writeKey("time_zone"); + generator.write(this.timeZone); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DateRangeQuery}. + */ + + public static class Builder extends RangeQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String format; + + @Nullable + private String timeZone; + + /** + * Date format used to convert date values in the query. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Coordinated Universal Time (UTC) offset or IANA time zone used to convert + * date values in the query to UTC. + *

+ * API name: {@code time_zone} + */ + public final Builder timeZone(@Nullable String value) { + this.timeZone = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DateRangeQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DateRangeQuery build() { + _checkSingleUse(); + super.tSerializer(null); + + return new DateRangeQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DateRangeQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DateRangeQuery::setupDateRangeQueryDeserializer); + + protected static void setupDateRangeQueryDeserializer(ObjectDeserializer op) { + RangeQueryBase.setupRangeQueryBaseDeserializer(op, JsonpDeserializer.stringDeserializer()); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunction.java index 8faad5f39..0c015e97e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunction.java @@ -19,15 +19,20 @@ package co.elastic.clients.elasticsearch._types.query_dsl; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import jakarta.json.stream.JsonGenerator; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -56,22 +61,41 @@ * specification */ @JsonpDeserializable -public class DecayFunction extends DecayFunctionBase implements FunctionScoreVariant { - private final String field; +public class DecayFunction + implements + TaggedUnion, + FunctionScoreVariant, + JsonpSerializable { - private final DecayPlacement placement; + /** + * {@link DecayFunction} variant kinds. + * + * @see API + * specification + */ - // --------------------------------------------------------------------------------------------- + public enum Kind implements JsonEnum { + Date("date"), - private DecayFunction(Builder builder) { - super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.placement = ApiTypeHelper.requireNonNull(builder.placement, this, "placement"); + Geo("geo"), - } + Numeric("numeric"), + + Untyped("untyped"), + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } - public static DecayFunction of(Function> fn) { - return fn.apply(new Builder()).build(); } /** @@ -82,98 +106,182 @@ public FunctionScore.Kind _functionScoreKind() { return FunctionScore.Kind.Linear; } + private final Kind _kind; + private final DecayFunctionVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final DecayFunctionVariant _get() { + return _value; + } + + public DecayFunction(DecayFunctionVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._decayFunctionKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private DecayFunction(Kind kind, DecayFunctionVariant value) { + this._kind = kind; + this._value = value; + } + + private DecayFunction(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static DecayFunction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + /** - * Required - + * Is this variant instance of kind {@code date}? */ - public final String field() { - return this.field; + public boolean isDate() { + return _kind == Kind.Date; } /** - * Required - + * Get the {@code date} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code date} kind. */ - public final DecayPlacement placement() { - return this.placement; + public DateDecayFunction date() { + return TaggedUnionUtils.get(this, Kind.Date); } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey(this.field); - this.placement.serialize(generator, mapper); + /** + * Is this variant instance of kind {@code geo}? + */ + public boolean isGeo() { + return _kind == Kind.Geo; + } - super.serializeInternal(generator, mapper); + /** + * Get the {@code geo} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geo} kind. + */ + public GeoDecayFunction geo() { + return TaggedUnionUtils.get(this, Kind.Geo); + } + /** + * Is this variant instance of kind {@code numeric}? + */ + public boolean isNumeric() { + return _kind == Kind.Numeric; } - // --------------------------------------------------------------------------------------------- + /** + * Get the {@code numeric} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code numeric} kind. + */ + public NumericDecayFunction numeric() { + return TaggedUnionUtils.get(this, Kind.Numeric); + } /** - * Builder for {@link DecayFunction}. + * Is this variant instance of kind {@code untyped}? */ + public boolean isUntyped() { + return _kind == Kind.Untyped; + } - public static class Builder extends DecayFunctionBase.AbstractBuilder - implements - ObjectBuilder { - private String field; + /** + * Get the {@code untyped} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code untyped} kind. + */ + public UntypedDecayFunction untyped() { + return TaggedUnionUtils.get(this, Kind.Untyped); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + mapper.serialize(_value, generator); - private DecayPlacement placement; + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } - /** - * Required - - */ - public final Builder field(String value) { - this.field = value; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private DecayFunctionVariant _value; + + public ObjectBuilder date(DateDecayFunction v) { + this._kind = Kind.Date; + this._value = v; return this; } - /** - * Required - - */ - public final Builder placement(DecayPlacement value) { - this.placement = value; + public ObjectBuilder date( + Function> fn) { + return this.date(fn.apply(new DateDecayFunction.Builder()).build()); + } + + public ObjectBuilder geo(GeoDecayFunction v) { + this._kind = Kind.Geo; + this._value = v; return this; } - /** - * Required - - */ - public final Builder placement(Function> fn) { - return this.placement(fn.apply(new DecayPlacement.Builder()).build()); + public ObjectBuilder geo( + Function> fn) { + return this.geo(fn.apply(new GeoDecayFunction.Builder()).build()); } - @Override - protected Builder self() { + public ObjectBuilder numeric(NumericDecayFunction v) { + this._kind = Kind.Numeric; + this._value = v; return this; } - /** - * Builds a {@link DecayFunction}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DecayFunction build() { - _checkSingleUse(); - - return new DecayFunction(this); + public ObjectBuilder numeric( + Function> fn) { + return this.numeric(fn.apply(new NumericDecayFunction.Builder()).build()); } - } - // --------------------------------------------------------------------------------------------- + public ObjectBuilder untyped(UntypedDecayFunction v) { + this._kind = Kind.Untyped; + this._value = v; + return this; + } - /** - * Json deserializer for {@link DecayFunction} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DecayFunction::setupDecayFunctionDeserializer); + public ObjectBuilder untyped( + Function> fn) { + return this.untyped(fn.apply(new UntypedDecayFunction.Builder()).build()); + } - protected static void setupDecayFunctionDeserializer(ObjectDeserializer op) { - DecayFunctionBase.setupDecayFunctionBaseDeserializer(op); + public DecayFunction build() { + _checkSingleUse(); + return new DecayFunction(this); + } - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.field(name); - builder.placement(DecayPlacement._DESERIALIZER.deserialize(parser, mapper)); - }); + } + private static JsonpDeserializer buildDecayFunctionDeserializer() { + return new UnionDeserializer.Builder(DecayFunction::new, false) + .addMember(Kind.Untyped, UntypedDecayFunction._DESERIALIZER).build(); } + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(DecayFunction::buildDecayFunctionDeserializer); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBase.java index 9f402613c..c157d26f2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBase.java @@ -23,13 +23,17 @@ import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpSerializer; 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.String; import java.util.Objects; +import java.util.function.Function; import javax.annotation.Nullable; //---------------------------------------------------------------- @@ -56,16 +60,45 @@ * specification */ -public abstract class DecayFunctionBase implements JsonpSerializable { +public abstract class DecayFunctionBase implements JsonpSerializable { + private final String field; + + private final DecayPlacement placement; + @Nullable private final MultiValueMode multiValueMode; + @Nullable + private final JsonpSerializer tOriginSerializer; + + @Nullable + private final JsonpSerializer tScaleSerializer; + // --------------------------------------------------------------------------------------------- - protected DecayFunctionBase(AbstractBuilder builder) { + protected DecayFunctionBase(AbstractBuilder builder) { + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.placement = ApiTypeHelper.requireNonNull(builder.placement, this, "placement"); this.multiValueMode = builder.multiValueMode; + this.tOriginSerializer = builder.tOriginSerializer; + this.tScaleSerializer = builder.tScaleSerializer; + + } + /** + * Required - + */ + public final String field() { + return this.field; + } + + /** + * Required - + */ + public final DecayPlacement placement() { + return this.placement; } /** @@ -89,6 +122,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey(this.field); + this.placement.serialize(generator, mapper); if (this.multiValueMode != null) { generator.writeKey("multi_value_mode"); @@ -102,12 +137,46 @@ public String toString() { return JsonpUtils.toString(this); } - public abstract static class AbstractBuilder> + public abstract static class AbstractBuilder> extends WithJsonObjectBuilderBase { + private String field; + + private DecayPlacement placement; + + /** + * Required - + */ + public final BuilderT field(String value) { + this.field = value; + return self(); + } + + /** + * Required - + */ + public final BuilderT placement(DecayPlacement value) { + this.placement = value; + return self(); + } + + /** + * Required - + */ + public final BuilderT placement( + Function, ObjectBuilder>> fn) { + return this.placement(fn.apply(new DecayPlacement.Builder()).build()); + } + @Nullable private MultiValueMode multiValueMode; + @Nullable + private JsonpSerializer tOriginSerializer; + + @Nullable + private JsonpSerializer tScaleSerializer; + /** * Determines how the distance is calculated when a field used for computing the * decay contains multiple values. @@ -119,16 +188,41 @@ public final BuilderT multiValueMode(@Nullable MultiValueMode value) { return self(); } + /** + * Serializer for TOrigin. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final BuilderT tOriginSerializer(@Nullable JsonpSerializer value) { + this.tOriginSerializer = value; + return self(); + } + + /** + * Serializer for TScale. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final BuilderT tScaleSerializer(@Nullable JsonpSerializer value) { + this.tScaleSerializer = value; + return self(); + } + protected abstract BuilderT self(); } // --------------------------------------------------------------------------------------------- - protected static > void setupDecayFunctionBaseDeserializer( - ObjectDeserializer op) { + protected static > void setupDecayFunctionBaseDeserializer( + ObjectDeserializer op, JsonpDeserializer tOriginDeserializer, + JsonpDeserializer tScaleDeserializer) { op.add(AbstractBuilder::multiValueMode, MultiValueMode._DESERIALIZER, "multi_value_mode"); + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + builder.field(name); + builder.placement(DecayPlacement.createDecayPlacementDeserializer(tOriginDeserializer, tScaleDeserializer) + .deserialize(parser, mapper)); + }); + } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBuilders.java new file mode 100644 index 000000000..4969a51fd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionBuilders.java @@ -0,0 +1,121 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link DecayFunction} variants. + */ +public class DecayFunctionBuilders { + private DecayFunctionBuilders() { + } + + /** + * Creates a builder for the {@link DateDecayFunction date} + * {@code DecayFunction} variant. + */ + public static DateDecayFunction.Builder date() { + return new DateDecayFunction.Builder(); + } + + /** + * Creates a DecayFunction of the {@link DateDecayFunction date} + * {@code DecayFunction} variant. + */ + public static DecayFunction date(Function> fn) { + DecayFunction.Builder builder = new DecayFunction.Builder(); + builder.date(fn.apply(new DateDecayFunction.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link GeoDecayFunction geo} {@code DecayFunction} + * variant. + */ + public static GeoDecayFunction.Builder geo() { + return new GeoDecayFunction.Builder(); + } + + /** + * Creates a DecayFunction of the {@link GeoDecayFunction geo} + * {@code DecayFunction} variant. + */ + public static DecayFunction geo(Function> fn) { + DecayFunction.Builder builder = new DecayFunction.Builder(); + builder.geo(fn.apply(new GeoDecayFunction.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link NumericDecayFunction numeric} + * {@code DecayFunction} variant. + */ + public static NumericDecayFunction.Builder numeric() { + return new NumericDecayFunction.Builder(); + } + + /** + * Creates a DecayFunction of the {@link NumericDecayFunction numeric} + * {@code DecayFunction} variant. + */ + public static DecayFunction numeric( + Function> fn) { + DecayFunction.Builder builder = new DecayFunction.Builder(); + builder.numeric(fn.apply(new NumericDecayFunction.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link UntypedDecayFunction untyped} + * {@code DecayFunction} variant. + */ + public static UntypedDecayFunction.Builder untyped() { + return new UntypedDecayFunction.Builder(); + } + + /** + * Creates a DecayFunction of the {@link UntypedDecayFunction untyped} + * {@code DecayFunction} variant. + */ + public static DecayFunction untyped( + Function> fn) { + DecayFunction.Builder builder = new DecayFunction.Builder(); + builder.untyped(fn.apply(new UntypedDecayFunction.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionVariant.java new file mode 100644 index 000000000..afad5ad21 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayFunctionVariant.java @@ -0,0 +1,48 @@ +/* + * 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._types.query_dsl; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link DecayFunction} variants. + */ +public interface DecayFunctionVariant { + + DecayFunction.Kind _decayFunctionKind(); + + default DecayFunction _toDecayFunction() { + return new DecayFunction(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayPlacement.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayPlacement.java index 8c94014da..25a6cba80 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayPlacement.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DecayPlacement.java @@ -19,12 +19,13 @@ package co.elastic.clients.elasticsearch._types.query_dsl; -import co.elastic.clients.json.JsonData; 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.JsonpSerializer; import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.NamedDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -33,6 +34,7 @@ import java.lang.Double; import java.util.Objects; import java.util.function.Function; +import java.util.function.Supplier; import javax.annotation.Nullable; //---------------------------------------------------------------- @@ -59,32 +61,41 @@ * specification */ @JsonpDeserializable -public class DecayPlacement implements JsonpSerializable { +public class DecayPlacement implements JsonpSerializable { @Nullable private final Double decay; @Nullable - private final JsonData offset; + private final TScale offset; @Nullable - private final JsonData scale; + private final TScale scale; @Nullable - private final JsonData origin; + private final TOrigin origin; + + @Nullable + private final JsonpSerializer tOriginSerializer; + + @Nullable + private final JsonpSerializer tScaleSerializer; // --------------------------------------------------------------------------------------------- - private DecayPlacement(Builder builder) { + private DecayPlacement(Builder builder) { this.decay = builder.decay; this.offset = builder.offset; this.scale = builder.scale; this.origin = builder.origin; + this.tOriginSerializer = builder.tOriginSerializer; + this.tScaleSerializer = builder.tScaleSerializer; } - public static DecayPlacement of(Function> fn) { - return fn.apply(new Builder()).build(); + public static DecayPlacement of( + Function, ObjectBuilder>> fn) { + return fn.apply(new Builder<>()).build(); } /** @@ -104,7 +115,7 @@ public final Double decay() { * API name: {@code offset} */ @Nullable - public final JsonData offset() { + public final TScale offset() { return this.offset; } @@ -115,7 +126,7 @@ public final JsonData offset() { * API name: {@code scale} */ @Nullable - public final JsonData scale() { + public final TScale scale() { return this.scale; } @@ -126,7 +137,7 @@ public final JsonData scale() { * API name: {@code origin} */ @Nullable - public final JsonData origin() { + public final TOrigin origin() { return this.origin; } @@ -148,17 +159,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.offset != null) { generator.writeKey("offset"); - this.offset.serialize(generator, mapper); + JsonpUtils.serialize(this.offset, generator, tScaleSerializer, mapper); } if (this.scale != null) { generator.writeKey("scale"); - this.scale.serialize(generator, mapper); + JsonpUtils.serialize(this.scale, generator, tScaleSerializer, mapper); } if (this.origin != null) { generator.writeKey("origin"); - this.origin.serialize(generator, mapper); + JsonpUtils.serialize(this.origin, generator, tOriginSerializer, mapper); } @@ -175,25 +186,33 @@ public String toString() { * Builder for {@link DecayPlacement}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + public static class Builder extends WithJsonObjectBuilderBase> + implements + ObjectBuilder> { @Nullable private Double decay; @Nullable - private JsonData offset; + private TScale offset; + + @Nullable + private TScale scale; @Nullable - private JsonData scale; + private TOrigin origin; @Nullable - private JsonData origin; + private JsonpSerializer tOriginSerializer; + + @Nullable + private JsonpSerializer tScaleSerializer; /** * Defines how documents are scored at the distance given at scale. *

* API name: {@code decay} */ - public final Builder decay(@Nullable Double value) { + public final Builder decay(@Nullable Double value) { this.decay = value; return this; } @@ -204,7 +223,7 @@ public final Builder decay(@Nullable Double value) { *

* API name: {@code offset} */ - public final Builder offset(@Nullable JsonData value) { + public final Builder offset(@Nullable TScale value) { this.offset = value; return this; } @@ -215,7 +234,7 @@ public final Builder offset(@Nullable JsonData value) { *

* API name: {@code scale} */ - public final Builder scale(@Nullable JsonData value) { + public final Builder scale(@Nullable TScale value) { this.scale = value; return this; } @@ -226,13 +245,31 @@ public final Builder scale(@Nullable JsonData value) { *

* API name: {@code origin} */ - public final Builder origin(@Nullable JsonData value) { + public final Builder origin(@Nullable TOrigin value) { this.origin = value; return this; } + /** + * Serializer for TOrigin. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final Builder tOriginSerializer(@Nullable JsonpSerializer value) { + this.tOriginSerializer = value; + return this; + } + + /** + * Serializer for TScale. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final Builder tScaleSerializer(@Nullable JsonpSerializer value) { + this.tScaleSerializer = value; + return this; + } + @Override - protected Builder self() { + protected Builder self() { return this; } @@ -242,27 +279,41 @@ protected Builder self() { * @throws NullPointerException * if some of the required fields are null. */ - public DecayPlacement build() { + public DecayPlacement build() { _checkSingleUse(); - return new DecayPlacement(this); + return new DecayPlacement(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link DecayPlacement} + * Create a JSON deserializer for DecayPlacement + */ + public static JsonpDeserializer> createDecayPlacementDeserializer( + JsonpDeserializer tOriginDeserializer, JsonpDeserializer tScaleDeserializer) { + return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, + op -> DecayPlacement.setupDecayPlacementDeserializer(op, tOriginDeserializer, tScaleDeserializer)); + }; + + /** + * Json deserializer for {@link DecayPlacement} based on named deserializers + * provided by the calling {@code JsonMapper}. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DecayPlacement::setupDecayPlacementDeserializer); + public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer + .lazy(() -> createDecayPlacementDeserializer( + new NamedDeserializer<>("co.elastic.clients:Deserializer:_types.query_dsl.DecayPlacement.TOrigin"), + new NamedDeserializer<>("co.elastic.clients:Deserializer:_types.query_dsl.DecayPlacement.TScale"))); - protected static void setupDecayPlacementDeserializer(ObjectDeserializer op) { + protected static void setupDecayPlacementDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tOriginDeserializer, JsonpDeserializer tScaleDeserializer) { op.add(Builder::decay, JsonpDeserializer.doubleDeserializer(), "decay"); - op.add(Builder::offset, JsonData._DESERIALIZER, "offset"); - op.add(Builder::scale, JsonData._DESERIALIZER, "scale"); - op.add(Builder::origin, JsonData._DESERIALIZER, "origin"); + op.add(Builder::offset, tScaleDeserializer, "offset"); + op.add(Builder::scale, tScaleDeserializer, "scale"); + op.add(Builder::origin, tOriginDeserializer, "origin"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQuery.java index fcaf06ecb..e0bd1824c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQuery.java @@ -19,16 +19,20 @@ package co.elastic.clients.elasticsearch._types.query_dsl; -import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import jakarta.json.stream.JsonGenerator; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -57,26 +61,39 @@ * specification */ @JsonpDeserializable -public class DistanceFeatureQuery extends QueryBase implements QueryVariant { - private final JsonData origin; +public class DistanceFeatureQuery + implements + TaggedUnion, + QueryVariant, + JsonpSerializable { - private final JsonData pivot; + /** + * {@link DistanceFeatureQuery} variant kinds. + * + * @see API + * specification + */ - private final String field; + public enum Kind implements JsonEnum { + Date("date"), - // --------------------------------------------------------------------------------------------- + Geo("geo"), - private DistanceFeatureQuery(Builder builder) { - super(builder); + Untyped("untyped"), - this.origin = ApiTypeHelper.requireNonNull(builder.origin, this, "origin"); - this.pivot = ApiTypeHelper.requireNonNull(builder.pivot, this, "pivot"); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + ; - } + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } - public static DistanceFeatureQuery of(Function> fn) { - return fn.apply(new Builder()).build(); } /** @@ -87,156 +104,155 @@ public Query.Kind _queryKind() { return Query.Kind.DistanceFeature; } + private final Kind _kind; + private final DistanceFeatureQueryVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final DistanceFeatureQueryVariant _get() { + return _value; + } + + public DistanceFeatureQuery(DistanceFeatureQueryVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._distanceFeatureQueryKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private DistanceFeatureQuery(Kind kind, DistanceFeatureQueryVariant value) { + this._kind = kind; + this._value = value; + } + + private DistanceFeatureQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static DistanceFeatureQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + /** - * Required - Date or point of origin used to calculate distances. If the - * field value is a date or date_nanos - * field, the origin value must be a date. Date Math, such as - * now-1h, is supported. If the field value is a - * geo_point field, the origin value must be a - * geopoint. - *

- * API name: {@code origin} + * Is this variant instance of kind {@code date}? */ - public final JsonData origin() { - return this.origin; + public boolean isDate() { + return _kind == Kind.Date; } /** - * Required - Distance from the origin at which relevance scores - * receive half of the boost value. If the field value - * is a date or date_nanos field, the - * pivot value must be a time unit, such as 1h or - * 10d. If the field value is a geo_point - * field, the pivot value must be a distance unit, such as - * 1km or 12m. - *

- * API name: {@code pivot} + * Get the {@code date} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code date} kind. */ - public final JsonData pivot() { - return this.pivot; + public DateDistanceFeatureQuery date() { + return TaggedUnionUtils.get(this, Kind.Date); } /** - * Required - Name of the field used to calculate distances. This field must - * meet the following criteria: be a date, date_nanos - * or geo_point field; have an index mapping parameter - * value of true, which is the default; have an - * doc_values mapping parameter value of true, which - * is the default. - *

- * API name: {@code field} + * Is this variant instance of kind {@code geo}? */ - public final String field() { - return this.field; + public boolean isGeo() { + return _kind == Kind.Geo; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Get the {@code geo} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geo} kind. + */ + public GeoDistanceFeatureQuery geo() { + return TaggedUnionUtils.get(this, Kind.Geo); + } - super.serializeInternal(generator, mapper); - generator.writeKey("origin"); - this.origin.serialize(generator, mapper); + /** + * Is this variant instance of kind {@code untyped}? + */ + public boolean isUntyped() { + return _kind == Kind.Untyped; + } - generator.writeKey("pivot"); - this.pivot.serialize(generator, mapper); + /** + * Get the {@code untyped} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code untyped} kind. + */ + public UntypedDistanceFeatureQuery untyped() { + return TaggedUnionUtils.get(this, Kind.Untyped); + } - generator.writeKey("field"); - generator.write(this.field); + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + mapper.serialize(_value, generator); } - // --------------------------------------------------------------------------------------------- + @Override + public String toString() { + return JsonpUtils.toString(this); + } - /** - * Builder for {@link DistanceFeatureQuery}. - */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private DistanceFeatureQueryVariant _value; - public static class Builder extends QueryBase.AbstractBuilder - implements - ObjectBuilder { - private JsonData origin; - - private JsonData pivot; - - private String field; - - /** - * Required - Date or point of origin used to calculate distances. If the - * field value is a date or date_nanos - * field, the origin value must be a date. Date Math, such as - * now-1h, is supported. If the field value is a - * geo_point field, the origin value must be a - * geopoint. - *

- * API name: {@code origin} - */ - public final Builder origin(JsonData value) { - this.origin = value; + public ObjectBuilder date(DateDistanceFeatureQuery v) { + this._kind = Kind.Date; + this._value = v; return this; } - /** - * Required - Distance from the origin at which relevance scores - * receive half of the boost value. If the field value - * is a date or date_nanos field, the - * pivot value must be a time unit, such as 1h or - * 10d. If the field value is a geo_point - * field, the pivot value must be a distance unit, such as - * 1km or 12m. - *

- * API name: {@code pivot} - */ - public final Builder pivot(JsonData value) { - this.pivot = value; - return this; + public ObjectBuilder date( + Function> fn) { + return this.date(fn.apply(new DateDistanceFeatureQuery.Builder()).build()); } - /** - * Required - Name of the field used to calculate distances. This field must - * meet the following criteria: be a date, date_nanos - * or geo_point field; have an index mapping parameter - * value of true, which is the default; have an - * doc_values mapping parameter value of true, which - * is the default. - *

- * API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; + public ObjectBuilder geo(GeoDistanceFeatureQuery v) { + this._kind = Kind.Geo; + this._value = v; return this; } - @Override - protected Builder self() { + public ObjectBuilder geo( + Function> fn) { + return this.geo(fn.apply(new GeoDistanceFeatureQuery.Builder()).build()); + } + + public ObjectBuilder untyped(UntypedDistanceFeatureQuery v) { + this._kind = Kind.Untyped; + this._value = v; return this; } - /** - * Builds a {@link DistanceFeatureQuery}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ + public ObjectBuilder untyped( + Function> fn) { + return this.untyped(fn.apply(new UntypedDistanceFeatureQuery.Builder()).build()); + } + public DistanceFeatureQuery build() { _checkSingleUse(); - return new DistanceFeatureQuery(this); } - } - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DistanceFeatureQuery} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DistanceFeatureQuery::setupDistanceFeatureQueryDeserializer); - - protected static void setupDistanceFeatureQueryDeserializer(ObjectDeserializer op) { - QueryBase.setupQueryBaseDeserializer(op); - op.add(Builder::origin, JsonData._DESERIALIZER, "origin"); - op.add(Builder::pivot, JsonData._DESERIALIZER, "pivot"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + } + private static JsonpDeserializer buildDistanceFeatureQueryDeserializer() { + return new UnionDeserializer.Builder( + DistanceFeatureQuery::new, false).addMember(Kind.Untyped, UntypedDistanceFeatureQuery._DESERIALIZER) + .build(); } + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(DistanceFeatureQuery::buildDistanceFeatureQueryDeserializer); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBase.java new file mode 100644 index 000000000..9384f75dd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBase.java @@ -0,0 +1,236 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializer; +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.String; +import java.util.Objects; +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: _types.query_dsl.DistanceFeatureQueryBase + +/** + * + * @see API + * specification + */ + +public abstract class DistanceFeatureQueryBase extends QueryBase { + private final TOrigin origin; + + private final TDistance pivot; + + private final String field; + + @Nullable + private final JsonpSerializer tOriginSerializer; + + @Nullable + private final JsonpSerializer tDistanceSerializer; + + // --------------------------------------------------------------------------------------------- + + protected DistanceFeatureQueryBase(AbstractBuilder builder) { + super(builder); + + this.origin = ApiTypeHelper.requireNonNull(builder.origin, this, "origin"); + this.pivot = ApiTypeHelper.requireNonNull(builder.pivot, this, "pivot"); + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.tOriginSerializer = builder.tOriginSerializer; + this.tDistanceSerializer = builder.tDistanceSerializer; + + } + + /** + * Required - Date or point of origin used to calculate distances. If the + * field value is a date or date_nanos + * field, the origin value must be a date. Date Math, such as + * now-1h, is supported. If the field value is a + * geo_point field, the origin value must be a + * geopoint. + *

+ * API name: {@code origin} + */ + public final TOrigin origin() { + return this.origin; + } + + /** + * Required - Distance from the origin at which relevance scores + * receive half of the boost value. If the field value + * is a date or date_nanos field, the + * pivot value must be a time unit, such as 1h or + * 10d. If the field value is a geo_point + * field, the pivot value must be a distance unit, such as + * 1km or 12m. + *

+ * API name: {@code pivot} + */ + public final TDistance pivot() { + return this.pivot; + } + + /** + * Required - Name of the field used to calculate distances. This field must + * meet the following criteria: be a date, date_nanos + * or geo_point field; have an index mapping parameter + * value of true, which is the default; have an + * doc_values mapping parameter value of true, which + * is the default. + *

+ * API name: {@code field} + */ + public final String field() { + return this.field; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("origin"); + JsonpUtils.serialize(this.origin, generator, tOriginSerializer, mapper); + + generator.writeKey("pivot"); + JsonpUtils.serialize(this.pivot, generator, tDistanceSerializer, mapper); + + generator.writeKey("field"); + generator.write(this.field); + + } + + public abstract static class AbstractBuilder> + extends + QueryBase.AbstractBuilder { + private TOrigin origin; + + private TDistance pivot; + + private String field; + + @Nullable + private JsonpSerializer tOriginSerializer; + + @Nullable + private JsonpSerializer tDistanceSerializer; + + /** + * Required - Date or point of origin used to calculate distances. If the + * field value is a date or date_nanos + * field, the origin value must be a date. Date Math, such as + * now-1h, is supported. If the field value is a + * geo_point field, the origin value must be a + * geopoint. + *

+ * API name: {@code origin} + */ + public final BuilderT origin(TOrigin value) { + this.origin = value; + return self(); + } + + /** + * Required - Distance from the origin at which relevance scores + * receive half of the boost value. If the field value + * is a date or date_nanos field, the + * pivot value must be a time unit, such as 1h or + * 10d. If the field value is a geo_point + * field, the pivot value must be a distance unit, such as + * 1km or 12m. + *

+ * API name: {@code pivot} + */ + public final BuilderT pivot(TDistance value) { + this.pivot = value; + return self(); + } + + /** + * Required - Name of the field used to calculate distances. This field must + * meet the following criteria: be a date, date_nanos + * or geo_point field; have an index mapping parameter + * value of true, which is the default; have an + * doc_values mapping parameter value of true, which + * is the default. + *

+ * API name: {@code field} + */ + public final BuilderT field(String value) { + this.field = value; + return self(); + } + + /** + * Serializer for TOrigin. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final BuilderT tOriginSerializer(@Nullable JsonpSerializer value) { + this.tOriginSerializer = value; + return self(); + } + + /** + * Serializer for TDistance. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final BuilderT tDistanceSerializer(@Nullable JsonpSerializer value) { + this.tDistanceSerializer = value; + return self(); + } + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupDistanceFeatureQueryBaseDeserializer( + ObjectDeserializer op, JsonpDeserializer tOriginDeserializer, + JsonpDeserializer tDistanceDeserializer) { + QueryBase.setupQueryBaseDeserializer(op); + op.add(AbstractBuilder::origin, tOriginDeserializer, "origin"); + op.add(AbstractBuilder::pivot, tDistanceDeserializer, "pivot"); + op.add(AbstractBuilder::field, JsonpDeserializer.stringDeserializer(), "field"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBuilders.java new file mode 100644 index 000000000..8b93597a9 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryBuilders.java @@ -0,0 +1,104 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link DistanceFeatureQuery} variants. + */ +public class DistanceFeatureQueryBuilders { + private DistanceFeatureQueryBuilders() { + } + + /** + * Creates a builder for the {@link DateDistanceFeatureQuery date} + * {@code DistanceFeatureQuery} variant. + */ + public static DateDistanceFeatureQuery.Builder date() { + return new DateDistanceFeatureQuery.Builder(); + } + + /** + * Creates a DistanceFeatureQuery of the {@link DateDistanceFeatureQuery date} + * {@code DistanceFeatureQuery} variant. + */ + public static DistanceFeatureQuery date( + Function> fn) { + DistanceFeatureQuery.Builder builder = new DistanceFeatureQuery.Builder(); + builder.date(fn.apply(new DateDistanceFeatureQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link GeoDistanceFeatureQuery geo} + * {@code DistanceFeatureQuery} variant. + */ + public static GeoDistanceFeatureQuery.Builder geo() { + return new GeoDistanceFeatureQuery.Builder(); + } + + /** + * Creates a DistanceFeatureQuery of the {@link GeoDistanceFeatureQuery geo} + * {@code DistanceFeatureQuery} variant. + */ + public static DistanceFeatureQuery geo( + Function> fn) { + DistanceFeatureQuery.Builder builder = new DistanceFeatureQuery.Builder(); + builder.geo(fn.apply(new GeoDistanceFeatureQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link UntypedDistanceFeatureQuery untyped} + * {@code DistanceFeatureQuery} variant. + */ + public static UntypedDistanceFeatureQuery.Builder untyped() { + return new UntypedDistanceFeatureQuery.Builder(); + } + + /** + * Creates a DistanceFeatureQuery of the {@link UntypedDistanceFeatureQuery + * untyped} {@code DistanceFeatureQuery} variant. + */ + public static DistanceFeatureQuery untyped( + Function> fn) { + DistanceFeatureQuery.Builder builder = new DistanceFeatureQuery.Builder(); + builder.untyped(fn.apply(new UntypedDistanceFeatureQuery.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryVariant.java new file mode 100644 index 000000000..f3ebc648c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/DistanceFeatureQueryVariant.java @@ -0,0 +1,48 @@ +/* + * 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._types.query_dsl; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link DistanceFeatureQuery} variants. + */ +public interface DistanceFeatureQueryVariant { + + DistanceFeatureQuery.Kind _distanceFeatureQueryKind(); + + default DistanceFeatureQuery _toDistanceFeatureQuery() { + return new DistanceFeatureQuery(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/ExistsQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/ExistsQuery.java index b958d6fd0..748b7dbb1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/ExistsQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/ExistsQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -57,7 +61,12 @@ * specification */ @JsonpDeserializable -public class ExistsQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class ExistsQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { private final String field; // --------------------------------------------------------------------------------------------- @@ -89,6 +98,22 @@ public Query.Kind _queryKind() { return Query.Kind.Exists; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Exists; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Exists; + } + /** * Required - Name of the field you wish to search. *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDecayFunction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDecayFunction.java new file mode 100644 index 000000000..7e995aa96 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDecayFunction.java @@ -0,0 +1,120 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.elasticsearch._types.GeoLocation; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.GeoDecayFunction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GeoDecayFunction extends DecayFunctionBase implements DecayFunctionVariant { + // --------------------------------------------------------------------------------------------- + + private GeoDecayFunction(Builder builder) { + super(builder); + + } + + public static GeoDecayFunction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DecayFunction variant kind. + */ + @Override + public DecayFunction.Kind _decayFunctionKind() { + return DecayFunction.Kind.Geo; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoDecayFunction}. + */ + + public static class Builder extends DecayFunctionBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GeoDecayFunction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoDecayFunction build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tScaleSerializer(null); + + return new GeoDecayFunction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoDecayFunction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GeoDecayFunction::setupGeoDecayFunctionDeserializer); + + protected static void setupGeoDecayFunctionDeserializer(ObjectDeserializer op) { + DecayFunctionBase.setupDecayFunctionBaseDeserializer(op, GeoLocation._DESERIALIZER, + JsonpDeserializer.stringDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceFeatureQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceFeatureQuery.java new file mode 100644 index 000000000..1a2b511a7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/GeoDistanceFeatureQuery.java @@ -0,0 +1,123 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.elasticsearch._types.GeoLocation; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.GeoDistanceFeatureQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GeoDistanceFeatureQuery extends DistanceFeatureQueryBase + implements + DistanceFeatureQueryVariant { + // --------------------------------------------------------------------------------------------- + + private GeoDistanceFeatureQuery(Builder builder) { + super(builder); + + } + + public static GeoDistanceFeatureQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DistanceFeatureQuery variant kind. + */ + @Override + public DistanceFeatureQuery.Kind _distanceFeatureQueryKind() { + return DistanceFeatureQuery.Kind.Geo; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoDistanceFeatureQuery}. + */ + + public static class Builder extends DistanceFeatureQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GeoDistanceFeatureQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoDistanceFeatureQuery build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tDistanceSerializer(null); + + return new GeoDistanceFeatureQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoDistanceFeatureQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GeoDistanceFeatureQuery::setupGeoDistanceFeatureQueryDeserializer); + + protected static void setupGeoDistanceFeatureQueryDeserializer( + ObjectDeserializer op) { + DistanceFeatureQueryBase.setupDistanceFeatureQueryBaseDeserializer(op, GeoLocation._DESERIALIZER, + JsonpDeserializer.stringDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/IdsQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/IdsQuery.java index 75a04fee3..534cd65c9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/IdsQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/IdsQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -58,7 +62,12 @@ * specification */ @JsonpDeserializable -public class IdsQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class IdsQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { private final List values; // --------------------------------------------------------------------------------------------- @@ -90,6 +99,22 @@ public Query.Kind _queryKind() { return Query.Kind.Ids; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Ids; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Ids; + } + /** * An array of document IDs. *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchAllQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchAllQuery.java index f119c6418..846c575d1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchAllQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchAllQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -54,7 +58,12 @@ * specification */ @JsonpDeserializable -public class MatchAllQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class MatchAllQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { // --------------------------------------------------------------------------------------------- private MatchAllQuery(Builder builder) { @@ -82,6 +91,22 @@ public Query.Kind _queryKind() { return Query.Kind.MatchAll; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.MatchAll; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.MatchAll; + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchQuery.java index 5b8d885a4..30b5b407e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MatchQuery.java @@ -22,6 +22,10 @@ import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -61,7 +65,12 @@ * specification */ @JsonpDeserializable -public class MatchQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class MatchQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { // Single key dictionary private final String field; @@ -145,6 +154,22 @@ public Query.Kind _queryKind() { return Query.Kind.Match; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Match; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Match; + } + /** * Required - The target field */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumberRangeQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumberRangeQuery.java new file mode 100644 index 000000000..ab7dd6b30 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumberRangeQuery.java @@ -0,0 +1,117 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Double; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.NumberRangeQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class NumberRangeQuery extends RangeQueryBase implements RangeQueryVariant { + // --------------------------------------------------------------------------------------------- + + private NumberRangeQuery(Builder builder) { + super(builder); + + } + + public static NumberRangeQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * RangeQuery variant kind. + */ + @Override + public RangeQuery.Kind _rangeQueryKind() { + return RangeQuery.Kind.Number; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NumberRangeQuery}. + */ + + public static class Builder extends RangeQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link NumberRangeQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NumberRangeQuery build() { + _checkSingleUse(); + super.tSerializer(null); + + return new NumberRangeQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NumberRangeQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + NumberRangeQuery::setupNumberRangeQueryDeserializer); + + protected static void setupNumberRangeQueryDeserializer(ObjectDeserializer op) { + RangeQueryBase.setupRangeQueryBaseDeserializer(op, JsonpDeserializer.doubleDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumericDecayFunction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumericDecayFunction.java new file mode 100644 index 000000000..ba3e46829 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/NumericDecayFunction.java @@ -0,0 +1,119 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Double; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.NumericDecayFunction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class NumericDecayFunction extends DecayFunctionBase implements DecayFunctionVariant { + // --------------------------------------------------------------------------------------------- + + private NumericDecayFunction(Builder builder) { + super(builder); + + } + + public static NumericDecayFunction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DecayFunction variant kind. + */ + @Override + public DecayFunction.Kind _decayFunctionKind() { + return DecayFunction.Kind.Numeric; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NumericDecayFunction}. + */ + + public static class Builder extends DecayFunctionBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link NumericDecayFunction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NumericDecayFunction build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tScaleSerializer(null); + + return new NumericDecayFunction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NumericDecayFunction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, NumericDecayFunction::setupNumericDecayFunctionDeserializer); + + protected static void setupNumericDecayFunctionDeserializer(ObjectDeserializer op) { + DecayFunctionBase.setupDecayFunctionBaseDeserializer(op, JsonpDeserializer.doubleDeserializer(), + JsonpDeserializer.doubleDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/PrefixQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/PrefixQuery.java index 37a9cab6e..0c1b4d26d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/PrefixQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/PrefixQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -58,7 +62,12 @@ * specification */ @JsonpDeserializable -public class PrefixQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class PrefixQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { // Single key dictionary private final String field; @@ -102,6 +111,22 @@ public Query.Kind _queryKind() { return Query.Kind.Prefix; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Prefix; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Prefix; + } + /** * Required - The target field */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQuery.java index 242c1d40f..cf7240e9c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQuery.java @@ -21,16 +21,24 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; -import co.elastic.clients.json.JsonData; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import jakarta.json.stream.JsonGenerator; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -58,53 +66,43 @@ * specification */ @JsonpDeserializable -public class RangeQuery extends RangeQueryBase implements ApiKeyQueryVariant, QueryVariant { - // Single key dictionary - private final String field; +public class RangeQuery + implements + TaggedUnion, + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant, + JsonpSerializable { - @Nullable - private final JsonData gt; - - @Nullable - private final JsonData gte; - - @Nullable - private final JsonData lt; + /** + * {@link RangeQuery} variant kinds. + * + * @see API + * specification + */ - @Nullable - private final JsonData lte; + public enum Kind implements JsonEnum { + Date("date"), - @Nullable - private final String from; + Number("number"), - @Nullable - private final String to; + Term("term"), - @Nullable - private final String format; + Untyped("untyped"), - @Nullable - private final String timeZone; + ; - // --------------------------------------------------------------------------------------------- + private final String jsonValue; - private RangeQuery(Builder builder) { - super(builder); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - - this.gt = builder.gt; - this.gte = builder.gte; - this.lt = builder.lt; - this.lte = builder.lte; - this.from = builder.from; - this.to = builder.to; - this.format = builder.format; - this.timeZone = builder.timeZone; + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } - } + public String jsonValue() { + return this.jsonValue; + } - public static RangeQuery of(Function> fn) { - return fn.apply(new Builder()).build(); } /** @@ -124,295 +122,195 @@ public Query.Kind _queryKind() { } /** - * Required - The target field + * RoleQuery variant kind. */ - public final String field() { - return this.field; + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Range; } /** - * Greater than. - *

- * API name: {@code gt} + * UserQuery variant kind. */ - @Nullable - public final JsonData gt() { - return this.gt; + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Range; } - /** - * Greater than or equal to. - *

- * API name: {@code gte} - */ - @Nullable - public final JsonData gte() { - return this.gte; + private final Kind _kind; + private final RangeQueryVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final RangeQueryVariant _get() { + return _value; + } + + public RangeQuery(RangeQueryVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._rangeQueryKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private RangeQuery(Kind kind, RangeQueryVariant value) { + this._kind = kind; + this._value = value; + } + + private RangeQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static RangeQuery of(Function> fn) { + return fn.apply(new Builder()).build(); } /** - * Less than. - *

- * API name: {@code lt} + * Is this variant instance of kind {@code date}? */ - @Nullable - public final JsonData lt() { - return this.lt; + public boolean isDate() { + return _kind == Kind.Date; } /** - * Less than or equal to. - *

- * API name: {@code lte} + * Get the {@code date} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code date} kind. */ - @Nullable - public final JsonData lte() { - return this.lte; + public DateRangeQuery date() { + return TaggedUnionUtils.get(this, Kind.Date); } /** - * API name: {@code from} + * Is this variant instance of kind {@code number}? */ - @Nullable - public final String from() { - return this.from; + public boolean isNumber() { + return _kind == Kind.Number; } /** - * API name: {@code to} + * Get the {@code number} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code number} kind. */ - @Nullable - public final String to() { - return this.to; + public NumberRangeQuery number() { + return TaggedUnionUtils.get(this, Kind.Number); } /** - * Date format used to convert date values in the query. - *

- * API name: {@code format} + * Is this variant instance of kind {@code term}? */ - @Nullable - public final String format() { - return this.format; + public boolean isTerm() { + return _kind == Kind.Term; } /** - * Coordinated Universal Time (UTC) offset or IANA time zone used to convert - * date values in the query to UTC. - *

- * API name: {@code time_zone} + * Get the {@code term} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code term} kind. */ - @Nullable - public final String timeZone() { - return this.timeZone; + public TermRangeQuery term() { + return TaggedUnionUtils.get(this, Kind.Term); } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(this.field); - - super.serializeInternal(generator, mapper); - if (this.gt != null) { - generator.writeKey("gt"); - this.gt.serialize(generator, mapper); - - } - if (this.gte != null) { - generator.writeKey("gte"); - this.gte.serialize(generator, mapper); - - } - if (this.lt != null) { - generator.writeKey("lt"); - this.lt.serialize(generator, mapper); - - } - if (this.lte != null) { - generator.writeKey("lte"); - this.lte.serialize(generator, mapper); - - } - if (this.from != null) { - generator.writeKey("from"); - generator.write(this.from); - - } - if (this.to != null) { - generator.writeKey("to"); - generator.write(this.to); - - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - if (this.timeZone != null) { - generator.writeKey("time_zone"); - generator.write(this.timeZone); - - } - - generator.writeEnd(); - + /** + * Is this variant instance of kind {@code untyped}? + */ + public boolean isUntyped() { + return _kind == Kind.Untyped; } - // --------------------------------------------------------------------------------------------- - /** - * Builder for {@link RangeQuery}. + * Get the {@code untyped} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code untyped} kind. */ + public UntypedRangeQuery untyped() { + return TaggedUnionUtils.get(this, Kind.Untyped); + } - public static class Builder extends RangeQueryBase.AbstractBuilder implements ObjectBuilder { - private String field; - - /** - * Required - The target field - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - @Nullable - private JsonData gt; - - @Nullable - private JsonData gte; - - @Nullable - private JsonData lt; - - @Nullable - private JsonData lte; - - @Nullable - private String from; + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { - @Nullable - private String to; + mapper.serialize(_value, generator); - @Nullable - private String format; + } - @Nullable - private String timeZone; + @Override + public String toString() { + return JsonpUtils.toString(this); + } - /** - * Greater than. - *

- * API name: {@code gt} - */ - public final Builder gt(@Nullable JsonData value) { - this.gt = value; - return this; - } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private RangeQueryVariant _value; - /** - * Greater than or equal to. - *

- * API name: {@code gte} - */ - public final Builder gte(@Nullable JsonData value) { - this.gte = value; + public ObjectBuilder date(DateRangeQuery v) { + this._kind = Kind.Date; + this._value = v; return this; } - /** - * Less than. - *

- * API name: {@code lt} - */ - public final Builder lt(@Nullable JsonData value) { - this.lt = value; - return this; + public ObjectBuilder date(Function> fn) { + return this.date(fn.apply(new DateRangeQuery.Builder()).build()); } - /** - * Less than or equal to. - *

- * API name: {@code lte} - */ - public final Builder lte(@Nullable JsonData value) { - this.lte = value; + public ObjectBuilder number(NumberRangeQuery v) { + this._kind = Kind.Number; + this._value = v; return this; } - /** - * API name: {@code from} - */ - public final Builder from(@Nullable String value) { - this.from = value; - return this; + public ObjectBuilder number( + Function> fn) { + return this.number(fn.apply(new NumberRangeQuery.Builder()).build()); } - /** - * API name: {@code to} - */ - public final Builder to(@Nullable String value) { - this.to = value; + public ObjectBuilder term(TermRangeQuery v) { + this._kind = Kind.Term; + this._value = v; return this; } - /** - * Date format used to convert date values in the query. - *

- * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; + public ObjectBuilder term(Function> fn) { + return this.term(fn.apply(new TermRangeQuery.Builder()).build()); } - /** - * Coordinated Universal Time (UTC) offset or IANA time zone used to convert - * date values in the query to UTC. - *

- * API name: {@code time_zone} - */ - public final Builder timeZone(@Nullable String value) { - this.timeZone = value; + public ObjectBuilder untyped(UntypedRangeQuery v) { + this._kind = Kind.Untyped; + this._value = v; return this; } - @Override - protected Builder self() { - return this; + public ObjectBuilder untyped( + Function> fn) { + return this.untyped(fn.apply(new UntypedRangeQuery.Builder()).build()); } - /** - * Builds a {@link RangeQuery}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ public RangeQuery build() { _checkSingleUse(); - return new RangeQuery(this); } - } - - // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link RangeQuery} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RangeQuery::setupRangeQueryDeserializer); - - protected static void setupRangeQueryDeserializer(ObjectDeserializer op) { - RangeQueryBase.setupRangeQueryBaseDeserializer(op); - op.add(Builder::gt, JsonData._DESERIALIZER, "gt"); - op.add(Builder::gte, JsonData._DESERIALIZER, "gte"); - op.add(Builder::lt, JsonData._DESERIALIZER, "lt"); - op.add(Builder::lte, JsonData._DESERIALIZER, "lte"); - op.add(Builder::from, JsonpDeserializer.stringDeserializer(), "from"); - op.add(Builder::to, JsonpDeserializer.stringDeserializer(), "to"); - op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); - op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); - - op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); + } + private static JsonpDeserializer buildRangeQueryDeserializer() { + return new UnionDeserializer.Builder(RangeQuery::new, false) + .addMember(Kind.Untyped, UntypedRangeQuery._DESERIALIZER).build(); } + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(RangeQuery::buildRangeQueryDeserializer); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBase.java index 07b4adb69..738b22398 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBase.java @@ -22,11 +22,15 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializer; +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.String; import java.util.Objects; import javax.annotation.Nullable; @@ -54,17 +58,56 @@ * specification */ -public abstract class RangeQueryBase extends QueryBase { +public abstract class RangeQueryBase extends QueryBase { + // Single key dictionary + private final String field; + @Nullable private final RangeRelation relation; + @Nullable + private final T gt; + + @Nullable + private final T gte; + + @Nullable + private final T lt; + + @Nullable + private final T lte; + + @Nullable + private final T from; + + @Nullable + private final T to; + + @Nullable + private final JsonpSerializer tSerializer; + // --------------------------------------------------------------------------------------------- - protected RangeQueryBase(AbstractBuilder builder) { + protected RangeQueryBase(AbstractBuilder builder) { super(builder); + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.relation = builder.relation; + this.gt = builder.gt; + this.gte = builder.gte; + this.lt = builder.lt; + this.lte = builder.lte; + this.from = builder.from; + this.to = builder.to; + this.tSerializer = builder.tSerializer; + + } + /** + * Required - the required field + */ + public final String field() { + return this.field; } /** @@ -77,22 +120,142 @@ public final RangeRelation relation() { return this.relation; } + /** + * Greater than. + *

+ * API name: {@code gt} + */ + @Nullable + public final T gt() { + return this.gt; + } + + /** + * Greater than or equal to. + *

+ * API name: {@code gte} + */ + @Nullable + public final T gte() { + return this.gte; + } + + /** + * Less than. + *

+ * API name: {@code lt} + */ + @Nullable + public final T lt() { + return this.lt; + } + + /** + * Less than or equal to. + *

+ * API name: {@code lte} + */ + @Nullable + public final T lte() { + return this.lte; + } + + /** + * API name: {@code from} + */ + @Nullable + public final T from() { + return this.from; + } + + /** + * API name: {@code to} + */ + @Nullable + public final T to() { + return this.to; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(this.field); super.serializeInternal(generator, mapper); if (this.relation != null) { generator.writeKey("relation"); this.relation.serialize(generator, mapper); } + if (this.gt != null) { + generator.writeKey("gt"); + JsonpUtils.serialize(this.gt, generator, tSerializer, mapper); + + } + if (this.gte != null) { + generator.writeKey("gte"); + JsonpUtils.serialize(this.gte, generator, tSerializer, mapper); + + } + if (this.lt != null) { + generator.writeKey("lt"); + JsonpUtils.serialize(this.lt, generator, tSerializer, mapper); + + } + if (this.lte != null) { + generator.writeKey("lte"); + JsonpUtils.serialize(this.lte, generator, tSerializer, mapper); + + } + if (this.from != null) { + generator.writeKey("from"); + JsonpUtils.serialize(this.from, generator, tSerializer, mapper); + + } + if (this.to != null) { + generator.writeKey("to"); + JsonpUtils.serialize(this.to, generator, tSerializer, mapper); + + } + + generator.writeEnd(); } - public abstract static class AbstractBuilder> + public abstract static class AbstractBuilder> extends QueryBase.AbstractBuilder { + private String field; + + /** + * Required - the required field + */ + public final BuilderT field(String value) { + this.field = value; + return self(); + } + @Nullable private RangeRelation relation; + @Nullable + private T gt; + + @Nullable + private T gte; + + @Nullable + private T lt; + + @Nullable + private T lte; + + @Nullable + private T from; + + @Nullable + private T to; + + @Nullable + private JsonpSerializer tSerializer; + /** * Indicates how the range query matches values for range fields. *

@@ -103,13 +266,86 @@ public final BuilderT relation(@Nullable RangeRelation value) { return self(); } + /** + * Greater than. + *

+ * API name: {@code gt} + */ + public final BuilderT gt(@Nullable T value) { + this.gt = value; + return self(); + } + + /** + * Greater than or equal to. + *

+ * API name: {@code gte} + */ + public final BuilderT gte(@Nullable T value) { + this.gte = value; + return self(); + } + + /** + * Less than. + *

+ * API name: {@code lt} + */ + public final BuilderT lt(@Nullable T value) { + this.lt = value; + return self(); + } + + /** + * Less than or equal to. + *

+ * API name: {@code lte} + */ + public final BuilderT lte(@Nullable T value) { + this.lte = value; + return self(); + } + + /** + * API name: {@code from} + */ + public final BuilderT from(@Nullable T value) { + this.from = value; + return self(); + } + + /** + * API name: {@code to} + */ + public final BuilderT to(@Nullable T value) { + this.to = value; + return self(); + } + + /** + * Serializer for T. If not set, an attempt will be made to find a serializer + * from the JSON context. + */ + public final BuilderT tSerializer(@Nullable JsonpSerializer value) { + this.tSerializer = value; + return self(); + } + } // --------------------------------------------------------------------------------------------- - protected static > void setupRangeQueryBaseDeserializer( - ObjectDeserializer op) { + protected static > void setupRangeQueryBaseDeserializer( + ObjectDeserializer op, JsonpDeserializer tDeserializer) { QueryBase.setupQueryBaseDeserializer(op); op.add(AbstractBuilder::relation, RangeRelation._DESERIALIZER, "relation"); + op.add(AbstractBuilder::gt, tDeserializer, "gt"); + op.add(AbstractBuilder::gte, tDeserializer, "gte"); + op.add(AbstractBuilder::lt, tDeserializer, "lt"); + op.add(AbstractBuilder::lte, tDeserializer, "lte"); + op.add(AbstractBuilder::from, tDeserializer, "from"); + op.add(AbstractBuilder::to, tDeserializer, "to"); + + op.setKey(AbstractBuilder::field, JsonpDeserializer.stringDeserializer()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBuilders.java new file mode 100644 index 000000000..3d49c9772 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryBuilders.java @@ -0,0 +1,119 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link RangeQuery} variants. + */ +public class RangeQueryBuilders { + private RangeQueryBuilders() { + } + + /** + * Creates a builder for the {@link DateRangeQuery date} {@code RangeQuery} + * variant. + */ + public static DateRangeQuery.Builder date() { + return new DateRangeQuery.Builder(); + } + + /** + * Creates a RangeQuery of the {@link DateRangeQuery date} {@code RangeQuery} + * variant. + */ + public static RangeQuery date(Function> fn) { + RangeQuery.Builder builder = new RangeQuery.Builder(); + builder.date(fn.apply(new DateRangeQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link NumberRangeQuery number} {@code RangeQuery} + * variant. + */ + public static NumberRangeQuery.Builder number() { + return new NumberRangeQuery.Builder(); + } + + /** + * Creates a RangeQuery of the {@link NumberRangeQuery number} + * {@code RangeQuery} variant. + */ + public static RangeQuery number(Function> fn) { + RangeQuery.Builder builder = new RangeQuery.Builder(); + builder.number(fn.apply(new NumberRangeQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TermRangeQuery term} {@code RangeQuery} + * variant. + */ + public static TermRangeQuery.Builder term() { + return new TermRangeQuery.Builder(); + } + + /** + * Creates a RangeQuery of the {@link TermRangeQuery term} {@code RangeQuery} + * variant. + */ + public static RangeQuery term(Function> fn) { + RangeQuery.Builder builder = new RangeQuery.Builder(); + builder.term(fn.apply(new TermRangeQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link UntypedRangeQuery untyped} + * {@code RangeQuery} variant. + */ + public static UntypedRangeQuery.Builder untyped() { + return new UntypedRangeQuery.Builder(); + } + + /** + * Creates a RangeQuery of the {@link UntypedRangeQuery untyped} + * {@code RangeQuery} variant. + */ + public static RangeQuery untyped(Function> fn) { + RangeQuery.Builder builder = new RangeQuery.Builder(); + builder.untyped(fn.apply(new UntypedRangeQuery.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryVariant.java new file mode 100644 index 000000000..d74b8c00b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/RangeQueryVariant.java @@ -0,0 +1,48 @@ +/* + * 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._types.query_dsl; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link RangeQuery} variants. + */ +public interface RangeQueryVariant { + + RangeQuery.Kind _rangeQueryKind(); + + default RangeQuery _toRangeQuery() { + return new RangeQuery(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringQuery.java index ed1878df9..7dfe5e38b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonEnums; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -62,7 +66,12 @@ * specification */ @JsonpDeserializable -public class SimpleQueryStringQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class SimpleQueryStringQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { @Nullable private final String analyzer; @@ -140,6 +149,22 @@ public Query.Kind _queryKind() { return Query.Kind.SimpleQueryString; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.SimpleQueryString; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.SimpleQueryString; + } + /** * Analyzer used to convert text in the query string into tokens. *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermQuery.java index 1f69488c1..8a268b23b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermQuery.java @@ -22,6 +22,10 @@ import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -59,7 +63,12 @@ * specification */ @JsonpDeserializable -public class TermQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class TermQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { // Single key dictionary private final String field; @@ -99,6 +108,22 @@ public Query.Kind _queryKind() { return Query.Kind.Term; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Term; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Term; + } + /** * Required - The target field */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermRangeQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermRangeQuery.java new file mode 100644 index 000000000..35a2ed26b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermRangeQuery.java @@ -0,0 +1,117 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.TermRangeQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TermRangeQuery extends RangeQueryBase implements RangeQueryVariant { + // --------------------------------------------------------------------------------------------- + + private TermRangeQuery(Builder builder) { + super(builder); + + } + + public static TermRangeQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * RangeQuery variant kind. + */ + @Override + public RangeQuery.Kind _rangeQueryKind() { + return RangeQuery.Kind.Term; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TermRangeQuery}. + */ + + public static class Builder extends RangeQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TermRangeQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TermRangeQuery build() { + _checkSingleUse(); + super.tSerializer(null); + + return new TermRangeQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TermRangeQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + TermRangeQuery::setupTermRangeQueryDeserializer); + + protected static void setupTermRangeQueryDeserializer(ObjectDeserializer op) { + RangeQueryBase.setupRangeQueryBaseDeserializer(op, JsonpDeserializer.stringDeserializer()); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermsQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermsQuery.java index 176c3e32d..a6da51dc9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermsQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TermsQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -57,7 +61,12 @@ * specification */ @JsonpDeserializable -public class TermsQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class TermsQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { private final String field; private final TermsQueryField terms; @@ -91,6 +100,22 @@ public Query.Kind _queryKind() { return Query.Kind.Terms; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Terms; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Terms; + } + /** * Required - */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDecayFunction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDecayFunction.java new file mode 100644 index 000000000..2fa13f39b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDecayFunction.java @@ -0,0 +1,118 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.UntypedDecayFunction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class UntypedDecayFunction extends DecayFunctionBase implements DecayFunctionVariant { + // --------------------------------------------------------------------------------------------- + + private UntypedDecayFunction(Builder builder) { + super(builder); + + } + + public static UntypedDecayFunction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DecayFunction variant kind. + */ + @Override + public DecayFunction.Kind _decayFunctionKind() { + return DecayFunction.Kind.Untyped; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UntypedDecayFunction}. + */ + + public static class Builder extends DecayFunctionBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link UntypedDecayFunction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public UntypedDecayFunction build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tScaleSerializer(null); + + return new UntypedDecayFunction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UntypedDecayFunction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, UntypedDecayFunction::setupUntypedDecayFunctionDeserializer); + + protected static void setupUntypedDecayFunctionDeserializer(ObjectDeserializer op) { + DecayFunctionBase.setupDecayFunctionBaseDeserializer(op, JsonData._DESERIALIZER, JsonData._DESERIALIZER); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDistanceFeatureQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDistanceFeatureQuery.java new file mode 100644 index 000000000..8259c867d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedDistanceFeatureQuery.java @@ -0,0 +1,122 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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: _types.query_dsl.UntypedDistanceFeatureQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class UntypedDistanceFeatureQuery extends DistanceFeatureQueryBase + implements + DistanceFeatureQueryVariant { + // --------------------------------------------------------------------------------------------- + + private UntypedDistanceFeatureQuery(Builder builder) { + super(builder); + + } + + public static UntypedDistanceFeatureQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * DistanceFeatureQuery variant kind. + */ + @Override + public DistanceFeatureQuery.Kind _distanceFeatureQueryKind() { + return DistanceFeatureQuery.Kind.Untyped; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UntypedDistanceFeatureQuery}. + */ + + public static class Builder extends DistanceFeatureQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link UntypedDistanceFeatureQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public UntypedDistanceFeatureQuery build() { + _checkSingleUse(); + super.tOriginSerializer(null); + super.tDistanceSerializer(null); + + return new UntypedDistanceFeatureQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UntypedDistanceFeatureQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, UntypedDistanceFeatureQuery::setupUntypedDistanceFeatureQueryDeserializer); + + protected static void setupUntypedDistanceFeatureQueryDeserializer( + ObjectDeserializer op) { + DistanceFeatureQueryBase.setupDistanceFeatureQueryBaseDeserializer(op, JsonData._DESERIALIZER, + JsonData._DESERIALIZER); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedRangeQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedRangeQuery.java new file mode 100644 index 000000000..69d216052 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/UntypedRangeQuery.java @@ -0,0 +1,195 @@ +/* + * 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._types.query_dsl; + +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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: _types.query_dsl.UntypedRangeQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class UntypedRangeQuery extends RangeQueryBase implements RangeQueryVariant { + @Nullable + private final String format; + + @Nullable + private final String timeZone; + + // --------------------------------------------------------------------------------------------- + + private UntypedRangeQuery(Builder builder) { + super(builder); + + this.format = builder.format; + this.timeZone = builder.timeZone; + + } + + public static UntypedRangeQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * RangeQuery variant kind. + */ + @Override + public RangeQuery.Kind _rangeQueryKind() { + return RangeQuery.Kind.Untyped; + } + + /** + * Date format used to convert date values in the query. + *

+ * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * Coordinated Universal Time (UTC) offset or IANA time zone used to convert + * date values in the query to UTC. + *

+ * API name: {@code time_zone} + */ + @Nullable + public final String timeZone() { + return this.timeZone; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + if (this.timeZone != null) { + generator.writeKey("time_zone"); + generator.write(this.timeZone); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UntypedRangeQuery}. + */ + + public static class Builder extends RangeQueryBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String format; + + @Nullable + private String timeZone; + + /** + * Date format used to convert date values in the query. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Coordinated Universal Time (UTC) offset or IANA time zone used to convert + * date values in the query to UTC. + *

+ * API name: {@code time_zone} + */ + public final Builder timeZone(@Nullable String value) { + this.timeZone = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link UntypedRangeQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public UntypedRangeQuery build() { + _checkSingleUse(); + super.tSerializer(null); + + return new UntypedRangeQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UntypedRangeQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, UntypedRangeQuery::setupUntypedRangeQueryDeserializer); + + protected static void setupUntypedRangeQueryDeserializer(ObjectDeserializer op) { + RangeQueryBase.setupRangeQueryBaseDeserializer(op, JsonData._DESERIALIZER); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WildcardQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WildcardQuery.java index ad0c60f89..74f5bf15e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WildcardQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/WildcardQuery.java @@ -21,6 +21,10 @@ import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQuery; import co.elastic.clients.elasticsearch.security.query_api_keys.ApiKeyQueryVariant; +import co.elastic.clients.elasticsearch.security.query_role.RoleQuery; +import co.elastic.clients.elasticsearch.security.query_role.RoleQueryVariant; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +import co.elastic.clients.elasticsearch.security.query_user.UserQueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -59,7 +63,12 @@ * specification */ @JsonpDeserializable -public class WildcardQuery extends QueryBase implements ApiKeyQueryVariant, QueryVariant { +public class WildcardQuery extends QueryBase + implements + ApiKeyQueryVariant, + QueryVariant, + RoleQueryVariant, + UserQueryVariant { // Single key dictionary private final String field; @@ -108,6 +117,22 @@ public Query.Kind _queryKind() { return Query.Kind.Wildcard; } + /** + * RoleQuery variant kind. + */ + @Override + public RoleQuery.Kind _roleQueryKind() { + return RoleQuery.Kind.Wildcard; + } + + /** + * UserQuery variant kind. + */ + @Override + public UserQuery.Kind _userQueryKind() { + return UserQuery.Kind.Wildcard; + } + /** * Required - The target field */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/allocation/AllocationRecord.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/allocation/AllocationRecord.java index 5424dfa69..21c34641d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/allocation/AllocationRecord.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/allocation/AllocationRecord.java @@ -26,9 +26,11 @@ 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.Double; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -59,9 +61,17 @@ */ @JsonpDeserializable public class AllocationRecord implements JsonpSerializable { - @Nullable private final String shards; + @Nullable + private final String shardsUndesired; + + @Nullable + private final Double writeLoadForecast; + + @Nullable + private final String diskIndicesForecast; + @Nullable private final String diskIndices; @@ -83,14 +93,19 @@ public class AllocationRecord implements JsonpSerializable { @Nullable private final String ip; - @Nullable private final String node; + @Nullable + private final String nodeRole; + // --------------------------------------------------------------------------------------------- private AllocationRecord(Builder builder) { - this.shards = builder.shards; + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.shardsUndesired = builder.shardsUndesired; + this.writeLoadForecast = builder.writeLoadForecast; + this.diskIndicesForecast = builder.diskIndicesForecast; this.diskIndices = builder.diskIndices; this.diskUsed = builder.diskUsed; this.diskAvail = builder.diskAvail; @@ -98,7 +113,8 @@ private AllocationRecord(Builder builder) { this.diskPercent = builder.diskPercent; this.host = builder.host; this.ip = builder.ip; - this.node = builder.node; + this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); + this.nodeRole = builder.nodeRole; } @@ -107,15 +123,45 @@ public static AllocationRecord of(Function * API name: {@code shards} */ - @Nullable public final String shards() { return this.shards; } + /** + * Amount of shards that are scheduled to be moved elsewhere in the cluster or + * -1 other than desired balance allocator is used + *

+ * API name: {@code shards.undesired} + */ + @Nullable + public final String shardsUndesired() { + return this.shardsUndesired; + } + + /** + * Sum of index write load forecasts + *

+ * API name: {@code write_load.forecast} + */ + @Nullable + public final Double writeLoadForecast() { + return this.writeLoadForecast; + } + + /** + * Sum of shard size forecasts + *

+ * API name: {@code disk.indices.forecast} + */ + @Nullable + public final String diskIndicesForecast() { + return this.diskIndicesForecast; + } + /** * Disk space used by the node’s shards. Does not include disk space for the * translog or unassigned shards. IMPORTANT: This metric double-counts disk @@ -198,15 +244,24 @@ public final String ip() { } /** - * Name for the node. Set using the node.name setting. + * Required - Name for the node. Set using the node.name setting. *

* API name: {@code node} */ - @Nullable public final String node() { return this.node; } + /** + * Node roles + *

+ * API name: {@code node.role} + */ + @Nullable + public final String nodeRole() { + return this.nodeRole; + } + /** * Serialize this object to JSON. */ @@ -218,9 +273,22 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.shards != null) { - generator.writeKey("shards"); - generator.write(this.shards); + generator.writeKey("shards"); + generator.write(this.shards); + + if (this.shardsUndesired != null) { + generator.writeKey("shards.undesired"); + generator.write(this.shardsUndesired); + + } + if (this.writeLoadForecast != null) { + generator.writeKey("write_load.forecast"); + generator.write(this.writeLoadForecast); + + } + if (this.diskIndicesForecast != null) { + generator.writeKey("disk.indices.forecast"); + generator.write(this.diskIndicesForecast); } if (this.diskIndices != null) { @@ -258,9 +326,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.ip); } - if (this.node != null) { - generator.writeKey("node"); - generator.write(this.node); + generator.writeKey("node"); + generator.write(this.node); + + if (this.nodeRole != null) { + generator.writeKey("node.role"); + generator.write(this.nodeRole); } @@ -278,9 +349,17 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable private String shards; + @Nullable + private String shardsUndesired; + + @Nullable + private Double writeLoadForecast; + + @Nullable + private String diskIndicesForecast; + @Nullable private String diskIndices; @@ -302,19 +381,52 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String ip; - @Nullable private String node; + @Nullable + private String nodeRole; + /** - * Number of primary and replica shards assigned to the node. + * Required - Number of primary and replica shards assigned to the node. *

* API name: {@code shards} */ - public final Builder shards(@Nullable String value) { + public final Builder shards(String value) { this.shards = value; return this; } + /** + * Amount of shards that are scheduled to be moved elsewhere in the cluster or + * -1 other than desired balance allocator is used + *

+ * API name: {@code shards.undesired} + */ + public final Builder shardsUndesired(@Nullable String value) { + this.shardsUndesired = value; + return this; + } + + /** + * Sum of index write load forecasts + *

+ * API name: {@code write_load.forecast} + */ + public final Builder writeLoadForecast(@Nullable Double value) { + this.writeLoadForecast = value; + return this; + } + + /** + * Sum of shard size forecasts + *

+ * API name: {@code disk.indices.forecast} + */ + public final Builder diskIndicesForecast(@Nullable String value) { + this.diskIndicesForecast = value; + return this; + } + /** * Disk space used by the node’s shards. Does not include disk space for the * translog or unassigned shards. IMPORTANT: This metric double-counts disk @@ -397,15 +509,25 @@ public final Builder ip(@Nullable String value) { } /** - * Name for the node. Set using the node.name setting. + * Required - Name for the node. Set using the node.name setting. *

* API name: {@code node} */ - public final Builder node(@Nullable String value) { + public final Builder node(String value) { this.node = value; return this; } + /** + * Node roles + *

+ * API name: {@code node.role} + */ + public final Builder nodeRole(@Nullable String value) { + this.nodeRole = value; + return this; + } + @Override protected Builder self() { return this; @@ -435,6 +557,11 @@ public AllocationRecord build() { protected static void setupAllocationRecordDeserializer(ObjectDeserializer op) { op.add(Builder::shards, JsonpDeserializer.stringDeserializer(), "shards", "s"); + op.add(Builder::shardsUndesired, JsonpDeserializer.stringDeserializer(), "shards.undesired"); + op.add(Builder::writeLoadForecast, JsonpDeserializer.doubleDeserializer(), "write_load.forecast", "wlf", + "writeLoadForecast"); + op.add(Builder::diskIndicesForecast, JsonpDeserializer.stringDeserializer(), "disk.indices.forecast", "dif", + "diskIndicesForecast"); op.add(Builder::diskIndices, JsonpDeserializer.stringDeserializer(), "disk.indices", "di", "diskIndices"); op.add(Builder::diskUsed, JsonpDeserializer.stringDeserializer(), "disk.used", "du", "diskUsed"); op.add(Builder::diskAvail, JsonpDeserializer.stringDeserializer(), "disk.avail", "da", "diskAvail"); @@ -443,6 +570,7 @@ protected static void setupAllocationRecordDeserializer(ObjectDeserializer private Long policies; + private Integer stagnatingIndices; + /** * Required - API name: {@code ilm_status} */ @@ -144,6 +160,14 @@ public final Builder policies(long value) { return this; } + /** + * Required - API name: {@code stagnating_indices} + */ + public final Builder stagnatingIndices(int value) { + this.stagnatingIndices = value; + return this; + } + @Override protected Builder self() { return this; @@ -174,6 +198,7 @@ protected static void setupIlmIndicatorDetailsDeserializer(ObjectDeserializer ObjectBuilder { private Long creatingPrimaries; + private Long creatingReplicas; + private Long initializingPrimaries; private Long initializingReplicas; @@ -245,6 +260,14 @@ public final Builder creatingPrimaries(long value) { return this; } + /** + * Required - API name: {@code creating_replicas} + */ + public final Builder creatingReplicas(long value) { + this.creatingReplicas = value; + return this; + } + /** * Required - API name: {@code initializing_primaries} */ @@ -340,6 +363,7 @@ protected static void setupShardsAvailabilityIndicatorDetailsDeserializer( ObjectDeserializer op) { op.add(Builder::creatingPrimaries, JsonpDeserializer.longDeserializer(), "creating_primaries"); + op.add(Builder::creatingReplicas, JsonpDeserializer.longDeserializer(), "creating_replicas"); op.add(Builder::initializingPrimaries, JsonpDeserializer.longDeserializer(), "initializing_primaries"); op.add(Builder::initializingReplicas, JsonpDeserializer.longDeserializer(), "initializing_replicas"); op.add(Builder::restartingPrimaries, JsonpDeserializer.longDeserializer(), "restarting_primaries"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/health_report/SlmIndicatorDetails.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/health_report/SlmIndicatorDetails.java index 7892b002d..34ba0f653 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/health_report/SlmIndicatorDetails.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/health_report/SlmIndicatorDetails.java @@ -65,6 +65,7 @@ public class SlmIndicatorDetails implements JsonpSerializable { private final long policies; + @Nullable private final SlmIndicatorUnhealthyPolicies unhealthyPolicies; // --------------------------------------------------------------------------------------------- @@ -73,7 +74,7 @@ private SlmIndicatorDetails(Builder builder) { this.slmStatus = ApiTypeHelper.requireNonNull(builder.slmStatus, this, "slmStatus"); this.policies = ApiTypeHelper.requireNonNull(builder.policies, this, "policies"); - this.unhealthyPolicies = ApiTypeHelper.requireNonNull(builder.unhealthyPolicies, this, "unhealthyPolicies"); + this.unhealthyPolicies = builder.unhealthyPolicies; } @@ -96,8 +97,9 @@ public final long policies() { } /** - * Required - API name: {@code unhealthy_policies} + * API name: {@code unhealthy_policies} */ + @Nullable public final SlmIndicatorUnhealthyPolicies unhealthyPolicies() { return this.unhealthyPolicies; } @@ -118,8 +120,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("policies"); generator.write(this.policies); - generator.writeKey("unhealthy_policies"); - this.unhealthyPolicies.serialize(generator, mapper); + if (this.unhealthyPolicies != null) { + generator.writeKey("unhealthy_policies"); + this.unhealthyPolicies.serialize(generator, mapper); + + } } @@ -141,6 +146,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Long policies; + @Nullable private SlmIndicatorUnhealthyPolicies unhealthyPolicies; /** @@ -160,15 +166,15 @@ public final Builder policies(long value) { } /** - * Required - API name: {@code unhealthy_policies} + * API name: {@code unhealthy_policies} */ - public final Builder unhealthyPolicies(SlmIndicatorUnhealthyPolicies value) { + public final Builder unhealthyPolicies(@Nullable SlmIndicatorUnhealthyPolicies value) { this.unhealthyPolicies = value; return this; } /** - * Required - API name: {@code unhealthy_policies} + * API name: {@code unhealthy_policies} */ public final Builder unhealthyPolicies( Function> fn) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index 80b8d6d62..8349320dd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -59,10 +59,10 @@ '_global.health_report.BaseIndicator': '_global/health_report/types.ts#L42-L47', '_global.health_report.Diagnosis': '_global/health_report/types.ts#L49-L55', '_global.health_report.DiagnosisAffectedResources': '_global/health_report/types.ts#L57-L63', -'_global.health_report.DiskIndicator': '_global/health_report/types.ts#L121-L125', -'_global.health_report.DiskIndicatorDetails': '_global/health_report/types.ts#L126-L132', -'_global.health_report.IlmIndicator': '_global/health_report/types.ts#L145-L149', -'_global.health_report.IlmIndicatorDetails': '_global/health_report/types.ts#L150-L153', +'_global.health_report.DiskIndicator': '_global/health_report/types.ts#L122-L126', +'_global.health_report.DiskIndicatorDetails': '_global/health_report/types.ts#L127-L133', +'_global.health_report.IlmIndicator': '_global/health_report/types.ts#L146-L150', +'_global.health_report.IlmIndicatorDetails': '_global/health_report/types.ts#L151-L155', '_global.health_report.Impact': '_global/health_report/types.ts#L65-L70', '_global.health_report.ImpactArea': '_global/health_report/types.ts#L72-L77', '_global.health_report.IndicatorHealthStatus': '_global/health_report/types.ts#L25-L30', @@ -72,18 +72,18 @@ '_global.health_report.MasterIsStableIndicatorClusterFormationNode': '_global/health_report/types.ts#L98-L102', '_global.health_report.MasterIsStableIndicatorDetails': '_global/health_report/types.ts#L84-L89', '_global.health_report.MasterIsStableIndicatorExceptionFetchingHistory': '_global/health_report/types.ts#L94-L97', -'_global.health_report.RepositoryIntegrityIndicator': '_global/health_report/types.ts#L134-L138', -'_global.health_report.RepositoryIntegrityIndicatorDetails': '_global/health_report/types.ts#L139-L143', +'_global.health_report.RepositoryIntegrityIndicator': '_global/health_report/types.ts#L135-L139', +'_global.health_report.RepositoryIntegrityIndicatorDetails': '_global/health_report/types.ts#L140-L144', '_global.health_report.Request': '_global/health_report/Request.ts#L24-L52', '_global.health_report.Response': '_global/health_report/Response.ts#L22-L28', '_global.health_report.ShardsAvailabilityIndicator': '_global/health_report/types.ts#L104-L108', -'_global.health_report.ShardsAvailabilityIndicatorDetails': '_global/health_report/types.ts#L109-L119', -'_global.health_report.ShardsCapacityIndicator': '_global/health_report/types.ts#L171-L175', -'_global.health_report.ShardsCapacityIndicatorDetails': '_global/health_report/types.ts#L177-L180', -'_global.health_report.ShardsCapacityIndicatorTierDetail': '_global/health_report/types.ts#L182-L185', -'_global.health_report.SlmIndicator': '_global/health_report/types.ts#L155-L159', -'_global.health_report.SlmIndicatorDetails': '_global/health_report/types.ts#L160-L164', -'_global.health_report.SlmIndicatorUnhealthyPolicies': '_global/health_report/types.ts#L166-L169', +'_global.health_report.ShardsAvailabilityIndicatorDetails': '_global/health_report/types.ts#L109-L120', +'_global.health_report.ShardsCapacityIndicator': '_global/health_report/types.ts#L173-L177', +'_global.health_report.ShardsCapacityIndicatorDetails': '_global/health_report/types.ts#L179-L182', +'_global.health_report.ShardsCapacityIndicatorTierDetail': '_global/health_report/types.ts#L184-L187', +'_global.health_report.SlmIndicator': '_global/health_report/types.ts#L157-L161', +'_global.health_report.SlmIndicatorDetails': '_global/health_report/types.ts#L162-L166', +'_global.health_report.SlmIndicatorUnhealthyPolicies': '_global/health_report/types.ts#L168-L171', '_global.index.Request': '_global/index/IndexRequest.ts#L35-L117', '_global.index.Response': '_global/index/IndexResponse.ts#L22-L24', '_global.info.Request': '_global/info/RootNodeInfoRequest.ts#L22-L27', @@ -158,17 +158,17 @@ '_global.search._types.AggregationProfileDelegateDebugFilter': '_global/search/_types/profile.ts#L70-L75', '_global.search._types.BoundaryScanner': '_global/search/_types/highlighting.ts#L27-L46', '_global.search._types.Collector': '_global/search/_types/profile.ts#L86-L91', -'_global.search._types.CompletionContext': '_global/search/_types/suggester.ts#L232-L261', +'_global.search._types.CompletionContext': '_global/search/_types/suggester.ts#L235-L264', '_global.search._types.CompletionSuggest': '_global/search/_types/suggester.ts#L48-L55', '_global.search._types.CompletionSuggestOption': '_global/search/_types/suggester.ts#L73-L84', -'_global.search._types.CompletionSuggester': '_global/search/_types/suggester.ts#L160-L178', -'_global.search._types.Context': '_global/search/_types/suggester.ts#L225-L230', -'_global.search._types.DirectGenerator': '_global/search/_types/suggester.ts#L265-L328', +'_global.search._types.CompletionSuggester': '_global/search/_types/suggester.ts#L163-L181', +'_global.search._types.Context': '_global/search/_types/suggester.ts#L228-L233', +'_global.search._types.DirectGenerator': '_global/search/_types/suggester.ts#L268-L331', '_global.search._types.FetchProfile': '_global/search/_types/profile.ts#L139-L146', '_global.search._types.FetchProfileBreakdown': '_global/search/_types/profile.ts#L148-L157', '_global.search._types.FetchProfileDebug': '_global/search/_types/profile.ts#L159-L162', '_global.search._types.FieldCollapse': '_global/search/_types/FieldCollapse.ts#L24-L38', -'_global.search._types.FieldSuggester': '_global/search/_types/suggester.ts#L106-L139', +'_global.search._types.FieldSuggester': '_global/search/_types/suggester.ts#L109-L142', '_global.search._types.Highlight': '_global/search/_types/highlighting.ts#L153-L156', '_global.search._types.HighlightBase': '_global/search/_types/highlighting.ts#L48-L151', '_global.search._types.HighlightField': '_global/search/_types/highlighting.ts#L193-L197', @@ -181,41 +181,41 @@ '_global.search._types.HitsMetadata': '_global/search/_types/hits.ts#L66-L72', '_global.search._types.InnerHits': '_global/search/_types/hits.ts#L106-L140', '_global.search._types.InnerHitsResult': '_global/search/_types/hits.ts#L84-L86', -'_global.search._types.LaplaceSmoothingModel': '_global/search/_types/suggester.ts#L427-L432', +'_global.search._types.LaplaceSmoothingModel': '_global/search/_types/suggester.ts#L430-L435', '_global.search._types.LearningToRank': '_global/search/_types/rescoring.ts#L88-L97', -'_global.search._types.LinearInterpolationSmoothingModel': '_global/search/_types/suggester.ts#L434-L438', +'_global.search._types.LinearInterpolationSmoothingModel': '_global/search/_types/suggester.ts#L437-L441', '_global.search._types.NestedIdentity': '_global/search/_types/hits.ts#L88-L92', '_global.search._types.PhraseSuggest': '_global/search/_types/suggester.ts#L57-L62', -'_global.search._types.PhraseSuggestCollate': '_global/search/_types/suggester.ts#L330-L343', -'_global.search._types.PhraseSuggestCollateQuery': '_global/search/_types/suggester.ts#L345-L354', -'_global.search._types.PhraseSuggestHighlight': '_global/search/_types/suggester.ts#L416-L425', +'_global.search._types.PhraseSuggestCollate': '_global/search/_types/suggester.ts#L333-L346', +'_global.search._types.PhraseSuggestCollateQuery': '_global/search/_types/suggester.ts#L348-L357', +'_global.search._types.PhraseSuggestHighlight': '_global/search/_types/suggester.ts#L419-L428', '_global.search._types.PhraseSuggestOption': '_global/search/_types/suggester.ts#L86-L91', -'_global.search._types.PhraseSuggester': '_global/search/_types/suggester.ts#L356-L414', +'_global.search._types.PhraseSuggester': '_global/search/_types/suggester.ts#L359-L417', '_global.search._types.PointInTimeReference': '_global/search/_types/PointInTimeReference.ts#L23-L26', '_global.search._types.Profile': '_global/search/_types/profile.ts#L93-L95', '_global.search._types.QueryBreakdown': '_global/search/_types/profile.ts#L97-L116', '_global.search._types.QueryProfile': '_global/search/_types/profile.ts#L118-L124', -'_global.search._types.RegexOptions': '_global/search/_types/suggester.ts#L180-L191', +'_global.search._types.RegexOptions': '_global/search/_types/suggester.ts#L183-L194', '_global.search._types.Rescore': '_global/search/_types/rescoring.ts#L25-L38', '_global.search._types.RescoreQuery': '_global/search/_types/rescoring.ts#L40-L62', '_global.search._types.ScoreMode': '_global/search/_types/rescoring.ts#L64-L86', '_global.search._types.SearchProfile': '_global/search/_types/profile.ts#L126-L130', '_global.search._types.ShardProfile': '_global/search/_types/profile.ts#L132-L137', -'_global.search._types.SmoothingModelContainer': '_global/search/_types/suggester.ts#L442-L458', +'_global.search._types.SmoothingModelContainer': '_global/search/_types/suggester.ts#L445-L461', '_global.search._types.SourceConfig': '_global/search/_types/SourceFilter.ts#L33-L37', '_global.search._types.SourceConfigParam': '_global/search/_types/SourceFilter.ts#L39-L45', '_global.search._types.SourceFilter': '_global/search/_types/SourceFilter.ts#L23-L31', -'_global.search._types.StringDistance': '_global/search/_types/suggester.ts#L469-L490', -'_global.search._types.StupidBackoffSmoothingModel': '_global/search/_types/suggester.ts#L460-L465', +'_global.search._types.StringDistance': '_global/search/_types/suggester.ts#L472-L493', +'_global.search._types.StupidBackoffSmoothingModel': '_global/search/_types/suggester.ts#L463-L468', '_global.search._types.Suggest': '_global/search/_types/suggester.ts#L34-L40', '_global.search._types.SuggestBase': '_global/search/_types/suggester.ts#L42-L46', -'_global.search._types.SuggestFuzziness': '_global/search/_types/suggester.ts#L193-L221', -'_global.search._types.SuggestSort': '_global/search/_types/suggester.ts#L492-L501', -'_global.search._types.Suggester': '_global/search/_types/suggester.ts#L101-L104', -'_global.search._types.SuggesterBase': '_global/search/_types/suggester.ts#L141-L156', +'_global.search._types.SuggestFuzziness': '_global/search/_types/suggester.ts#L196-L224', +'_global.search._types.SuggestSort': '_global/search/_types/suggester.ts#L495-L504', +'_global.search._types.Suggester': '_global/search/_types/suggester.ts#L101-L107', +'_global.search._types.SuggesterBase': '_global/search/_types/suggester.ts#L144-L159', '_global.search._types.TermSuggest': '_global/search/_types/suggester.ts#L64-L69', '_global.search._types.TermSuggestOption': '_global/search/_types/suggester.ts#L93-L99', -'_global.search._types.TermSuggester': '_global/search/_types/suggester.ts#L503-L565', +'_global.search._types.TermSuggester': '_global/search/_types/suggester.ts#L506-L568', '_global.search._types.TotalHits': '_global/search/_types/hits.ts#L94-L97', '_global.search._types.TotalHitsRelation': '_global/search/_types/hits.ts#L99-L104', '_global.search._types.TrackHits': '_global/search/_types/hits.ts#L142-L150', @@ -247,11 +247,11 @@ '_global.update_by_query_rethrottle.UpdateByQueryRethrottleNode': '_global/update_by_query_rethrottle/UpdateByQueryRethrottleNode.ts#L25-L27', '_spec_utils.BaseNode': '_spec_utils/BaseNode.ts#L25-L32', '_types.AcknowledgedResponseBase': '_types/Base.ts#L47-L50', -'_types.BulkIndexByScrollFailure': '_types/Errors.ts#L58-L64', +'_types.BulkIndexByScrollFailure': '_types/Errors.ts#L60-L66', '_types.BulkStats': '_types/Stats.ts#L68-L78', '_types.Bytes': '_types/common.ts#L169-L181', '_types.ClusterDetails': '_types/Stats.ts#L45-L52', -'_types.ClusterInfoTarget': '_types/common.ts#L378-L384', +'_types.ClusterInfoTarget': '_types/common.ts#L381-L387', '_types.ClusterSearchStatus': '_types/Stats.ts#L37-L43', '_types.ClusterStatistics': '_types/Stats.ts#L27-L35', '_types.CompletionStats': '_types/Stats.ts#L80-L90', @@ -265,7 +265,7 @@ '_types.ElasticsearchVersionInfo': '_types/Base.ts#L54-L64', '_types.ElasticsearchVersionMinInfo': '_types/Base.ts#L66-L74', '_types.EmptyObject': '_types/common.ts#L160-L161', -'_types.ErrorCause': '_types/Errors.ts#L25-L48', +'_types.ErrorCause': '_types/Errors.ts#L25-L50', '_types.ErrorResponseBase': '_types/Base.ts#L76-L85', '_types.ExpandWildcard': '_types/common.ts#L201-L215', '_types.FieldMemoryUsage': '_types/Stats.ts#L118-L121', @@ -275,7 +275,7 @@ '_types.FielddataStats': '_types/Stats.ts#L111-L116', '_types.FlushStats': '_types/Stats.ts#L123-L128', '_types.GeoBounds': '_types/Geo.ts#L135-L148', -'_types.GeoDistanceSort': '_types/sort.ts#L58-L66', +'_types.GeoDistanceSort': '_types/sort.ts#L59-L71', '_types.GeoDistanceType': '_types/Geo.ts#L42-L51', '_types.GeoHashLocation': '_types/Geo.ts#L131-L133', '_types.GeoHashPrecision': '_types/Geo.ts#L86-L90', @@ -287,9 +287,9 @@ '_types.IBDistribution': '_types/Similarity.ts#L42-L45', '_types.IBLambda': '_types/Similarity.ts#L47-L50', '_types.IndexingStats': '_types/Stats.ts#L143-L159', -'_types.IndicesOptions': '_types/common.ts#L332-L359', +'_types.IndicesOptions': '_types/common.ts#L335-L362', '_types.IndicesResponseBase': '_types/Base.ts#L87-L89', -'_types.InlineGet': '_types/common.ts#L321-L330', +'_types.InlineGet': '_types/common.ts#L320-L333', '_types.InlineScript': '_types/Scripting.ts#L67-L79', '_types.KnnQuery': '_types/Knn.ts#L54-L67', '_types.KnnRetriever': '_types/Retriever.ts#L58-L71', @@ -327,28 +327,28 @@ '_types.ScriptBase': '_types/Scripting.ts#L59-L65', '_types.ScriptField': '_types/Scripting.ts#L91-L94', '_types.ScriptLanguage': '_types/Scripting.ts#L24-L45', -'_types.ScriptSort': '_types/sort.ts#L68-L74', -'_types.ScriptSortType': '_types/sort.ts#L76-L80', +'_types.ScriptSort': '_types/sort.ts#L73-L79', +'_types.ScriptSortType': '_types/sort.ts#L81-L85', '_types.ScriptTransform': '_types/Transform.ts#L36-L44', '_types.SearchStats': '_types/Stats.ts#L252-L271', '_types.SearchTransform': '_types/Transform.ts#L46-L49', '_types.SearchType': '_types/common.ts#L275-L280', '_types.SegmentsStats': '_types/Stats.ts#L273-L366', -'_types.ShardFailure': '_types/Errors.ts#L50-L56', +'_types.ShardFailure': '_types/Errors.ts#L52-L58', '_types.ShardStatistics': '_types/Stats.ts#L54-L66', '_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L93', '_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27', -'_types.Slices': '_types/common.ts#L361-L366', -'_types.SlicesCalculation': '_types/common.ts#L368-L376', -'_types.SortMode': '_types/sort.ts#L103-L112', -'_types.SortOptions': '_types/sort.ts#L82-L91', -'_types.SortOrder': '_types/sort.ts#L114-L123', +'_types.Slices': '_types/common.ts#L364-L369', +'_types.SlicesCalculation': '_types/common.ts#L371-L379', +'_types.SortMode': '_types/sort.ts#L109-L118', +'_types.SortOptions': '_types/sort.ts#L87-L97', +'_types.SortOrder': '_types/sort.ts#L120-L129', '_types.StandardRetriever': '_types/Retriever.ts#L43-L56', '_types.StoreStats': '_types/Stats.ts#L368-L395', '_types.StoredScript': '_types/Scripting.ts#L47-L57', '_types.StoredScriptId': '_types/Scripting.ts#L81-L86', '_types.SuggestMode': '_types/common.ts#L282-L295', -'_types.TaskFailure': '_types/Errors.ts#L66-L71', +'_types.TaskFailure': '_types/Errors.ts#L68-L73', '_types.TextEmbedding': '_types/Knn.ts#L74-L77', '_types.ThreadType': '_types/common.ts#L297-L303', '_types.TimeUnit': '_types/Time.ts#L69-L77', @@ -363,21 +363,21 @@ '_types.WarmerStats': '_types/Stats.ts#L407-L412', '_types.WktGeoBounds': '_types/Geo.ts#L150-L152', '_types.WriteResponseBase': '_types/Base.ts#L36-L45', -'_types.aggregations.AdjacencyMatrixAggregate': '_types/aggregations/Aggregate.ts#L573-L575', +'_types.aggregations.AdjacencyMatrixAggregate': '_types/aggregations/Aggregate.ts#L577-L579', '_types.aggregations.AdjacencyMatrixAggregation': '_types/aggregations/bucket.ts#L55-L65', -'_types.aggregations.AdjacencyMatrixBucket': '_types/aggregations/Aggregate.ts#L577-L579', +'_types.aggregations.AdjacencyMatrixBucket': '_types/aggregations/Aggregate.ts#L581-L583', '_types.aggregations.Aggregate': '_types/aggregations/Aggregate.ts#L38-L123', '_types.aggregations.AggregateBase': '_types/aggregations/Aggregate.ts#L134-L136', '_types.aggregations.Aggregation': '_types/aggregations/Aggregation.ts#L20-L20', '_types.aggregations.AggregationContainer': '_types/aggregations/AggregationContainer.ts#L105-L514', '_types.aggregations.AggregationRange': '_types/aggregations/bucket.ts#L674-L687', '_types.aggregations.ArrayPercentilesItem': '_types/aggregations/Aggregate.ts#L160-L164', -'_types.aggregations.AutoDateHistogramAggregate': '_types/aggregations/Aggregate.ts#L356-L360', +'_types.aggregations.AutoDateHistogramAggregate': '_types/aggregations/Aggregate.ts#L358-L362', '_types.aggregations.AutoDateHistogramAggregation': '_types/aggregations/bucket.ts#L67-L102', '_types.aggregations.AverageAggregation': '_types/aggregations/metric.ts#L55-L55', '_types.aggregations.AverageBucketAggregation': '_types/aggregations/pipeline.ts#L78-L78', '_types.aggregations.AvgAggregate': '_types/aggregations/Aggregate.ts#L209-L210', -'_types.aggregations.BoxPlotAggregate': '_types/aggregations/Aggregate.ts#L706-L722', +'_types.aggregations.BoxPlotAggregate': '_types/aggregations/Aggregate.ts#L713-L729', '_types.aggregations.BoxplotAggregation': '_types/aggregations/metric.ts#L57-L62', '_types.aggregations.BucketAggregationBase': '_types/aggregations/bucket.ts#L48-L53', '_types.aggregations.BucketCorrelationAggregation': '_types/aggregations/pipeline.ts#L129-L135', @@ -399,32 +399,32 @@ '_types.aggregations.CategorizeTextAggregation': '_types/aggregations/bucket.ts#L1045-L1109', '_types.aggregations.CategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1111-L1114', '_types.aggregations.ChiSquareHeuristic': '_types/aggregations/bucket.ts#L737-L746', -'_types.aggregations.ChildrenAggregate': '_types/aggregations/Aggregate.ts#L776-L777', +'_types.aggregations.ChildrenAggregate': '_types/aggregations/Aggregate.ts#L783-L784', '_types.aggregations.ChildrenAggregation': '_types/aggregations/bucket.ts#L113-L118', -'_types.aggregations.CompositeAggregate': '_types/aggregations/Aggregate.ts#L618-L623', +'_types.aggregations.CompositeAggregate': '_types/aggregations/Aggregate.ts#L622-L627', '_types.aggregations.CompositeAggregation': '_types/aggregations/bucket.ts#L122-L138', '_types.aggregations.CompositeAggregationBase': '_types/aggregations/bucket.ts#L159-L168', '_types.aggregations.CompositeAggregationSource': '_types/aggregations/bucket.ts#L140-L157', -'_types.aggregations.CompositeBucket': '_types/aggregations/Aggregate.ts#L625-L627', +'_types.aggregations.CompositeBucket': '_types/aggregations/Aggregate.ts#L629-L631', '_types.aggregations.CompositeDateHistogramAggregation': '_types/aggregations/bucket.ts#L176-L184', '_types.aggregations.CompositeGeoTileGridAggregation': '_types/aggregations/bucket.ts#L186-L189', '_types.aggregations.CompositeHistogramAggregation': '_types/aggregations/bucket.ts#L172-L174', '_types.aggregations.CompositeTermsAggregation': '_types/aggregations/bucket.ts#L170-L170', -'_types.aggregations.CumulativeCardinalityAggregate': '_types/aggregations/Aggregate.ts#L747-L755', +'_types.aggregations.CumulativeCardinalityAggregate': '_types/aggregations/Aggregate.ts#L754-L762', '_types.aggregations.CumulativeCardinalityAggregation': '_types/aggregations/pipeline.ts#L192-L192', '_types.aggregations.CumulativeSumAggregation': '_types/aggregations/pipeline.ts#L194-L194', '_types.aggregations.CustomCategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1116-L1120', -'_types.aggregations.DateHistogramAggregate': '_types/aggregations/Aggregate.ts#L348-L349', +'_types.aggregations.DateHistogramAggregate': '_types/aggregations/Aggregate.ts#L350-L351', '_types.aggregations.DateHistogramAggregation': '_types/aggregations/bucket.ts#L191-L249', -'_types.aggregations.DateHistogramBucket': '_types/aggregations/Aggregate.ts#L351-L354', -'_types.aggregations.DateRangeAggregate': '_types/aggregations/Aggregate.ts#L543-L548', +'_types.aggregations.DateHistogramBucket': '_types/aggregations/Aggregate.ts#L353-L356', +'_types.aggregations.DateRangeAggregate': '_types/aggregations/Aggregate.ts#L547-L552', '_types.aggregations.DateRangeAggregation': '_types/aggregations/bucket.ts#L270-L296', '_types.aggregations.DateRangeExpression': '_types/aggregations/bucket.ts#L307-L320', '_types.aggregations.DerivativeAggregate': '_types/aggregations/Aggregate.ts#L227-L231', '_types.aggregations.DerivativeAggregation': '_types/aggregations/pipeline.ts#L196-L196', '_types.aggregations.DiversifiedSamplerAggregation': '_types/aggregations/bucket.ts#L322-L343', -'_types.aggregations.DoubleTermsAggregate': '_types/aggregations/Aggregate.ts#L411-L416', -'_types.aggregations.DoubleTermsBucket': '_types/aggregations/Aggregate.ts#L418-L421', +'_types.aggregations.DoubleTermsAggregate': '_types/aggregations/Aggregate.ts#L413-L418', +'_types.aggregations.DoubleTermsBucket': '_types/aggregations/Aggregate.ts#L420-L423', '_types.aggregations.EwmaModelSettings': '_types/aggregations/pipeline.ts#L267-L269', '_types.aggregations.EwmaMovingAverageAggregation': '_types/aggregations/pipeline.ts#L252-L255', '_types.aggregations.ExtendedBounds': '_types/aggregations/bucket.ts#L491-L500', @@ -433,72 +433,72 @@ '_types.aggregations.ExtendedStatsBucketAggregate': '_types/aggregations/Aggregate.ts#L298-L299', '_types.aggregations.ExtendedStatsBucketAggregation': '_types/aggregations/pipeline.ts#L198-L203', '_types.aggregations.FieldDateMath': '_types/aggregations/bucket.ts#L298-L305', -'_types.aggregations.FilterAggregate': '_types/aggregations/Aggregate.ts#L495-L496', -'_types.aggregations.FiltersAggregate': '_types/aggregations/Aggregate.ts#L568-L569', +'_types.aggregations.FilterAggregate': '_types/aggregations/Aggregate.ts#L499-L500', +'_types.aggregations.FiltersAggregate': '_types/aggregations/Aggregate.ts#L572-L573', '_types.aggregations.FiltersAggregation': '_types/aggregations/bucket.ts#L360-L380', -'_types.aggregations.FiltersBucket': '_types/aggregations/Aggregate.ts#L571-L571', +'_types.aggregations.FiltersBucket': '_types/aggregations/Aggregate.ts#L575-L575', '_types.aggregations.FormatMetricAggregationBase': '_types/aggregations/metric.ts#L47-L49', '_types.aggregations.FormattableMetricAggregation': '_types/aggregations/metric.ts#L51-L53', -'_types.aggregations.FrequentItemSetsAggregate': '_types/aggregations/Aggregate.ts#L639-L640', +'_types.aggregations.FrequentItemSetsAggregate': '_types/aggregations/Aggregate.ts#L643-L644', '_types.aggregations.FrequentItemSetsAggregation': '_types/aggregations/bucket.ts#L1167-L1191', -'_types.aggregations.FrequentItemSetsBucket': '_types/aggregations/Aggregate.ts#L642-L645', +'_types.aggregations.FrequentItemSetsBucket': '_types/aggregations/Aggregate.ts#L646-L649', '_types.aggregations.FrequentItemSetsField': '_types/aggregations/bucket.ts#L1153-L1165', '_types.aggregations.GapPolicy': '_types/aggregations/pipeline.ts#L61-L76', '_types.aggregations.GeoBoundsAggregate': '_types/aggregations/Aggregate.ts#L303-L306', '_types.aggregations.GeoBoundsAggregation': '_types/aggregations/metric.ts#L108-L114', '_types.aggregations.GeoCentroidAggregate': '_types/aggregations/Aggregate.ts#L308-L312', '_types.aggregations.GeoCentroidAggregation': '_types/aggregations/metric.ts#L116-L119', -'_types.aggregations.GeoDistanceAggregate': '_types/aggregations/Aggregate.ts#L550-L554', +'_types.aggregations.GeoDistanceAggregate': '_types/aggregations/Aggregate.ts#L554-L558', '_types.aggregations.GeoDistanceAggregation': '_types/aggregations/bucket.ts#L382-L405', -'_types.aggregations.GeoHashGridAggregate': '_types/aggregations/Aggregate.ts#L506-L508', +'_types.aggregations.GeoHashGridAggregate': '_types/aggregations/Aggregate.ts#L510-L512', '_types.aggregations.GeoHashGridAggregation': '_types/aggregations/bucket.ts#L407-L432', -'_types.aggregations.GeoHashGridBucket': '_types/aggregations/Aggregate.ts#L510-L512', -'_types.aggregations.GeoHexGridAggregate': '_types/aggregations/Aggregate.ts#L522-L523', -'_types.aggregations.GeoHexGridBucket': '_types/aggregations/Aggregate.ts#L525-L527', -'_types.aggregations.GeoLineAggregate': '_types/aggregations/Aggregate.ts#L784-L791', +'_types.aggregations.GeoHashGridBucket': '_types/aggregations/Aggregate.ts#L514-L516', +'_types.aggregations.GeoHexGridAggregate': '_types/aggregations/Aggregate.ts#L526-L527', +'_types.aggregations.GeoHexGridBucket': '_types/aggregations/Aggregate.ts#L529-L531', +'_types.aggregations.GeoLineAggregate': '_types/aggregations/Aggregate.ts#L791-L798', '_types.aggregations.GeoLineAggregation': '_types/aggregations/metric.ts#L121-L146', '_types.aggregations.GeoLinePoint': '_types/aggregations/metric.ts#L155-L160', '_types.aggregations.GeoLineSort': '_types/aggregations/metric.ts#L148-L153', -'_types.aggregations.GeoTileGridAggregate': '_types/aggregations/Aggregate.ts#L514-L516', +'_types.aggregations.GeoTileGridAggregate': '_types/aggregations/Aggregate.ts#L518-L520', '_types.aggregations.GeoTileGridAggregation': '_types/aggregations/bucket.ts#L434-L460', -'_types.aggregations.GeoTileGridBucket': '_types/aggregations/Aggregate.ts#L518-L520', +'_types.aggregations.GeoTileGridBucket': '_types/aggregations/Aggregate.ts#L522-L524', '_types.aggregations.GeohexGridAggregation': '_types/aggregations/bucket.ts#L462-L487', -'_types.aggregations.GlobalAggregate': '_types/aggregations/Aggregate.ts#L492-L493', +'_types.aggregations.GlobalAggregate': '_types/aggregations/Aggregate.ts#L496-L497', '_types.aggregations.GlobalAggregation': '_types/aggregations/bucket.ts#L489-L489', '_types.aggregations.GoogleNormalizedDistanceHeuristic': '_types/aggregations/bucket.ts#L748-L753', '_types.aggregations.HdrMethod': '_types/aggregations/metric.ts#L216-L221', '_types.aggregations.HdrPercentileRanksAggregate': '_types/aggregations/Aggregate.ts#L169-L170', '_types.aggregations.HdrPercentilesAggregate': '_types/aggregations/Aggregate.ts#L166-L167', -'_types.aggregations.HistogramAggregate': '_types/aggregations/Aggregate.ts#L340-L341', +'_types.aggregations.HistogramAggregate': '_types/aggregations/Aggregate.ts#L342-L343', '_types.aggregations.HistogramAggregation': '_types/aggregations/bucket.ts#L502-L548', -'_types.aggregations.HistogramBucket': '_types/aggregations/Aggregate.ts#L343-L346', +'_types.aggregations.HistogramBucket': '_types/aggregations/Aggregate.ts#L345-L348', '_types.aggregations.HoltLinearModelSettings': '_types/aggregations/pipeline.ts#L271-L274', '_types.aggregations.HoltMovingAverageAggregation': '_types/aggregations/pipeline.ts#L257-L260', '_types.aggregations.HoltWintersModelSettings': '_types/aggregations/pipeline.ts#L275-L282', '_types.aggregations.HoltWintersMovingAverageAggregation': '_types/aggregations/pipeline.ts#L262-L265', '_types.aggregations.HoltWintersType': '_types/aggregations/pipeline.ts#L283-L286', -'_types.aggregations.InferenceAggregate': '_types/aggregations/Aggregate.ts#L659-L670', +'_types.aggregations.InferenceAggregate': '_types/aggregations/Aggregate.ts#L663-L677', '_types.aggregations.InferenceAggregation': '_types/aggregations/pipeline.ts#L205-L214', -'_types.aggregations.InferenceClassImportance': '_types/aggregations/Aggregate.ts#L684-L687', +'_types.aggregations.InferenceClassImportance': '_types/aggregations/Aggregate.ts#L691-L694', '_types.aggregations.InferenceConfigContainer': '_types/aggregations/pipeline.ts#L216-L222', -'_types.aggregations.InferenceFeatureImportance': '_types/aggregations/Aggregate.ts#L678-L682', -'_types.aggregations.InferenceTopClassEntry': '_types/aggregations/Aggregate.ts#L672-L676', -'_types.aggregations.IpPrefixAggregate': '_types/aggregations/Aggregate.ts#L629-L630', +'_types.aggregations.InferenceFeatureImportance': '_types/aggregations/Aggregate.ts#L685-L689', +'_types.aggregations.InferenceTopClassEntry': '_types/aggregations/Aggregate.ts#L679-L683', +'_types.aggregations.IpPrefixAggregate': '_types/aggregations/Aggregate.ts#L633-L634', '_types.aggregations.IpPrefixAggregation': '_types/aggregations/bucket.ts#L1122-L1151', -'_types.aggregations.IpPrefixBucket': '_types/aggregations/Aggregate.ts#L632-L637', -'_types.aggregations.IpRangeAggregate': '_types/aggregations/Aggregate.ts#L556-L558', +'_types.aggregations.IpPrefixBucket': '_types/aggregations/Aggregate.ts#L636-L641', +'_types.aggregations.IpRangeAggregate': '_types/aggregations/Aggregate.ts#L560-L562', '_types.aggregations.IpRangeAggregation': '_types/aggregations/bucket.ts#L550-L559', '_types.aggregations.IpRangeAggregationRange': '_types/aggregations/bucket.ts#L561-L574', -'_types.aggregations.IpRangeBucket': '_types/aggregations/Aggregate.ts#L560-L564', +'_types.aggregations.IpRangeBucket': '_types/aggregations/Aggregate.ts#L564-L568', '_types.aggregations.LinearMovingAverageAggregation': '_types/aggregations/pipeline.ts#L242-L245', -'_types.aggregations.LongRareTermsAggregate': '_types/aggregations/Aggregate.ts#L431-L436', -'_types.aggregations.LongRareTermsBucket': '_types/aggregations/Aggregate.ts#L438-L441', -'_types.aggregations.LongTermsAggregate': '_types/aggregations/Aggregate.ts#L399-L404', -'_types.aggregations.LongTermsBucket': '_types/aggregations/Aggregate.ts#L406-L409', +'_types.aggregations.LongRareTermsAggregate': '_types/aggregations/Aggregate.ts#L433-L438', +'_types.aggregations.LongRareTermsBucket': '_types/aggregations/Aggregate.ts#L440-L443', +'_types.aggregations.LongTermsAggregate': '_types/aggregations/Aggregate.ts#L401-L406', +'_types.aggregations.LongTermsBucket': '_types/aggregations/Aggregate.ts#L408-L411', '_types.aggregations.MatrixAggregation': '_types/aggregations/matrix.ts#L26-L36', -'_types.aggregations.MatrixStatsAggregate': '_types/aggregations/Aggregate.ts#L757-L761', +'_types.aggregations.MatrixStatsAggregate': '_types/aggregations/Aggregate.ts#L764-L768', '_types.aggregations.MatrixStatsAggregation': '_types/aggregations/matrix.ts#L38-L44', -'_types.aggregations.MatrixStatsFields': '_types/aggregations/Aggregate.ts#L763-L772', +'_types.aggregations.MatrixStatsFields': '_types/aggregations/Aggregate.ts#L770-L779', '_types.aggregations.MaxAggregate': '_types/aggregations/Aggregate.ts#L200-L201', '_types.aggregations.MaxAggregation': '_types/aggregations/metric.ts#L162-L162', '_types.aggregations.MaxBucketAggregation': '_types/aggregations/pipeline.ts#L224-L224', @@ -509,7 +509,7 @@ '_types.aggregations.MinAggregation': '_types/aggregations/metric.ts#L172-L172', '_types.aggregations.MinBucketAggregation': '_types/aggregations/pipeline.ts#L226-L226', '_types.aggregations.MinimumInterval': '_types/aggregations/bucket.ts#L104-L111', -'_types.aggregations.MissingAggregate': '_types/aggregations/Aggregate.ts#L483-L484', +'_types.aggregations.MissingAggregate': '_types/aggregations/Aggregate.ts#L487-L488', '_types.aggregations.MissingAggregation': '_types/aggregations/bucket.ts#L576-L582', '_types.aggregations.MissingOrder': '_types/aggregations/AggregationContainer.ts#L517-L521', '_types.aggregations.MovingAverageAggregation': '_types/aggregations/pipeline.ts#L228-L234', @@ -517,17 +517,17 @@ '_types.aggregations.MovingFunctionAggregation': '_types/aggregations/pipeline.ts#L288-L303', '_types.aggregations.MovingPercentilesAggregation': '_types/aggregations/pipeline.ts#L305-L317', '_types.aggregations.MultiBucketAggregateBase': '_types/aggregations/Aggregate.ts#L327-L329', -'_types.aggregations.MultiBucketBase': '_types/aggregations/Aggregate.ts#L331-L338', +'_types.aggregations.MultiBucketBase': '_types/aggregations/Aggregate.ts#L331-L340', '_types.aggregations.MultiTermLookup': '_types/aggregations/bucket.ts#L626-L636', -'_types.aggregations.MultiTermsAggregate': '_types/aggregations/Aggregate.ts#L461-L463', +'_types.aggregations.MultiTermsAggregate': '_types/aggregations/Aggregate.ts#L463-L465', '_types.aggregations.MultiTermsAggregation': '_types/aggregations/bucket.ts#L584-L624', -'_types.aggregations.MultiTermsBucket': '_types/aggregations/Aggregate.ts#L465-L469', +'_types.aggregations.MultiTermsBucket': '_types/aggregations/Aggregate.ts#L467-L471', '_types.aggregations.MutualInformationHeuristic': '_types/aggregations/bucket.ts#L755-L764', -'_types.aggregations.NestedAggregate': '_types/aggregations/Aggregate.ts#L486-L487', +'_types.aggregations.NestedAggregate': '_types/aggregations/Aggregate.ts#L490-L491', '_types.aggregations.NestedAggregation': '_types/aggregations/bucket.ts#L638-L643', '_types.aggregations.NormalizeAggregation': '_types/aggregations/pipeline.ts#L319-L324', '_types.aggregations.NormalizeMethod': '_types/aggregations/pipeline.ts#L326-L352', -'_types.aggregations.ParentAggregate': '_types/aggregations/Aggregate.ts#L779-L780', +'_types.aggregations.ParentAggregate': '_types/aggregations/Aggregate.ts#L786-L787', '_types.aggregations.ParentAggregation': '_types/aggregations/bucket.ts#L645-L650', '_types.aggregations.PercentageScoreHeuristic': '_types/aggregations/bucket.ts#L766-L766', '_types.aggregations.PercentileRanksAggregation': '_types/aggregations/metric.ts#L174-L193', @@ -537,33 +537,33 @@ '_types.aggregations.PercentilesBucketAggregate': '_types/aggregations/Aggregate.ts#L178-L179', '_types.aggregations.PercentilesBucketAggregation': '_types/aggregations/pipeline.ts#L354-L359', '_types.aggregations.PipelineAggregationBase': '_types/aggregations/pipeline.ts#L39-L51', -'_types.aggregations.RangeAggregate': '_types/aggregations/Aggregate.ts#L531-L532', +'_types.aggregations.RangeAggregate': '_types/aggregations/Aggregate.ts#L535-L536', '_types.aggregations.RangeAggregation': '_types/aggregations/bucket.ts#L652-L672', -'_types.aggregations.RangeBucket': '_types/aggregations/Aggregate.ts#L534-L541', +'_types.aggregations.RangeBucket': '_types/aggregations/Aggregate.ts#L538-L545', '_types.aggregations.RareTermsAggregation': '_types/aggregations/bucket.ts#L689-L719', -'_types.aggregations.RateAggregate': '_types/aggregations/Aggregate.ts#L741-L745', +'_types.aggregations.RateAggregate': '_types/aggregations/Aggregate.ts#L748-L752', '_types.aggregations.RateAggregation': '_types/aggregations/metric.ts#L230-L241', '_types.aggregations.RateMode': '_types/aggregations/metric.ts#L243-L252', -'_types.aggregations.ReverseNestedAggregate': '_types/aggregations/Aggregate.ts#L489-L490', +'_types.aggregations.ReverseNestedAggregate': '_types/aggregations/Aggregate.ts#L493-L494', '_types.aggregations.ReverseNestedAggregation': '_types/aggregations/bucket.ts#L721-L727', -'_types.aggregations.SamplerAggregate': '_types/aggregations/Aggregate.ts#L498-L499', +'_types.aggregations.SamplerAggregate': '_types/aggregations/Aggregate.ts#L502-L503', '_types.aggregations.SamplerAggregation': '_types/aggregations/bucket.ts#L729-L735', '_types.aggregations.SamplerAggregationExecutionHint': '_types/aggregations/bucket.ts#L345-L358', '_types.aggregations.ScriptedHeuristic': '_types/aggregations/bucket.ts#L768-L770', -'_types.aggregations.ScriptedMetricAggregate': '_types/aggregations/Aggregate.ts#L649-L652', +'_types.aggregations.ScriptedMetricAggregate': '_types/aggregations/Aggregate.ts#L653-L656', '_types.aggregations.ScriptedMetricAggregation': '_types/aggregations/metric.ts#L254-L280', '_types.aggregations.SerialDifferencingAggregation': '_types/aggregations/pipeline.ts#L361-L367', -'_types.aggregations.SignificantLongTermsAggregate': '_types/aggregations/Aggregate.ts#L588-L590', -'_types.aggregations.SignificantLongTermsBucket': '_types/aggregations/Aggregate.ts#L597-L600', -'_types.aggregations.SignificantStringTermsAggregate': '_types/aggregations/Aggregate.ts#L602-L604', -'_types.aggregations.SignificantStringTermsBucket': '_types/aggregations/Aggregate.ts#L606-L608', -'_types.aggregations.SignificantTermsAggregateBase': '_types/aggregations/Aggregate.ts#L581-L586', +'_types.aggregations.SignificantLongTermsAggregate': '_types/aggregations/Aggregate.ts#L592-L594', +'_types.aggregations.SignificantLongTermsBucket': '_types/aggregations/Aggregate.ts#L601-L604', +'_types.aggregations.SignificantStringTermsAggregate': '_types/aggregations/Aggregate.ts#L606-L608', +'_types.aggregations.SignificantStringTermsBucket': '_types/aggregations/Aggregate.ts#L610-L612', +'_types.aggregations.SignificantTermsAggregateBase': '_types/aggregations/Aggregate.ts#L585-L590', '_types.aggregations.SignificantTermsAggregation': '_types/aggregations/bucket.ts#L772-L836', -'_types.aggregations.SignificantTermsBucketBase': '_types/aggregations/Aggregate.ts#L592-L595', +'_types.aggregations.SignificantTermsBucketBase': '_types/aggregations/Aggregate.ts#L596-L599', '_types.aggregations.SignificantTextAggregation': '_types/aggregations/bucket.ts#L838-L910', '_types.aggregations.SimpleMovingAverageAggregation': '_types/aggregations/pipeline.ts#L247-L250', '_types.aggregations.SimpleValueAggregate': '_types/aggregations/Aggregate.ts#L224-L225', -'_types.aggregations.SingleBucketAggregateBase': '_types/aggregations/Aggregate.ts#L473-L481', +'_types.aggregations.SingleBucketAggregateBase': '_types/aggregations/Aggregate.ts#L475-L485', '_types.aggregations.SingleMetricAggregateBase': '_types/aggregations/Aggregate.ts#L183-L192', '_types.aggregations.StandardDeviationBounds': '_types/aggregations/Aggregate.ts#L260-L267', '_types.aggregations.StandardDeviationBoundsAsString': '_types/aggregations/Aggregate.ts#L269-L276', @@ -571,46 +571,46 @@ '_types.aggregations.StatsAggregation': '_types/aggregations/metric.ts#L282-L282', '_types.aggregations.StatsBucketAggregate': '_types/aggregations/Aggregate.ts#L257-L258', '_types.aggregations.StatsBucketAggregation': '_types/aggregations/pipeline.ts#L369-L369', -'_types.aggregations.StringRareTermsAggregate': '_types/aggregations/Aggregate.ts#L443-L447', -'_types.aggregations.StringRareTermsBucket': '_types/aggregations/Aggregate.ts#L449-L451', -'_types.aggregations.StringStatsAggregate': '_types/aggregations/Aggregate.ts#L693-L704', +'_types.aggregations.StringRareTermsAggregate': '_types/aggregations/Aggregate.ts#L445-L449', +'_types.aggregations.StringRareTermsBucket': '_types/aggregations/Aggregate.ts#L451-L453', +'_types.aggregations.StringStatsAggregate': '_types/aggregations/Aggregate.ts#L700-L711', '_types.aggregations.StringStatsAggregation': '_types/aggregations/metric.ts#L284-L290', -'_types.aggregations.StringTermsAggregate': '_types/aggregations/Aggregate.ts#L384-L389', -'_types.aggregations.StringTermsBucket': '_types/aggregations/Aggregate.ts#L395-L397', +'_types.aggregations.StringTermsAggregate': '_types/aggregations/Aggregate.ts#L386-L391', +'_types.aggregations.StringTermsBucket': '_types/aggregations/Aggregate.ts#L397-L399', '_types.aggregations.SumAggregate': '_types/aggregations/Aggregate.ts#L203-L207', '_types.aggregations.SumAggregation': '_types/aggregations/metric.ts#L292-L292', '_types.aggregations.SumBucketAggregation': '_types/aggregations/pipeline.ts#L371-L371', '_types.aggregations.TDigest': '_types/aggregations/metric.ts#L223-L228', '_types.aggregations.TDigestPercentileRanksAggregate': '_types/aggregations/Aggregate.ts#L175-L176', '_types.aggregations.TDigestPercentilesAggregate': '_types/aggregations/Aggregate.ts#L172-L173', -'_types.aggregations.TTestAggregate': '_types/aggregations/Aggregate.ts#L735-L739', +'_types.aggregations.TTestAggregate': '_types/aggregations/Aggregate.ts#L742-L746', '_types.aggregations.TTestAggregation': '_types/aggregations/metric.ts#L294-L308', '_types.aggregations.TTestType': '_types/aggregations/metric.ts#L322-L335', -'_types.aggregations.TermsAggregateBase': '_types/aggregations/Aggregate.ts#L377-L382', +'_types.aggregations.TermsAggregateBase': '_types/aggregations/Aggregate.ts#L379-L384', '_types.aggregations.TermsAggregation': '_types/aggregations/bucket.ts#L912-L977', '_types.aggregations.TermsAggregationCollectMode': '_types/aggregations/bucket.ts#L987-L996', '_types.aggregations.TermsAggregationExecutionHint': '_types/aggregations/bucket.ts#L998-L1003', -'_types.aggregations.TermsBucketBase': '_types/aggregations/Aggregate.ts#L391-L393', +'_types.aggregations.TermsBucketBase': '_types/aggregations/Aggregate.ts#L393-L395', '_types.aggregations.TermsExclude': '_types/aggregations/bucket.ts#L1008-L1009', '_types.aggregations.TermsInclude': '_types/aggregations/bucket.ts#L1005-L1006', '_types.aggregations.TermsPartition': '_types/aggregations/bucket.ts#L1011-L1020', '_types.aggregations.TestPopulation': '_types/aggregations/metric.ts#L310-L320', -'_types.aggregations.TopHitsAggregate': '_types/aggregations/Aggregate.ts#L654-L657', +'_types.aggregations.TopHitsAggregate': '_types/aggregations/Aggregate.ts#L658-L661', '_types.aggregations.TopHitsAggregation': '_types/aggregations/metric.ts#L337-L397', -'_types.aggregations.TopMetrics': '_types/aggregations/Aggregate.ts#L729-L733', -'_types.aggregations.TopMetricsAggregate': '_types/aggregations/Aggregate.ts#L724-L727', +'_types.aggregations.TopMetrics': '_types/aggregations/Aggregate.ts#L736-L740', +'_types.aggregations.TopMetricsAggregate': '_types/aggregations/Aggregate.ts#L731-L734', '_types.aggregations.TopMetricsAggregation': '_types/aggregations/metric.ts#L399-L413', '_types.aggregations.TopMetricsValue': '_types/aggregations/metric.ts#L415-L420', -'_types.aggregations.UnmappedRareTermsAggregate': '_types/aggregations/Aggregate.ts#L453-L459', -'_types.aggregations.UnmappedSamplerAggregate': '_types/aggregations/Aggregate.ts#L501-L502', -'_types.aggregations.UnmappedSignificantTermsAggregate': '_types/aggregations/Aggregate.ts#L610-L616', -'_types.aggregations.UnmappedTermsAggregate': '_types/aggregations/Aggregate.ts#L423-L429', +'_types.aggregations.UnmappedRareTermsAggregate': '_types/aggregations/Aggregate.ts#L455-L461', +'_types.aggregations.UnmappedSamplerAggregate': '_types/aggregations/Aggregate.ts#L505-L506', +'_types.aggregations.UnmappedSignificantTermsAggregate': '_types/aggregations/Aggregate.ts#L614-L620', +'_types.aggregations.UnmappedTermsAggregate': '_types/aggregations/Aggregate.ts#L425-L431', '_types.aggregations.ValueCountAggregate': '_types/aggregations/Aggregate.ts#L218-L222', '_types.aggregations.ValueCountAggregation': '_types/aggregations/metric.ts#L422-L422', '_types.aggregations.ValueType': '_types/aggregations/metric.ts#L424-L435', -'_types.aggregations.VariableWidthHistogramAggregate': '_types/aggregations/Aggregate.ts#L362-L364', +'_types.aggregations.VariableWidthHistogramAggregate': '_types/aggregations/Aggregate.ts#L364-L366', '_types.aggregations.VariableWidthHistogramAggregation': '_types/aggregations/bucket.ts#L1022-L1043', -'_types.aggregations.VariableWidthHistogramBucket': '_types/aggregations/Aggregate.ts#L366-L373', +'_types.aggregations.VariableWidthHistogramBucket': '_types/aggregations/Aggregate.ts#L368-L375', '_types.aggregations.WeightedAverageAggregation': '_types/aggregations/metric.ts#L437-L451', '_types.aggregations.WeightedAverageValue': '_types/aggregations/metric.ts#L453-L463', '_types.aggregations.WeightedAvgAggregate': '_types/aggregations/Aggregate.ts#L212-L216', @@ -809,40 +809,46 @@ '_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L177-L180', '_types.mapping.VersionProperty': '_types/mapping/core.ts#L287-L289', '_types.mapping.WildcardProperty': '_types/mapping/core.ts#L291-L298', -'_types.query_dsl.BoolQuery': '_types/query_dsl/compound.ts#L28-L52', -'_types.query_dsl.BoostingQuery': '_types/query_dsl/compound.ts#L54-L67', +'_types.query_dsl.BoolQuery': '_types/query_dsl/compound.ts#L29-L53', +'_types.query_dsl.BoostingQuery': '_types/query_dsl/compound.ts#L55-L68', '_types.query_dsl.ChildScoreMode': '_types/query_dsl/joining.ts#L25-L39', '_types.query_dsl.CombinedFieldsOperator': '_types/query_dsl/abstractions.ts#L509-L512', '_types.query_dsl.CombinedFieldsQuery': '_types/query_dsl/abstractions.ts#L465-L499', '_types.query_dsl.CombinedFieldsZeroTerms': '_types/query_dsl/abstractions.ts#L514-L523', '_types.query_dsl.CommonTermsQuery': '_types/query_dsl/fulltext.ts#L34-L44', -'_types.query_dsl.ConstantScoreQuery': '_types/query_dsl/compound.ts#L69-L76', -'_types.query_dsl.DecayFunction': '_types/query_dsl/compound.ts#L194-L199', -'_types.query_dsl.DecayFunctionBase': '_types/query_dsl/compound.ts#L174-L180', -'_types.query_dsl.DecayPlacement': '_types/query_dsl/compound.ts#L153-L172', -'_types.query_dsl.DisMaxQuery': '_types/query_dsl/compound.ts#L78-L90', -'_types.query_dsl.DistanceFeatureQuery': '_types/query_dsl/specialized.ts#L40-L60', -'_types.query_dsl.ExistsQuery': '_types/query_dsl/term.ts#L36-L41', +'_types.query_dsl.ConstantScoreQuery': '_types/query_dsl/compound.ts#L70-L77', +'_types.query_dsl.DateDecayFunction': '_types/query_dsl/compound.ts#L193-L193', +'_types.query_dsl.DateDistanceFeatureQuery': '_types/query_dsl/specialized.ts#L72-L75', +'_types.query_dsl.DateRangeQuery': '_types/query_dsl/term.ts#L146-L155', +'_types.query_dsl.DecayFunction': '_types/query_dsl/compound.ts#L199-L208', +'_types.query_dsl.DecayFunctionBase': '_types/query_dsl/compound.ts#L175-L186', +'_types.query_dsl.DecayPlacement': '_types/query_dsl/compound.ts#L154-L173', +'_types.query_dsl.DisMaxQuery': '_types/query_dsl/compound.ts#L79-L91', +'_types.query_dsl.DistanceFeatureQuery': '_types/query_dsl/specialized.ts#L77-L85', +'_types.query_dsl.DistanceFeatureQueryBase': '_types/query_dsl/specialized.ts#L40-L60', +'_types.query_dsl.ExistsQuery': '_types/query_dsl/term.ts#L37-L42', '_types.query_dsl.FieldAndFormat': '_types/query_dsl/abstractions.ts#L525-L539', '_types.query_dsl.FieldLookup': '_types/query_dsl/abstractions.ts#L429-L446', -'_types.query_dsl.FieldValueFactorModifier': '_types/query_dsl/compound.ts#L298-L341', -'_types.query_dsl.FieldValueFactorScoreFunction': '_types/query_dsl/compound.ts#L132-L151', -'_types.query_dsl.FunctionBoostMode': '_types/query_dsl/compound.ts#L270-L296', -'_types.query_dsl.FunctionScoreContainer': '_types/query_dsl/compound.ts#L201-L241', -'_types.query_dsl.FunctionScoreMode': '_types/query_dsl/compound.ts#L243-L268', -'_types.query_dsl.FunctionScoreQuery': '_types/query_dsl/compound.ts#L92-L118', -'_types.query_dsl.FuzzyQuery': '_types/query_dsl/term.ts#L43-L78', -'_types.query_dsl.GeoBoundingBoxQuery': '_types/query_dsl/geo.ts#L32-L50', -'_types.query_dsl.GeoDistanceQuery': '_types/query_dsl/geo.ts#L57-L85', -'_types.query_dsl.GeoExecution': '_types/query_dsl/geo.ts#L52-L55', -'_types.query_dsl.GeoPolygonPoints': '_types/query_dsl/geo.ts#L87-L89', -'_types.query_dsl.GeoPolygonQuery': '_types/query_dsl/geo.ts#L91-L99', -'_types.query_dsl.GeoShapeFieldQuery': '_types/query_dsl/geo.ts#L106-L117', -'_types.query_dsl.GeoShapeQuery': '_types/query_dsl/geo.ts#L121-L131', -'_types.query_dsl.GeoValidationMethod': '_types/query_dsl/geo.ts#L147-L157', +'_types.query_dsl.FieldValueFactorModifier': '_types/query_dsl/compound.ts#L307-L350', +'_types.query_dsl.FieldValueFactorScoreFunction': '_types/query_dsl/compound.ts#L133-L152', +'_types.query_dsl.FunctionBoostMode': '_types/query_dsl/compound.ts#L279-L305', +'_types.query_dsl.FunctionScoreContainer': '_types/query_dsl/compound.ts#L210-L250', +'_types.query_dsl.FunctionScoreMode': '_types/query_dsl/compound.ts#L252-L277', +'_types.query_dsl.FunctionScoreQuery': '_types/query_dsl/compound.ts#L93-L119', +'_types.query_dsl.FuzzyQuery': '_types/query_dsl/term.ts#L44-L79', +'_types.query_dsl.GeoBoundingBoxQuery': '_types/query_dsl/geo.ts#L32-L53', +'_types.query_dsl.GeoDecayFunction': '_types/query_dsl/compound.ts#L194-L197', +'_types.query_dsl.GeoDistanceFeatureQuery': '_types/query_dsl/specialized.ts#L67-L70', +'_types.query_dsl.GeoDistanceQuery': '_types/query_dsl/geo.ts#L60-L91', +'_types.query_dsl.GeoExecution': '_types/query_dsl/geo.ts#L55-L58', +'_types.query_dsl.GeoPolygonPoints': '_types/query_dsl/geo.ts#L93-L95', +'_types.query_dsl.GeoPolygonQuery': '_types/query_dsl/geo.ts#L97-L108', +'_types.query_dsl.GeoShapeFieldQuery': '_types/query_dsl/geo.ts#L115-L126', +'_types.query_dsl.GeoShapeQuery': '_types/query_dsl/geo.ts#L128-L143', +'_types.query_dsl.GeoValidationMethod': '_types/query_dsl/geo.ts#L159-L169', '_types.query_dsl.HasChildQuery': '_types/query_dsl/joining.ts#L41-L76', '_types.query_dsl.HasParentQuery': '_types/query_dsl/joining.ts#L78-L104', -'_types.query_dsl.IdsQuery': '_types/query_dsl/term.ts#L80-L85', +'_types.query_dsl.IdsQuery': '_types/query_dsl/term.ts#L81-L86', '_types.query_dsl.IntervalsAllOf': '_types/query_dsl/fulltext.ts#L50-L70', '_types.query_dsl.IntervalsAnyOf': '_types/query_dsl/fulltext.ts#L72-L81', '_types.query_dsl.IntervalsContainer': '_types/query_dsl/fulltext.ts#L83-L110', @@ -852,45 +858,47 @@ '_types.query_dsl.IntervalsPrefix': '_types/query_dsl/fulltext.ts#L218-L233', '_types.query_dsl.IntervalsQuery': '_types/query_dsl/fulltext.ts#L235-L263', '_types.query_dsl.IntervalsWildcard': '_types/query_dsl/fulltext.ts#L265-L280', -'_types.query_dsl.Like': '_types/query_dsl/specialized.ts#L186-L191', -'_types.query_dsl.LikeDocument': '_types/query_dsl/specialized.ts#L162-L184', +'_types.query_dsl.Like': '_types/query_dsl/specialized.ts#L195-L200', +'_types.query_dsl.LikeDocument': '_types/query_dsl/specialized.ts#L171-L193', '_types.query_dsl.MatchAllQuery': '_types/query_dsl/MatchAllQuery.ts#L22-L22', '_types.query_dsl.MatchBoolPrefixQuery': '_types/query_dsl/fulltext.ts#L349-L403', '_types.query_dsl.MatchNoneQuery': '_types/query_dsl/MatchNoneQuery.ts#L22-L22', '_types.query_dsl.MatchPhrasePrefixQuery': '_types/query_dsl/fulltext.ts#L428-L454', '_types.query_dsl.MatchPhraseQuery': '_types/query_dsl/fulltext.ts#L405-L426', '_types.query_dsl.MatchQuery': '_types/query_dsl/fulltext.ts#L282-L347', -'_types.query_dsl.MoreLikeThisQuery': '_types/query_dsl/specialized.ts#L78-L160', +'_types.query_dsl.MoreLikeThisQuery': '_types/query_dsl/specialized.ts#L87-L169', '_types.query_dsl.MultiMatchQuery': '_types/query_dsl/fulltext.ts#L456-L539', -'_types.query_dsl.MultiValueMode': '_types/query_dsl/compound.ts#L343-L360', +'_types.query_dsl.MultiValueMode': '_types/query_dsl/compound.ts#L352-L369', '_types.query_dsl.NestedQuery': '_types/query_dsl/joining.ts#L106-L130', +'_types.query_dsl.NumberRangeQuery': '_types/query_dsl/term.ts#L157-L157', +'_types.query_dsl.NumericDecayFunction': '_types/query_dsl/compound.ts#L192-L192', '_types.query_dsl.Operator': '_types/query_dsl/Operator.ts#L22-L27', '_types.query_dsl.ParentIdQuery': '_types/query_dsl/joining.ts#L132-L146', -'_types.query_dsl.PercolateQuery': '_types/query_dsl/specialized.ts#L193-L230', -'_types.query_dsl.PinnedDoc': '_types/query_dsl/specialized.ts#L253-L262', -'_types.query_dsl.PinnedQuery': '_types/query_dsl/specialized.ts#L232-L251', -'_types.query_dsl.PrefixQuery': '_types/query_dsl/term.ts#L87-L106', +'_types.query_dsl.PercolateQuery': '_types/query_dsl/specialized.ts#L202-L239', +'_types.query_dsl.PinnedDoc': '_types/query_dsl/specialized.ts#L262-L271', +'_types.query_dsl.PinnedQuery': '_types/query_dsl/specialized.ts#L241-L260', +'_types.query_dsl.PrefixQuery': '_types/query_dsl/term.ts#L88-L107', '_types.query_dsl.QueryBase': '_types/query_dsl/abstractions.ts#L452-L463', '_types.query_dsl.QueryContainer': '_types/query_dsl/abstractions.ts#L102-L427', '_types.query_dsl.QueryStringQuery': '_types/query_dsl/fulltext.ts#L580-L700', -'_types.query_dsl.RandomScoreFunction': '_types/query_dsl/compound.ts#L127-L130', -'_types.query_dsl.RangeQuery': '_types/query_dsl/term.ts#L116-L143', -'_types.query_dsl.RangeQueryBase': '_types/query_dsl/term.ts#L108-L114', -'_types.query_dsl.RangeRelation': '_types/query_dsl/term.ts#L191-L204', -'_types.query_dsl.RankFeatureFunction': '_types/query_dsl/specialized.ts#L264-L264', -'_types.query_dsl.RankFeatureFunctionLinear': '_types/query_dsl/specialized.ts#L266-L266', -'_types.query_dsl.RankFeatureFunctionLogarithm': '_types/query_dsl/specialized.ts#L268-L273', -'_types.query_dsl.RankFeatureFunctionSaturation': '_types/query_dsl/specialized.ts#L275-L280', -'_types.query_dsl.RankFeatureFunctionSigmoid': '_types/query_dsl/specialized.ts#L282-L291', -'_types.query_dsl.RankFeatureQuery': '_types/query_dsl/specialized.ts#L293-L316', -'_types.query_dsl.RegexpQuery': '_types/query_dsl/term.ts#L206-L236', -'_types.query_dsl.RuleQuery': '_types/query_dsl/specialized.ts#L369-L373', -'_types.query_dsl.ScriptQuery': '_types/query_dsl/specialized.ts#L318-L324', -'_types.query_dsl.ScriptScoreFunction': '_types/query_dsl/compound.ts#L120-L125', -'_types.query_dsl.ScriptScoreQuery': '_types/query_dsl/specialized.ts#L326-L340', +'_types.query_dsl.RandomScoreFunction': '_types/query_dsl/compound.ts#L128-L131', +'_types.query_dsl.RangeQuery': '_types/query_dsl/term.ts#L161-L170', +'_types.query_dsl.RangeQueryBase': '_types/query_dsl/term.ts#L109-L133', +'_types.query_dsl.RangeRelation': '_types/query_dsl/term.ts#L172-L185', +'_types.query_dsl.RankFeatureFunction': '_types/query_dsl/specialized.ts#L273-L273', +'_types.query_dsl.RankFeatureFunctionLinear': '_types/query_dsl/specialized.ts#L275-L275', +'_types.query_dsl.RankFeatureFunctionLogarithm': '_types/query_dsl/specialized.ts#L277-L282', +'_types.query_dsl.RankFeatureFunctionSaturation': '_types/query_dsl/specialized.ts#L284-L289', +'_types.query_dsl.RankFeatureFunctionSigmoid': '_types/query_dsl/specialized.ts#L291-L300', +'_types.query_dsl.RankFeatureQuery': '_types/query_dsl/specialized.ts#L302-L325', +'_types.query_dsl.RegexpQuery': '_types/query_dsl/term.ts#L187-L217', +'_types.query_dsl.RuleQuery': '_types/query_dsl/specialized.ts#L381-L385', +'_types.query_dsl.ScriptQuery': '_types/query_dsl/specialized.ts#L327-L333', +'_types.query_dsl.ScriptScoreFunction': '_types/query_dsl/compound.ts#L121-L126', +'_types.query_dsl.ScriptScoreQuery': '_types/query_dsl/specialized.ts#L335-L349', '_types.query_dsl.SemanticQuery': '_types/query_dsl/SemanticQuery.ts#L22-L27', -'_types.query_dsl.ShapeFieldQuery': '_types/query_dsl/specialized.ts#L354-L367', -'_types.query_dsl.ShapeQuery': '_types/query_dsl/specialized.ts#L344-L352', +'_types.query_dsl.ShapeFieldQuery': '_types/query_dsl/specialized.ts#L366-L379', +'_types.query_dsl.ShapeQuery': '_types/query_dsl/specialized.ts#L351-L364', '_types.query_dsl.SimpleQueryStringFlag': '_types/query_dsl/fulltext.ts#L708-L763', '_types.query_dsl.SimpleQueryStringQuery': '_types/query_dsl/fulltext.ts#L765-L830', '_types.query_dsl.SpanContainingQuery': '_types/query_dsl/span.ts#L25-L36', @@ -904,17 +912,21 @@ '_types.query_dsl.SpanTermQuery': '_types/query_dsl/span.ts#L113-L116', '_types.query_dsl.SpanWithinQuery': '_types/query_dsl/span.ts#L118-L129', '_types.query_dsl.SparseVectorQuery': '_types/query_dsl/SparseVectorQuery.ts#L26-L79', -'_types.query_dsl.TermQuery': '_types/query_dsl/term.ts#L238-L252', -'_types.query_dsl.TermsLookup': '_types/query_dsl/term.ts#L263-L268', -'_types.query_dsl.TermsQuery': '_types/query_dsl/term.ts#L254-L256', -'_types.query_dsl.TermsQueryField': '_types/query_dsl/term.ts#L258-L261', -'_types.query_dsl.TermsSetQuery': '_types/query_dsl/term.ts#L270-L283', +'_types.query_dsl.TermQuery': '_types/query_dsl/term.ts#L219-L233', +'_types.query_dsl.TermRangeQuery': '_types/query_dsl/term.ts#L159-L159', +'_types.query_dsl.TermsLookup': '_types/query_dsl/term.ts#L247-L252', +'_types.query_dsl.TermsQuery': '_types/query_dsl/term.ts#L235-L240', +'_types.query_dsl.TermsQueryField': '_types/query_dsl/term.ts#L242-L245', +'_types.query_dsl.TermsSetQuery': '_types/query_dsl/term.ts#L254-L267', '_types.query_dsl.TextExpansionQuery': '_types/query_dsl/TextExpansionQuery.ts#L23-L33', '_types.query_dsl.TextQueryType': '_types/query_dsl/fulltext.ts#L541-L567', '_types.query_dsl.TokenPruningConfig': '_types/query_dsl/TokenPruningConfig.ts#L22-L35', -'_types.query_dsl.TypeQuery': '_types/query_dsl/term.ts#L285-L287', +'_types.query_dsl.TypeQuery': '_types/query_dsl/term.ts#L269-L271', +'_types.query_dsl.UntypedDecayFunction': '_types/query_dsl/compound.ts#L188-L191', +'_types.query_dsl.UntypedDistanceFeatureQuery': '_types/query_dsl/specialized.ts#L62-L65', +'_types.query_dsl.UntypedRangeQuery': '_types/query_dsl/term.ts#L135-L144', '_types.query_dsl.WeightedTokensQuery': '_types/query_dsl/WeightedTokensQuery.ts#L27-L32', -'_types.query_dsl.WildcardQuery': '_types/query_dsl/term.ts#L289-L306', +'_types.query_dsl.WildcardQuery': '_types/query_dsl/term.ts#L273-L290', '_types.query_dsl.WrapperQuery': '_types/query_dsl/abstractions.ts#L501-L507', '_types.query_dsl.ZeroTermsQuery': '_types/query_dsl/fulltext.ts#L569-L578', 'async_search._types.AsyncSearch': 'async_search/_types/AsyncSearch.ts#L30-L56', @@ -952,7 +964,7 @@ 'cat.aliases.AliasesRecord': 'cat/aliases/types.ts#L22-L53', 'cat.aliases.Request': 'cat/aliases/CatAliasesRequest.ts#L23-L41', 'cat.aliases.Response': 'cat/aliases/CatAliasesResponse.ts#L22-L24', -'cat.allocation.AllocationRecord': 'cat/allocation/types.ts#L24-L75', +'cat.allocation.AllocationRecord': 'cat/allocation/types.ts#L24-L98', 'cat.allocation.Request': 'cat/allocation/CatAllocationRequest.ts#L23-L41', 'cat.allocation.Response': 'cat/allocation/CatAllocationResponse.ts#L22-L24', 'cat.component_templates.ComponentTemplate': 'cat/component_templates/types.ts#L20-L28', @@ -1181,8 +1193,8 @@ 'enrich.stats.Response': 'enrich/stats/EnrichStatsResponse.ts#L22-L39', 'eql._types.EqlHits': 'eql/_types/EqlHits.ts#L25-L39', 'eql._types.EqlSearchResponseBase': 'eql/_types/EqlSearchResponseBase.ts#L25-L50', -'eql._types.HitsEvent': 'eql/_types/EqlHits.ts#L41-L49', -'eql._types.HitsSequence': 'eql/_types/EqlHits.ts#L51-L59', +'eql._types.HitsEvent': 'eql/_types/EqlHits.ts#L41-L54', +'eql._types.HitsSequence': 'eql/_types/EqlHits.ts#L56-L64', 'eql.delete.Request': 'eql/delete/EqlDeleteRequest.ts#L23-L39', 'eql.delete.Response': 'eql/delete/EqlDeleteResponse.ts#L22-L24', 'eql.get.Request': 'eql/get/EqlGetRequest.ts#L24-L50', @@ -1246,7 +1258,7 @@ 'ilm.stop.Response': 'ilm/stop/StopIlmResponse.ts#L22-L24', 'indices._types.Alias': 'indices/_types/Alias.ts#L23-L53', 'indices._types.AliasDefinition': 'indices/_types/AliasDefinition.ts#L22-L54', -'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L405-L407', +'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L407-L409', 'indices._types.DataStream': 'indices/_types/DataStream.ts#L39-L112', 'indices._types.DataStreamIndex': 'indices/_types/DataStream.ts#L121-L142', 'indices._types.DataStreamLifecycle': 'indices/_types/DataStreamLifecycle.ts#L25-L31', @@ -1258,7 +1270,7 @@ 'indices._types.DownsampleConfig': 'indices/_types/Downsample.ts#L22-L27', 'indices._types.DownsamplingRound': 'indices/_types/DownsamplingRound.ts#L23-L32', 'indices._types.FielddataFrequencyFilter': 'indices/_types/FielddataFrequencyFilter.ts#L22-L26', -'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L260-L267', +'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L262-L269', 'indices._types.IndexRouting': 'indices/_types/IndexRouting.ts#L22-L25', 'indices._types.IndexRoutingAllocation': 'indices/_types/IndexRouting.ts#L27-L32', 'indices._types.IndexRoutingAllocationDisk': 'indices/_types/IndexRouting.ts#L62-L64', @@ -1268,62 +1280,62 @@ 'indices._types.IndexRoutingRebalance': 'indices/_types/IndexRouting.ts#L34-L36', 'indices._types.IndexRoutingRebalanceOptions': 'indices/_types/IndexRouting.ts#L45-L50', 'indices._types.IndexSegmentSort': 'indices/_types/IndexSegmentSort.ts#L22-L27', -'indices._types.IndexSettingBlocks': 'indices/_types/IndexSettings.ts#L252-L258', -'indices._types.IndexSettings': 'indices/_types/IndexSettings.ts#L69-L167', -'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L317-L323', -'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L274-L307', -'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L309-L315', -'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L325-L328', +'indices._types.IndexSettingBlocks': 'indices/_types/IndexSettings.ts#L254-L260', +'indices._types.IndexSettings': 'indices/_types/IndexSettings.ts#L69-L169', +'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L319-L325', +'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L276-L309', +'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L311-L317', +'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L327-L330', 'indices._types.IndexState': 'indices/_types/IndexState.ts#L27-L40', 'indices._types.IndexTemplate': 'indices/_types/IndexTemplate.ts#L31-L70', 'indices._types.IndexTemplateDataStreamConfiguration': 'indices/_types/IndexTemplate.ts#L72-L83', 'indices._types.IndexTemplateSummary': 'indices/_types/IndexTemplate.ts#L85-L107', -'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L269-L272', -'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L548-L550', -'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L552-L559', -'indices._types.IndexingSlowlogSettings': 'indices/_types/IndexSettings.ts#L561-L566', -'indices._types.IndexingSlowlogTresholds': 'indices/_types/IndexSettings.ts#L568-L575', +'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L271-L274', +'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L550-L552', +'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L554-L561', +'indices._types.IndexingSlowlogSettings': 'indices/_types/IndexSettings.ts#L563-L568', +'indices._types.IndexingSlowlogTresholds': 'indices/_types/IndexSettings.ts#L570-L577', 'indices._types.ManagedBy': 'indices/_types/DataStream.ts#L32-L37', -'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L409-L422', -'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L443-L450', -'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L480-L486', -'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L471-L478', -'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L452-L460', -'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L462-L469', -'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L424-L441', -'indices._types.Merge': 'indices/_types/IndexSettings.ts#L330-L332', -'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L334-L337', +'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L411-L424', +'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L445-L452', +'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L482-L488', +'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L473-L480', +'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L454-L462', +'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L464-L471', +'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L426-L443', +'indices._types.Merge': 'indices/_types/IndexSettings.ts#L332-L334', +'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L336-L339', 'indices._types.NumericFielddata': 'indices/_types/NumericFielddata.ts#L22-L24', 'indices._types.NumericFielddataFormat': 'indices/_types/NumericFielddataFormat.ts#L20-L23', -'indices._types.Queries': 'indices/_types/IndexSettings.ts#L401-L403', +'indices._types.Queries': 'indices/_types/IndexSettings.ts#L403-L405', 'indices._types.RetentionLease': 'indices/_types/IndexSettings.ts#L65-L67', -'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L243-L246', +'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L245-L248', 'indices._types.SegmentSortMissing': 'indices/_types/IndexSegmentSort.ts#L43-L46', 'indices._types.SegmentSortMode': 'indices/_types/IndexSegmentSort.ts#L36-L41', 'indices._types.SegmentSortOrder': 'indices/_types/IndexSegmentSort.ts#L29-L34', -'indices._types.SettingsAnalyze': 'indices/_types/IndexSettings.ts#L233-L236', -'indices._types.SettingsHighlight': 'indices/_types/IndexSettings.ts#L228-L231', -'indices._types.SettingsQueryString': 'indices/_types/IndexSettings.ts#L248-L250', -'indices._types.SettingsSearch': 'indices/_types/IndexSettings.ts#L238-L241', -'indices._types.SettingsSimilarity': 'indices/_types/IndexSettings.ts#L169-L180', -'indices._types.SettingsSimilarityBm25': 'indices/_types/IndexSettings.ts#L186-L191', -'indices._types.SettingsSimilarityBoolean': 'indices/_types/IndexSettings.ts#L182-L184', -'indices._types.SettingsSimilarityDfi': 'indices/_types/IndexSettings.ts#L193-L196', -'indices._types.SettingsSimilarityDfr': 'indices/_types/IndexSettings.ts#L198-L203', -'indices._types.SettingsSimilarityIb': 'indices/_types/IndexSettings.ts#L205-L210', -'indices._types.SettingsSimilarityLmd': 'indices/_types/IndexSettings.ts#L212-L215', -'indices._types.SettingsSimilarityLmj': 'indices/_types/IndexSettings.ts#L217-L220', -'indices._types.SettingsSimilarityScripted': 'indices/_types/IndexSettings.ts#L222-L226', -'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L488-L493', -'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L500-L505', -'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L495-L498', +'indices._types.SettingsAnalyze': 'indices/_types/IndexSettings.ts#L235-L238', +'indices._types.SettingsHighlight': 'indices/_types/IndexSettings.ts#L230-L233', +'indices._types.SettingsQueryString': 'indices/_types/IndexSettings.ts#L250-L252', +'indices._types.SettingsSearch': 'indices/_types/IndexSettings.ts#L240-L243', +'indices._types.SettingsSimilarity': 'indices/_types/IndexSettings.ts#L171-L182', +'indices._types.SettingsSimilarityBm25': 'indices/_types/IndexSettings.ts#L188-L193', +'indices._types.SettingsSimilarityBoolean': 'indices/_types/IndexSettings.ts#L184-L186', +'indices._types.SettingsSimilarityDfi': 'indices/_types/IndexSettings.ts#L195-L198', +'indices._types.SettingsSimilarityDfr': 'indices/_types/IndexSettings.ts#L200-L205', +'indices._types.SettingsSimilarityIb': 'indices/_types/IndexSettings.ts#L207-L212', +'indices._types.SettingsSimilarityLmd': 'indices/_types/IndexSettings.ts#L214-L217', +'indices._types.SettingsSimilarityLmj': 'indices/_types/IndexSettings.ts#L219-L222', +'indices._types.SettingsSimilarityScripted': 'indices/_types/IndexSettings.ts#L224-L228', +'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L490-L495', +'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L502-L507', +'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L497-L500', 'indices._types.SoftDeletes': 'indices/_types/IndexSettings.ts#L50-L63', -'indices._types.Storage': 'indices/_types/IndexSettings.ts#L507-L516', -'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L518-L546', +'indices._types.Storage': 'indices/_types/IndexSettings.ts#L509-L518', +'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L520-L548', 'indices._types.TemplateMapping': 'indices/_types/TemplateMapping.ts#L27-L34', -'indices._types.Translog': 'indices/_types/IndexSettings.ts#L339-L361', -'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L363-L378', -'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L380-L399', +'indices._types.Translog': 'indices/_types/IndexSettings.ts#L341-L363', +'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L365-L380', +'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L382-L401', 'indices.add_block.IndicesBlockOptions': 'indices/add_block/IndicesAddBlockRequest.ts#L43-L48', 'indices.add_block.IndicesBlockStatus': 'indices/add_block/IndicesAddBlockResponse.ts#L30-L33', 'indices.add_block.Request': 'indices/add_block/IndicesAddBlockRequest.ts#L24-L41', @@ -1332,10 +1344,10 @@ 'indices.analyze.AnalyzeToken': 'indices/analyze/types.ts#L37-L44', 'indices.analyze.AnalyzerDetail': 'indices/analyze/types.ts#L32-L35', 'indices.analyze.CharFilterDetail': 'indices/analyze/types.ts#L46-L49', -'indices.analyze.ExplainAnalyzeToken': 'indices/analyze/types.ts#L52-L64', +'indices.analyze.ExplainAnalyzeToken': 'indices/analyze/types.ts#L52-L67', 'indices.analyze.Request': 'indices/analyze/IndicesAnalyzeRequest.ts#L27-L92', 'indices.analyze.Response': 'indices/analyze/IndicesAnalyzeResponse.ts#L22-L27', -'indices.analyze.TokenDetail': 'indices/analyze/types.ts#L68-L71', +'indices.analyze.TokenDetail': 'indices/analyze/types.ts#L71-L74', 'indices.clear_cache.Request': 'indices/clear_cache/IndicesIndicesClearCacheRequest.ts#L23-L77', 'indices.clear_cache.Response': 'indices/clear_cache/IndicesClearCacheResponse.ts#L22-L24', 'indices.clone.Request': 'indices/clone/IndicesCloneRequest.ts#L27-L75', @@ -1374,14 +1386,14 @@ 'indices.explain_data_lifecycle.DataStreamLifecycleExplain': 'indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L31-L41', 'indices.explain_data_lifecycle.Request': 'indices/explain_data_lifecycle/IndicesExplainDataLifecycleRequest.ts#L24-L38', 'indices.explain_data_lifecycle.Response': 'indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponse.ts#L25-L29', -'indices.field_usage_stats.FieldSummary': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L54-L63', -'indices.field_usage_stats.FieldsUsageBody': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L32-L36', -'indices.field_usage_stats.InvertedIndex': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L65-L73', +'indices.field_usage_stats.FieldSummary': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L57-L66', +'indices.field_usage_stats.FieldsUsageBody': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L32-L39', +'indices.field_usage_stats.InvertedIndex': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L68-L76', 'indices.field_usage_stats.Request': 'indices/field_usage_stats/IndicesFieldUsageStatsRequest.ts#L29-L84', 'indices.field_usage_stats.Response': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L28-L30', -'indices.field_usage_stats.ShardsStats': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L49-L52', -'indices.field_usage_stats.UsageStatsIndex': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L38-L40', -'indices.field_usage_stats.UsageStatsShards': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L42-L47', +'indices.field_usage_stats.ShardsStats': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L52-L55', +'indices.field_usage_stats.UsageStatsIndex': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L41-L43', +'indices.field_usage_stats.UsageStatsShards': 'indices/field_usage_stats/IndicesFieldUsageStatsResponse.ts#L45-L50', 'indices.flush.Request': 'indices/flush/IndicesFlushRequest.ts#L23-L71', 'indices.flush.Response': 'indices/flush/IndicesFlushResponse.ts#L22-L24', 'indices.forcemerge.Request': 'indices/forcemerge/IndicesForceMergeRequest.ts#L24-L42', @@ -1472,12 +1484,12 @@ 'indices.shard_stores.IndicesShardStores': 'indices/shard_stores/types.ts#L26-L28', 'indices.shard_stores.Request': 'indices/shard_stores/IndicesShardStoresRequest.ts#L24-L60', 'indices.shard_stores.Response': 'indices/shard_stores/IndicesShardStoresResponse.ts#L24-L26', -'indices.shard_stores.ShardStore': 'indices/shard_stores/types.ts#L30-L34', -'indices.shard_stores.ShardStoreAllocation': 'indices/shard_stores/types.ts#L45-L49', -'indices.shard_stores.ShardStoreException': 'indices/shard_stores/types.ts#L51-L54', -'indices.shard_stores.ShardStoreNode': 'indices/shard_stores/types.ts#L36-L43', -'indices.shard_stores.ShardStoreStatus': 'indices/shard_stores/types.ts#L60-L69', -'indices.shard_stores.ShardStoreWrapper': 'indices/shard_stores/types.ts#L56-L58', +'indices.shard_stores.ShardStore': 'indices/shard_stores/types.ts#L30-L37', +'indices.shard_stores.ShardStoreAllocation': 'indices/shard_stores/types.ts#L48-L52', +'indices.shard_stores.ShardStoreException': 'indices/shard_stores/types.ts#L54-L57', +'indices.shard_stores.ShardStoreNode': 'indices/shard_stores/types.ts#L39-L46', +'indices.shard_stores.ShardStoreStatus': 'indices/shard_stores/types.ts#L63-L72', +'indices.shard_stores.ShardStoreWrapper': 'indices/shard_stores/types.ts#L59-L61', 'indices.shrink.Request': 'indices/shrink/IndicesShrinkRequest.ts#L27-L75', 'indices.shrink.Response': 'indices/shrink/IndicesShrinkResponse.ts#L22-L28', 'indices.simulate_index_template.Request': 'indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts#L24-L50', @@ -1593,7 +1605,7 @@ 'ingest.put_pipeline.Request': 'ingest/put_pipeline/PutPipelineRequest.ts#L25-L77', 'ingest.put_pipeline.Response': 'ingest/put_pipeline/PutPipelineResponse.ts#L22-L24', 'ingest.simulate.Document': 'ingest/simulate/types.ts#L41-L55', -'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L57-L85', +'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L57-L87', 'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L28-L31', 'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L33-L39', 'ingest.simulate.Request': 'ingest/simulate/SimulatePipelineRequest.ts#L25-L57', @@ -2048,52 +2060,52 @@ 'nodes.hot_threads.Response': 'nodes/hot_threads/NodesHotThreadsResponse.ts#L22-L24', 'nodes.info.DeprecationIndexing': 'nodes/info/types.ts#L144-L146', 'nodes.info.NodeInfo': 'nodes/info/types.ts#L31-L67', -'nodes.info.NodeInfoAction': 'nodes/info/types.ts#L181-L183', -'nodes.info.NodeInfoAggregation': 'nodes/info/types.ts#L232-L234', -'nodes.info.NodeInfoBootstrap': 'nodes/info/types.ts#L201-L203', -'nodes.info.NodeInfoClient': 'nodes/info/types.ts#L185-L187', -'nodes.info.NodeInfoDiscover': 'nodes/info/types.ts#L173-L179', -'nodes.info.NodeInfoHttp': 'nodes/info/types.ts#L303-L308', -'nodes.info.NodeInfoIngest': 'nodes/info/types.ts#L224-L226', +'nodes.info.NodeInfoAction': 'nodes/info/types.ts#L184-L186', +'nodes.info.NodeInfoAggregation': 'nodes/info/types.ts#L235-L237', +'nodes.info.NodeInfoBootstrap': 'nodes/info/types.ts#L204-L206', +'nodes.info.NodeInfoClient': 'nodes/info/types.ts#L188-L190', +'nodes.info.NodeInfoDiscover': 'nodes/info/types.ts#L173-L182', +'nodes.info.NodeInfoHttp': 'nodes/info/types.ts#L306-L311', +'nodes.info.NodeInfoIngest': 'nodes/info/types.ts#L227-L229', 'nodes.info.NodeInfoIngestDownloader': 'nodes/info/types.ts#L128-L130', 'nodes.info.NodeInfoIngestInfo': 'nodes/info/types.ts#L124-L126', -'nodes.info.NodeInfoIngestProcessor': 'nodes/info/types.ts#L228-L230', -'nodes.info.NodeInfoJvmMemory': 'nodes/info/types.ts#L310-L321', -'nodes.info.NodeInfoMemory': 'nodes/info/types.ts#L323-L326', -'nodes.info.NodeInfoNetwork': 'nodes/info/types.ts#L328-L331', -'nodes.info.NodeInfoNetworkInterface': 'nodes/info/types.ts#L333-L337', -'nodes.info.NodeInfoOSCPU': 'nodes/info/types.ts#L339-L348', +'nodes.info.NodeInfoIngestProcessor': 'nodes/info/types.ts#L231-L233', +'nodes.info.NodeInfoJvmMemory': 'nodes/info/types.ts#L313-L324', +'nodes.info.NodeInfoMemory': 'nodes/info/types.ts#L326-L329', +'nodes.info.NodeInfoNetwork': 'nodes/info/types.ts#L331-L334', +'nodes.info.NodeInfoNetworkInterface': 'nodes/info/types.ts#L336-L340', +'nodes.info.NodeInfoOSCPU': 'nodes/info/types.ts#L342-L351', 'nodes.info.NodeInfoPath': 'nodes/info/types.ts#L158-L163', 'nodes.info.NodeInfoRepositories': 'nodes/info/types.ts#L165-L167', 'nodes.info.NodeInfoRepositoriesUrl': 'nodes/info/types.ts#L169-L171', -'nodes.info.NodeInfoScript': 'nodes/info/types.ts#L281-L284', -'nodes.info.NodeInfoSearch': 'nodes/info/types.ts#L286-L288', -'nodes.info.NodeInfoSearchRemote': 'nodes/info/types.ts#L290-L292', +'nodes.info.NodeInfoScript': 'nodes/info/types.ts#L284-L287', +'nodes.info.NodeInfoSearch': 'nodes/info/types.ts#L289-L291', +'nodes.info.NodeInfoSearchRemote': 'nodes/info/types.ts#L293-L295', 'nodes.info.NodeInfoSettings': 'nodes/info/types.ts#L69-L85', 'nodes.info.NodeInfoSettingsCluster': 'nodes/info/types.ts#L132-L142', 'nodes.info.NodeInfoSettingsClusterElection': 'nodes/info/types.ts#L148-L150', -'nodes.info.NodeInfoSettingsHttp': 'nodes/info/types.ts#L189-L194', -'nodes.info.NodeInfoSettingsHttpType': 'nodes/info/types.ts#L196-L199', +'nodes.info.NodeInfoSettingsHttp': 'nodes/info/types.ts#L192-L197', +'nodes.info.NodeInfoSettingsHttpType': 'nodes/info/types.ts#L199-L202', 'nodes.info.NodeInfoSettingsIngest': 'nodes/info/types.ts#L87-L122', -'nodes.info.NodeInfoSettingsNetwork': 'nodes/info/types.ts#L220-L222', +'nodes.info.NodeInfoSettingsNetwork': 'nodes/info/types.ts#L223-L225', 'nodes.info.NodeInfoSettingsNode': 'nodes/info/types.ts#L152-L156', -'nodes.info.NodeInfoSettingsTransport': 'nodes/info/types.ts#L205-L209', -'nodes.info.NodeInfoSettingsTransportFeatures': 'nodes/info/types.ts#L216-L218', -'nodes.info.NodeInfoSettingsTransportType': 'nodes/info/types.ts#L211-L214', -'nodes.info.NodeInfoTransport': 'nodes/info/types.ts#L350-L354', -'nodes.info.NodeInfoXpack': 'nodes/info/types.ts#L236-L240', -'nodes.info.NodeInfoXpackLicense': 'nodes/info/types.ts#L273-L275', -'nodes.info.NodeInfoXpackLicenseType': 'nodes/info/types.ts#L277-L279', -'nodes.info.NodeInfoXpackSecurity': 'nodes/info/types.ts#L242-L247', -'nodes.info.NodeInfoXpackSecurityAuthc': 'nodes/info/types.ts#L253-L256', -'nodes.info.NodeInfoXpackSecurityAuthcRealms': 'nodes/info/types.ts#L258-L262', -'nodes.info.NodeInfoXpackSecurityAuthcRealmsStatus': 'nodes/info/types.ts#L268-L271', -'nodes.info.NodeInfoXpackSecurityAuthcToken': 'nodes/info/types.ts#L264-L266', -'nodes.info.NodeInfoXpackSecuritySsl': 'nodes/info/types.ts#L249-L251', -'nodes.info.NodeJvmInfo': 'nodes/info/types.ts#L356-L370', -'nodes.info.NodeOperatingSystemInfo': 'nodes/info/types.ts#L372-L389', -'nodes.info.NodeProcessInfo': 'nodes/info/types.ts#L391-L398', -'nodes.info.NodeThreadPoolInfo': 'nodes/info/types.ts#L294-L301', +'nodes.info.NodeInfoSettingsTransport': 'nodes/info/types.ts#L208-L212', +'nodes.info.NodeInfoSettingsTransportFeatures': 'nodes/info/types.ts#L219-L221', +'nodes.info.NodeInfoSettingsTransportType': 'nodes/info/types.ts#L214-L217', +'nodes.info.NodeInfoTransport': 'nodes/info/types.ts#L353-L357', +'nodes.info.NodeInfoXpack': 'nodes/info/types.ts#L239-L243', +'nodes.info.NodeInfoXpackLicense': 'nodes/info/types.ts#L276-L278', +'nodes.info.NodeInfoXpackLicenseType': 'nodes/info/types.ts#L280-L282', +'nodes.info.NodeInfoXpackSecurity': 'nodes/info/types.ts#L245-L250', +'nodes.info.NodeInfoXpackSecurityAuthc': 'nodes/info/types.ts#L256-L259', +'nodes.info.NodeInfoXpackSecurityAuthcRealms': 'nodes/info/types.ts#L261-L265', +'nodes.info.NodeInfoXpackSecurityAuthcRealmsStatus': 'nodes/info/types.ts#L271-L274', +'nodes.info.NodeInfoXpackSecurityAuthcToken': 'nodes/info/types.ts#L267-L269', +'nodes.info.NodeInfoXpackSecuritySsl': 'nodes/info/types.ts#L252-L254', +'nodes.info.NodeJvmInfo': 'nodes/info/types.ts#L359-L373', +'nodes.info.NodeOperatingSystemInfo': 'nodes/info/types.ts#L375-L392', +'nodes.info.NodeProcessInfo': 'nodes/info/types.ts#L394-L401', +'nodes.info.NodeThreadPoolInfo': 'nodes/info/types.ts#L297-L304', 'nodes.info.Request': 'nodes/info/NodesInfoRequest.ts#L24-L55', 'nodes.info.Response': 'nodes/info/NodesInfoResponse.ts#L30-L32', 'nodes.info.ResponseBase': 'nodes/info/NodesInfoResponse.ts#L25-L28', @@ -2107,12 +2119,12 @@ 'nodes.usage.Request': 'nodes/usage/NodesUsageRequest.ts#L24-L49', 'nodes.usage.Response': 'nodes/usage/NodesUsageResponse.ts#L30-L32', 'nodes.usage.ResponseBase': 'nodes/usage/NodesUsageResponse.ts#L25-L28', -'query_rules._types.QueryRule': 'query_rules/_types/QueryRuleset.ts#L37-L42', -'query_rules._types.QueryRuleActions': 'query_rules/_types/QueryRuleset.ts#L68-L71', -'query_rules._types.QueryRuleCriteria': 'query_rules/_types/QueryRuleset.ts#L48-L52', -'query_rules._types.QueryRuleCriteriaType': 'query_rules/_types/QueryRuleset.ts#L54-L66', -'query_rules._types.QueryRuleType': 'query_rules/_types/QueryRuleset.ts#L44-L46', -'query_rules._types.QueryRuleset': 'query_rules/_types/QueryRuleset.ts#L26-L35', +'query_rules._types.QueryRule': 'query_rules/_types/QueryRuleset.ts#L38-L44', +'query_rules._types.QueryRuleActions': 'query_rules/_types/QueryRuleset.ts#L71-L74', +'query_rules._types.QueryRuleCriteria': 'query_rules/_types/QueryRuleset.ts#L50-L54', +'query_rules._types.QueryRuleCriteriaType': 'query_rules/_types/QueryRuleset.ts#L56-L69', +'query_rules._types.QueryRuleType': 'query_rules/_types/QueryRuleset.ts#L46-L48', +'query_rules._types.QueryRuleset': 'query_rules/_types/QueryRuleset.ts#L27-L36', 'query_rules.delete_rule.Request': 'query_rules/delete_rule/QueryRuleDeleteRequest.ts#L22-L40', 'query_rules.delete_rule.Response': 'query_rules/delete_rule/QueryRuleDeleteResponse.ts#L22-L24', 'query_rules.delete_ruleset.Request': 'query_rules/delete_ruleset/QueryRulesetDeleteRequest.ts#L22-L35', @@ -2124,7 +2136,7 @@ 'query_rules.list_rulesets.QueryRulesetListItem': 'query_rules/list_rulesets/types.ts#L23-L37', 'query_rules.list_rulesets.Request': 'query_rules/list_rulesets/QueryRulesetListRequest.ts#L22-L39', 'query_rules.list_rulesets.Response': 'query_rules/list_rulesets/QueryRulesetListResponse.ts#L23-L28', -'query_rules.put_rule.Request': 'query_rules/put_rule/QueryRulePutRequest.ts#L27-L54', +'query_rules.put_rule.Request': 'query_rules/put_rule/QueryRulePutRequest.ts#L28-L56', 'query_rules.put_rule.Response': 'query_rules/put_rule/QueryRulePutResponse.ts#L22-L26', 'query_rules.put_ruleset.Request': 'query_rules/put_ruleset/QueryRulesetPutRequest.ts#L23-L43', 'query_rules.put_ruleset.Response': 'query_rules/put_ruleset/QueryRulesetPutResponse.ts#L22-L26', @@ -2198,6 +2210,7 @@ 'security._types.ApiKey': 'security/_types/ApiKey.ts#L27-L89', 'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L333-L335', 'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L26-L39', +'security._types.BulkError': 'security/_types/Bulk.ts#L24-L33', 'security._types.ClusterNode': 'security/_types/ClusterNode.ts#L22-L24', 'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L41-L198', 'security._types.CreatedStatus': 'security/_types/CreatedStatus.ts#L20-L22', @@ -2209,8 +2222,8 @@ 'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L200-L224', 'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L337-L339', 'security._types.RealmInfo': 'security/_types/RealmInfo.ts#L22-L25', -'security._types.RoleDescriptor': 'security/_types/RoleDescriptor.ts#L28-L56', -'security._types.RoleDescriptorRead': 'security/_types/RoleDescriptor.ts#L58-L86', +'security._types.RoleDescriptor': 'security/_types/RoleDescriptor.ts#L28-L61', +'security._types.RoleDescriptorRead': 'security/_types/RoleDescriptor.ts#L63-L95', 'security._types.RoleMapping': 'security/_types/RoleMapping.ts#L25-L33', 'security._types.RoleMappingRule': 'security/_types/RoleMappingRule.ts#L23-L34', 'security._types.RoleTemplate': 'security/_types/RoleTemplate.ts#L28-L31', @@ -2229,6 +2242,10 @@ 'security.authenticate.Request': 'security/authenticate/SecurityAuthenticateRequest.ts#L22-L30', 'security.authenticate.Response': 'security/authenticate/SecurityAuthenticateResponse.ts#L25-L43', 'security.authenticate.Token': 'security/authenticate/types.ts#L22-L29', +'security.bulk_delete_role.Request': 'security/bulk_delete_role/SecurityBulkDeleteRoleRequest.ts#L23-L41', +'security.bulk_delete_role.Response': 'security/bulk_delete_role/SecurityBulkDeleteRoleResponse.ts#L25-L40', +'security.bulk_put_role.Request': 'security/bulk_put_role/SecurityBulkPutRoleRequest.ts#L25-L43', +'security.bulk_put_role.Response': 'security/bulk_put_role/SecurityBulkPutRoleResponse.ts#L22-L41', 'security.change_password.Request': 'security/change_password/SecurityChangePasswordRequest.ts#L23-L51', 'security.change_password.Response': 'security/change_password/SecurityChangePasswordResponse.ts#L20-L22', 'security.clear_api_key_cache.Request': 'security/clear_api_key_cache/SecurityClearApiKeyCacheRequest.ts#L23-L40', @@ -2320,7 +2337,7 @@ 'security.put_privileges.Actions': 'security/put_privileges/types.ts#L22-L27', 'security.put_privileges.Request': 'security/put_privileges/SecurityPutPrivilegesRequest.ts#L25-L37', 'security.put_privileges.Response': 'security/put_privileges/SecurityPutPrivilegesResponse.ts#L23-L26', -'security.put_role.Request': 'security/put_role/SecurityPutRoleRequest.ts#L30-L80', +'security.put_role.Request': 'security/put_role/SecurityPutRoleRequest.ts#L30-L84', 'security.put_role.Response': 'security/put_role/SecurityPutRoleResponse.ts#L22-L24', 'security.put_role_mapping.Request': 'security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L25-L47', 'security.put_role_mapping.Response': 'security/put_role_mapping/SecurityPutRoleMappingResponse.ts#L22-L24', @@ -2332,6 +2349,14 @@ 'security.query_api_keys.ApiKeyQueryContainer': 'security/query_api_keys/types.ts#L142-L206', 'security.query_api_keys.Request': 'security/query_api_keys/QueryApiKeysRequest.ts#L26-L99', 'security.query_api_keys.Response': 'security/query_api_keys/QueryApiKeysResponse.ts#L26-L45', +'security.query_role.QueryRole': 'security/query_role/types.ts#L103-L109', +'security.query_role.Request': 'security/query_role/QueryRolesRequest.ts#L25-L67', +'security.query_role.Response': 'security/query_role/QueryRolesResponse.ts#L23-L38', +'security.query_role.RoleQueryContainer': 'security/query_role/types.ts#L37-L101', +'security.query_user.QueryUser': 'security/query_user/types.ts#L103-L105', +'security.query_user.Request': 'security/query_user/SecurityQueryUserRequest.ts#L25-L72', +'security.query_user.Response': 'security/query_user/SecurityQueryUserResponse.ts#L23-L38', +'security.query_user.UserQueryContainer': 'security/query_user/types.ts#L37-L101', 'security.saml_authenticate.Request': 'security/saml_authenticate/Request.ts#L23-L38', 'security.saml_authenticate.Response': 'security/saml_authenticate/Response.ts#L22-L30', 'security.saml_complete_logout.Request': 'security/saml_complete_logout/Request.ts#L23-L40', @@ -2543,12 +2568,12 @@ 'watcher._types.ActivationState': 'watcher/_types/Activation.ts#L24-L27', 'watcher._types.ActivationStatus': 'watcher/_types/Activation.ts#L29-L33', 'watcher._types.AlwaysCondition': 'watcher/_types/Conditions.ts#L25-L25', -'watcher._types.ArrayCompareCondition': 'watcher/_types/Conditions.ts#L32-L36', +'watcher._types.ArrayCompareCondition': 'watcher/_types/Conditions.ts#L32-L39', 'watcher._types.ArrayCompareOpParams': 'watcher/_types/Conditions.ts#L27-L30', 'watcher._types.ChainInput': 'watcher/_types/Input.ts#L35-L37', -'watcher._types.ConditionContainer': 'watcher/_types/Conditions.ts#L47-L59', -'watcher._types.ConditionOp': 'watcher/_types/Conditions.ts#L38-L45', -'watcher._types.ConditionType': 'watcher/_types/Conditions.ts#L61-L67', +'watcher._types.ConditionContainer': 'watcher/_types/Conditions.ts#L50-L62', +'watcher._types.ConditionOp': 'watcher/_types/Conditions.ts#L41-L48', +'watcher._types.ConditionType': 'watcher/_types/Conditions.ts#L64-L70', 'watcher._types.ConnectionScheme': 'watcher/_types/Input.ts#L39-L42', 'watcher._types.DailySchedule': 'watcher/_types/Schedule.ts#L33-L35', 'watcher._types.DataAttachmentFormat': 'watcher/_types/Actions.ts#L187-L190', @@ -2587,7 +2612,7 @@ 'watcher._types.LoggingAction': 'watcher/_types/Actions.ts#L281-L285', 'watcher._types.LoggingResult': 'watcher/_types/Actions.ts#L287-L289', 'watcher._types.Month': 'watcher/_types/Schedule.ts#L65-L78', -'watcher._types.NeverCondition': 'watcher/_types/Conditions.ts#L69-L69', +'watcher._types.NeverCondition': 'watcher/_types/Conditions.ts#L72-L72', 'watcher._types.PagerDutyAction': 'watcher/_types/Actions.ts#L54-L54', 'watcher._types.PagerDutyContext': 'watcher/_types/Actions.ts#L61-L65', 'watcher._types.PagerDutyContextType': 'watcher/_types/Actions.ts#L67-L70', @@ -2595,14 +2620,14 @@ 'watcher._types.PagerDutyEventProxy': 'watcher/_types/Actions.ts#L56-L59', 'watcher._types.PagerDutyEventType': 'watcher/_types/Actions.ts#L72-L76', 'watcher._types.PagerDutyResult': 'watcher/_types/Actions.ts#L78-L83', -'watcher._types.Quantifier': 'watcher/_types/Conditions.ts#L71-L74', +'watcher._types.Quantifier': 'watcher/_types/Conditions.ts#L74-L77', 'watcher._types.QueryWatch': 'watcher/_types/Watch.ts#L58-L64', 'watcher._types.ReportingEmailAttachment': 'watcher/_types/Actions.ts#L224-L232', 'watcher._types.ResponseContentType': 'watcher/_types/Input.ts#L106-L110', 'watcher._types.ScheduleContainer': 'watcher/_types/Schedule.ts#L80-L91', 'watcher._types.ScheduleTimeOfDay': 'watcher/_types/Schedule.ts#L98-L103', 'watcher._types.ScheduleTriggerEvent': 'watcher/_types/Schedule.ts#L93-L96', -'watcher._types.ScriptCondition': 'watcher/_types/Conditions.ts#L76-L84', +'watcher._types.ScriptCondition': 'watcher/_types/Conditions.ts#L79-L87', 'watcher._types.SearchInput': 'watcher/_types/Input.ts#L112-L116', 'watcher._types.SearchInputRequestBody': 'watcher/_types/Input.ts#L147-L149', 'watcher._types.SearchInputRequestDefinition': 'watcher/_types/Input.ts#L118-L125', @@ -2731,10 +2756,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/94ad8c5b43dc517a0eda7d135e9de4e4fc5432af/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/4d640a658bda81d29e93a2b3c74f3e2cc1f63cc9/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/eql/HitsEvent.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java index e71f4302a..cc2b5bf01 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java @@ -33,6 +33,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.List; import java.util.Map; @@ -71,6 +72,9 @@ public class HitsEvent implements JsonpSerializable { private final TEvent source; + @Nullable + private final Boolean missing; + private final Map> fields; @Nullable @@ -83,6 +87,7 @@ private HitsEvent(Builder builder) { this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.missing = builder.missing; this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.tEventSerializer = builder.tEventSerializer; @@ -120,6 +125,17 @@ public final TEvent source() { return this.source; } + /** + * Set to true for events in a timespan-constrained sequence that + * do not meet a given condition. + *

+ * API name: {@code missing} + */ + @Nullable + public final Boolean missing() { + return this.missing; + } + /** * API name: {@code fields} */ @@ -147,6 +163,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("_source"); JsonpUtils.serialize(this.source, generator, tEventSerializer, mapper); + if (this.missing != null) { + generator.writeKey("missing"); + generator.write(this.missing); + + } if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartObject(); @@ -188,6 +209,9 @@ public static class Builder extends WithJsonObjectBuilderBase> fields; @@ -225,6 +249,17 @@ public final Builder source(TEvent value) { return this; } + /** + * Set to true for events in a timespan-constrained sequence that + * do not meet a given condition. + *

+ * API name: {@code missing} + */ + public final Builder missing(@Nullable Boolean value) { + this.missing = value; + return this; + } + /** * API name: {@code fields} *

@@ -297,6 +332,7 @@ protected static void setupHitsEventDeserializer(ObjectDeserializer implements JsonpSerializable { private HitsSequence(Builder builder) { this.events = ApiTypeHelper.unmodifiableRequired(builder.events, this, "events"); - this.joinKeys = ApiTypeHelper.unmodifiableRequired(builder.joinKeys, this, "joinKeys"); + this.joinKeys = ApiTypeHelper.unmodifiable(builder.joinKeys); this.tEventSerializer = builder.tEventSerializer; } @@ -95,8 +95,8 @@ public final List> events() { } /** - * Required - Shared field values used to constrain matches in the sequence. - * These are defined using the by keyword in the EQL query syntax. + * Shared field values used to constrain matches in the sequence. These are + * defined using the by keyword in the EQL query syntax. *

* API name: {@code join_keys} */ @@ -154,6 +154,7 @@ public static class Builder extends WithJsonObjectBuilderBase> { private List> events; + @Nullable private List joinKeys; @Nullable @@ -198,8 +199,8 @@ public final Builder events(Function, ObjectBu } /** - * Required - Shared field values used to constrain matches in the sequence. - * These are defined using the by keyword in the EQL query syntax. + * Shared field values used to constrain matches in the sequence. These are + * defined using the by keyword in the EQL query syntax. *

* API name: {@code join_keys} *

@@ -211,8 +212,8 @@ public final Builder joinKeys(List list) { } /** - * Required - Shared field values used to constrain matches in the sequence. - * These are defined using the by keyword in the EQL query syntax. + * Shared field values used to constrain matches in the sequence. These are + * defined using the by keyword in the EQL query syntax. *

* API name: {@code join_keys} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java index 72cf18a9d..a423dd323 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Processor.java @@ -74,42 +74,52 @@ public class Processor implements OpenTaggedUnion, Jsonp */ public enum Kind implements JsonEnum { + Append("append"), + Attachment("attachment"), - Append("append"), + Bytes("bytes"), - Csv("csv"), + Circle("circle"), Convert("convert"), + Csv("csv"), + Date("date"), DateIndexName("date_index_name"), + Dissect("dissect"), + DotExpander("dot_expander"), + Drop("drop"), + Enrich("enrich"), Fail("fail"), Foreach("foreach"), - Json("json"), - - UserAgent("user_agent"), - - Kv("kv"), - Geoip("geoip"), Grok("grok"), Gsub("gsub"), + Inference("inference"), + Join("join"), + Json("json"), + + Kv("kv"), + Lowercase("lowercase"), + Pipeline("pipeline"), + Remove("remove"), Rename("rename"), @@ -120,6 +130,8 @@ public enum Kind implements JsonEnum { Set("set"), + SetSecurityUser("set_security_user"), + Sort("sort"), Split("split"), @@ -130,19 +142,7 @@ public enum Kind implements JsonEnum { Urldecode("urldecode"), - Bytes("bytes"), - - Dissect("dissect"), - - SetSecurityUser("set_security_user"), - - Pipeline("pipeline"), - - Drop("drop"), - - Circle("circle"), - - Inference("inference"), + UserAgent("user_agent"), /** A custom {@code Processor} defined by a plugin */ _Custom(null) @@ -194,6 +194,23 @@ public static Processor of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Is this variant instance of kind {@code append}? + */ + public boolean isAppend() { + return _kind == Kind.Append; + } + + /** + * Get the {@code append} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code append} kind. + */ + public AppendProcessor append() { + return TaggedUnionUtils.get(this, Kind.Append); + } + /** * Is this variant instance of kind {@code attachment}? */ @@ -212,37 +229,37 @@ public AttachmentProcessor attachment() { } /** - * Is this variant instance of kind {@code append}? + * Is this variant instance of kind {@code bytes}? */ - public boolean isAppend() { - return _kind == Kind.Append; + public boolean isBytes() { + return _kind == Kind.Bytes; } /** - * Get the {@code append} variant value. + * Get the {@code bytes} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code append} kind. + * if the current variant is not of the {@code bytes} kind. */ - public AppendProcessor append() { - return TaggedUnionUtils.get(this, Kind.Append); + public BytesProcessor bytes() { + return TaggedUnionUtils.get(this, Kind.Bytes); } /** - * Is this variant instance of kind {@code csv}? + * Is this variant instance of kind {@code circle}? */ - public boolean isCsv() { - return _kind == Kind.Csv; + public boolean isCircle() { + return _kind == Kind.Circle; } /** - * Get the {@code csv} variant value. + * Get the {@code circle} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code csv} kind. + * if the current variant is not of the {@code circle} kind. */ - public CsvProcessor csv() { - return TaggedUnionUtils.get(this, Kind.Csv); + public CircleProcessor circle() { + return TaggedUnionUtils.get(this, Kind.Circle); } /** @@ -262,6 +279,23 @@ public ConvertProcessor convert() { return TaggedUnionUtils.get(this, Kind.Convert); } + /** + * Is this variant instance of kind {@code csv}? + */ + public boolean isCsv() { + return _kind == Kind.Csv; + } + + /** + * Get the {@code csv} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code csv} kind. + */ + public CsvProcessor csv() { + return TaggedUnionUtils.get(this, Kind.Csv); + } + /** * Is this variant instance of kind {@code date}? */ @@ -297,6 +331,23 @@ public DateIndexNameProcessor dateIndexName() { return TaggedUnionUtils.get(this, Kind.DateIndexName); } + /** + * Is this variant instance of kind {@code dissect}? + */ + public boolean isDissect() { + return _kind == Kind.Dissect; + } + + /** + * Get the {@code dissect} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code dissect} kind. + */ + public DissectProcessor dissect() { + return TaggedUnionUtils.get(this, Kind.Dissect); + } + /** * Is this variant instance of kind {@code dot_expander}? */ @@ -314,6 +365,23 @@ public DotExpanderProcessor dotExpander() { return TaggedUnionUtils.get(this, Kind.DotExpander); } + /** + * Is this variant instance of kind {@code drop}? + */ + public boolean isDrop() { + return _kind == Kind.Drop; + } + + /** + * Get the {@code drop} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code drop} kind. + */ + public DropProcessor drop() { + return TaggedUnionUtils.get(this, Kind.Drop); + } + /** * Is this variant instance of kind {@code enrich}? */ @@ -366,122 +434,122 @@ public ForeachProcessor foreach() { } /** - * Is this variant instance of kind {@code json}? + * Is this variant instance of kind {@code geoip}? */ - public boolean isJson() { - return _kind == Kind.Json; + public boolean isGeoip() { + return _kind == Kind.Geoip; } /** - * Get the {@code json} variant value. + * Get the {@code geoip} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code json} kind. + * if the current variant is not of the {@code geoip} kind. */ - public JsonProcessor json() { - return TaggedUnionUtils.get(this, Kind.Json); + public GeoIpProcessor geoip() { + return TaggedUnionUtils.get(this, Kind.Geoip); } /** - * Is this variant instance of kind {@code user_agent}? + * Is this variant instance of kind {@code grok}? */ - public boolean isUserAgent() { - return _kind == Kind.UserAgent; + public boolean isGrok() { + return _kind == Kind.Grok; } /** - * Get the {@code user_agent} variant value. + * Get the {@code grok} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code user_agent} kind. + * if the current variant is not of the {@code grok} kind. */ - public UserAgentProcessor userAgent() { - return TaggedUnionUtils.get(this, Kind.UserAgent); + public GrokProcessor grok() { + return TaggedUnionUtils.get(this, Kind.Grok); } /** - * Is this variant instance of kind {@code kv}? + * Is this variant instance of kind {@code gsub}? */ - public boolean isKv() { - return _kind == Kind.Kv; + public boolean isGsub() { + return _kind == Kind.Gsub; } /** - * Get the {@code kv} variant value. + * Get the {@code gsub} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code kv} kind. + * if the current variant is not of the {@code gsub} kind. */ - public KeyValueProcessor kv() { - return TaggedUnionUtils.get(this, Kind.Kv); + public GsubProcessor gsub() { + return TaggedUnionUtils.get(this, Kind.Gsub); } /** - * Is this variant instance of kind {@code geoip}? + * Is this variant instance of kind {@code inference}? */ - public boolean isGeoip() { - return _kind == Kind.Geoip; + public boolean isInference() { + return _kind == Kind.Inference; } /** - * Get the {@code geoip} variant value. + * Get the {@code inference} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code geoip} kind. + * if the current variant is not of the {@code inference} kind. */ - public GeoIpProcessor geoip() { - return TaggedUnionUtils.get(this, Kind.Geoip); + public InferenceProcessor inference() { + return TaggedUnionUtils.get(this, Kind.Inference); } /** - * Is this variant instance of kind {@code grok}? + * Is this variant instance of kind {@code join}? */ - public boolean isGrok() { - return _kind == Kind.Grok; + public boolean isJoin() { + return _kind == Kind.Join; } /** - * Get the {@code grok} variant value. + * Get the {@code join} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code grok} kind. + * if the current variant is not of the {@code join} kind. */ - public GrokProcessor grok() { - return TaggedUnionUtils.get(this, Kind.Grok); + public JoinProcessor join() { + return TaggedUnionUtils.get(this, Kind.Join); } /** - * Is this variant instance of kind {@code gsub}? + * Is this variant instance of kind {@code json}? */ - public boolean isGsub() { - return _kind == Kind.Gsub; + public boolean isJson() { + return _kind == Kind.Json; } /** - * Get the {@code gsub} variant value. + * Get the {@code json} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code gsub} kind. + * if the current variant is not of the {@code json} kind. */ - public GsubProcessor gsub() { - return TaggedUnionUtils.get(this, Kind.Gsub); + public JsonProcessor json() { + return TaggedUnionUtils.get(this, Kind.Json); } /** - * Is this variant instance of kind {@code join}? + * Is this variant instance of kind {@code kv}? */ - public boolean isJoin() { - return _kind == Kind.Join; + public boolean isKv() { + return _kind == Kind.Kv; } /** - * Get the {@code join} variant value. + * Get the {@code kv} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code join} kind. + * if the current variant is not of the {@code kv} kind. */ - public JoinProcessor join() { - return TaggedUnionUtils.get(this, Kind.Join); + public KeyValueProcessor kv() { + return TaggedUnionUtils.get(this, Kind.Kv); } /** @@ -501,6 +569,23 @@ public LowercaseProcessor lowercase() { return TaggedUnionUtils.get(this, Kind.Lowercase); } + /** + * Is this variant instance of kind {@code pipeline}? + */ + public boolean isPipeline() { + return _kind == Kind.Pipeline; + } + + /** + * Get the {@code pipeline} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code pipeline} kind. + */ + public PipelineProcessor pipeline() { + return TaggedUnionUtils.get(this, Kind.Pipeline); + } + /** * Is this variant instance of kind {@code remove}? */ @@ -587,9 +672,27 @@ public SetProcessor set() { } /** - * Is this variant instance of kind {@code sort}? + * Is this variant instance of kind {@code set_security_user}? */ - public boolean isSort() { + public boolean isSetSecurityUser() { + return _kind == Kind.SetSecurityUser; + } + + /** + * Get the {@code set_security_user} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code set_security_user} + * kind. + */ + public SetSecurityUserProcessor setSecurityUser() { + return TaggedUnionUtils.get(this, Kind.SetSecurityUser); + } + + /** + * Is this variant instance of kind {@code sort}? + */ + public boolean isSort() { return _kind == Kind.Sort; } @@ -672,123 +775,20 @@ public UrlDecodeProcessor urldecode() { } /** - * Is this variant instance of kind {@code bytes}? - */ - public boolean isBytes() { - return _kind == Kind.Bytes; - } - - /** - * Get the {@code bytes} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code bytes} kind. - */ - public BytesProcessor bytes() { - return TaggedUnionUtils.get(this, Kind.Bytes); - } - - /** - * Is this variant instance of kind {@code dissect}? - */ - public boolean isDissect() { - return _kind == Kind.Dissect; - } - - /** - * Get the {@code dissect} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code dissect} kind. - */ - public DissectProcessor dissect() { - return TaggedUnionUtils.get(this, Kind.Dissect); - } - - /** - * Is this variant instance of kind {@code set_security_user}? - */ - public boolean isSetSecurityUser() { - return _kind == Kind.SetSecurityUser; - } - - /** - * Get the {@code set_security_user} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code set_security_user} - * kind. - */ - public SetSecurityUserProcessor setSecurityUser() { - return TaggedUnionUtils.get(this, Kind.SetSecurityUser); - } - - /** - * Is this variant instance of kind {@code pipeline}? - */ - public boolean isPipeline() { - return _kind == Kind.Pipeline; - } - - /** - * Get the {@code pipeline} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code pipeline} kind. - */ - public PipelineProcessor pipeline() { - return TaggedUnionUtils.get(this, Kind.Pipeline); - } - - /** - * Is this variant instance of kind {@code drop}? - */ - public boolean isDrop() { - return _kind == Kind.Drop; - } - - /** - * Get the {@code drop} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code drop} kind. - */ - public DropProcessor drop() { - return TaggedUnionUtils.get(this, Kind.Drop); - } - - /** - * Is this variant instance of kind {@code circle}? - */ - public boolean isCircle() { - return _kind == Kind.Circle; - } - - /** - * Get the {@code circle} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code circle} kind. - */ - public CircleProcessor circle() { - return TaggedUnionUtils.get(this, Kind.Circle); - } - - /** - * Is this variant instance of kind {@code inference}? + * Is this variant instance of kind {@code user_agent}? */ - public boolean isInference() { - return _kind == Kind.Inference; + public boolean isUserAgent() { + return _kind == Kind.UserAgent; } /** - * Get the {@code inference} variant value. + * Get the {@code user_agent} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code inference} kind. + * if the current variant is not of the {@code user_agent} kind. */ - public InferenceProcessor inference() { - return TaggedUnionUtils.get(this, Kind.Inference); + public UserAgentProcessor userAgent() { + return TaggedUnionUtils.get(this, Kind.UserAgent); } @Nullable @@ -849,6 +849,16 @@ public static class Builder extends WithJsonObjectBuilderBase implement protected Builder self() { return this; } + public ObjectBuilder append(AppendProcessor v) { + this._kind = Kind.Append; + this._value = v; + return this; + } + + public ObjectBuilder append(Function> fn) { + return this.append(fn.apply(new AppendProcessor.Builder()).build()); + } + public ObjectBuilder attachment(AttachmentProcessor v) { this._kind = Kind.Attachment; this._value = v; @@ -860,24 +870,24 @@ public ObjectBuilder attachment( return this.attachment(fn.apply(new AttachmentProcessor.Builder()).build()); } - public ObjectBuilder append(AppendProcessor v) { - this._kind = Kind.Append; + public ObjectBuilder bytes(BytesProcessor v) { + this._kind = Kind.Bytes; this._value = v; return this; } - public ObjectBuilder append(Function> fn) { - return this.append(fn.apply(new AppendProcessor.Builder()).build()); + public ObjectBuilder bytes(Function> fn) { + return this.bytes(fn.apply(new BytesProcessor.Builder()).build()); } - public ObjectBuilder csv(CsvProcessor v) { - this._kind = Kind.Csv; + public ObjectBuilder circle(CircleProcessor v) { + this._kind = Kind.Circle; this._value = v; return this; } - public ObjectBuilder csv(Function> fn) { - return this.csv(fn.apply(new CsvProcessor.Builder()).build()); + public ObjectBuilder circle(Function> fn) { + return this.circle(fn.apply(new CircleProcessor.Builder()).build()); } public ObjectBuilder convert(ConvertProcessor v) { @@ -891,6 +901,16 @@ public ObjectBuilder convert( return this.convert(fn.apply(new ConvertProcessor.Builder()).build()); } + public ObjectBuilder csv(CsvProcessor v) { + this._kind = Kind.Csv; + this._value = v; + return this; + } + + public ObjectBuilder csv(Function> fn) { + return this.csv(fn.apply(new CsvProcessor.Builder()).build()); + } + public ObjectBuilder date(DateProcessor v) { this._kind = Kind.Date; this._value = v; @@ -912,6 +932,17 @@ public ObjectBuilder dateIndexName( return this.dateIndexName(fn.apply(new DateIndexNameProcessor.Builder()).build()); } + public ObjectBuilder dissect(DissectProcessor v) { + this._kind = Kind.Dissect; + this._value = v; + return this; + } + + public ObjectBuilder dissect( + Function> fn) { + return this.dissect(fn.apply(new DissectProcessor.Builder()).build()); + } + public ObjectBuilder dotExpander(DotExpanderProcessor v) { this._kind = Kind.DotExpander; this._value = v; @@ -923,6 +954,16 @@ public ObjectBuilder dotExpander( return this.dotExpander(fn.apply(new DotExpanderProcessor.Builder()).build()); } + public ObjectBuilder drop(DropProcessor v) { + this._kind = Kind.Drop; + this._value = v; + return this; + } + + public ObjectBuilder drop(Function> fn) { + return this.drop(fn.apply(new DropProcessor.Builder()).build()); + } + public ObjectBuilder enrich(EnrichProcessor v) { this._kind = Kind.Enrich; this._value = v; @@ -954,75 +995,75 @@ public ObjectBuilder foreach( return this.foreach(fn.apply(new ForeachProcessor.Builder()).build()); } - public ObjectBuilder json(JsonProcessor v) { - this._kind = Kind.Json; + public ObjectBuilder geoip(GeoIpProcessor v) { + this._kind = Kind.Geoip; this._value = v; return this; } - public ObjectBuilder json(Function> fn) { - return this.json(fn.apply(new JsonProcessor.Builder()).build()); + public ObjectBuilder geoip(Function> fn) { + return this.geoip(fn.apply(new GeoIpProcessor.Builder()).build()); } - public ObjectBuilder userAgent(UserAgentProcessor v) { - this._kind = Kind.UserAgent; + public ObjectBuilder grok(GrokProcessor v) { + this._kind = Kind.Grok; this._value = v; return this; } - public ObjectBuilder userAgent( - Function> fn) { - return this.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); + public ObjectBuilder grok(Function> fn) { + return this.grok(fn.apply(new GrokProcessor.Builder()).build()); } - public ObjectBuilder kv(KeyValueProcessor v) { - this._kind = Kind.Kv; + public ObjectBuilder gsub(GsubProcessor v) { + this._kind = Kind.Gsub; this._value = v; return this; } - public ObjectBuilder kv(Function> fn) { - return this.kv(fn.apply(new KeyValueProcessor.Builder()).build()); + public ObjectBuilder gsub(Function> fn) { + return this.gsub(fn.apply(new GsubProcessor.Builder()).build()); } - public ObjectBuilder geoip(GeoIpProcessor v) { - this._kind = Kind.Geoip; + public ObjectBuilder inference(InferenceProcessor v) { + this._kind = Kind.Inference; this._value = v; return this; } - public ObjectBuilder geoip(Function> fn) { - return this.geoip(fn.apply(new GeoIpProcessor.Builder()).build()); + public ObjectBuilder inference( + Function> fn) { + return this.inference(fn.apply(new InferenceProcessor.Builder()).build()); } - public ObjectBuilder grok(GrokProcessor v) { - this._kind = Kind.Grok; + public ObjectBuilder join(JoinProcessor v) { + this._kind = Kind.Join; this._value = v; return this; } - public ObjectBuilder grok(Function> fn) { - return this.grok(fn.apply(new GrokProcessor.Builder()).build()); + public ObjectBuilder join(Function> fn) { + return this.join(fn.apply(new JoinProcessor.Builder()).build()); } - public ObjectBuilder gsub(GsubProcessor v) { - this._kind = Kind.Gsub; + public ObjectBuilder json(JsonProcessor v) { + this._kind = Kind.Json; this._value = v; return this; } - public ObjectBuilder gsub(Function> fn) { - return this.gsub(fn.apply(new GsubProcessor.Builder()).build()); + public ObjectBuilder json(Function> fn) { + return this.json(fn.apply(new JsonProcessor.Builder()).build()); } - public ObjectBuilder join(JoinProcessor v) { - this._kind = Kind.Join; + public ObjectBuilder kv(KeyValueProcessor v) { + this._kind = Kind.Kv; this._value = v; return this; } - public ObjectBuilder join(Function> fn) { - return this.join(fn.apply(new JoinProcessor.Builder()).build()); + public ObjectBuilder kv(Function> fn) { + return this.kv(fn.apply(new KeyValueProcessor.Builder()).build()); } public ObjectBuilder lowercase(LowercaseProcessor v) { @@ -1036,6 +1077,17 @@ public ObjectBuilder lowercase( return this.lowercase(fn.apply(new LowercaseProcessor.Builder()).build()); } + public ObjectBuilder pipeline(PipelineProcessor v) { + this._kind = Kind.Pipeline; + this._value = v; + return this; + } + + public ObjectBuilder pipeline( + Function> fn) { + return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); + } + public ObjectBuilder remove(RemoveProcessor v) { this._kind = Kind.Remove; this._value = v; @@ -1087,6 +1139,17 @@ public ObjectBuilder set(Function setSecurityUser(SetSecurityUserProcessor v) { + this._kind = Kind.SetSecurityUser; + this._value = v; + return this; + } + + public ObjectBuilder setSecurityUser( + Function> fn) { + return this.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); + } + public ObjectBuilder sort(SortProcessor v) { this._kind = Kind.Sort; this._value = v; @@ -1139,78 +1202,15 @@ public ObjectBuilder urldecode( return this.urldecode(fn.apply(new UrlDecodeProcessor.Builder()).build()); } - public ObjectBuilder bytes(BytesProcessor v) { - this._kind = Kind.Bytes; - this._value = v; - return this; - } - - public ObjectBuilder bytes(Function> fn) { - return this.bytes(fn.apply(new BytesProcessor.Builder()).build()); - } - - public ObjectBuilder dissect(DissectProcessor v) { - this._kind = Kind.Dissect; - this._value = v; - return this; - } - - public ObjectBuilder dissect( - Function> fn) { - return this.dissect(fn.apply(new DissectProcessor.Builder()).build()); - } - - public ObjectBuilder setSecurityUser(SetSecurityUserProcessor v) { - this._kind = Kind.SetSecurityUser; - this._value = v; - return this; - } - - public ObjectBuilder setSecurityUser( - Function> fn) { - return this.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); - } - - public ObjectBuilder pipeline(PipelineProcessor v) { - this._kind = Kind.Pipeline; - this._value = v; - return this; - } - - public ObjectBuilder pipeline( - Function> fn) { - return this.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); - } - - public ObjectBuilder drop(DropProcessor v) { - this._kind = Kind.Drop; - this._value = v; - return this; - } - - public ObjectBuilder drop(Function> fn) { - return this.drop(fn.apply(new DropProcessor.Builder()).build()); - } - - public ObjectBuilder circle(CircleProcessor v) { - this._kind = Kind.Circle; - this._value = v; - return this; - } - - public ObjectBuilder circle(Function> fn) { - return this.circle(fn.apply(new CircleProcessor.Builder()).build()); - } - - public ObjectBuilder inference(InferenceProcessor v) { - this._kind = Kind.Inference; + public ObjectBuilder userAgent(UserAgentProcessor v) { + this._kind = Kind.UserAgent; this._value = v; return this; } - public ObjectBuilder inference( - Function> fn) { - return this.inference(fn.apply(new InferenceProcessor.Builder()).build()); + public ObjectBuilder userAgent( + Function> fn) { + return this.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); } /** @@ -1238,41 +1238,41 @@ public Processor build() { protected static void setupProcessorDeserializer(ObjectDeserializer op) { - op.add(Builder::attachment, AttachmentProcessor._DESERIALIZER, "attachment"); op.add(Builder::append, AppendProcessor._DESERIALIZER, "append"); - op.add(Builder::csv, CsvProcessor._DESERIALIZER, "csv"); + op.add(Builder::attachment, AttachmentProcessor._DESERIALIZER, "attachment"); + op.add(Builder::bytes, BytesProcessor._DESERIALIZER, "bytes"); + op.add(Builder::circle, CircleProcessor._DESERIALIZER, "circle"); op.add(Builder::convert, ConvertProcessor._DESERIALIZER, "convert"); + op.add(Builder::csv, CsvProcessor._DESERIALIZER, "csv"); op.add(Builder::date, DateProcessor._DESERIALIZER, "date"); op.add(Builder::dateIndexName, DateIndexNameProcessor._DESERIALIZER, "date_index_name"); + op.add(Builder::dissect, DissectProcessor._DESERIALIZER, "dissect"); op.add(Builder::dotExpander, DotExpanderProcessor._DESERIALIZER, "dot_expander"); + op.add(Builder::drop, DropProcessor._DESERIALIZER, "drop"); op.add(Builder::enrich, EnrichProcessor._DESERIALIZER, "enrich"); op.add(Builder::fail, FailProcessor._DESERIALIZER, "fail"); op.add(Builder::foreach, ForeachProcessor._DESERIALIZER, "foreach"); - op.add(Builder::json, JsonProcessor._DESERIALIZER, "json"); - op.add(Builder::userAgent, UserAgentProcessor._DESERIALIZER, "user_agent"); - op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::geoip, GeoIpProcessor._DESERIALIZER, "geoip"); op.add(Builder::grok, GrokProcessor._DESERIALIZER, "grok"); op.add(Builder::gsub, GsubProcessor._DESERIALIZER, "gsub"); + op.add(Builder::inference, InferenceProcessor._DESERIALIZER, "inference"); op.add(Builder::join, JoinProcessor._DESERIALIZER, "join"); + op.add(Builder::json, JsonProcessor._DESERIALIZER, "json"); + op.add(Builder::kv, KeyValueProcessor._DESERIALIZER, "kv"); op.add(Builder::lowercase, LowercaseProcessor._DESERIALIZER, "lowercase"); + op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); op.add(Builder::remove, RemoveProcessor._DESERIALIZER, "remove"); op.add(Builder::rename, RenameProcessor._DESERIALIZER, "rename"); op.add(Builder::reroute, RerouteProcessor._DESERIALIZER, "reroute"); op.add(Builder::script, ScriptProcessor._DESERIALIZER, "script"); op.add(Builder::set, SetProcessor._DESERIALIZER, "set"); + op.add(Builder::setSecurityUser, SetSecurityUserProcessor._DESERIALIZER, "set_security_user"); op.add(Builder::sort, SortProcessor._DESERIALIZER, "sort"); op.add(Builder::split, SplitProcessor._DESERIALIZER, "split"); op.add(Builder::trim, TrimProcessor._DESERIALIZER, "trim"); op.add(Builder::uppercase, UppercaseProcessor._DESERIALIZER, "uppercase"); op.add(Builder::urldecode, UrlDecodeProcessor._DESERIALIZER, "urldecode"); - op.add(Builder::bytes, BytesProcessor._DESERIALIZER, "bytes"); - op.add(Builder::dissect, DissectProcessor._DESERIALIZER, "dissect"); - op.add(Builder::setSecurityUser, SetSecurityUserProcessor._DESERIALIZER, "set_security_user"); - op.add(Builder::pipeline, PipelineProcessor._DESERIALIZER, "pipeline"); - op.add(Builder::drop, DropProcessor._DESERIALIZER, "drop"); - op.add(Builder::circle, CircleProcessor._DESERIALIZER, "circle"); - op.add(Builder::inference, InferenceProcessor._DESERIALIZER, "inference"); + op.add(Builder::userAgent, UserAgentProcessor._DESERIALIZER, "user_agent"); op.setUnknownFieldHandler((builder, name, parser, mapper) -> { JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java index f5d4c5074..1c13f6724 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/ProcessorBuilders.java @@ -44,6 +44,24 @@ public class ProcessorBuilders { private ProcessorBuilders() { } + /** + * Creates a builder for the {@link AppendProcessor append} {@code Processor} + * variant. + */ + public static AppendProcessor.Builder append() { + return new AppendProcessor.Builder(); + } + + /** + * Creates a Processor of the {@link AppendProcessor append} {@code Processor} + * variant. + */ + public static Processor append(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.append(fn.apply(new AppendProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link AttachmentProcessor attachment} * {@code Processor} variant. @@ -63,37 +81,38 @@ public static Processor attachment(Function> fn) { + public static Processor bytes(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.append(fn.apply(new AppendProcessor.Builder()).build()); + builder.bytes(fn.apply(new BytesProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link CsvProcessor csv} {@code Processor} variant. + * Creates a builder for the {@link CircleProcessor circle} {@code Processor} + * variant. */ - public static CsvProcessor.Builder csv() { - return new CsvProcessor.Builder(); + public static CircleProcessor.Builder circle() { + return new CircleProcessor.Builder(); } /** - * Creates a Processor of the {@link CsvProcessor csv} {@code Processor} + * Creates a Processor of the {@link CircleProcessor circle} {@code Processor} * variant. */ - public static Processor csv(Function> fn) { + public static Processor circle(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.csv(fn.apply(new CsvProcessor.Builder()).build()); + builder.circle(fn.apply(new CircleProcessor.Builder()).build()); return builder.build(); } @@ -115,6 +134,23 @@ public static Processor convert(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.csv(fn.apply(new CsvProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link DateProcessor date} {@code Processor} * variant. @@ -152,6 +188,24 @@ public static Processor dateIndexName( return builder.build(); } + /** + * Creates a builder for the {@link DissectProcessor dissect} {@code Processor} + * variant. + */ + public static DissectProcessor.Builder dissect() { + return new DissectProcessor.Builder(); + } + + /** + * Creates a Processor of the {@link DissectProcessor dissect} {@code Processor} + * variant. + */ + public static Processor dissect(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.dissect(fn.apply(new DissectProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link DotExpanderProcessor dot_expander} * {@code Processor} variant. @@ -171,6 +225,24 @@ public static Processor dotExpander( return builder.build(); } + /** + * Creates a builder for the {@link DropProcessor drop} {@code Processor} + * variant. + */ + public static DropProcessor.Builder drop() { + return new DropProcessor.Builder(); + } + + /** + * Creates a Processor of the {@link DropProcessor drop} {@code Processor} + * variant. + */ + public static Processor drop(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.drop(fn.apply(new DropProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link EnrichProcessor enrich} {@code Processor} * variant. @@ -226,128 +298,128 @@ public static Processor foreach(Function> fn) { + public static Processor geoip(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.json(fn.apply(new JsonProcessor.Builder()).build()); + builder.geoip(fn.apply(new GeoIpProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link UserAgentProcessor user_agent} - * {@code Processor} variant. + * Creates a builder for the {@link GrokProcessor grok} {@code Processor} + * variant. */ - public static UserAgentProcessor.Builder userAgent() { - return new UserAgentProcessor.Builder(); + public static GrokProcessor.Builder grok() { + return new GrokProcessor.Builder(); } /** - * Creates a Processor of the {@link UserAgentProcessor user_agent} - * {@code Processor} variant. + * Creates a Processor of the {@link GrokProcessor grok} {@code Processor} + * variant. */ - public static Processor userAgent(Function> fn) { + public static Processor grok(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); + builder.grok(fn.apply(new GrokProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link KeyValueProcessor kv} {@code Processor} + * Creates a builder for the {@link GsubProcessor gsub} {@code Processor} * variant. */ - public static KeyValueProcessor.Builder kv() { - return new KeyValueProcessor.Builder(); + public static GsubProcessor.Builder gsub() { + return new GsubProcessor.Builder(); } /** - * Creates a Processor of the {@link KeyValueProcessor kv} {@code Processor} + * Creates a Processor of the {@link GsubProcessor gsub} {@code Processor} * variant. */ - public static Processor kv(Function> fn) { + public static Processor gsub(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.kv(fn.apply(new KeyValueProcessor.Builder()).build()); + builder.gsub(fn.apply(new GsubProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link GeoIpProcessor geoip} {@code Processor} - * variant. + * Creates a builder for the {@link InferenceProcessor inference} + * {@code Processor} variant. */ - public static GeoIpProcessor.Builder geoip() { - return new GeoIpProcessor.Builder(); + public static InferenceProcessor.Builder inference() { + return new InferenceProcessor.Builder(); } /** - * Creates a Processor of the {@link GeoIpProcessor geoip} {@code Processor} - * variant. + * Creates a Processor of the {@link InferenceProcessor inference} + * {@code Processor} variant. */ - public static Processor geoip(Function> fn) { + public static Processor inference(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.geoip(fn.apply(new GeoIpProcessor.Builder()).build()); + builder.inference(fn.apply(new InferenceProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link GrokProcessor grok} {@code Processor} + * Creates a builder for the {@link JoinProcessor join} {@code Processor} * variant. */ - public static GrokProcessor.Builder grok() { - return new GrokProcessor.Builder(); + public static JoinProcessor.Builder join() { + return new JoinProcessor.Builder(); } /** - * Creates a Processor of the {@link GrokProcessor grok} {@code Processor} + * Creates a Processor of the {@link JoinProcessor join} {@code Processor} * variant. */ - public static Processor grok(Function> fn) { + public static Processor join(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.grok(fn.apply(new GrokProcessor.Builder()).build()); + builder.join(fn.apply(new JoinProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link GsubProcessor gsub} {@code Processor} + * Creates a builder for the {@link JsonProcessor json} {@code Processor} * variant. */ - public static GsubProcessor.Builder gsub() { - return new GsubProcessor.Builder(); + public static JsonProcessor.Builder json() { + return new JsonProcessor.Builder(); } /** - * Creates a Processor of the {@link GsubProcessor gsub} {@code Processor} + * Creates a Processor of the {@link JsonProcessor json} {@code Processor} * variant. */ - public static Processor gsub(Function> fn) { + public static Processor json(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.gsub(fn.apply(new GsubProcessor.Builder()).build()); + builder.json(fn.apply(new JsonProcessor.Builder()).build()); return builder.build(); } /** - * Creates a builder for the {@link JoinProcessor join} {@code Processor} + * Creates a builder for the {@link KeyValueProcessor kv} {@code Processor} * variant. */ - public static JoinProcessor.Builder join() { - return new JoinProcessor.Builder(); + public static KeyValueProcessor.Builder kv() { + return new KeyValueProcessor.Builder(); } /** - * Creates a Processor of the {@link JoinProcessor join} {@code Processor} + * Creates a Processor of the {@link KeyValueProcessor kv} {@code Processor} * variant. */ - public static Processor join(Function> fn) { + public static Processor kv(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.join(fn.apply(new JoinProcessor.Builder()).build()); + builder.kv(fn.apply(new KeyValueProcessor.Builder()).build()); return builder.build(); } @@ -369,6 +441,24 @@ public static Processor lowercase(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link RemoveProcessor remove} {@code Processor} * variant. @@ -458,6 +548,25 @@ public static Processor set(Function> fn) { + Processor.Builder builder = new Processor.Builder(); + builder.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link SortProcessor sort} {@code Processor} * variant. @@ -549,129 +658,20 @@ public static Processor urldecode(Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.bytes(fn.apply(new BytesProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link DissectProcessor dissect} {@code Processor} - * variant. - */ - public static DissectProcessor.Builder dissect() { - return new DissectProcessor.Builder(); - } - - /** - * Creates a Processor of the {@link DissectProcessor dissect} {@code Processor} - * variant. - */ - public static Processor dissect(Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.dissect(fn.apply(new DissectProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SetSecurityUserProcessor set_security_user} - * {@code Processor} variant. - */ - public static SetSecurityUserProcessor.Builder setSecurityUser() { - return new SetSecurityUserProcessor.Builder(); - } - - /** - * Creates a Processor of the {@link SetSecurityUserProcessor set_security_user} - * {@code Processor} variant. - */ - public static Processor setSecurityUser( - Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.setSecurityUser(fn.apply(new SetSecurityUserProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link PipelineProcessor pipeline} - * {@code Processor} variant. - */ - public static PipelineProcessor.Builder pipeline() { - return new PipelineProcessor.Builder(); - } - - /** - * Creates a Processor of the {@link PipelineProcessor pipeline} - * {@code Processor} variant. - */ - public static Processor pipeline(Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.pipeline(fn.apply(new PipelineProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link DropProcessor drop} {@code Processor} - * variant. - */ - public static DropProcessor.Builder drop() { - return new DropProcessor.Builder(); - } - - /** - * Creates a Processor of the {@link DropProcessor drop} {@code Processor} - * variant. - */ - public static Processor drop(Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.drop(fn.apply(new DropProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link CircleProcessor circle} {@code Processor} - * variant. - */ - public static CircleProcessor.Builder circle() { - return new CircleProcessor.Builder(); - } - - /** - * Creates a Processor of the {@link CircleProcessor circle} {@code Processor} - * variant. - */ - public static Processor circle(Function> fn) { - Processor.Builder builder = new Processor.Builder(); - builder.circle(fn.apply(new CircleProcessor.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link InferenceProcessor inference} + * Creates a builder for the {@link UserAgentProcessor user_agent} * {@code Processor} variant. */ - public static InferenceProcessor.Builder inference() { - return new InferenceProcessor.Builder(); + public static UserAgentProcessor.Builder userAgent() { + return new UserAgentProcessor.Builder(); } /** - * Creates a Processor of the {@link InferenceProcessor inference} + * Creates a Processor of the {@link UserAgentProcessor user_agent} * {@code Processor} variant. */ - public static Processor inference(Function> fn) { + public static Processor userAgent(Function> fn) { Processor.Builder builder = new Processor.Builder(); - builder.inference(fn.apply(new InferenceProcessor.Builder()).build()); + builder.userAgent(fn.apply(new UserAgentProcessor.Builder()).build()); return builder.build(); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/PutRuleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/PutRuleRequest.java index ca6be096d..25271bb07 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/PutRuleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/PutRuleRequest.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; import java.lang.String; import java.util.Collections; import java.util.HashMap; @@ -70,6 +71,9 @@ public class PutRuleRequest extends RequestBase implements JsonpSerializable { private final List criteria; + @Nullable + private final Integer priority; + private final String ruleId; private final String rulesetId; @@ -82,6 +86,7 @@ private PutRuleRequest(Builder builder) { this.actions = ApiTypeHelper.requireNonNull(builder.actions, this, "actions"); this.criteria = ApiTypeHelper.unmodifiableRequired(builder.criteria, this, "criteria"); + this.priority = builder.priority; this.ruleId = ApiTypeHelper.requireNonNull(builder.ruleId, this, "ruleId"); this.rulesetId = ApiTypeHelper.requireNonNull(builder.rulesetId, this, "rulesetId"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); @@ -106,6 +111,14 @@ public final List criteria() { return this.criteria; } + /** + * API name: {@code priority} + */ + @Nullable + public final Integer priority() { + return this.priority; + } + /** * Required - The unique identifier of the query rule within the specified * ruleset to be created or updated @@ -156,6 +169,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.priority != null) { + generator.writeKey("priority"); + generator.write(this.priority); + } generator.writeKey("type"); this.type.serialize(generator, mapper); @@ -173,6 +191,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private List criteria; + @Nullable + private Integer priority; + private String ruleId; private String rulesetId; @@ -223,6 +244,14 @@ public final Builder criteria(Function builder) { @@ -76,6 +80,7 @@ protected QueryRule(AbstractBuilder builder) { this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.criteria = ApiTypeHelper.unmodifiableRequired(builder.criteria, this, "criteria"); this.actions = ApiTypeHelper.requireNonNull(builder.actions, this, "actions"); + this.priority = builder.priority; } @@ -111,6 +116,14 @@ public final QueryRuleActions actions() { return this.actions; } + /** + * API name: {@code priority} + */ + @Nullable + public final Integer priority() { + return this.priority; + } + /** * Serialize this object to JSON. */ @@ -140,6 +153,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("actions"); this.actions.serialize(generator, mapper); + if (this.priority != null) { + generator.writeKey("priority"); + generator.write(this.priority); + + } + } @Override @@ -183,6 +202,9 @@ public abstract static class AbstractBuilder> void setupQueryRul op.add(AbstractBuilder::criteria, JsonpDeserializer.arrayDeserializer(QueryRuleCriteria._DESERIALIZER), "criteria"); op.add(AbstractBuilder::actions, QueryRuleActions._DESERIALIZER, "actions"); + op.add(AbstractBuilder::priority, JsonpDeserializer.integerDeserializer(), "priority"); } 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 4f5ba5e7e..8c8de0478 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 @@ -52,6 +52,8 @@ public enum QueryRuleCriteriaType implements JsonEnum { ExactFuzzy("exact_fuzzy"), + Fuzzy("fuzzy"), + Prefix("prefix"), Suffix("suffix"), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/list_rulesets/QueryRulesetListItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/list_rulesets/QueryRulesetListItem.java index 6e64cba04..8910039e3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/list_rulesets/QueryRulesetListItem.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/query_rules/list_rulesets/QueryRulesetListItem.java @@ -66,7 +66,7 @@ public class QueryRulesetListItem implements JsonpSerializable { private final int ruleTotalCount; - private final Map ruleCriteriaTypesCounts; + private final Map ruleCriteriaTypesCounts; // --------------------------------------------------------------------------------------------- @@ -106,7 +106,7 @@ public final int ruleTotalCount() { *

* API name: {@code rule_criteria_types_counts} */ - public final Map ruleCriteriaTypesCounts() { + public final Map ruleCriteriaTypesCounts() { return this.ruleCriteriaTypesCounts; } @@ -130,7 +130,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.ruleCriteriaTypesCounts)) { generator.writeKey("rule_criteria_types_counts"); generator.writeStartObject(); - for (Map.Entry item0 : this.ruleCriteriaTypesCounts.entrySet()) { + for (Map.Entry item0 : this.ruleCriteriaTypesCounts.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); @@ -159,7 +159,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer ruleTotalCount; - private Map ruleCriteriaTypesCounts; + private Map ruleCriteriaTypesCounts; /** * Required - Ruleset unique identifier @@ -188,7 +188,7 @@ public final Builder ruleTotalCount(int value) { *

* Adds all entries of map to ruleCriteriaTypesCounts. */ - public final Builder ruleCriteriaTypesCounts(Map map) { + public final Builder ruleCriteriaTypesCounts(Map map) { this.ruleCriteriaTypesCounts = _mapPutAll(this.ruleCriteriaTypesCounts, map); return this; } @@ -200,7 +200,7 @@ public final Builder ruleCriteriaTypesCounts(Map map) { *

* Adds an entry to ruleCriteriaTypesCounts. */ - public final Builder ruleCriteriaTypesCounts(String key, String value) { + public final Builder ruleCriteriaTypesCounts(String key, Integer value) { this.ruleCriteriaTypesCounts = _mapPut(this.ruleCriteriaTypesCounts, key, value); return this; } @@ -236,7 +236,7 @@ protected static void setupQueryRulesetListItemDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class BulkDeleteRoleRequest extends RequestBase implements JsonpSerializable { + private final List names; + + @Nullable + private final Refresh refresh; + + // --------------------------------------------------------------------------------------------- + + private BulkDeleteRoleRequest(Builder builder) { + + this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); + this.refresh = builder.refresh; + + } + + public static BulkDeleteRoleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - An array of role names to delete + *

+ * API name: {@code names} + */ + public final List names() { + return this.names; + } + + /** + * If true (the default) then refresh the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + @Nullable + public final Refresh refresh() { + return this.refresh; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.names)) { + generator.writeKey("names"); + generator.writeStartArray(); + for (String item0 : this.names) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkDeleteRoleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private List names; + + @Nullable + private Refresh refresh; + + /** + * Required - An array of role names to delete + *

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

+ * Adds all elements of list to names. + */ + public final Builder names(List list) { + this.names = _listAddAll(this.names, list); + return this; + } + + /** + * Required - An array of role names to delete + *

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

+ * Adds one or more values to names. + */ + public final Builder names(String value, String... values) { + this.names = _listAdd(this.names, value, values); + return this; + } + + /** + * If true (the default) then refresh the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + public final Builder refresh(@Nullable Refresh value) { + this.refresh = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BulkDeleteRoleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkDeleteRoleRequest build() { + _checkSingleUse(); + + return new BulkDeleteRoleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkDeleteRoleRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, BulkDeleteRoleRequest::setupBulkDeleteRoleRequestDeserializer); + + protected static void setupBulkDeleteRoleRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.bulk_delete_role}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.bulk_delete_role", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + return "/_security/role"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.refresh != null) { + params.put("refresh", request.refresh.jsonValue()); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, BulkDeleteRoleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkDeleteRoleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkDeleteRoleResponse.java new file mode 100644 index 000000000..49738b22f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkDeleteRoleResponse.java @@ -0,0 +1,279 @@ +/* + * 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.security; + +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.String; +import java.util.List; +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: security.bulk_delete_role.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class BulkDeleteRoleResponse implements JsonpSerializable { + private final List deleted; + + private final List notFound; + + @Nullable + private final BulkError errors; + + // --------------------------------------------------------------------------------------------- + + private BulkDeleteRoleResponse(Builder builder) { + + this.deleted = ApiTypeHelper.unmodifiable(builder.deleted); + this.notFound = ApiTypeHelper.unmodifiable(builder.notFound); + this.errors = builder.errors; + + } + + public static BulkDeleteRoleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Array of deleted roles + *

+ * API name: {@code deleted} + */ + public final List deleted() { + return this.deleted; + } + + /** + * Array of roles that could not be found + *

+ * API name: {@code not_found} + */ + public final List notFound() { + return this.notFound; + } + + /** + * Present if any deletes resulted in errors + *

+ * API name: {@code errors} + */ + @Nullable + public final BulkError errors() { + return this.errors; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.deleted)) { + generator.writeKey("deleted"); + generator.writeStartArray(); + for (String item0 : this.deleted) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.notFound)) { + generator.writeKey("not_found"); + generator.writeStartArray(); + for (String item0 : this.notFound) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.errors != null) { + generator.writeKey("errors"); + this.errors.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkDeleteRoleResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private List deleted; + + @Nullable + private List notFound; + + @Nullable + private BulkError errors; + + /** + * Array of deleted roles + *

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

+ * Adds all elements of list to deleted. + */ + public final Builder deleted(List list) { + this.deleted = _listAddAll(this.deleted, list); + return this; + } + + /** + * Array of deleted roles + *

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

+ * Adds one or more values to deleted. + */ + public final Builder deleted(String value, String... values) { + this.deleted = _listAdd(this.deleted, value, values); + return this; + } + + /** + * Array of roles that could not be found + *

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

+ * Adds all elements of list to notFound. + */ + public final Builder notFound(List list) { + this.notFound = _listAddAll(this.notFound, list); + return this; + } + + /** + * Array of roles that could not be found + *

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

+ * Adds one or more values to notFound. + */ + public final Builder notFound(String value, String... values) { + this.notFound = _listAdd(this.notFound, value, values); + return this; + } + + /** + * Present if any deletes resulted in errors + *

+ * API name: {@code errors} + */ + public final Builder errors(@Nullable BulkError value) { + this.errors = value; + return this; + } + + /** + * Present if any deletes resulted in errors + *

+ * API name: {@code errors} + */ + public final Builder errors(Function> fn) { + return this.errors(fn.apply(new BulkError.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BulkDeleteRoleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkDeleteRoleResponse build() { + _checkSingleUse(); + + return new BulkDeleteRoleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkDeleteRoleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, BulkDeleteRoleResponse::setupBulkDeleteRoleResponseDeserializer); + + protected static void setupBulkDeleteRoleResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::deleted, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "deleted"); + op.add(Builder::notFound, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "not_found"); + op.add(Builder::errors, BulkError._DESERIALIZER, "errors"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkError.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkError.java new file mode 100644 index 000000000..d40a27eec --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkError.java @@ -0,0 +1,222 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch._types.ErrorCause; +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.Integer; +import java.lang.String; +import java.util.Map; +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: security._types.BulkError + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class BulkError implements JsonpSerializable { + private final int count; + + private final Map details; + + // --------------------------------------------------------------------------------------------- + + private BulkError(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.details = ApiTypeHelper.unmodifiableRequired(builder.details, this, "details"); + + } + + public static BulkError of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of errors + *

+ * API name: {@code count} + */ + public final int count() { + return this.count; + } + + /** + * Required - Details about the errors, keyed by role name + *

+ * API name: {@code details} + */ + public final Map details() { + return this.details; + } + + /** + * 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("count"); + generator.write(this.count); + + if (ApiTypeHelper.isDefined(this.details)) { + generator.writeKey("details"); + generator.writeStartObject(); + for (Map.Entry item0 : this.details.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkError}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Integer count; + + private Map details; + + /** + * Required - The number of errors + *

+ * API name: {@code count} + */ + public final Builder count(int value) { + this.count = value; + return this; + } + + /** + * Required - Details about the errors, keyed by role name + *

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

+ * Adds all entries of map to details. + */ + public final Builder details(Map map) { + this.details = _mapPutAll(this.details, map); + return this; + } + + /** + * Required - Details about the errors, keyed by role name + *

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

+ * Adds an entry to details. + */ + public final Builder details(String key, ErrorCause value) { + this.details = _mapPut(this.details, key, value); + return this; + } + + /** + * Required - Details about the errors, keyed by role name + *

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

+ * Adds an entry to details using a builder lambda. + */ + public final Builder details(String key, Function> fn) { + return details(key, fn.apply(new ErrorCause.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BulkError}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkError build() { + _checkSingleUse(); + + return new BulkError(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkError} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + BulkError::setupBulkErrorDeserializer); + + protected static void setupBulkErrorDeserializer(ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + op.add(Builder::details, JsonpDeserializer.stringMapDeserializer(ErrorCause._DESERIALIZER), "details"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleRequest.java new file mode 100644 index 000000000..1dd5efc93 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleRequest.java @@ -0,0 +1,268 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.Refresh; +import co.elastic.clients.elasticsearch._types.RequestBase; +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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +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: security.bulk_put_role.Request + +/** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk create or update roles + * API cannot update roles that are defined in roles files. + * + * @see API + * specification + */ +@JsonpDeserializable +public class BulkPutRoleRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Refresh refresh; + + private final Map roles; + + // --------------------------------------------------------------------------------------------- + + private BulkPutRoleRequest(Builder builder) { + + this.refresh = builder.refresh; + this.roles = ApiTypeHelper.unmodifiableRequired(builder.roles, this, "roles"); + + } + + public static BulkPutRoleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If true (the default) then refresh the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + @Nullable + public final Refresh refresh() { + return this.refresh; + } + + /** + * Required - A dictionary of role name to RoleDescriptor objects to add or + * update + *

+ * API name: {@code roles} + */ + public final Map roles() { + return this.roles; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartObject(); + for (Map.Entry item0 : this.roles.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkPutRoleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Refresh refresh; + + private Map roles; + + /** + * If true (the default) then refresh the affected shards to make + * this operation visible to search, if wait_for then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + public final Builder refresh(@Nullable Refresh value) { + this.refresh = value; + return this; + } + + /** + * Required - A dictionary of role name to RoleDescriptor objects to add or + * update + *

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

+ * Adds all entries of map to roles. + */ + public final Builder roles(Map map) { + this.roles = _mapPutAll(this.roles, map); + return this; + } + + /** + * Required - A dictionary of role name to RoleDescriptor objects to add or + * update + *

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

+ * Adds an entry to roles. + */ + public final Builder roles(String key, RoleDescriptor value) { + this.roles = _mapPut(this.roles, key, value); + return this; + } + + /** + * Required - A dictionary of role name to RoleDescriptor objects to add or + * update + *

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

+ * Adds an entry to roles using a builder lambda. + */ + public final Builder roles(String key, Function> fn) { + return roles(key, fn.apply(new RoleDescriptor.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BulkPutRoleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkPutRoleRequest build() { + _checkSingleUse(); + + return new BulkPutRoleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkPutRoleRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, BulkPutRoleRequest::setupBulkPutRoleRequestDeserializer); + + protected static void setupBulkPutRoleRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::roles, JsonpDeserializer.stringMapDeserializer(RoleDescriptor._DESERIALIZER), "roles"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.bulk_put_role}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.bulk_put_role", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/role"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.refresh != null) { + params.put("refresh", request.refresh.jsonValue()); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, BulkPutRoleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleResponse.java new file mode 100644 index 000000000..409c5743e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/BulkPutRoleResponse.java @@ -0,0 +1,327 @@ +/* + * 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.security; + +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.String; +import java.util.List; +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: security.bulk_put_role.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class BulkPutRoleResponse implements JsonpSerializable { + private final List created; + + private final List updated; + + private final List noop; + + @Nullable + private final BulkError errors; + + // --------------------------------------------------------------------------------------------- + + private BulkPutRoleResponse(Builder builder) { + + this.created = ApiTypeHelper.unmodifiable(builder.created); + this.updated = ApiTypeHelper.unmodifiable(builder.updated); + this.noop = ApiTypeHelper.unmodifiable(builder.noop); + this.errors = builder.errors; + + } + + public static BulkPutRoleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Array of created roles + *

+ * API name: {@code created} + */ + public final List created() { + return this.created; + } + + /** + * Array of updated roles + *

+ * API name: {@code updated} + */ + public final List updated() { + return this.updated; + } + + /** + * Array of role names without any changes + *

+ * API name: {@code noop} + */ + public final List noop() { + return this.noop; + } + + /** + * Present if any updates resulted in errors + *

+ * API name: {@code errors} + */ + @Nullable + public final BulkError errors() { + return this.errors; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.created)) { + generator.writeKey("created"); + generator.writeStartArray(); + for (String item0 : this.created) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.updated)) { + generator.writeKey("updated"); + generator.writeStartArray(); + for (String item0 : this.updated) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.noop)) { + generator.writeKey("noop"); + generator.writeStartArray(); + for (String item0 : this.noop) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.errors != null) { + generator.writeKey("errors"); + this.errors.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkPutRoleResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private List created; + + @Nullable + private List updated; + + @Nullable + private List noop; + + @Nullable + private BulkError errors; + + /** + * Array of created roles + *

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

+ * Adds all elements of list to created. + */ + public final Builder created(List list) { + this.created = _listAddAll(this.created, list); + return this; + } + + /** + * Array of created roles + *

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

+ * Adds one or more values to created. + */ + public final Builder created(String value, String... values) { + this.created = _listAdd(this.created, value, values); + return this; + } + + /** + * Array of updated roles + *

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

+ * Adds all elements of list to updated. + */ + public final Builder updated(List list) { + this.updated = _listAddAll(this.updated, list); + return this; + } + + /** + * Array of updated roles + *

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

+ * Adds one or more values to updated. + */ + public final Builder updated(String value, String... values) { + this.updated = _listAdd(this.updated, value, values); + return this; + } + + /** + * Array of role names without any changes + *

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

+ * Adds all elements of list to noop. + */ + public final Builder noop(List list) { + this.noop = _listAddAll(this.noop, list); + return this; + } + + /** + * Array of role names without any changes + *

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

+ * Adds one or more values to noop. + */ + public final Builder noop(String value, String... values) { + this.noop = _listAdd(this.noop, value, values); + return this; + } + + /** + * Present if any updates resulted in errors + *

+ * API name: {@code errors} + */ + public final Builder errors(@Nullable BulkError value) { + this.errors = value; + return this; + } + + /** + * Present if any updates resulted in errors + *

+ * API name: {@code errors} + */ + public final Builder errors(Function> fn) { + return this.errors(fn.apply(new BulkError.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BulkPutRoleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkPutRoleResponse build() { + _checkSingleUse(); + + return new BulkPutRoleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkPutRoleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, BulkPutRoleResponse::setupBulkPutRoleResponseDeserializer); + + protected static void setupBulkPutRoleResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::created, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "created"); + op.add(Builder::updated, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "updated"); + op.add(Builder::noop, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "noop"); + op.add(Builder::errors, BulkError._DESERIALIZER, "errors"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java index 20471c40f..8f8aefc99 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityAsyncClient.java @@ -120,6 +120,80 @@ public CompletableFuture authenticate() { this.transportOptions); } + // ----- Endpoint: security.bulk_delete_role + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk delete roles API + * cannot delete roles that are defined in roles files. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture bulkDeleteRole(BulkDeleteRoleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) BulkDeleteRoleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk delete roles API + * cannot delete roles that are defined in roles files. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkDeleteRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture bulkDeleteRole( + Function> fn) { + return bulkDeleteRole(fn.apply(new BulkDeleteRoleRequest.Builder()).build()); + } + + // ----- Endpoint: security.bulk_put_role + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk create or update roles + * API cannot update roles that are defined in roles files. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture bulkPutRole(BulkPutRoleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) BulkPutRoleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk create or update roles + * API cannot update roles that are defined in roles files. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkPutRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture bulkPutRole( + Function> fn) { + return bulkPutRole(fn.apply(new BulkPutRoleRequest.Builder()).build()); + } + // ----- Endpoint: security.change_password /** @@ -1708,6 +1782,104 @@ public CompletableFuture queryApiKeys() { QueryApiKeysRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: security.query_role + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture queryRole(QueryRoleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) QueryRoleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture queryRole( + Function> fn) { + return queryRole(fn.apply(new QueryRoleRequest.Builder()).build()); + } + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture queryRole() { + return this.transport.performRequestAsync(new QueryRoleRequest.Builder().build(), QueryRoleRequest._ENDPOINT, + this.transportOptions); + } + + // ----- Endpoint: security.query_user + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture queryUser(QueryUserRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) QueryUserRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryUserRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture queryUser( + Function> fn) { + return queryUser(fn.apply(new QueryUserRequest.Builder()).build()); + } + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture queryUser() { + return this.transport.performRequestAsync(new QueryUserRequest.Builder().build(), QueryUserRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: security.saml_authenticate /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java index cabf93894..6dbdc1e42 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java @@ -120,6 +120,83 @@ public AuthenticateResponse authenticate() throws IOException, ElasticsearchExce this.transportOptions); } + // ----- Endpoint: security.bulk_delete_role + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk delete roles API + * cannot delete roles that are defined in roles files. + * + * @see Documentation + * on elastic.co + */ + + public BulkDeleteRoleResponse bulkDeleteRole(BulkDeleteRoleRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) BulkDeleteRoleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk delete roles API + * cannot delete roles that are defined in roles files. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkDeleteRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final BulkDeleteRoleResponse bulkDeleteRole( + Function> fn) + throws IOException, ElasticsearchException { + return bulkDeleteRole(fn.apply(new BulkDeleteRoleRequest.Builder()).build()); + } + + // ----- Endpoint: security.bulk_put_role + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk create or update roles + * API cannot update roles that are defined in roles files. + * + * @see Documentation + * on elastic.co + */ + + public BulkPutRoleResponse bulkPutRole(BulkPutRoleRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) BulkPutRoleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * The role management APIs are generally the preferred way to manage roles, + * rather than using file-based role management. The bulk create or update roles + * API cannot update roles that are defined in roles files. + * + * @param fn + * a function that initializes a builder to create the + * {@link BulkPutRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final BulkPutRoleResponse bulkPutRole( + Function> fn) + throws IOException, ElasticsearchException { + return bulkPutRole(fn.apply(new BulkPutRoleRequest.Builder()).build()); + } + // ----- Endpoint: security.change_password /** @@ -1756,6 +1833,104 @@ public QueryApiKeysResponse queryApiKeys() throws IOException, ElasticsearchExce this.transportOptions); } + // ----- Endpoint: security.query_role + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @see Documentation + * on elastic.co + */ + + public QueryRoleResponse queryRole(QueryRoleRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) QueryRoleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryRoleRequest} + * @see Documentation + * on elastic.co + */ + + public final QueryRoleResponse queryRole(Function> fn) + throws IOException, ElasticsearchException { + return queryRole(fn.apply(new QueryRoleRequest.Builder()).build()); + } + + /** + * Retrieves roles in a paginated manner. You can optionally filter the results + * with a query. + * + * @see Documentation + * on elastic.co + */ + + public QueryRoleResponse queryRole() throws IOException, ElasticsearchException { + return this.transport.performRequest(new QueryRoleRequest.Builder().build(), QueryRoleRequest._ENDPOINT, + this.transportOptions); + } + + // ----- Endpoint: security.query_user + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @see Documentation + * on elastic.co + */ + + public QueryUserResponse queryUser(QueryUserRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) QueryUserRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @param fn + * a function that initializes a builder to create the + * {@link QueryUserRequest} + * @see Documentation + * on elastic.co + */ + + public final QueryUserResponse queryUser(Function> fn) + throws IOException, ElasticsearchException { + return queryUser(fn.apply(new QueryUserRequest.Builder()).build()); + } + + /** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @see Documentation + * on elastic.co + */ + + public QueryUserResponse queryUser() throws IOException, ElasticsearchException { + return this.transport.performRequest(new QueryUserRequest.Builder().build(), QueryUserRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: security.saml_authenticate /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java index 9c20ac346..da79fe67c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java @@ -73,6 +73,9 @@ public class PutRoleRequest extends RequestBase implements JsonpSerializable { private final List cluster; + @Nullable + private final String description; + private final Map global; private final List indices; @@ -94,6 +97,7 @@ private PutRoleRequest(Builder builder) { this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.cluster = ApiTypeHelper.unmodifiable(builder.cluster); + this.description = builder.description; this.global = ApiTypeHelper.unmodifiable(builder.global); this.indices = ApiTypeHelper.unmodifiable(builder.indices); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); @@ -127,6 +131,16 @@ public final List cluster() { return this.cluster; } + /** + * Optional description of the role descriptor + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -235,6 +249,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } if (ApiTypeHelper.isDefined(this.global)) { generator.writeKey("global"); @@ -305,6 +324,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private List cluster; + @Nullable + private String description; + @Nullable private Map global; @@ -387,6 +409,16 @@ public final Builder cluster(String value, String... values) { return this; } + /** + * Optional description of the role descriptor + *

+ * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -595,6 +627,7 @@ protected static void setupPutRoleRequestDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class QueryRoleRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Integer from; + + @Nullable + private final RoleQuery query; + + private final List searchAfter; + + @Nullable + private final Integer size; + + private final List sort; + + // --------------------------------------------------------------------------------------------- + + private QueryRoleRequest(Builder builder) { + + this.from = builder.from; + this.query = builder.query; + this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter); + this.size = builder.size; + this.sort = ApiTypeHelper.unmodifiable(builder.sort); + + } + + public static QueryRoleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Starting document offset. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To page through more hits, + * use the search_after parameter. + *

+ * API name: {@code from} + */ + @Nullable + public final Integer from() { + return this.from; + } + + /** + * A query to filter which roles to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with roles: name, + * description, metadata, + * applications.application, applications.privileges, + * applications.resources. + *

+ * API name: {@code query} + */ + @Nullable + public final RoleQuery query() { + return this.query; + } + + /** + * Search after definition + *

+ * API name: {@code search_after} + */ + public final List searchAfter() { + return this.searchAfter; + } + + /** + * The number of hits to return. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To + * page through more hits, use the search_after parameter. + *

+ * API name: {@code size} + */ + @Nullable + public final Integer size() { + return this.size; + } + + /** + * All public fields of a role are eligible for sorting. In addition, sort can + * also be applied to the _doc field to sort by index order. + *

+ * API name: {@code sort} + */ + public final List sort() { + return this.sort; + } + + /** + * 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.from != null) { + generator.writeKey("from"); + generator.write(this.from); + + } + if (this.query != null) { + generator.writeKey("query"); + this.query.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.searchAfter)) { + generator.writeKey("search_after"); + generator.writeStartArray(); + for (FieldValue item0 : this.searchAfter) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("sort"); + generator.writeStartArray(); + for (SortOptions item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryRoleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Integer from; + + @Nullable + private RoleQuery query; + + @Nullable + private List searchAfter; + + @Nullable + private Integer size; + + @Nullable + private List sort; + + /** + * Starting document offset. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To page through more hits, + * use the search_after parameter. + *

+ * API name: {@code from} + */ + public final Builder from(@Nullable Integer value) { + this.from = value; + return this; + } + + /** + * A query to filter which roles to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with roles: name, + * description, metadata, + * applications.application, applications.privileges, + * applications.resources. + *

+ * API name: {@code query} + */ + public final Builder query(@Nullable RoleQuery value) { + this.query = value; + return this; + } + + /** + * A query to filter which roles to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with roles: name, + * description, metadata, + * applications.application, applications.privileges, + * applications.resources. + *

+ * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new RoleQuery.Builder()).build()); + } + + /** + * Search after definition + *

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

+ * Adds all elements of list to searchAfter. + */ + public final Builder searchAfter(List list) { + this.searchAfter = _listAddAll(this.searchAfter, list); + return this; + } + + /** + * Search after definition + *

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

+ * Adds one or more values to searchAfter. + */ + public final Builder searchAfter(FieldValue value, FieldValue... values) { + this.searchAfter = _listAdd(this.searchAfter, value, values); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds a value to searchAfter using a builder lambda. + */ + public final Builder searchAfter(Function> fn) { + return searchAfter(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * The number of hits to return. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To + * page through more hits, use the search_after parameter. + *

+ * API name: {@code size} + */ + public final Builder size(@Nullable Integer value) { + this.size = value; + return this; + } + + /** + * All public fields of a role are eligible for sorting. In addition, sort can + * also be applied to the _doc field to sort by index order. + *

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

+ * Adds all elements of list to sort. + */ + public final Builder sort(List list) { + this.sort = _listAddAll(this.sort, list); + return this; + } + + /** + * All public fields of a role are eligible for sorting. In addition, sort can + * also be applied to the _doc field to sort by index order. + *

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

+ * Adds one or more values to sort. + */ + public final Builder sort(SortOptions value, SortOptions... values) { + this.sort = _listAdd(this.sort, value, values); + return this; + } + + /** + * All public fields of a role are eligible for sorting. In addition, sort can + * also be applied to the _doc field to sort by index order. + *

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

+ * Adds a value to sort using a builder lambda. + */ + public final Builder sort(Function> fn) { + return sort(fn.apply(new SortOptions.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryRoleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryRoleRequest build() { + _checkSingleUse(); + + return new QueryRoleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryRoleRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + QueryRoleRequest::setupQueryRoleRequestDeserializer); + + protected static void setupQueryRoleRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::from, JsonpDeserializer.integerDeserializer(), "from"); + op.add(Builder::query, RoleQuery._DESERIALIZER, "query"); + op.add(Builder::searchAfter, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "search_after"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.query_role}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.query_role", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/_query/role"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, QueryRoleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryRoleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryRoleResponse.java new file mode 100644 index 000000000..f7d8e50d3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryRoleResponse.java @@ -0,0 +1,248 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch.security.query_role.QueryRole; +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.Integer; +import java.util.List; +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: security.query_role.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryRoleResponse implements JsonpSerializable { + private final int total; + + private final int count; + + private final List roles; + + // --------------------------------------------------------------------------------------------- + + private QueryRoleResponse(Builder builder) { + + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.roles = ApiTypeHelper.unmodifiableRequired(builder.roles, this, "roles"); + + } + + public static QueryRoleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The total number of roles found. + *

+ * API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * Required - The number of roles returned in the response. + *

+ * API name: {@code count} + */ + public final int count() { + return this.count; + } + + /** + * Required - The list of roles. + *

+ * API name: {@code roles} + */ + public final List roles() { + return this.roles; + } + + /** + * 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("total"); + generator.write(this.total); + + generator.writeKey("count"); + generator.write(this.count); + + if (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartArray(); + for (QueryRole item0 : this.roles) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryRoleResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Integer total; + + private Integer count; + + private List roles; + + /** + * Required - The total number of roles found. + *

+ * API name: {@code total} + */ + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * Required - The number of roles returned in the response. + *

+ * API name: {@code count} + */ + public final Builder count(int value) { + this.count = value; + return this; + } + + /** + * Required - The list of roles. + *

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

+ * Adds all elements of list to roles. + */ + public final Builder roles(List list) { + this.roles = _listAddAll(this.roles, list); + return this; + } + + /** + * Required - The list of roles. + *

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

+ * Adds one or more values to roles. + */ + public final Builder roles(QueryRole value, QueryRole... values) { + this.roles = _listAdd(this.roles, value, values); + return this; + } + + /** + * Required - The list of roles. + *

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

+ * Adds a value to roles using a builder lambda. + */ + public final Builder roles(Function> fn) { + return roles(fn.apply(new QueryRole.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryRoleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryRoleResponse build() { + _checkSingleUse(); + + return new QueryRoleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryRoleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, QueryRoleResponse::setupQueryRoleResponseDeserializer); + + protected static void setupQueryRoleResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(QueryRole._DESERIALIZER), "roles"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserRequest.java new file mode 100644 index 000000000..5ad39c13b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserRequest.java @@ -0,0 +1,534 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.FieldValue; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.SortOptions; +import co.elastic.clients.elasticsearch.security.query_user.UserQuery; +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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +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: security.query_user.Request + +/** + * Retrieves information for Users in a paginated manner. You can optionally + * filter the results with a query. + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryUserRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Integer from; + + @Nullable + private final UserQuery query; + + private final List searchAfter; + + @Nullable + private final Integer size; + + private final List sort; + + @Nullable + private final Boolean withProfileUid; + + // --------------------------------------------------------------------------------------------- + + private QueryUserRequest(Builder builder) { + + this.from = builder.from; + this.query = builder.query; + this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter); + this.size = builder.size; + this.sort = ApiTypeHelper.unmodifiable(builder.sort); + this.withProfileUid = builder.withProfileUid; + + } + + public static QueryUserRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Starting document offset. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To page through more hits, + * use the search_after parameter. + *

+ * API name: {@code from} + */ + @Nullable + public final Integer from() { + return this.from; + } + + /** + * A query to filter which users to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with user: username, + * roles, enabled + *

+ * API name: {@code query} + */ + @Nullable + public final UserQuery query() { + return this.query; + } + + /** + * Search after definition + *

+ * API name: {@code search_after} + */ + public final List searchAfter() { + return this.searchAfter; + } + + /** + * The number of hits to return. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To + * page through more hits, use the search_after parameter. + *

+ * API name: {@code size} + */ + @Nullable + public final Integer size() { + return this.size; + } + + /** + * Fields eligible for sorting are: username, roles, enabled In addition, sort + * can also be applied to the _doc field to sort by index order. + *

+ * API name: {@code sort} + */ + public final List sort() { + return this.sort; + } + + /** + * If true will return the User Profile ID for the users in the query result, if + * any. + *

+ * API name: {@code with_profile_uid} + */ + @Nullable + public final Boolean withProfileUid() { + return this.withProfileUid; + } + + /** + * 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.from != null) { + generator.writeKey("from"); + generator.write(this.from); + + } + if (this.query != null) { + generator.writeKey("query"); + this.query.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.searchAfter)) { + generator.writeKey("search_after"); + generator.writeStartArray(); + for (FieldValue item0 : this.searchAfter) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("sort"); + generator.writeStartArray(); + for (SortOptions item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryUserRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Integer from; + + @Nullable + private UserQuery query; + + @Nullable + private List searchAfter; + + @Nullable + private Integer size; + + @Nullable + private List sort; + + @Nullable + private Boolean withProfileUid; + + /** + * Starting document offset. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To page through more hits, + * use the search_after parameter. + *

+ * API name: {@code from} + */ + public final Builder from(@Nullable Integer value) { + this.from = value; + return this; + } + + /** + * A query to filter which users to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with user: username, + * roles, enabled + *

+ * API name: {@code query} + */ + public final Builder query(@Nullable UserQuery value) { + this.query = value; + return this; + } + + /** + * A query to filter which users to return. If the query parameter is missing, + * it is equivalent to a match_all query. The query supports a + * subset of query types, including match_all, bool, + * term, terms, match, ids, + * prefix, wildcard, exists, + * range, and simple_query_string. You can query the + * following information associated with user: username, + * roles, enabled + *

+ * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new UserQuery.Builder()).build()); + } + + /** + * Search after definition + *

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

+ * Adds all elements of list to searchAfter. + */ + public final Builder searchAfter(List list) { + this.searchAfter = _listAddAll(this.searchAfter, list); + return this; + } + + /** + * Search after definition + *

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

+ * Adds one or more values to searchAfter. + */ + public final Builder searchAfter(FieldValue value, FieldValue... values) { + this.searchAfter = _listAdd(this.searchAfter, value, values); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(long value, long... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(double value, double... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds all passed values to searchAfter. + */ + public final Builder searchAfter(boolean value, boolean... values) { + this.searchAfter = _listAdd(this.searchAfter, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.searchAfter = _listAddAll(this.searchAfter, fieldValues); + return this; + } + + /** + * Search after definition + *

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

+ * Adds a value to searchAfter using a builder lambda. + */ + public final Builder searchAfter(Function> fn) { + return searchAfter(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * The number of hits to return. By default, you cannot page through more than + * 10,000 hits using the from and size parameters. To + * page through more hits, use the search_after parameter. + *

+ * API name: {@code size} + */ + public final Builder size(@Nullable Integer value) { + this.size = value; + return this; + } + + /** + * Fields eligible for sorting are: username, roles, enabled In addition, sort + * can also be applied to the _doc field to sort by index order. + *

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

+ * Adds all elements of list to sort. + */ + public final Builder sort(List list) { + this.sort = _listAddAll(this.sort, list); + return this; + } + + /** + * Fields eligible for sorting are: username, roles, enabled In addition, sort + * can also be applied to the _doc field to sort by index order. + *

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

+ * Adds one or more values to sort. + */ + public final Builder sort(SortOptions value, SortOptions... values) { + this.sort = _listAdd(this.sort, value, values); + return this; + } + + /** + * Fields eligible for sorting are: username, roles, enabled In addition, sort + * can also be applied to the _doc field to sort by index order. + *

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

+ * Adds a value to sort using a builder lambda. + */ + public final Builder sort(Function> fn) { + return sort(fn.apply(new SortOptions.Builder()).build()); + } + + /** + * If true will return the User Profile ID for the users in the query result, if + * any. + *

+ * API name: {@code with_profile_uid} + */ + public final Builder withProfileUid(@Nullable Boolean value) { + this.withProfileUid = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryUserRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryUserRequest build() { + _checkSingleUse(); + + return new QueryUserRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryUserRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + QueryUserRequest::setupQueryUserRequestDeserializer); + + protected static void setupQueryUserRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::from, JsonpDeserializer.integerDeserializer(), "from"); + op.add(Builder::query, UserQuery._DESERIALIZER, "query"); + op.add(Builder::searchAfter, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "search_after"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); + op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.query_user}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.query_user", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/_query/user"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.withProfileUid != null) { + params.put("with_profile_uid", String.valueOf(request.withProfileUid)); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, QueryUserResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserResponse.java new file mode 100644 index 000000000..8bfa29f84 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/QueryUserResponse.java @@ -0,0 +1,248 @@ +/* + * 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.security; + +import co.elastic.clients.elasticsearch.security.query_user.QueryUser; +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.Integer; +import java.util.List; +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: security.query_user.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryUserResponse implements JsonpSerializable { + private final int total; + + private final int count; + + private final List users; + + // --------------------------------------------------------------------------------------------- + + private QueryUserResponse(Builder builder) { + + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.users = ApiTypeHelper.unmodifiableRequired(builder.users, this, "users"); + + } + + public static QueryUserResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The total number of users found. + *

+ * API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * Required - The number of users returned in the response. + *

+ * API name: {@code count} + */ + public final int count() { + return this.count; + } + + /** + * Required - A list of user information. + *

+ * API name: {@code users} + */ + public final List users() { + return this.users; + } + + /** + * 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("total"); + generator.write(this.total); + + generator.writeKey("count"); + generator.write(this.count); + + if (ApiTypeHelper.isDefined(this.users)) { + generator.writeKey("users"); + generator.writeStartArray(); + for (QueryUser item0 : this.users) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryUserResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Integer total; + + private Integer count; + + private List users; + + /** + * Required - The total number of users found. + *

+ * API name: {@code total} + */ + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * Required - The number of users returned in the response. + *

+ * API name: {@code count} + */ + public final Builder count(int value) { + this.count = value; + return this; + } + + /** + * Required - A list of user information. + *

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

+ * Adds all elements of list to users. + */ + public final Builder users(List list) { + this.users = _listAddAll(this.users, list); + return this; + } + + /** + * Required - A list of user information. + *

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

+ * Adds one or more values to users. + */ + public final Builder users(QueryUser value, QueryUser... values) { + this.users = _listAdd(this.users, value, values); + return this; + } + + /** + * Required - A list of user information. + *

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

+ * Adds a value to users using a builder lambda. + */ + public final Builder users(Function> fn) { + return users(fn.apply(new QueryUser.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryUserResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryUserResponse build() { + _checkSingleUse(); + + return new QueryUserResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryUserResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, QueryUserResponse::setupQueryUserResponseDeserializer); + + protected static void setupQueryUserResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + op.add(Builder::users, JsonpDeserializer.arrayDeserializer(QueryUser._DESERIALIZER), "users"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java index 482bdea2e..d19de378e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java @@ -74,11 +74,14 @@ public class RoleDescriptor implements JsonpSerializable { private final List runAs; + @Nullable + private final String description; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- - private RoleDescriptor(Builder builder) { + protected RoleDescriptor(AbstractBuilder builder) { this.cluster = ApiTypeHelper.unmodifiable(builder.cluster); this.indices = ApiTypeHelper.unmodifiable(builder.indices); @@ -86,11 +89,12 @@ private RoleDescriptor(Builder builder) { this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); + this.description = builder.description; this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } - public static RoleDescriptor of(Function> fn) { + public static RoleDescriptor roleDescriptorOf(Function> fn) { return fn.apply(new Builder()).build(); } @@ -144,7 +148,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 + * 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} */ @@ -152,6 +159,16 @@ public final List runAs() { return this.runAs; } + /** + * Optional description of the role descriptor + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + /** * API name: {@code transient_metadata} */ @@ -230,6 +247,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); @@ -256,7 +278,30 @@ public String toString() { * Builder for {@link RoleDescriptor}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + public static class Builder extends RoleDescriptor.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RoleDescriptor}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RoleDescriptor build() { + _checkSingleUse(); + + return new RoleDescriptor(this); + } + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { @Nullable private List cluster; @@ -275,6 +320,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private List runAs; + @Nullable + private String description; + @Nullable private Map transientMetadata; @@ -286,9 +334,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement *

* Adds all elements of list to cluster. */ - public final Builder cluster(List list) { + public final BuilderT cluster(List list) { this.cluster = _listAddAll(this.cluster, list); - return this; + return self(); } /** @@ -299,9 +347,9 @@ public final Builder cluster(List list) { *

* Adds one or more values to cluster. */ - public final Builder cluster(String value, String... values) { + public final BuilderT cluster(String value, String... values) { this.cluster = _listAdd(this.cluster, value, values); - return this; + return self(); } /** @@ -311,9 +359,9 @@ public final Builder cluster(String value, String... values) { *

* Adds all elements of list to indices. */ - public final Builder indices(List list) { + public final BuilderT indices(List list) { this.indices = _listAddAll(this.indices, list); - return this; + return self(); } /** @@ -323,9 +371,9 @@ public final Builder indices(List list) { *

* Adds one or more values to indices. */ - public final Builder indices(IndicesPrivileges value, IndicesPrivileges... values) { + public final BuilderT indices(IndicesPrivileges value, IndicesPrivileges... values) { this.indices = _listAdd(this.indices, value, values); - return this; + return self(); } /** @@ -335,7 +383,7 @@ public final Builder indices(IndicesPrivileges value, IndicesPrivileges... value *

* Adds a value to indices using a builder lambda. */ - public final Builder indices(Function> fn) { + public final BuilderT indices(Function> fn) { return indices(fn.apply(new IndicesPrivileges.Builder()).build()); } @@ -348,9 +396,9 @@ public final Builder indices(Function * Adds all elements of list to global. */ - public final Builder global(List list) { + public final BuilderT global(List list) { this.global = _listAddAll(this.global, list); - return this; + return self(); } /** @@ -362,9 +410,9 @@ public final Builder global(List list) { *

* Adds one or more values to global. */ - public final Builder global(GlobalPrivilege value, GlobalPrivilege... values) { + public final BuilderT global(GlobalPrivilege value, GlobalPrivilege... values) { this.global = _listAdd(this.global, value, values); - return this; + return self(); } /** @@ -376,7 +424,7 @@ public final Builder global(GlobalPrivilege value, GlobalPrivilege... values) { *

* Adds a value to global using a builder lambda. */ - public final Builder global(Function> fn) { + public final BuilderT global(Function> fn) { return global(fn.apply(new GlobalPrivilege.Builder()).build()); } @@ -387,9 +435,9 @@ public final Builder global(Function * Adds all elements of list to applications. */ - public final Builder applications(List list) { + public final BuilderT applications(List list) { this.applications = _listAddAll(this.applications, list); - return this; + return self(); } /** @@ -399,9 +447,9 @@ public final Builder applications(List list) { *

* Adds one or more values to applications. */ - public final Builder applications(ApplicationPrivileges value, ApplicationPrivileges... values) { + public final BuilderT applications(ApplicationPrivileges value, ApplicationPrivileges... values) { this.applications = _listAdd(this.applications, value, values); - return this; + return self(); } /** @@ -411,7 +459,7 @@ public final Builder applications(ApplicationPrivileges value, ApplicationPrivil *

* Adds a value to applications using a builder lambda. */ - public final Builder applications( + public final BuilderT applications( Function> fn) { return applications(fn.apply(new ApplicationPrivileges.Builder()).build()); } @@ -424,9 +472,9 @@ public final Builder applications( *

* Adds all entries of map to metadata. */ - public final Builder metadata(Map map) { + public final BuilderT metadata(Map map) { this.metadata = _mapPutAll(this.metadata, map); - return this; + return self(); } /** @@ -437,33 +485,49 @@ public final Builder metadata(Map map) { *

* Adds an entry to metadata. */ - public final Builder metadata(String key, JsonData value) { + public final BuilderT metadata(String key, JsonData value) { this.metadata = _mapPut(this.metadata, key, value); - return this; + return self(); } /** - * A list of users that the API keys can impersonate. + * A list of users that the API keys can impersonate. Note: in + * 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} *

* Adds all elements of list to runAs. */ - public final Builder runAs(List list) { + public final BuilderT runAs(List list) { this.runAs = _listAddAll(this.runAs, list); - return this; + return self(); } /** - * A list of users that the API keys can impersonate. + * A list of users that the API keys can impersonate. Note: in + * 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} *

* Adds one or more values to runAs. */ - public final Builder runAs(String value, String... values) { + public final BuilderT runAs(String value, String... values) { this.runAs = _listAdd(this.runAs, value, values); - return this; + return self(); + } + + /** + * Optional description of the role descriptor + *

+ * API name: {@code description} + */ + public final BuilderT description(@Nullable String value) { + this.description = value; + return self(); } /** @@ -471,9 +535,9 @@ public final Builder runAs(String value, String... values) { *

* Adds all entries of map to transientMetadata. */ - public final Builder transientMetadata(Map map) { + public final BuilderT transientMetadata(Map map) { this.transientMetadata = _mapPutAll(this.transientMetadata, map); - return this; + return self(); } /** @@ -481,27 +545,13 @@ public final Builder transientMetadata(Map map) { *

* Adds an entry to transientMetadata. */ - public final Builder transientMetadata(String key, JsonData value) { + public final BuilderT transientMetadata(String key, JsonData value) { this.transientMetadata = _mapPut(this.transientMetadata, key, value); - return this; + return self(); } - @Override - protected Builder self() { - return this; - } + protected abstract BuilderT self(); - /** - * Builds a {@link RoleDescriptor}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RoleDescriptor build() { - _checkSingleUse(); - - return new RoleDescriptor(this); - } } // --------------------------------------------------------------------------------------------- @@ -512,18 +562,21 @@ public RoleDescriptor build() { public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, RoleDescriptor::setupRoleDescriptorDeserializer); - protected static void setupRoleDescriptorDeserializer(ObjectDeserializer op) { + protected static > void setupRoleDescriptorDeserializer( + ObjectDeserializer op) { - op.add(Builder::cluster, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + op.add(AbstractBuilder::cluster, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "cluster"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(IndicesPrivileges._DESERIALIZER), "indices", - "index"); - op.add(Builder::global, JsonpDeserializer.arrayDeserializer(GlobalPrivilege._DESERIALIZER), "global"); - op.add(Builder::applications, JsonpDeserializer.arrayDeserializer(ApplicationPrivileges._DESERIALIZER), + op.add(AbstractBuilder::indices, JsonpDeserializer.arrayDeserializer(IndicesPrivileges._DESERIALIZER), + "indices", "index"); + op.add(AbstractBuilder::global, JsonpDeserializer.arrayDeserializer(GlobalPrivilege._DESERIALIZER), "global"); + op.add(AbstractBuilder::applications, JsonpDeserializer.arrayDeserializer(ApplicationPrivileges._DESERIALIZER), "applications"); - op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); - op.add(Builder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "run_as"); - op.add(Builder::transientMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), + op.add(AbstractBuilder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); + op.add(AbstractBuilder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "run_as"); + op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(AbstractBuilder::transientMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "transient_metadata"); } 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 b38aba1d1..07c3ac990 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 @@ -75,6 +75,9 @@ public class RoleDescriptorRead implements JsonpSerializable { private final List runAs; + @Nullable + private final String description; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -87,6 +90,7 @@ private RoleDescriptorRead(Builder builder) { this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); + this.description = builder.description; this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -153,6 +157,16 @@ public final List runAs() { return this.runAs; } + /** + * Optional description of the role descriptor + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + /** * API name: {@code transient_metadata} */ @@ -231,6 +245,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); @@ -276,6 +295,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private List runAs; + @Nullable + private String description; + @Nullable private Map transientMetadata; @@ -467,6 +489,16 @@ public final Builder runAs(String value, String... values) { return this; } + /** + * Optional description of the role descriptor + *

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

@@ -524,6 +556,7 @@ protected static void setupRoleDescriptorReadDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class QueryRole extends RoleDescriptor { + private final List sort; + + private final String name; + + // --------------------------------------------------------------------------------------------- + + private QueryRole(Builder builder) { + super(builder); + + this.sort = ApiTypeHelper.unmodifiable(builder.sort); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + + } + + public static QueryRole of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code _sort} + */ + public final List sort() { + return this.sort; + } + + /** + * Required - Name of the role. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("_sort"); + generator.writeStartArray(); + for (FieldValue item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("name"); + generator.write(this.name); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryRole}. + */ + + public static class Builder extends RoleDescriptor.AbstractBuilder implements ObjectBuilder { + @Nullable + private List sort; + + private String name; + + /** + * API name: {@code _sort} + *

+ * Adds all elements of list to sort. + */ + public final Builder sort(List list) { + this.sort = _listAddAll(this.sort, list); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds one or more values to sort. + */ + public final Builder sort(FieldValue value, FieldValue... values) { + this.sort = _listAdd(this.sort, value, values); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(String value, String... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(long value, long... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(double value, double... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(boolean value, boolean... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds a value to sort using a builder lambda. + */ + public final Builder sort(Function> fn) { + return sort(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * Required - Name of the role. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryRole}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryRole build() { + _checkSingleUse(); + + return new QueryRole(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryRole} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + QueryRole::setupQueryRoleDeserializer); + + protected static void setupQueryRoleDeserializer(ObjectDeserializer op) { + RoleDescriptor.setupRoleDescriptorDeserializer(op); + op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "_sort"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQuery.java new file mode 100644 index 000000000..5673bd039 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQuery.java @@ -0,0 +1,563 @@ +/* + * 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.security.query_role; + +import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.ExistsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.IdsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchAllQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.PrefixQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.RangeQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.WildcardQuery; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; +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.OpenTaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +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: security.query_role.RoleQueryContainer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RoleQuery implements OpenTaggedUnion, JsonpSerializable { + + /** + * {@link RoleQuery} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Bool("bool"), + + Exists("exists"), + + Ids("ids"), + + Match("match"), + + MatchAll("match_all"), + + Prefix("prefix"), + + Range("range"), + + SimpleQueryString("simple_query_string"), + + Term("term"), + + Terms("terms"), + + Wildcard("wildcard"), + + /** A custom {@code RoleQuery} defined by a plugin */ + _Custom(null) + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public RoleQuery(RoleQueryVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._roleQueryKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; + + } + + private RoleQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; + + } + + public static RoleQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code bool}? + */ + public boolean isBool() { + return _kind == Kind.Bool; + } + + /** + * Get the {@code bool} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code bool} kind. + */ + public BoolQuery bool() { + return TaggedUnionUtils.get(this, Kind.Bool); + } + + /** + * Is this variant instance of kind {@code exists}? + */ + public boolean isExists() { + return _kind == Kind.Exists; + } + + /** + * Get the {@code exists} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code exists} kind. + */ + public ExistsQuery exists() { + return TaggedUnionUtils.get(this, Kind.Exists); + } + + /** + * Is this variant instance of kind {@code ids}? + */ + public boolean isIds() { + return _kind == Kind.Ids; + } + + /** + * Get the {@code ids} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code ids} kind. + */ + public IdsQuery ids() { + return TaggedUnionUtils.get(this, Kind.Ids); + } + + /** + * Is this variant instance of kind {@code match}? + */ + public boolean isMatch() { + return _kind == Kind.Match; + } + + /** + * Get the {@code match} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code match} kind. + */ + public MatchQuery match() { + return TaggedUnionUtils.get(this, Kind.Match); + } + + /** + * Is this variant instance of kind {@code match_all}? + */ + public boolean isMatchAll() { + return _kind == Kind.MatchAll; + } + + /** + * Get the {@code match_all} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code match_all} kind. + */ + public MatchAllQuery matchAll() { + return TaggedUnionUtils.get(this, Kind.MatchAll); + } + + /** + * Is this variant instance of kind {@code prefix}? + */ + public boolean isPrefix() { + return _kind == Kind.Prefix; + } + + /** + * Get the {@code prefix} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code prefix} kind. + */ + public PrefixQuery prefix() { + return TaggedUnionUtils.get(this, Kind.Prefix); + } + + /** + * Is this variant instance of kind {@code range}? + */ + public boolean isRange() { + return _kind == Kind.Range; + } + + /** + * Get the {@code range} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code range} kind. + */ + public RangeQuery range() { + return TaggedUnionUtils.get(this, Kind.Range); + } + + /** + * Is this variant instance of kind {@code simple_query_string}? + */ + public boolean isSimpleQueryString() { + return _kind == Kind.SimpleQueryString; + } + + /** + * Get the {@code simple_query_string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code simple_query_string} + * kind. + */ + public SimpleQueryStringQuery simpleQueryString() { + return TaggedUnionUtils.get(this, Kind.SimpleQueryString); + } + + /** + * Is this variant instance of kind {@code term}? + */ + public boolean isTerm() { + return _kind == Kind.Term; + } + + /** + * Get the {@code term} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code term} kind. + */ + public TermQuery term() { + return TaggedUnionUtils.get(this, Kind.Term); + } + + /** + * Is this variant instance of kind {@code terms}? + */ + public boolean isTerms() { + return _kind == Kind.Terms; + } + + /** + * Get the {@code terms} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code terms} kind. + */ + public TermsQuery terms() { + return TaggedUnionUtils.get(this, Kind.Terms); + } + + /** + * Is this variant instance of kind {@code wildcard}? + */ + public boolean isWildcard() { + return _kind == Kind.Wildcard; + } + + /** + * Get the {@code wildcard} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code wildcard} kind. + */ + public WildcardQuery wildcard() { + return TaggedUnionUtils.get(this, Kind.Wildcard); + } + + @Nullable + private final String _customKind; + + /** + * Is this a custom {@code RoleQuery} defined by a plugin? + */ + public boolean _isCustom() { + return _kind == Kind._Custom; + } + + /** + * Get the actual kind when {@code _kind()} equals {@link Kind#_Custom} + * (plugin-defined variant). + */ + @Nullable + public final String _customKind() { + return _customKind; + } + + /** + * Get the custom plugin-defined variant value. + * + * @throws IllegalStateException + * if the current variant is not {@link Kind#_Custom}. + */ + public JsonData _custom() { + return TaggedUnionUtils.get(this, Kind._Custom); + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); + + generator.writeKey(_kind == Kind._Custom ? _customKind : _kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + private String _customKind; + + @Override + protected Builder self() { + return this; + } + public ObjectBuilder bool(BoolQuery v) { + this._kind = Kind.Bool; + this._value = v; + return this; + } + + public ObjectBuilder bool(Function> fn) { + return this.bool(fn.apply(new BoolQuery.Builder()).build()); + } + + public ObjectBuilder exists(ExistsQuery v) { + this._kind = Kind.Exists; + this._value = v; + return this; + } + + public ObjectBuilder exists(Function> fn) { + return this.exists(fn.apply(new ExistsQuery.Builder()).build()); + } + + public ObjectBuilder ids(IdsQuery v) { + this._kind = Kind.Ids; + this._value = v; + return this; + } + + public ObjectBuilder ids(Function> fn) { + return this.ids(fn.apply(new IdsQuery.Builder()).build()); + } + + public ObjectBuilder match(MatchQuery v) { + this._kind = Kind.Match; + this._value = v; + return this; + } + + public ObjectBuilder match(Function> fn) { + return this.match(fn.apply(new MatchQuery.Builder()).build()); + } + + public ObjectBuilder matchAll(MatchAllQuery v) { + this._kind = Kind.MatchAll; + this._value = v; + return this; + } + + public ObjectBuilder matchAll(Function> fn) { + return this.matchAll(fn.apply(new MatchAllQuery.Builder()).build()); + } + + public ObjectBuilder prefix(PrefixQuery v) { + this._kind = Kind.Prefix; + this._value = v; + return this; + } + + public ObjectBuilder prefix(Function> fn) { + return this.prefix(fn.apply(new PrefixQuery.Builder()).build()); + } + + public ObjectBuilder range(RangeQuery v) { + this._kind = Kind.Range; + this._value = v; + return this; + } + + public ObjectBuilder range(Function> fn) { + return this.range(fn.apply(new RangeQuery.Builder()).build()); + } + + public ObjectBuilder simpleQueryString(SimpleQueryStringQuery v) { + this._kind = Kind.SimpleQueryString; + this._value = v; + return this; + } + + public ObjectBuilder simpleQueryString( + Function> fn) { + return this.simpleQueryString(fn.apply(new SimpleQueryStringQuery.Builder()).build()); + } + + public ObjectBuilder term(TermQuery v) { + this._kind = Kind.Term; + this._value = v; + return this; + } + + public ObjectBuilder term(Function> fn) { + return this.term(fn.apply(new TermQuery.Builder()).build()); + } + + public ObjectBuilder terms(TermsQuery v) { + this._kind = Kind.Terms; + this._value = v; + return this; + } + + public ObjectBuilder terms(Function> fn) { + return this.terms(fn.apply(new TermsQuery.Builder()).build()); + } + + public ObjectBuilder wildcard(WildcardQuery v) { + this._kind = Kind.Wildcard; + this._value = v; + return this; + } + + public ObjectBuilder wildcard(Function> fn) { + return this.wildcard(fn.apply(new WildcardQuery.Builder()).build()); + } + + /** + * Define this {@code RoleQuery} as a plugin-defined variant. + * + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code RoleQuery}. It is converted + * internally to {@link JsonData}. + */ + public ObjectBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); + return this; + } + + public RoleQuery build() { + _checkSingleUse(); + return new RoleQuery(this); + } + + } + + protected static void setupRoleQueryDeserializer(ObjectDeserializer op) { + + op.add(Builder::bool, BoolQuery._DESERIALIZER, "bool"); + op.add(Builder::exists, ExistsQuery._DESERIALIZER, "exists"); + op.add(Builder::ids, IdsQuery._DESERIALIZER, "ids"); + op.add(Builder::match, MatchQuery._DESERIALIZER, "match"); + op.add(Builder::matchAll, MatchAllQuery._DESERIALIZER, "match_all"); + op.add(Builder::prefix, PrefixQuery._DESERIALIZER, "prefix"); + op.add(Builder::range, RangeQuery._DESERIALIZER, "range"); + op.add(Builder::simpleQueryString, SimpleQueryStringQuery._DESERIALIZER, "simple_query_string"); + op.add(Builder::term, TermQuery._DESERIALIZER, "term"); + op.add(Builder::terms, TermsQuery._DESERIALIZER, "terms"); + op.add(Builder::wildcard, WildcardQuery._DESERIALIZER, "wildcard"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RoleQuery::setupRoleQueryDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryBuilders.java new file mode 100644 index 000000000..319fa24ff --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryBuilders.java @@ -0,0 +1,248 @@ +/* + * 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.security.query_role; + +import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.ExistsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.IdsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchAllQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.PrefixQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.RangeQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.WildcardQuery; +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link RoleQuery} variants. + */ +public class RoleQueryBuilders { + private RoleQueryBuilders() { + } + + /** + * Creates a builder for the {@link BoolQuery bool} {@code RoleQuery} variant. + */ + public static BoolQuery.Builder bool() { + return new BoolQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link BoolQuery bool} {@code RoleQuery} variant. + */ + public static RoleQuery bool(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.bool(fn.apply(new BoolQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ExistsQuery exists} {@code RoleQuery} + * variant. + */ + public static ExistsQuery.Builder exists() { + return new ExistsQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link ExistsQuery exists} {@code RoleQuery} + * variant. + */ + public static RoleQuery exists(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.exists(fn.apply(new ExistsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link IdsQuery ids} {@code RoleQuery} variant. + */ + public static IdsQuery.Builder ids() { + return new IdsQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link IdsQuery ids} {@code RoleQuery} variant. + */ + public static RoleQuery ids(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.ids(fn.apply(new IdsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link MatchQuery match} {@code RoleQuery} variant. + */ + public static MatchQuery.Builder match() { + return new MatchQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link MatchQuery match} {@code RoleQuery} + * variant. + */ + public static RoleQuery match(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.match(fn.apply(new MatchQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link MatchAllQuery match_all} {@code RoleQuery} + * variant. + */ + public static MatchAllQuery.Builder matchAll() { + return new MatchAllQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link MatchAllQuery match_all} {@code RoleQuery} + * variant. + */ + public static RoleQuery matchAll(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.matchAll(fn.apply(new MatchAllQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link PrefixQuery prefix} {@code RoleQuery} + * variant. + */ + public static PrefixQuery.Builder prefix() { + return new PrefixQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link PrefixQuery prefix} {@code RoleQuery} + * variant. + */ + public static RoleQuery prefix(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.prefix(fn.apply(new PrefixQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link RangeQuery range} {@code RoleQuery} variant. + */ + public static RangeQuery.Builder range() { + return new RangeQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link RangeQuery range} {@code RoleQuery} + * variant. + */ + public static RoleQuery range(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.range(fn.apply(new RangeQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SimpleQueryStringQuery simple_query_string} + * {@code RoleQuery} variant. + */ + public static SimpleQueryStringQuery.Builder simpleQueryString() { + return new SimpleQueryStringQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link SimpleQueryStringQuery simple_query_string} + * {@code RoleQuery} variant. + */ + public static RoleQuery simpleQueryString( + Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.simpleQueryString(fn.apply(new SimpleQueryStringQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TermQuery term} {@code RoleQuery} variant. + */ + public static TermQuery.Builder term() { + return new TermQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link TermQuery term} {@code RoleQuery} variant. + */ + public static RoleQuery term(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.term(fn.apply(new TermQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TermsQuery terms} {@code RoleQuery} variant. + */ + public static TermsQuery.Builder terms() { + return new TermsQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link TermsQuery terms} {@code RoleQuery} + * variant. + */ + public static RoleQuery terms(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.terms(fn.apply(new TermsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link WildcardQuery wildcard} {@code RoleQuery} + * variant. + */ + public static WildcardQuery.Builder wildcard() { + return new WildcardQuery.Builder(); + } + + /** + * Creates a RoleQuery of the {@link WildcardQuery wildcard} {@code RoleQuery} + * variant. + */ + public static RoleQuery wildcard(Function> fn) { + RoleQuery.Builder builder = new RoleQuery.Builder(); + builder.wildcard(fn.apply(new WildcardQuery.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryVariant.java new file mode 100644 index 000000000..eb00fe5da --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_role/RoleQueryVariant.java @@ -0,0 +1,48 @@ +/* + * 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.security.query_role; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link RoleQuery} variants. + */ +public interface RoleQueryVariant { + + RoleQuery.Kind _roleQueryKind(); + + default RoleQuery _toRoleQuery() { + return new RoleQuery(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/QueryUser.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/QueryUser.java new file mode 100644 index 000000000..7b246fd61 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/QueryUser.java @@ -0,0 +1,232 @@ +/* + * 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.security.query_user; + +import co.elastic.clients.elasticsearch._types.FieldValue; +import co.elastic.clients.elasticsearch.security.User; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +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 jakarta.json.stream.JsonGenerator; +import java.util.ArrayList; +import java.util.List; +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: security.query_user.QueryUser + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryUser extends User { + private final List sort; + + // --------------------------------------------------------------------------------------------- + + private QueryUser(Builder builder) { + super(builder); + + this.sort = ApiTypeHelper.unmodifiable(builder.sort); + + } + + public static QueryUser of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code _sort} + */ + public final List sort() { + return this.sort; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("_sort"); + generator.writeStartArray(); + for (FieldValue item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryUser}. + */ + + public static class Builder extends User.AbstractBuilder implements ObjectBuilder { + @Nullable + private List sort; + + /** + * API name: {@code _sort} + *

+ * Adds all elements of list to sort. + */ + public final Builder sort(List list) { + this.sort = _listAddAll(this.sort, list); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds one or more values to sort. + */ + public final Builder sort(FieldValue value, FieldValue... values) { + this.sort = _listAdd(this.sort, value, values); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(String value, String... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (String v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(long value, long... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (long v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(double value, double... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (double v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds all passed values to sort. + */ + public final Builder sort(boolean value, boolean... values) { + this.sort = _listAdd(this.sort, FieldValue.of(value)); + List fieldValues = new ArrayList<>(); + for (boolean v : values) { + fieldValues.add(FieldValue.of(v)); + } + this.sort = _listAddAll(this.sort, fieldValues); + return this; + } + + /** + * API name: {@code _sort} + *

+ * Adds a value to sort using a builder lambda. + */ + public final Builder sort(Function> fn) { + return sort(fn.apply(new FieldValue.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryUser}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryUser build() { + _checkSingleUse(); + + return new QueryUser(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryUser} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + QueryUser::setupQueryUserDeserializer); + + protected static void setupQueryUserDeserializer(ObjectDeserializer op) { + User.setupUserDeserializer(op); + op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "_sort"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQuery.java new file mode 100644 index 000000000..eb37d4e44 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQuery.java @@ -0,0 +1,563 @@ +/* + * 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.security.query_user; + +import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.ExistsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.IdsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchAllQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.PrefixQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.RangeQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.WildcardQuery; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; +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.OpenTaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +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: security.query_user.UserQueryContainer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class UserQuery implements OpenTaggedUnion, JsonpSerializable { + + /** + * {@link UserQuery} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Ids("ids"), + + Bool("bool"), + + Exists("exists"), + + Match("match"), + + MatchAll("match_all"), + + Prefix("prefix"), + + Range("range"), + + SimpleQueryString("simple_query_string"), + + Term("term"), + + Terms("terms"), + + Wildcard("wildcard"), + + /** A custom {@code UserQuery} defined by a plugin */ + _Custom(null) + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public UserQuery(UserQueryVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._userQueryKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; + + } + + private UserQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; + + } + + public static UserQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code ids}? + */ + public boolean isIds() { + return _kind == Kind.Ids; + } + + /** + * Get the {@code ids} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code ids} kind. + */ + public IdsQuery ids() { + return TaggedUnionUtils.get(this, Kind.Ids); + } + + /** + * Is this variant instance of kind {@code bool}? + */ + public boolean isBool() { + return _kind == Kind.Bool; + } + + /** + * Get the {@code bool} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code bool} kind. + */ + public BoolQuery bool() { + return TaggedUnionUtils.get(this, Kind.Bool); + } + + /** + * Is this variant instance of kind {@code exists}? + */ + public boolean isExists() { + return _kind == Kind.Exists; + } + + /** + * Get the {@code exists} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code exists} kind. + */ + public ExistsQuery exists() { + return TaggedUnionUtils.get(this, Kind.Exists); + } + + /** + * Is this variant instance of kind {@code match}? + */ + public boolean isMatch() { + return _kind == Kind.Match; + } + + /** + * Get the {@code match} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code match} kind. + */ + public MatchQuery match() { + return TaggedUnionUtils.get(this, Kind.Match); + } + + /** + * Is this variant instance of kind {@code match_all}? + */ + public boolean isMatchAll() { + return _kind == Kind.MatchAll; + } + + /** + * Get the {@code match_all} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code match_all} kind. + */ + public MatchAllQuery matchAll() { + return TaggedUnionUtils.get(this, Kind.MatchAll); + } + + /** + * Is this variant instance of kind {@code prefix}? + */ + public boolean isPrefix() { + return _kind == Kind.Prefix; + } + + /** + * Get the {@code prefix} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code prefix} kind. + */ + public PrefixQuery prefix() { + return TaggedUnionUtils.get(this, Kind.Prefix); + } + + /** + * Is this variant instance of kind {@code range}? + */ + public boolean isRange() { + return _kind == Kind.Range; + } + + /** + * Get the {@code range} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code range} kind. + */ + public RangeQuery range() { + return TaggedUnionUtils.get(this, Kind.Range); + } + + /** + * Is this variant instance of kind {@code simple_query_string}? + */ + public boolean isSimpleQueryString() { + return _kind == Kind.SimpleQueryString; + } + + /** + * Get the {@code simple_query_string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code simple_query_string} + * kind. + */ + public SimpleQueryStringQuery simpleQueryString() { + return TaggedUnionUtils.get(this, Kind.SimpleQueryString); + } + + /** + * Is this variant instance of kind {@code term}? + */ + public boolean isTerm() { + return _kind == Kind.Term; + } + + /** + * Get the {@code term} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code term} kind. + */ + public TermQuery term() { + return TaggedUnionUtils.get(this, Kind.Term); + } + + /** + * Is this variant instance of kind {@code terms}? + */ + public boolean isTerms() { + return _kind == Kind.Terms; + } + + /** + * Get the {@code terms} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code terms} kind. + */ + public TermsQuery terms() { + return TaggedUnionUtils.get(this, Kind.Terms); + } + + /** + * Is this variant instance of kind {@code wildcard}? + */ + public boolean isWildcard() { + return _kind == Kind.Wildcard; + } + + /** + * Get the {@code wildcard} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code wildcard} kind. + */ + public WildcardQuery wildcard() { + return TaggedUnionUtils.get(this, Kind.Wildcard); + } + + @Nullable + private final String _customKind; + + /** + * Is this a custom {@code UserQuery} defined by a plugin? + */ + public boolean _isCustom() { + return _kind == Kind._Custom; + } + + /** + * Get the actual kind when {@code _kind()} equals {@link Kind#_Custom} + * (plugin-defined variant). + */ + @Nullable + public final String _customKind() { + return _customKind; + } + + /** + * Get the custom plugin-defined variant value. + * + * @throws IllegalStateException + * if the current variant is not {@link Kind#_Custom}. + */ + public JsonData _custom() { + return TaggedUnionUtils.get(this, Kind._Custom); + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); + + generator.writeKey(_kind == Kind._Custom ? _customKind : _kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + private String _customKind; + + @Override + protected Builder self() { + return this; + } + public ObjectBuilder ids(IdsQuery v) { + this._kind = Kind.Ids; + this._value = v; + return this; + } + + public ObjectBuilder ids(Function> fn) { + return this.ids(fn.apply(new IdsQuery.Builder()).build()); + } + + public ObjectBuilder bool(BoolQuery v) { + this._kind = Kind.Bool; + this._value = v; + return this; + } + + public ObjectBuilder bool(Function> fn) { + return this.bool(fn.apply(new BoolQuery.Builder()).build()); + } + + public ObjectBuilder exists(ExistsQuery v) { + this._kind = Kind.Exists; + this._value = v; + return this; + } + + public ObjectBuilder exists(Function> fn) { + return this.exists(fn.apply(new ExistsQuery.Builder()).build()); + } + + public ObjectBuilder match(MatchQuery v) { + this._kind = Kind.Match; + this._value = v; + return this; + } + + public ObjectBuilder match(Function> fn) { + return this.match(fn.apply(new MatchQuery.Builder()).build()); + } + + public ObjectBuilder matchAll(MatchAllQuery v) { + this._kind = Kind.MatchAll; + this._value = v; + return this; + } + + public ObjectBuilder matchAll(Function> fn) { + return this.matchAll(fn.apply(new MatchAllQuery.Builder()).build()); + } + + public ObjectBuilder prefix(PrefixQuery v) { + this._kind = Kind.Prefix; + this._value = v; + return this; + } + + public ObjectBuilder prefix(Function> fn) { + return this.prefix(fn.apply(new PrefixQuery.Builder()).build()); + } + + public ObjectBuilder range(RangeQuery v) { + this._kind = Kind.Range; + this._value = v; + return this; + } + + public ObjectBuilder range(Function> fn) { + return this.range(fn.apply(new RangeQuery.Builder()).build()); + } + + public ObjectBuilder simpleQueryString(SimpleQueryStringQuery v) { + this._kind = Kind.SimpleQueryString; + this._value = v; + return this; + } + + public ObjectBuilder simpleQueryString( + Function> fn) { + return this.simpleQueryString(fn.apply(new SimpleQueryStringQuery.Builder()).build()); + } + + public ObjectBuilder term(TermQuery v) { + this._kind = Kind.Term; + this._value = v; + return this; + } + + public ObjectBuilder term(Function> fn) { + return this.term(fn.apply(new TermQuery.Builder()).build()); + } + + public ObjectBuilder terms(TermsQuery v) { + this._kind = Kind.Terms; + this._value = v; + return this; + } + + public ObjectBuilder terms(Function> fn) { + return this.terms(fn.apply(new TermsQuery.Builder()).build()); + } + + public ObjectBuilder wildcard(WildcardQuery v) { + this._kind = Kind.Wildcard; + this._value = v; + return this; + } + + public ObjectBuilder wildcard(Function> fn) { + return this.wildcard(fn.apply(new WildcardQuery.Builder()).build()); + } + + /** + * Define this {@code UserQuery} as a plugin-defined variant. + * + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code UserQuery}. It is converted + * internally to {@link JsonData}. + */ + public ObjectBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); + return this; + } + + public UserQuery build() { + _checkSingleUse(); + return new UserQuery(this); + } + + } + + protected static void setupUserQueryDeserializer(ObjectDeserializer op) { + + op.add(Builder::ids, IdsQuery._DESERIALIZER, "ids"); + op.add(Builder::bool, BoolQuery._DESERIALIZER, "bool"); + op.add(Builder::exists, ExistsQuery._DESERIALIZER, "exists"); + op.add(Builder::match, MatchQuery._DESERIALIZER, "match"); + op.add(Builder::matchAll, MatchAllQuery._DESERIALIZER, "match_all"); + op.add(Builder::prefix, PrefixQuery._DESERIALIZER, "prefix"); + op.add(Builder::range, RangeQuery._DESERIALIZER, "range"); + op.add(Builder::simpleQueryString, SimpleQueryStringQuery._DESERIALIZER, "simple_query_string"); + op.add(Builder::term, TermQuery._DESERIALIZER, "term"); + op.add(Builder::terms, TermsQuery._DESERIALIZER, "terms"); + op.add(Builder::wildcard, WildcardQuery._DESERIALIZER, "wildcard"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + UserQuery::setupUserQueryDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryBuilders.java new file mode 100644 index 000000000..0f3220840 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryBuilders.java @@ -0,0 +1,248 @@ +/* + * 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.security.query_user; + +import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.ExistsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.IdsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchAllQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.PrefixQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.RangeQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.SimpleQueryStringQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.WildcardQuery; +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link UserQuery} variants. + */ +public class UserQueryBuilders { + private UserQueryBuilders() { + } + + /** + * Creates a builder for the {@link IdsQuery ids} {@code UserQuery} variant. + */ + public static IdsQuery.Builder ids() { + return new IdsQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link IdsQuery ids} {@code UserQuery} variant. + */ + public static UserQuery ids(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.ids(fn.apply(new IdsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link BoolQuery bool} {@code UserQuery} variant. + */ + public static BoolQuery.Builder bool() { + return new BoolQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link BoolQuery bool} {@code UserQuery} variant. + */ + public static UserQuery bool(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.bool(fn.apply(new BoolQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ExistsQuery exists} {@code UserQuery} + * variant. + */ + public static ExistsQuery.Builder exists() { + return new ExistsQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link ExistsQuery exists} {@code UserQuery} + * variant. + */ + public static UserQuery exists(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.exists(fn.apply(new ExistsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link MatchQuery match} {@code UserQuery} variant. + */ + public static MatchQuery.Builder match() { + return new MatchQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link MatchQuery match} {@code UserQuery} + * variant. + */ + public static UserQuery match(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.match(fn.apply(new MatchQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link MatchAllQuery match_all} {@code UserQuery} + * variant. + */ + public static MatchAllQuery.Builder matchAll() { + return new MatchAllQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link MatchAllQuery match_all} {@code UserQuery} + * variant. + */ + public static UserQuery matchAll(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.matchAll(fn.apply(new MatchAllQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link PrefixQuery prefix} {@code UserQuery} + * variant. + */ + public static PrefixQuery.Builder prefix() { + return new PrefixQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link PrefixQuery prefix} {@code UserQuery} + * variant. + */ + public static UserQuery prefix(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.prefix(fn.apply(new PrefixQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link RangeQuery range} {@code UserQuery} variant. + */ + public static RangeQuery.Builder range() { + return new RangeQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link RangeQuery range} {@code UserQuery} + * variant. + */ + public static UserQuery range(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.range(fn.apply(new RangeQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SimpleQueryStringQuery simple_query_string} + * {@code UserQuery} variant. + */ + public static SimpleQueryStringQuery.Builder simpleQueryString() { + return new SimpleQueryStringQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link SimpleQueryStringQuery simple_query_string} + * {@code UserQuery} variant. + */ + public static UserQuery simpleQueryString( + Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.simpleQueryString(fn.apply(new SimpleQueryStringQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TermQuery term} {@code UserQuery} variant. + */ + public static TermQuery.Builder term() { + return new TermQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link TermQuery term} {@code UserQuery} variant. + */ + public static UserQuery term(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.term(fn.apply(new TermQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TermsQuery terms} {@code UserQuery} variant. + */ + public static TermsQuery.Builder terms() { + return new TermsQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link TermsQuery terms} {@code UserQuery} + * variant. + */ + public static UserQuery terms(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.terms(fn.apply(new TermsQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link WildcardQuery wildcard} {@code UserQuery} + * variant. + */ + public static WildcardQuery.Builder wildcard() { + return new WildcardQuery.Builder(); + } + + /** + * Creates a UserQuery of the {@link WildcardQuery wildcard} {@code UserQuery} + * variant. + */ + public static UserQuery wildcard(Function> fn) { + UserQuery.Builder builder = new UserQuery.Builder(); + builder.wildcard(fn.apply(new WildcardQuery.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryVariant.java new file mode 100644 index 000000000..70e17ee35 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_user/UserQueryVariant.java @@ -0,0 +1,48 @@ +/* + * 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.security.query_user; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link UserQuery} variants. + */ +public interface UserQueryVariant { + + UserQuery.Kind _userQueryKind(); + + default UserQuery _toUserQuery() { + return new UserQuery(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform_stats/TransformProgress.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform_stats/TransformProgress.java index e33d79f50..89ee059a4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform_stats/TransformProgress.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform_stats/TransformProgress.java @@ -34,6 +34,7 @@ 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. @@ -64,11 +65,14 @@ public class TransformProgress implements JsonpSerializable { private final long docsProcessed; - private final long docsRemaining; + @Nullable + private final Long docsRemaining; - private final double percentComplete; + @Nullable + private final Double percentComplete; - private final long totalDocs; + @Nullable + private final Long totalDocs; // --------------------------------------------------------------------------------------------- @@ -76,9 +80,9 @@ private TransformProgress(Builder builder) { this.docsIndexed = ApiTypeHelper.requireNonNull(builder.docsIndexed, this, "docsIndexed"); this.docsProcessed = ApiTypeHelper.requireNonNull(builder.docsProcessed, this, "docsProcessed"); - this.docsRemaining = ApiTypeHelper.requireNonNull(builder.docsRemaining, this, "docsRemaining"); - this.percentComplete = ApiTypeHelper.requireNonNull(builder.percentComplete, this, "percentComplete"); - this.totalDocs = ApiTypeHelper.requireNonNull(builder.totalDocs, this, "totalDocs"); + this.docsRemaining = builder.docsRemaining; + this.percentComplete = builder.percentComplete; + this.totalDocs = builder.totalDocs; } @@ -101,23 +105,26 @@ public final long docsProcessed() { } /** - * Required - API name: {@code docs_remaining} + * API name: {@code docs_remaining} */ - public final long docsRemaining() { + @Nullable + public final Long docsRemaining() { return this.docsRemaining; } /** - * Required - API name: {@code percent_complete} + * API name: {@code percent_complete} */ - public final double percentComplete() { + @Nullable + public final Double percentComplete() { return this.percentComplete; } /** - * Required - API name: {@code total_docs} + * API name: {@code total_docs} */ - public final long totalDocs() { + @Nullable + public final Long totalDocs() { return this.totalDocs; } @@ -138,14 +145,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("docs_processed"); generator.write(this.docsProcessed); - generator.writeKey("docs_remaining"); - generator.write(this.docsRemaining); + if (this.docsRemaining != null) { + generator.writeKey("docs_remaining"); + generator.write(this.docsRemaining); - generator.writeKey("percent_complete"); - generator.write(this.percentComplete); + } + if (this.percentComplete != null) { + generator.writeKey("percent_complete"); + generator.write(this.percentComplete); + + } + if (this.totalDocs != null) { + generator.writeKey("total_docs"); + generator.write(this.totalDocs); - generator.writeKey("total_docs"); - generator.write(this.totalDocs); + } } @@ -165,10 +179,13 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long docsProcessed; + @Nullable private Long docsRemaining; + @Nullable private Double percentComplete; + @Nullable private Long totalDocs; /** @@ -188,25 +205,25 @@ public final Builder docsProcessed(long value) { } /** - * Required - API name: {@code docs_remaining} + * API name: {@code docs_remaining} */ - public final Builder docsRemaining(long value) { + public final Builder docsRemaining(@Nullable Long value) { this.docsRemaining = value; return this; } /** - * Required - API name: {@code percent_complete} + * API name: {@code percent_complete} */ - public final Builder percentComplete(double value) { + public final Builder percentComplete(@Nullable Double value) { this.percentComplete = value; return this; } /** - * Required - API name: {@code total_docs} + * API name: {@code total_docs} */ - public final Builder totalDocs(long value) { + public final Builder totalDocs(@Nullable Long value) { this.totalDocs = value; return this; } diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java index caa88c073..b0179e037 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/SearchingTest.java @@ -131,8 +131,9 @@ public void searchNested() throws Exception { // Search by max price Query byMaxPrice = RangeQuery.of(r -> r + .number(n -> n .field("price") - .gte(JsonData.of(maxPrice)) // <3> + .gte(maxPrice)) // <3> )._toQuery(); // Combine name and price queries to search the product index diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java index 1e1b299b9..77610444e 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/UnionTests.java @@ -19,10 +19,17 @@ package co.elastic.clients.elasticsearch.model; +import co.elastic.clients.elasticsearch._types.GeoLocation; +import co.elastic.clients.elasticsearch._types.LatLonGeoLocation; import co.elastic.clients.elasticsearch._types.Script; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch._types.aggregations.Aggregate; import co.elastic.clients.elasticsearch._types.mapping.Property; +import co.elastic.clients.elasticsearch._types.query_dsl.DistanceFeatureQuery; +import co.elastic.clients.elasticsearch._types.query_dsl.MultiValueMode; import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.elasticsearch._types.query_dsl.RangeRelation; +import co.elastic.clients.elasticsearch._types.query_dsl.TermRangeQuery; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.testkit.ModelTestCase; import jakarta.json.Json; @@ -104,7 +111,7 @@ public void testOpenInternalUnion() { public void testOpenTypedKeysUnion() { String requiredFields = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0.0,\"successful\":1.0,\"total\":1.0}," + - "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]}}"; + "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]}}"; String customAgg = "{\"bar\":42}"; @@ -130,5 +137,222 @@ public void testOpenTypedKeysUnion() { assertEquals(42, aggregate._custom().toJson().asJsonObject().getInt("bar")); + } + + @Test + public void testUntaggedUnion() { + // Range queries + Query numberRangeQuery = Query.of(q -> q.range(r -> r + .number(n -> n + .field("age") + .gte(10D) + .lte(20D) + .boost(1.0F) + .relation(RangeRelation.Contains)))); + + String expectedNumberRangeQuery = "{\"range\":{\"age\":{\"boost\":1.0,\"relation\":\"contains\"," + + "\"gte\":10.0,\"lte\":20.0}}}"; + + assertEquals(expectedNumberRangeQuery, toJson(numberRangeQuery)); + + Query dateRangeQuery = Query.of(q -> q.range(r -> r + .date(d -> d + .field("day") + .gte("20-06-24") + .lte("20-07-24") + .boost(1.0F) + .format("some-format") + .relation(RangeRelation.Contains)))); + + String expectedDateRangeQuery = "{\"range\":{\"day\":{\"boost\":1.0,\"relation\":\"contains\"," + + "\"gte\":\"20-06-24\",\"lte\":\"20-07-24\"},\"format\":\"some-format\"}}"; + + assertEquals(expectedDateRangeQuery, toJson(dateRangeQuery)); + + Query termRangeQuery = Query.of(q -> q.range(r -> r + .term(d -> d + .field("word") + .gte("some") + .lte("word") + .boost(1.0F) + .relation(RangeRelation.Contains)))); + + String expectedTermRangeQuery = "{\"range\":{\"word\":{\"boost\":1.0,\"relation\":\"contains\"," + + "\"gte\":\"some\",\"lte\":\"word\"}}}"; + + assertEquals(expectedTermRangeQuery, toJson(termRangeQuery)); + + String jsonNumberRangeQuery = "{\n" + + " \"range\": {\n" + + " \"age\": {\n" + + " \"gte\": 10,\n" + + " \"lte\": 20,\n" + + " \"boost\": 1.0,\n" + + " \"relation\": \"contains\"\n" + + " }\n" + + " }\n" + + " }"; + + Query numberRangeQueryFromJson = Query.of(q -> q.withJson(new StringReader(jsonNumberRangeQuery))); + + assertTrue(numberRangeQueryFromJson.range().isUntyped()); + assertEquals(10, numberRangeQueryFromJson.range().untyped().gte().to(Integer.class)); + assertEquals(20, numberRangeQueryFromJson.range().untyped().lte().to(Integer.class)); + assertEquals(RangeRelation.Contains, numberRangeQueryFromJson.range().untyped().relation()); + + Query converted = + TermRangeQuery.of(trq -> trq.field("a").gte("b").lte("c"))._toRangeQuery()._toQuery(); + assertTrue(converted.isRange()); + + // Distance feature queries + + Query geoDistanceFeatureQuery = Query.of(q -> q.bool(b -> b + .must(m -> m.matchAll(mm -> mm)) + .should(sh -> sh.distanceFeature(df -> df + .geo(g -> g + .field("location") + .pivot("1000m") + .origin(GeoLocation.of(gl -> gl.latlon(LatLonGeoLocation.of(ll -> ll.lon(-71.3).lat(41.15)))))))))); + + String expectedGeoDistFeatQuery = "{\"bool\":{\"must\":[{\"match_all\":{}}]," + + "\"should\":[{\"distance_feature\":{\"origin\":{\"lat\":41.15,\"lon\":-71.3}," + + "\"pivot\":\"1000m\",\"field\":\"location\"}}]}}"; + assertEquals(expectedGeoDistFeatQuery, toJson(geoDistanceFeatureQuery)); + + + Query dateDistanceFeatureQuery = Query.of(q -> q.bool(b -> b + .must(m -> m.matchAll(mm -> mm)) + .should(sh -> sh.distanceFeature(df -> df + .date(d -> d + .field("date") + .pivot(Time.of(t -> t.time("7d"))) + .origin("now")))))); + + String expectedDateDistFeatQuery = "{\"bool\":{\"must\":[{\"match_all\":{}}]," + + "\"should\":[{\"distance_feature\":{\"origin\":\"now\",\"pivot\":\"7d\",\"field\":\"date\"}}]}}"; + assertEquals(expectedDateDistFeatQuery, toJson(dateDistanceFeatureQuery)); + + String distDateQuery = "{\n" + + " \"bool\": {\n" + + " \"must\": {\n" + + " \"match_all\": {}\n" + + " },\n" + + " \"should\": {\n" + + " \"distance_feature\": {\n" + + " \"field\": \"date\",\n" + + " \"pivot\": \"7d\",\n" + + " \"origin\": \"now\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }"; + + Query distDateQueryFromJson = Query.of(q -> q.withJson(new StringReader(distDateQuery))); + assertTrue(distDateQueryFromJson.bool().should().get(0).distanceFeature().isUntyped()); + assertEquals("7d", + distDateQueryFromJson.bool().should().get(0).distanceFeature().untyped().pivot().to(String.class)); + assertEquals("date", + distDateQueryFromJson.bool().should().get(0).distanceFeature().untyped().field().toString()); + + + String distGeoQuery = "{\n" + + " \"bool\": {\n" + + " \"must\": {\n" + + " \"match_all\": {}\n" + + " },\n" + + " \"should\": {\n" + + " \"distance_feature\": {\n" + + " \"field\": \"location\",\n" + + " \"pivot\": \"1000m\",\n" + + " \"origin\": [-71.3, 41.15]\n" + + " }\n" + + " }\n" + + " }\n" + + " }"; + + Query distGeoQueryFromJson = Query.of(q -> q.withJson(new StringReader(distGeoQuery))); + assertTrue(distGeoQueryFromJson.bool().should().get(0).distanceFeature().isUntyped()); + assertEquals("1000m", + distGeoQueryFromJson.bool().should().get(0).distanceFeature().untyped().pivot().to(String.class)); + assertEquals("location", + distGeoQueryFromJson.bool().should().get(0).distanceFeature().untyped().field()); + + + Query convertedDist = DistanceFeatureQuery.of(dfq -> dfq.date(d -> d + .field("date") + .pivot(Time.of(t -> t.time("7d"))) + .origin("now")))._toQuery(); + + assertTrue(convertedDist.isDistanceFeature()); + + //Decay Function / Function Score queries + + Query functionScoreQueryGaussDate = Query.of(q -> q.functionScore(fs -> fs + .functions(fn -> fn + .gauss(g -> g + .date(d -> d.field("date").placement(pl -> pl + .origin("2013-09-17") + .scale(Time.of(t -> t.time("10d"))) + .offset(Time.of(t -> t.time("5d"))) + .decay(0.5D))))))); + + String expectedFunctionScoreQueryGaussDate = "{\"function_score\":{\"functions\":[{\"gauss" + + "\":{\"date\":{\"decay\":0.5,\"offset\":\"5d\",\"scale\":\"10d\",\"origin\":\"2013-09-17\"}}}]}}"; + assertEquals(expectedFunctionScoreQueryGaussDate, toJson(functionScoreQueryGaussDate)); + + Query functionScoreQueryExpGeo = Query.of(q -> q.functionScore(fs -> fs + .functions(fn -> fn + .exp(g -> g + .geo(d -> d.field("location").placement(pl -> pl + .origin(GeoLocation.of(gl -> gl.latlon(LatLonGeoLocation.of(ll -> ll.lon(-71.3).lat(41.15))))) + .scale("1km") + .offset("2km") + .decay(0.5D))))))); + + String expectedFunctionScoreQueryExpGeo = "{\"function_score\":{\"functions\":[{\"exp\":{\"location" + + "\":{\"decay\":0.5,\"offset\":\"2km\",\"scale\":\"1km\",\"origin\":{\"lat\":41.15,\"lon\":-71" + + ".3}}}}]}}"; + assertEquals(expectedFunctionScoreQueryExpGeo, toJson(functionScoreQueryExpGeo)); + + Query functionScoreQueryLinearNumeric = Query.of(q -> q.functionScore(fs -> fs + .functions(fn -> fn + .linear(g -> g + .numeric(d -> d.field("nums").placement(pl -> pl + .origin(2D) + .scale(3D) + .offset(4D) + .decay(0.5D))))))); + + String expectedFunctionScoreQueryLinearNumeric = "{\"function_score\":{\"functions\":[{\"linear" + + "\":{\"nums\":{\"decay\":0.5,\"offset\":4.0,\"scale\":3.0,\"origin\":2.0}}}]}}"; + assertEquals(expectedFunctionScoreQueryLinearNumeric, toJson(functionScoreQueryLinearNumeric)); + + String funScoreQuery = + " {\n" + + "\"function_score\": {\n" + + " \"functions\": [\n" + + "{\n" + + " \"gauss\": {\n" + + "\"date\": {\n" + + " \"origin\": \"2013-09-17\",\n" + + " \"scale\": \"10d\",\n" + + " \"offset\": \"5d\",\n" + + " \"decay\": 0.5\n" + + "},\n" + + "\"multi_value_mode\": \"avg\"\n" + + " }\n" + + "}\n" + + " ]\n" + + "}\n" + + " }"; + + Query funScoreQueryFromJson = Query.of(q -> q.withJson(new StringReader(funScoreQuery))); + assertTrue(funScoreQueryFromJson.functionScore().functions().get(0).gauss().isUntyped()); + assertEquals("2013-09-17", + funScoreQueryFromJson.functionScore().functions().get(0).gauss().untyped().placement().origin().to(String.class)); + assertEquals(MultiValueMode.Avg, + funScoreQueryFromJson.functionScore().functions().get(0).gauss().untyped().multiValueMode()); + + } } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java index 47bd82c8d..f432c3c7e 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/VariantsTest.java @@ -263,11 +263,12 @@ public void testContainerWithOptionalVariants() { .functions(f -> f .weight(1.0) .linear(l -> l + .numeric(n -> n .field("foo") .placement(p -> p.decay(2.0)) ) ) - ); + )); String json = "{\"function_score\":{\"functions\":[{\"weight\":1.0,\"linear\":{\"foo\":{\"decay\":2.0}}}]," + "\"query\":{\"term\":{\"foo\":{\"value\":\"bar\"}}}}}"; @@ -277,7 +278,7 @@ public void testContainerWithOptionalVariants() { assertEquals(FunctionScore.Kind.Linear, fsq2.functionScore().functions().get(0)._kind()); assertEquals(1.0, fsq2.functionScore().functions().get(0).weight(), 0.001); - assertEquals(2.0, fsq2.functionScore().functions().get(0).linear().placement().decay(), 0.001); + assertEquals(2.0, fsq2.functionScore().functions().get(0).linear().untyped().placement().decay(), 0.001); } } }