From a9a29ca4cc56e78afc740b87018bbc0bfa544b14 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 24 May 2022 18:38:24 +0200 Subject: [PATCH] [codegen] Update to latest API spec (#293) --- .../clients/elasticsearch/_types/Slices.java | 180 +++ .../elasticsearch/_types/SlicesBuilders.java | 40 + .../_types/SlicesCalculation.java | 57 + .../_types/mapping/DynamicProperty.java | 808 ++++++++++++ .../_types/mapping/Property.java | 32 + .../_types/mapping/PropertyBase.java | 29 - .../_types/mapping/PropertyBuilders.java | 18 + .../cat/ComponentTemplatesRequest.java | 159 +++ .../cat/ComponentTemplatesResponse.java | 170 +++ .../cat/ElasticsearchCatAsyncClient.java | 46 + .../cat/ElasticsearchCatClient.java | 48 + .../ComponentTemplate.java | 287 +++++ .../core/DeleteByQueryRequest.java | 21 +- .../core/DeleteByQueryRethrottleResponse.java | 8 +- .../elasticsearch/core/MsearchRequest.java | 30 + .../elasticsearch/core/ReindexRequest.java | 21 +- .../core/UpdateByQueryRequest.java | 21 +- .../core/msearch/MultisearchBody.java | 1137 ++++++++++++++++- .../core/msearch/MultisearchHeader.java | 88 ++ .../core/reindex/RemoteSource.java | 120 +- .../elasticsearch/core/search/Highlight.java | 630 +-------- .../core/search/HighlightBase.java | 767 +++++++++++ .../core/search/HighlightField.java | 623 +-------- .../core/search/SuggestFuzziness.java | 103 +- .../elasticsearch/core/termvectors/Term.java | 11 +- .../elasticsearch/doc-files/api-spec.html | 175 +-- .../clients/elasticsearch/ilm/IlmPolicy.java | 48 +- .../indices/IndexCheckOnStartup.java | 4 +- .../indices/analyze/ExplainAnalyzeToken.java | 47 + .../create_api_key/IndexPrivileges.java | 207 --- .../create_api_key/RoleDescriptor.java | 229 +++- .../get_service_accounts/RoleDescriptor.java | 3 +- .../shutdown/DeleteNodeRequest.java | 71 +- .../shutdown/GetNodeRequest.java | 71 +- .../shutdown/PutNodeRequest.java | 276 +++- .../clients/elasticsearch/shutdown/Type.java | 56 + .../snapshot/RestoreRequest.java | 17 +- .../elasticsearch/tasks/ListResponse.java | 17 +- 38 files changed, 4941 insertions(+), 1734 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Slices.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesCalculation.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/cat/component_templates/ComponentTemplate.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightBase.java delete mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/IndexPrivileges.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/Type.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Slices.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Slices.java new file mode 100644 index 000000000..5c157e0aa --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Slices.java @@ -0,0 +1,180 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +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.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.Integer; +import java.lang.Object; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _types.Slices + +/** + * Slices configuration used to parallelize a process. + * + * @see API specification + */ +@JsonpDeserializable +public class Slices implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Computed, Value + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private Slices(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + public String _toJsonString() { + switch (_kind) { + case Computed : + return this.computed().jsonValue(); + case Value : + return String.valueOf(this.value()); + + default : + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private Slices(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static Slices of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code computed}? + */ + public boolean isComputed() { + return _kind == Kind.Computed; + } + + /** + * Get the {@code computed} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code computed} kind. + */ + public SlicesCalculation computed() { + return TaggedUnionUtils.get(this, Kind.Computed); + } + + /** + * Is this variant instance of kind {@code value}? + */ + public boolean isValue() { + return _kind == Kind.Value; + } + + /** + * Get the {@code value} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code value} kind. + */ + public Integer value() { + return TaggedUnionUtils.get(this, Kind.Value); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Value : + generator.write(((Integer) this._value)); + + break; + } + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder computed(SlicesCalculation v) { + this._kind = Kind.Computed; + this._value = v; + return this; + } + + public ObjectBuilder value(Integer v) { + this._kind = Kind.Value; + this._value = v; + return this; + } + + public Slices build() { + _checkSingleUse(); + return new Slices(this); + } + + } + + private static JsonpDeserializer buildSlicesDeserializer() { + return new UnionDeserializer.Builder(Slices::new, false) + .addMember(Kind.Computed, SlicesCalculation._DESERIALIZER) + .addMember(Kind.Value, JsonpDeserializer.integerDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(Slices::buildSlicesDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesBuilders.java new file mode 100644 index 000000000..acfc50b48 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesBuilders.java @@ -0,0 +1,40 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +/** + * Builders for {@link Slices} variants. + *

+ * Variants computed, value are not available here as + * they don't have a dedicated class. Use {@link Slices}'s builder for these. + * + */ +public class SlicesBuilders { + private SlicesBuilders() { + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesCalculation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesCalculation.java new file mode 100644 index 000000000..70b42b0a8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SlicesCalculation.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum SlicesCalculation implements JsonEnum { + /** + * Let Elasticsearch choose a reasonable number for most data streams and + * indices. + */ + Auto("auto"), + + ; + + private final String jsonValue; + + SlicesCalculation(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + SlicesCalculation.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java new file mode 100644 index 000000000..3547ad1f3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java @@ -0,0 +1,808 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types.mapping; + +import co.elastic.clients.elasticsearch._types.FieldValue; +import co.elastic.clients.elasticsearch._types.Script; +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.Boolean; +import java.lang.Double; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _types.mapping.DynamicProperty + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DynamicProperty extends DocValuesPropertyBase implements PropertyVariant { + @Nullable + private final Boolean enabled; + + @Nullable + private final FieldValue nullValue; + + @Nullable + private final Double boost; + + @Nullable + private final Boolean coerce; + + @Nullable + private final Script script; + + @Nullable + private final OnScriptError onScriptError; + + @Nullable + private final Boolean ignoreMalformed; + + @Nullable + private final TimeSeriesMetricType timeSeriesMetric; + + @Nullable + private final String analyzer; + + @Nullable + private final Boolean eagerGlobalOrdinals; + + @Nullable + private final Boolean index; + + @Nullable + private final IndexOptions indexOptions; + + @Nullable + private final Boolean indexPhrases; + + @Nullable + private final TextIndexPrefixes indexPrefixes; + + @Nullable + private final Boolean norms; + + @Nullable + private final Integer positionIncrementGap; + + @Nullable + private final String searchAnalyzer; + + @Nullable + private final String searchQuoteAnalyzer; + + @Nullable + private final TermVectorOption termVector; + + @Nullable + private final String format; + + @Nullable + private final Integer precisionStep; + + @Nullable + private final String locale; + + // --------------------------------------------------------------------------------------------- + + private DynamicProperty(Builder builder) { + super(builder); + + this.enabled = builder.enabled; + this.nullValue = builder.nullValue; + this.boost = builder.boost; + this.coerce = builder.coerce; + this.script = builder.script; + this.onScriptError = builder.onScriptError; + this.ignoreMalformed = builder.ignoreMalformed; + this.timeSeriesMetric = builder.timeSeriesMetric; + this.analyzer = builder.analyzer; + this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals; + this.index = builder.index; + this.indexOptions = builder.indexOptions; + this.indexPhrases = builder.indexPhrases; + this.indexPrefixes = builder.indexPrefixes; + this.norms = builder.norms; + this.positionIncrementGap = builder.positionIncrementGap; + this.searchAnalyzer = builder.searchAnalyzer; + this.searchQuoteAnalyzer = builder.searchQuoteAnalyzer; + this.termVector = builder.termVector; + this.format = builder.format; + this.precisionStep = builder.precisionStep; + this.locale = builder.locale; + + } + + public static DynamicProperty of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Property variant kind. + */ + @Override + public Property.Kind _propertyKind() { + return Property.Kind.DynamicProperty; + } + + /** + * API name: {@code enabled} + */ + @Nullable + public final Boolean enabled() { + return this.enabled; + } + + /** + * API name: {@code null_value} + */ + @Nullable + public final FieldValue nullValue() { + return this.nullValue; + } + + /** + * API name: {@code boost} + */ + @Nullable + public final Double boost() { + return this.boost; + } + + /** + * API name: {@code coerce} + */ + @Nullable + public final Boolean coerce() { + return this.coerce; + } + + /** + * API name: {@code script} + */ + @Nullable + public final Script script() { + return this.script; + } + + /** + * API name: {@code on_script_error} + */ + @Nullable + public final OnScriptError onScriptError() { + return this.onScriptError; + } + + /** + * API name: {@code ignore_malformed} + */ + @Nullable + public final Boolean ignoreMalformed() { + return this.ignoreMalformed; + } + + /** + * API name: {@code time_series_metric} + */ + @Nullable + public final TimeSeriesMetricType timeSeriesMetric() { + return this.timeSeriesMetric; + } + + /** + * API name: {@code analyzer} + */ + @Nullable + public final String analyzer() { + return this.analyzer; + } + + /** + * API name: {@code eager_global_ordinals} + */ + @Nullable + public final Boolean eagerGlobalOrdinals() { + return this.eagerGlobalOrdinals; + } + + /** + * API name: {@code index} + */ + @Nullable + public final Boolean index() { + return this.index; + } + + /** + * API name: {@code index_options} + */ + @Nullable + public final IndexOptions indexOptions() { + return this.indexOptions; + } + + /** + * API name: {@code index_phrases} + */ + @Nullable + public final Boolean indexPhrases() { + return this.indexPhrases; + } + + /** + * API name: {@code index_prefixes} + */ + @Nullable + public final TextIndexPrefixes indexPrefixes() { + return this.indexPrefixes; + } + + /** + * API name: {@code norms} + */ + @Nullable + public final Boolean norms() { + return this.norms; + } + + /** + * API name: {@code position_increment_gap} + */ + @Nullable + public final Integer positionIncrementGap() { + return this.positionIncrementGap; + } + + /** + * API name: {@code search_analyzer} + */ + @Nullable + public final String searchAnalyzer() { + return this.searchAnalyzer; + } + + /** + * API name: {@code search_quote_analyzer} + */ + @Nullable + public final String searchQuoteAnalyzer() { + return this.searchQuoteAnalyzer; + } + + /** + * API name: {@code term_vector} + */ + @Nullable + public final TermVectorOption termVector() { + return this.termVector; + } + + /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * API name: {@code precision_step} + */ + @Nullable + public final Integer precisionStep() { + return this.precisionStep; + } + + /** + * API name: {@code locale} + */ + @Nullable + public final String locale() { + return this.locale; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "{dynamic_property}"); + super.serializeInternal(generator, mapper); + if (this.enabled != null) { + generator.writeKey("enabled"); + generator.write(this.enabled); + + } + if (this.nullValue != null) { + generator.writeKey("null_value"); + this.nullValue.serialize(generator, mapper); + + } + if (this.boost != null) { + generator.writeKey("boost"); + generator.write(this.boost); + + } + if (this.coerce != null) { + generator.writeKey("coerce"); + generator.write(this.coerce); + + } + if (this.script != null) { + generator.writeKey("script"); + this.script.serialize(generator, mapper); + + } + if (this.onScriptError != null) { + generator.writeKey("on_script_error"); + this.onScriptError.serialize(generator, mapper); + } + if (this.ignoreMalformed != null) { + generator.writeKey("ignore_malformed"); + generator.write(this.ignoreMalformed); + + } + if (this.timeSeriesMetric != null) { + generator.writeKey("time_series_metric"); + this.timeSeriesMetric.serialize(generator, mapper); + } + if (this.analyzer != null) { + generator.writeKey("analyzer"); + generator.write(this.analyzer); + + } + if (this.eagerGlobalOrdinals != null) { + generator.writeKey("eager_global_ordinals"); + generator.write(this.eagerGlobalOrdinals); + + } + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + + } + if (this.indexOptions != null) { + generator.writeKey("index_options"); + this.indexOptions.serialize(generator, mapper); + } + if (this.indexPhrases != null) { + generator.writeKey("index_phrases"); + generator.write(this.indexPhrases); + + } + if (this.indexPrefixes != null) { + generator.writeKey("index_prefixes"); + this.indexPrefixes.serialize(generator, mapper); + + } + if (this.norms != null) { + generator.writeKey("norms"); + generator.write(this.norms); + + } + if (this.positionIncrementGap != null) { + generator.writeKey("position_increment_gap"); + generator.write(this.positionIncrementGap); + + } + if (this.searchAnalyzer != null) { + generator.writeKey("search_analyzer"); + generator.write(this.searchAnalyzer); + + } + if (this.searchQuoteAnalyzer != null) { + generator.writeKey("search_quote_analyzer"); + generator.write(this.searchQuoteAnalyzer); + + } + if (this.termVector != null) { + generator.writeKey("term_vector"); + this.termVector.serialize(generator, mapper); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + if (this.precisionStep != null) { + generator.writeKey("precision_step"); + generator.write(this.precisionStep); + + } + if (this.locale != null) { + generator.writeKey("locale"); + generator.write(this.locale); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DynamicProperty}. + */ + + public static class Builder extends DocValuesPropertyBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Boolean enabled; + + @Nullable + private FieldValue nullValue; + + @Nullable + private Double boost; + + @Nullable + private Boolean coerce; + + @Nullable + private Script script; + + @Nullable + private OnScriptError onScriptError; + + @Nullable + private Boolean ignoreMalformed; + + @Nullable + private TimeSeriesMetricType timeSeriesMetric; + + @Nullable + private String analyzer; + + @Nullable + private Boolean eagerGlobalOrdinals; + + @Nullable + private Boolean index; + + @Nullable + private IndexOptions indexOptions; + + @Nullable + private Boolean indexPhrases; + + @Nullable + private TextIndexPrefixes indexPrefixes; + + @Nullable + private Boolean norms; + + @Nullable + private Integer positionIncrementGap; + + @Nullable + private String searchAnalyzer; + + @Nullable + private String searchQuoteAnalyzer; + + @Nullable + private TermVectorOption termVector; + + @Nullable + private String format; + + @Nullable + private Integer precisionStep; + + @Nullable + private String locale; + + /** + * API name: {@code enabled} + */ + public final Builder enabled(@Nullable Boolean value) { + this.enabled = value; + return this; + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(@Nullable FieldValue value) { + this.nullValue = value; + return this; + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(Function> fn) { + return this.nullValue(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(String value) { + this.nullValue = FieldValue.of(value); + return this; + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(long value) { + this.nullValue = FieldValue.of(value); + return this; + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(double value) { + this.nullValue = FieldValue.of(value); + return this; + } + + /** + * API name: {@code null_value} + */ + public final Builder nullValue(boolean value) { + this.nullValue = FieldValue.of(value); + return this; + } + + /** + * API name: {@code boost} + */ + public final Builder boost(@Nullable Double value) { + this.boost = value; + return this; + } + + /** + * API name: {@code coerce} + */ + public final Builder coerce(@Nullable Boolean value) { + this.coerce = value; + return this; + } + + /** + * API name: {@code script} + */ + public final Builder script(@Nullable Script value) { + this.script = value; + return this; + } + + /** + * API name: {@code script} + */ + public final Builder script(Function> fn) { + return this.script(fn.apply(new Script.Builder()).build()); + } + + /** + * API name: {@code on_script_error} + */ + public final Builder onScriptError(@Nullable OnScriptError value) { + this.onScriptError = value; + return this; + } + + /** + * API name: {@code ignore_malformed} + */ + public final Builder ignoreMalformed(@Nullable Boolean value) { + this.ignoreMalformed = value; + return this; + } + + /** + * API name: {@code time_series_metric} + */ + public final Builder timeSeriesMetric(@Nullable TimeSeriesMetricType value) { + this.timeSeriesMetric = value; + return this; + } + + /** + * API name: {@code analyzer} + */ + public final Builder analyzer(@Nullable String value) { + this.analyzer = value; + return this; + } + + /** + * API name: {@code eager_global_ordinals} + */ + public final Builder eagerGlobalOrdinals(@Nullable Boolean value) { + this.eagerGlobalOrdinals = value; + return this; + } + + /** + * API name: {@code index} + */ + public final Builder index(@Nullable Boolean value) { + this.index = value; + return this; + } + + /** + * API name: {@code index_options} + */ + public final Builder indexOptions(@Nullable IndexOptions value) { + this.indexOptions = value; + return this; + } + + /** + * API name: {@code index_phrases} + */ + public final Builder indexPhrases(@Nullable Boolean value) { + this.indexPhrases = value; + return this; + } + + /** + * API name: {@code index_prefixes} + */ + public final Builder indexPrefixes(@Nullable TextIndexPrefixes value) { + this.indexPrefixes = value; + return this; + } + + /** + * API name: {@code index_prefixes} + */ + public final Builder indexPrefixes(Function> fn) { + return this.indexPrefixes(fn.apply(new TextIndexPrefixes.Builder()).build()); + } + + /** + * API name: {@code norms} + */ + public final Builder norms(@Nullable Boolean value) { + this.norms = value; + return this; + } + + /** + * API name: {@code position_increment_gap} + */ + public final Builder positionIncrementGap(@Nullable Integer value) { + this.positionIncrementGap = value; + return this; + } + + /** + * API name: {@code search_analyzer} + */ + public final Builder searchAnalyzer(@Nullable String value) { + this.searchAnalyzer = value; + return this; + } + + /** + * API name: {@code search_quote_analyzer} + */ + public final Builder searchQuoteAnalyzer(@Nullable String value) { + this.searchQuoteAnalyzer = value; + return this; + } + + /** + * API name: {@code term_vector} + */ + public final Builder termVector(@Nullable TermVectorOption value) { + this.termVector = value; + return this; + } + + /** + * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * API name: {@code precision_step} + */ + public final Builder precisionStep(@Nullable Integer value) { + this.precisionStep = value; + return this; + } + + /** + * API name: {@code locale} + */ + public final Builder locale(@Nullable String value) { + this.locale = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DynamicProperty}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DynamicProperty build() { + _checkSingleUse(); + + return new DynamicProperty(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DynamicProperty} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DynamicProperty::setupDynamicPropertyDeserializer); + + protected static void setupDynamicPropertyDeserializer(ObjectDeserializer op) { + DocValuesPropertyBase.setupDocValuesPropertyBaseDeserializer(op); + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + op.add(Builder::nullValue, FieldValue._DESERIALIZER, "null_value"); + op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); + op.add(Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); + op.add(Builder::script, Script._DESERIALIZER, "script"); + op.add(Builder::onScriptError, OnScriptError._DESERIALIZER, "on_script_error"); + op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); + op.add(Builder::timeSeriesMetric, TimeSeriesMetricType._DESERIALIZER, "time_series_metric"); + op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer"); + op.add(Builder::eagerGlobalOrdinals, JsonpDeserializer.booleanDeserializer(), "eager_global_ordinals"); + op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index"); + op.add(Builder::indexOptions, IndexOptions._DESERIALIZER, "index_options"); + op.add(Builder::indexPhrases, JsonpDeserializer.booleanDeserializer(), "index_phrases"); + op.add(Builder::indexPrefixes, TextIndexPrefixes._DESERIALIZER, "index_prefixes"); + op.add(Builder::norms, JsonpDeserializer.booleanDeserializer(), "norms"); + op.add(Builder::positionIncrementGap, JsonpDeserializer.integerDeserializer(), "position_increment_gap"); + op.add(Builder::searchAnalyzer, JsonpDeserializer.stringDeserializer(), "search_analyzer"); + op.add(Builder::searchQuoteAnalyzer, JsonpDeserializer.stringDeserializer(), "search_quote_analyzer"); + op.add(Builder::termVector, TermVectorOption._DESERIALIZER, "term_vector"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + op.add(Builder::precisionStep, JsonpDeserializer.integerDeserializer(), "precision_step"); + op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java index 25e347501..4184d3e8b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java @@ -85,6 +85,8 @@ public enum Kind implements JsonEnum { DoubleRange("double_range"), + DynamicProperty("{dynamic_property}"), + Alias("alias"), Flattened("flattened"), @@ -402,6 +404,24 @@ public DoubleRangeProperty doubleRange() { return TaggedUnionUtils.get(this, Kind.DoubleRange); } + /** + * Is this variant instance of kind {@code {dynamic_property}}? + */ + public boolean isDynamicProperty() { + return _kind == Kind.DynamicProperty; + } + + /** + * Get the {@code {dynamic_property}} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code {dynamic_property}} + * kind. + */ + public DynamicProperty dynamicProperty() { + return TaggedUnionUtils.get(this, Kind.DynamicProperty); + } + /** * Is this variant instance of kind {@code alias}? */ @@ -1109,6 +1129,17 @@ public ObjectBuilder doubleRange( return this.doubleRange(fn.apply(new DoubleRangeProperty.Builder()).build()); } + public ObjectBuilder dynamicProperty(DynamicProperty v) { + this._kind = Kind.DynamicProperty; + this._value = v; + return this; + } + + public ObjectBuilder dynamicProperty( + Function> fn) { + return this.dynamicProperty(fn.apply(new DynamicProperty.Builder()).build()); + } + public ObjectBuilder alias(FieldAliasProperty v) { this._kind = Kind.Alias; this._value = v; @@ -1483,6 +1514,7 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) op.add(Builder::denseVector, DenseVectorProperty._DESERIALIZER, "dense_vector"); op.add(Builder::double_, DoubleNumberProperty._DESERIALIZER, "double"); op.add(Builder::doubleRange, DoubleRangeProperty._DESERIALIZER, "double_range"); + op.add(Builder::dynamicProperty, DynamicProperty._DESERIALIZER, "{dynamic_property}"); op.add(Builder::alias, FieldAliasProperty._DESERIALIZER, "alias"); op.add(Builder::flattened, FlattenedProperty._DESERIALIZER, "flattened"); op.add(Builder::float_, FloatNumberProperty._DESERIALIZER, "float"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBase.java index 66e875059..bf8df2870 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBase.java @@ -55,9 +55,6 @@ public abstract class PropertyBase implements JsonpSerializable { private final Map meta; - @Nullable - private final String name; - private final Map properties; @Nullable @@ -74,7 +71,6 @@ protected PropertyBase(AbstractBuilder builder) { this.localMetadata = ApiTypeHelper.unmodifiable(builder.localMetadata); this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.name = builder.name; this.properties = ApiTypeHelper.unmodifiable(builder.properties); this.ignoreAbove = builder.ignoreAbove; this.dynamic = builder.dynamic; @@ -96,14 +92,6 @@ public final Map meta() { return this.meta; } - /** - * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - /** * API name: {@code properties} */ @@ -166,11 +154,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); - } - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); - } if (ApiTypeHelper.isDefined(this.properties)) { generator.writeKey("properties"); @@ -220,9 +203,6 @@ protected abstract static class AbstractBuilder meta; - @Nullable - private String name; - @Nullable private Map properties; @@ -275,14 +255,6 @@ public final BuilderT meta(String key, String value) { return self(); } - /** - * API name: {@code name} - */ - public final BuilderT name(@Nullable String value) { - this.name = value; - return self(); - } - /** * API name: {@code properties} *

@@ -369,7 +341,6 @@ protected static > void setupProperty "local_metadata"); op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "meta"); - op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(AbstractBuilder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "properties"); op.add(AbstractBuilder::ignoreAbove, JsonpDeserializer.integerDeserializer(), "ignore_above"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java index 24a1b85c2..6c8ad3a6f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java @@ -249,6 +249,24 @@ public static Property doubleRange(Function> fn) { + Property.Builder builder = new Property.Builder(); + builder.dynamicProperty(fn.apply(new DynamicProperty.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link FieldAliasProperty alias} {@code Property} * variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java new file mode 100644 index 000000000..ea1774a7c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesRequest.java @@ -0,0 +1,159 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.cat; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +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.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: cat.component_templates.Request + +/** + * Returns information about existing component_templates templates. + * + * @see API + * specification + */ + +public class ComponentTemplatesRequest extends CatRequestBase { + @Nullable + private final String name; + + // --------------------------------------------------------------------------------------------- + + private ComponentTemplatesRequest(Builder builder) { + + this.name = builder.name; + + } + + public static ComponentTemplatesRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * A pattern that returned component template names must match + *

+ * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ComponentTemplatesRequest}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String name; + + /** + * A pattern that returned component template names must match + *

+ * API name: {@code name} + */ + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link ComponentTemplatesRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ComponentTemplatesRequest build() { + _checkSingleUse(); + + return new ComponentTemplatesRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code cat.component_templates}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/cat.component_templates", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + if (request.name() != null) + propsSet |= _name; + + if (propsSet == 0) { + StringBuilder buf = new StringBuilder(); + buf.append("/_cat"); + buf.append("/component_templates"); + return buf.toString(); + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_cat"); + buf.append("/component_templates"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + params.put("format", "json"); + return params; + + }, SimpleEndpoint.emptyMap(), false, ComponentTemplatesResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesResponse.java new file mode 100644 index 000000000..ee0286e81 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ComponentTemplatesResponse.java @@ -0,0 +1,170 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.cat; + +import co.elastic.clients.elasticsearch.cat.component_templates.ComponentTemplate; +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 jakarta.json.stream.JsonParser; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: cat.component_templates.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ComponentTemplatesResponse implements JsonpSerializable { + private final List valueBody; + + // --------------------------------------------------------------------------------------------- + + private ComponentTemplatesResponse(Builder builder) { + + this.valueBody = ApiTypeHelper.unmodifiableRequired(builder.valueBody, this, "valueBody"); + + } + + public static ComponentTemplatesResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Response value. + */ + public final List valueBody() { + return this.valueBody; + } + + /** + * Serialize this value to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartArray(); + for (ComponentTemplate item0 : this.valueBody) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ComponentTemplatesResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List valueBody; + + /** + * Required - Response value. + *

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

+ * Adds one or more values to valueBody. + */ + public final Builder valueBody(ComponentTemplate value, ComponentTemplate... values) { + this.valueBody = _listAdd(this.valueBody, value, values); + return this; + } + + /** + * Required - Response value. + *

+ * Adds a value to valueBody using a builder lambda. + */ + public final Builder valueBody(Function> fn) { + return valueBody(fn.apply(new ComponentTemplate.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + List value = (List) JsonpDeserializer + .arrayDeserializer(ComponentTemplate._DESERIALIZER).deserialize(parser, mapper); + return this.valueBody(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ComponentTemplatesResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ComponentTemplatesResponse build() { + _checkSingleUse(); + + return new ComponentTemplatesResponse(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createComponentTemplatesResponseDeserializer(); + protected static JsonpDeserializer createComponentTemplatesResponseDeserializer() { + + JsonpDeserializer> valueDeserializer = JsonpDeserializer + .arrayDeserializer(ComponentTemplate._DESERIALIZER); + + return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), + (parser, mapper) -> new Builder().valueBody(valueDeserializer.deserialize(parser, mapper)).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java index baac20c8a..ec11ce949 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java @@ -151,6 +151,52 @@ public CompletableFuture allocation() { this.transportOptions); } + // ----- Endpoint: cat.component_templates + + /** + * Returns information about existing component_templates templates. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture componentTemplates(ComponentTemplatesRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ComponentTemplatesRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns information about existing component_templates templates. + * + * @param fn + * a function that initializes a builder to create the + * {@link ComponentTemplatesRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture componentTemplates( + Function> fn) { + return componentTemplates(fn.apply(new ComponentTemplatesRequest.Builder()).build()); + } + + /** + * Returns information about existing component_templates templates. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture componentTemplates() { + return this.transport.performRequestAsync(new ComponentTemplatesRequest.Builder().build(), + ComponentTemplatesRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: cat.count /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java index 857296042..99e9e9501 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java @@ -152,6 +152,54 @@ public AllocationResponse allocation() throws IOException, ElasticsearchExceptio this.transportOptions); } + // ----- Endpoint: cat.component_templates + + /** + * Returns information about existing component_templates templates. + * + * @see Documentation + * on elastic.co + */ + + public ComponentTemplatesResponse componentTemplates(ComponentTemplatesRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ComponentTemplatesRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns information about existing component_templates templates. + * + * @param fn + * a function that initializes a builder to create the + * {@link ComponentTemplatesRequest} + * @see Documentation + * on elastic.co + */ + + public final ComponentTemplatesResponse componentTemplates( + Function> fn) + throws IOException, ElasticsearchException { + return componentTemplates(fn.apply(new ComponentTemplatesRequest.Builder()).build()); + } + + /** + * Returns information about existing component_templates templates. + * + * @see Documentation + * on elastic.co + */ + + public ComponentTemplatesResponse componentTemplates() throws IOException, ElasticsearchException { + return this.transport.performRequest(new ComponentTemplatesRequest.Builder().build(), + ComponentTemplatesRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: cat.count /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/component_templates/ComponentTemplate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/component_templates/ComponentTemplate.java new file mode 100644 index 000000000..dbd3c72bd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/component_templates/ComponentTemplate.java @@ -0,0 +1,287 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.cat.component_templates; + +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.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: cat.component_templates.ComponentTemplate + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ComponentTemplate implements JsonpSerializable { + private final String name; + + private final String version; + + private final String aliasCount; + + private final String mappingCount; + + private final String settingsCount; + + private final String metadataCount; + + private final String includedIn; + + // --------------------------------------------------------------------------------------------- + + private ComponentTemplate(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + this.aliasCount = ApiTypeHelper.requireNonNull(builder.aliasCount, this, "aliasCount"); + this.mappingCount = ApiTypeHelper.requireNonNull(builder.mappingCount, this, "mappingCount"); + this.settingsCount = ApiTypeHelper.requireNonNull(builder.settingsCount, this, "settingsCount"); + this.metadataCount = ApiTypeHelper.requireNonNull(builder.metadataCount, this, "metadataCount"); + this.includedIn = ApiTypeHelper.requireNonNull(builder.includedIn, this, "includedIn"); + + } + + public static ComponentTemplate of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code version} + */ + public final String version() { + return this.version; + } + + /** + * Required - API name: {@code alias_count} + */ + public final String aliasCount() { + return this.aliasCount; + } + + /** + * Required - API name: {@code mapping_count} + */ + public final String mappingCount() { + return this.mappingCount; + } + + /** + * Required - API name: {@code settings_count} + */ + public final String settingsCount() { + return this.settingsCount; + } + + /** + * Required - API name: {@code metadata_count} + */ + public final String metadataCount() { + return this.metadataCount; + } + + /** + * Required - API name: {@code included_in} + */ + public final String includedIn() { + return this.includedIn; + } + + /** + * 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("name"); + generator.write(this.name); + + generator.writeKey("version"); + generator.write(this.version); + + generator.writeKey("alias_count"); + generator.write(this.aliasCount); + + generator.writeKey("mapping_count"); + generator.write(this.mappingCount); + + generator.writeKey("settings_count"); + generator.write(this.settingsCount); + + generator.writeKey("metadata_count"); + generator.write(this.metadataCount); + + generator.writeKey("included_in"); + generator.write(this.includedIn); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ComponentTemplate}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String name; + + private String version; + + private String aliasCount; + + private String mappingCount; + + private String settingsCount; + + private String metadataCount; + + private String includedIn; + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Required - API name: {@code alias_count} + */ + public final Builder aliasCount(String value) { + this.aliasCount = value; + return this; + } + + /** + * Required - API name: {@code mapping_count} + */ + public final Builder mappingCount(String value) { + this.mappingCount = value; + return this; + } + + /** + * Required - API name: {@code settings_count} + */ + public final Builder settingsCount(String value) { + this.settingsCount = value; + return this; + } + + /** + * Required - API name: {@code metadata_count} + */ + public final Builder metadataCount(String value) { + this.metadataCount = value; + return this; + } + + /** + * Required - API name: {@code included_in} + */ + public final Builder includedIn(String value) { + this.includedIn = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ComponentTemplate}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ComponentTemplate build() { + _checkSingleUse(); + + return new ComponentTemplate(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ComponentTemplate} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ComponentTemplate::setupComponentTemplateDeserializer); + + protected static void setupComponentTemplateDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + op.add(Builder::aliasCount, JsonpDeserializer.stringDeserializer(), "alias_count"); + op.add(Builder::mappingCount, JsonpDeserializer.stringDeserializer(), "mapping_count"); + op.add(Builder::settingsCount, JsonpDeserializer.stringDeserializer(), "settings_count"); + op.add(Builder::metadataCount, JsonpDeserializer.stringDeserializer(), "metadata_count"); + op.add(Builder::includedIn, JsonpDeserializer.stringDeserializer(), "included_in"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java index 6f463ea2d..f06da3dd2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRequest.java @@ -29,6 +29,7 @@ import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.SearchType; import co.elastic.clients.elasticsearch._types.SlicedScroll; +import co.elastic.clients.elasticsearch._types.Slices; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch._types.WaitForActiveShards; import co.elastic.clients.elasticsearch._types.query_dsl.Operator; @@ -137,7 +138,7 @@ public class DeleteByQueryRequest extends RequestBase implements JsonpSerializab private final SlicedScroll slice; @Nullable - private final Long slices; + private final Slices slices; private final List sort; @@ -452,7 +453,7 @@ public final SlicedScroll slice() { * API name: {@code slices} */ @Nullable - public final Long slices() { + public final Slices slices() { return this.slices; } @@ -640,7 +641,7 @@ public static class Builder extends WithJsonObjectBuilderBase private SlicedScroll slice; @Nullable - private Long slices; + private Slices slices; @Nullable private List sort; @@ -978,11 +979,21 @@ public final Builder slice(Function * API name: {@code slices} */ - public final Builder slices(@Nullable Long value) { + public final Builder slices(@Nullable Slices value) { this.slices = value; return this; } + /** + * The number of slices this task should be divided into. Defaults to 1, meaning + * the task isn't sliced into subtasks. Can be set to auto. + *

+ * API name: {@code slices} + */ + public final Builder slices(Function> fn) { + return this.slices(fn.apply(new Slices.Builder()).build()); + } + /** * A comma-separated list of <field>:<direction> pairs *

@@ -1182,7 +1193,7 @@ protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); if (request.slices != null) { - params.put("slices", String.valueOf(request.slices)); + params.put("slices", request.slices._toJsonString()); } if (request.df != null) { params.put("df", request.df); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleResponse.java index 753cedc96..bfea9e722 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleResponse.java @@ -23,7 +23,7 @@ package co.elastic.clients.elasticsearch.core; -import co.elastic.clients.elasticsearch.tasks.ListResponse; +import co.elastic.clients.elasticsearch.tasks.TaskListResponseBase; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -42,7 +42,7 @@ * specification */ @JsonpDeserializable -public class DeleteByQueryRethrottleResponse extends ListResponse { +public class DeleteByQueryRethrottleResponse extends TaskListResponseBase { // --------------------------------------------------------------------------------------------- private DeleteByQueryRethrottleResponse(Builder builder) { @@ -61,7 +61,7 @@ public static DeleteByQueryRethrottleResponse of( * Builder for {@link DeleteByQueryRethrottleResponse}. */ - public static class Builder extends ListResponse.AbstractBuilder + public static class Builder extends TaskListResponseBase.AbstractBuilder implements ObjectBuilder { @Override @@ -92,7 +92,7 @@ public DeleteByQueryRethrottleResponse build() { protected static void setupDeleteByQueryRethrottleResponseDeserializer( ObjectDeserializer op) { - ListResponse.setupListResponseDeserializer(op); + TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchRequest.java index e9a3fdd8b..bbe3abfd5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/MsearchRequest.java @@ -88,6 +88,9 @@ public class MsearchRequest extends RequestBase implements NdJsonpSerializable, @Nullable private final Long preFilterShardSize; + @Nullable + private final String routing; + @Nullable private final SearchType searchType; @@ -106,6 +109,7 @@ private MsearchRequest(Builder builder) { this.maxConcurrentSearches = builder.maxConcurrentSearches; this.maxConcurrentShardRequests = builder.maxConcurrentShardRequests; this.preFilterShardSize = builder.preFilterShardSize; + this.routing = builder.routing; this.searchType = builder.searchType; this.searches = ApiTypeHelper.unmodifiableRequired(builder.searches, this, "searches"); @@ -220,6 +224,16 @@ public final Long preFilterShardSize() { return this.preFilterShardSize; } + /** + * Custom routing value used to route search operations to a specific shard. + *

+ * API name: {@code routing} + */ + @Nullable + public final String routing() { + return this.routing; + } + /** * Indicates whether global term and document frequencies should be used when * scoring returned documents. @@ -285,6 +299,9 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder + * API name: {@code routing} + */ + public final Builder routing(@Nullable String value) { + this.routing = value; + return this; + } + /** * Indicates whether global term and document frequencies should be used when * scoring returned documents. @@ -518,6 +545,9 @@ public MsearchRequest build() { request -> { Map params = new HashMap<>(); params.put("typed_keys", "true"); + if (request.routing != null) { + params.put("routing", request.routing); + } if (request.preFilterShardSize != null) { params.put("pre_filter_shard_size", String.valueOf(request.preFilterShardSize)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java index 4954c079e..c2a9c8fe9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java @@ -27,6 +27,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Script; +import co.elastic.clients.elasticsearch._types.Slices; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch._types.WaitForActiveShards; import co.elastic.clients.elasticsearch.core.reindex.Destination; @@ -90,7 +91,7 @@ public class ReindexRequest extends RequestBase implements JsonpSerializable { private final Long size; @Nullable - private final Long slices; + private final Slices slices; private final Source source; @@ -213,7 +214,7 @@ public final Long size() { * API name: {@code slices} */ @Nullable - public final Long slices() { + public final Slices slices() { return this.slices; } @@ -331,7 +332,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long size; @Nullable - private Long slices; + private Slices slices; private Source source; @@ -452,11 +453,21 @@ public final Builder size(@Nullable Long value) { *

* API name: {@code slices} */ - public final Builder slices(@Nullable Long value) { + public final Builder slices(@Nullable Slices value) { this.slices = value; return this; } + /** + * The number of slices this task should be divided into. Defaults to 1, meaning + * the task isn't sliced into subtasks. Can be set to auto. + *

+ * API name: {@code slices} + */ + public final Builder slices(Function> fn) { + return this.slices(fn.apply(new Slices.Builder()).build()); + } + /** * Required - API name: {@code source} */ @@ -592,7 +603,7 @@ protected static void setupReindexRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); if (request.slices != null) { - params.put("slices", String.valueOf(request.slices)); + params.put("slices", request.slices._toJsonString()); } if (request.requestsPerSecond != null) { params.put("requests_per_second", String.valueOf(request.requestsPerSecond)); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java index 3c23025d1..8d3d14103 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java @@ -30,6 +30,7 @@ import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.elasticsearch._types.SearchType; import co.elastic.clients.elasticsearch._types.SlicedScroll; +import co.elastic.clients.elasticsearch._types.Slices; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch._types.WaitForActiveShards; import co.elastic.clients.elasticsearch._types.query_dsl.Operator; @@ -142,7 +143,7 @@ public class UpdateByQueryRequest extends RequestBase implements JsonpSerializab private final SlicedScroll slice; @Nullable - private final Long slices; + private final Slices slices; private final List sort; @@ -468,7 +469,7 @@ public final SlicedScroll slice() { * API name: {@code slices} */ @Nullable - public final Long slices() { + public final Slices slices() { return this.slices; } @@ -680,7 +681,7 @@ public static class Builder extends WithJsonObjectBuilderBase private SlicedScroll slice; @Nullable - private Long slices; + private Slices slices; @Nullable private List sort; @@ -1034,11 +1035,21 @@ public final Builder slice(Function * API name: {@code slices} */ - public final Builder slices(@Nullable Long value) { + public final Builder slices(@Nullable Slices value) { this.slices = value; return this; } + /** + * The number of slices this task should be divided into. Defaults to 1, meaning + * the task isn't sliced into subtasks. Can be set to auto. + *

+ * API name: {@code slices} + */ + public final Builder slices(Function> fn) { + return this.slices(fn.apply(new Slices.Builder()).build()); + } + /** * A comma-separated list of <field>:<direction> pairs *

@@ -1252,7 +1263,7 @@ protected static void setupUpdateByQueryRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); if (request.slices != null) { - params.put("slices", String.valueOf(request.slices)); + params.put("slices", request.slices._toJsonString()); } if (request.df != null) { params.put("df", request.df); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java index f541bd04e..fc68d41a2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/msearch/MultisearchBody.java @@ -23,9 +23,17 @@ package co.elastic.clients.elasticsearch.core.msearch; +import co.elastic.clients.elasticsearch._types.ScriptField; +import co.elastic.clients.elasticsearch._types.SortOptions; import co.elastic.clients.elasticsearch._types.aggregations.Aggregation; +import co.elastic.clients.elasticsearch._types.mapping.RuntimeField; +import co.elastic.clients.elasticsearch._types.query_dsl.FieldAndFormat; import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.elasticsearch.core.search.FieldCollapse; +import co.elastic.clients.elasticsearch.core.search.Highlight; import co.elastic.clients.elasticsearch.core.search.PointInTimeReference; +import co.elastic.clients.elasticsearch.core.search.Rescore; +import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.elasticsearch.core.search.Suggester; import co.elastic.clients.elasticsearch.core.search.TrackHits; import co.elastic.clients.json.JsonpDeserializable; @@ -39,8 +47,12 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Double; import java.lang.Integer; +import java.lang.Long; import java.lang.String; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -58,21 +70,77 @@ public class MultisearchBody implements JsonpSerializable { private final Map aggregations; + @Nullable + private final FieldCollapse collapse; + @Nullable private final Query query; + @Nullable + private final Boolean explain; + + private final List storedFields; + + private final List docvalueFields; + @Nullable private final Integer from; + @Nullable + private final Highlight highlight; + + private final List> indicesBoost; + + @Nullable + private final Double minScore; + + @Nullable + private final Query postFilter; + + @Nullable + private final Boolean profile; + + private final List rescore; + + private final Map scriptFields; + + private final List searchAfter; + @Nullable private final Integer size; + private final List sort; + @Nullable - private final PointInTimeReference pit; + private final SourceConfig source; + + private final List fields; + + @Nullable + private final Long terminateAfter; + + private final List stats; + + @Nullable + private final String timeout; + + @Nullable + private final Boolean trackScores; @Nullable private final TrackHits trackTotalHits; + @Nullable + private final Boolean version; + + private final Map> runtimeMappings; + + @Nullable + private final Boolean seqNoPrimaryTerm; + + @Nullable + private final PointInTimeReference pit; + @Nullable private final Suggester suggest; @@ -81,11 +149,33 @@ public class MultisearchBody implements JsonpSerializable { private MultisearchBody(Builder builder) { this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.collapse = builder.collapse; this.query = builder.query; + this.explain = builder.explain; + this.storedFields = ApiTypeHelper.unmodifiable(builder.storedFields); + this.docvalueFields = ApiTypeHelper.unmodifiable(builder.docvalueFields); this.from = builder.from; + this.highlight = builder.highlight; + this.indicesBoost = ApiTypeHelper.unmodifiable(builder.indicesBoost); + this.minScore = builder.minScore; + this.postFilter = builder.postFilter; + this.profile = builder.profile; + this.rescore = ApiTypeHelper.unmodifiable(builder.rescore); + this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields); + this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter); this.size = builder.size; - this.pit = builder.pit; + this.sort = ApiTypeHelper.unmodifiable(builder.sort); + this.source = builder.source; + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.terminateAfter = builder.terminateAfter; + this.stats = ApiTypeHelper.unmodifiable(builder.stats); + this.timeout = builder.timeout; + this.trackScores = builder.trackScores; this.trackTotalHits = builder.trackTotalHits; + this.version = builder.version; + this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings); + this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm; + this.pit = builder.pit; this.suggest = builder.suggest; } @@ -102,6 +192,16 @@ public final Map aggregations() { } /** + * API name: {@code collapse} + */ + @Nullable + public final FieldCollapse collapse() { + return this.collapse; + } + + /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ @Nullable @@ -110,6 +210,43 @@ public final Query query() { } /** + * If true, returns detailed information about score computation as part of a + * hit. + *

+ * API name: {@code explain} + */ + @Nullable + public final Boolean explain() { + return this.explain; + } + + /** + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. You can pass _source: true to return + * both source fields and stored fields in the search response. + *

+ * API name: {@code stored_fields} + */ + public final List storedFields() { + return this.storedFields; + } + + /** + * Array of wildcard (*) patterns. The request returns doc values for field + * names matching these patterns in the hits.fields property of the response. + *

+ * API name: {@code docvalue_fields} + */ + public final List docvalueFields() { + return this.docvalueFields; + } + + /** + * 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 @@ -118,6 +255,77 @@ public final Integer from() { } /** + * API name: {@code highlight} + */ + @Nullable + public final Highlight highlight() { + return this.highlight; + } + + /** + * Boosts the _score of documents from specified indices. + *

+ * API name: {@code indices_boost} + */ + public final List> indicesBoost() { + return this.indicesBoost; + } + + /** + * Minimum _score for matching documents. Documents with a lower _score are not + * included in the search results. + *

+ * API name: {@code min_score} + */ + @Nullable + public final Double minScore() { + return this.minScore; + } + + /** + * API name: {@code post_filter} + */ + @Nullable + public final Query postFilter() { + return this.postFilter; + } + + /** + * API name: {@code profile} + */ + @Nullable + public final Boolean profile() { + return this.profile; + } + + /** + * API name: {@code rescore} + */ + public final List rescore() { + return this.rescore; + } + + /** + * Retrieve a script evaluation (based on different fields) for each hit. + *

+ * API name: {@code script_fields} + */ + public final Map scriptFields() { + return this.scriptFields; + } + + /** + * 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 @@ -126,14 +334,86 @@ public final Integer size() { } /** - * API name: {@code pit} + * API name: {@code sort} + */ + public final List sort() { + return this.sort; + } + + /** + * Indicates which source fields are returned for matching documents. These + * fields are returned in the hits._source property of the search response. + *

+ * API name: {@code _source} */ @Nullable - public final PointInTimeReference pit() { - return this.pit; + public final SourceConfig source() { + return this.source; + } + + /** + * Array of wildcard (*) patterns. The request returns values for field names + * matching these patterns in the hits.fields property of the response. + *

+ * API name: {@code fields} + */ + public final List fields() { + return this.fields; + } + + /** + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Defaults to 0, which does not terminate query + * execution early. + *

+ * API name: {@code terminate_after} + */ + @Nullable + public final Long terminateAfter() { + return this.terminateAfter; + } + + /** + * Stats groups to associate with the search. Each group maintains a statistics + * aggregation for its associated searches. You can retrieve these stats using + * the indices stats API. + *

+ * API name: {@code stats} + */ + public final List stats() { + return this.stats; } /** + * Specifies the period of time to wait for a response from each shard. If no + * response is received before the timeout expires, the request fails and + * returns an error. Defaults to no timeout. + *

+ * API name: {@code timeout} + */ + @Nullable + public final String timeout() { + return this.timeout; + } + + /** + * If true, calculate and return document scores, even if the scores are not + * used for sorting. + *

+ * API name: {@code track_scores} + */ + @Nullable + public final Boolean trackScores() { + return this.trackScores; + } + + /** + * Number of hits matching the query to count accurately. If true, the exact + * number of hits is returned at the cost of some performance. If false, the + * response does not include the total number of hits matching the query. + * Defaults to 10,000 hits. + *

* API name: {@code track_total_hits} */ @Nullable @@ -141,6 +421,48 @@ public final TrackHits trackTotalHits() { return this.trackTotalHits; } + /** + * If true, returns document version as part of a hit. + *

+ * API name: {@code version} + */ + @Nullable + public final Boolean version() { + return this.version; + } + + /** + * Defines one or more runtime fields in the search request. These fields take + * precedence over mapped fields with the same name. + *

+ * API name: {@code runtime_mappings} + */ + public final Map> runtimeMappings() { + return this.runtimeMappings; + } + + /** + * If true, returns sequence number and primary term of the last modification of + * each hit. See Optimistic concurrency control. + *

+ * API name: {@code seq_no_primary_term} + */ + @Nullable + public final Boolean seqNoPrimaryTerm() { + return this.seqNoPrimaryTerm; + } + + /** + * Limits the search to a point in time (PIT). If you provide a PIT, you cannot + * specify an <index> in the request path. + *

+ * API name: {@code pit} + */ + @Nullable + public final PointInTimeReference pit() { + return this.pit; + } + /** * API name: {@code suggest} */ @@ -170,31 +492,208 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.collapse != null) { + generator.writeKey("collapse"); + this.collapse.serialize(generator, mapper); + } if (this.query != null) { generator.writeKey("query"); this.query.serialize(generator, mapper); + } + if (this.explain != null) { + generator.writeKey("explain"); + generator.write(this.explain); + + } + if (ApiTypeHelper.isDefined(this.storedFields)) { + generator.writeKey("stored_fields"); + generator.writeStartArray(); + for (String item0 : this.storedFields) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.docvalueFields)) { + generator.writeKey("docvalue_fields"); + generator.writeStartArray(); + for (FieldAndFormat item0 : this.docvalueFields) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (this.from != null) { generator.writeKey("from"); generator.write(this.from); + } + if (this.highlight != null) { + generator.writeKey("highlight"); + this.highlight.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.indicesBoost)) { + generator.writeKey("indices_boost"); + generator.writeStartArray(); + for (Map item0 : this.indicesBoost) { + generator.writeStartObject(); + if (item0 != null) { + for (Map.Entry item1 : item0.entrySet()) { + generator.writeKey(item1.getKey()); + generator.write(item1.getValue()); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + if (this.minScore != null) { + generator.writeKey("min_score"); + generator.write(this.minScore); + + } + if (this.postFilter != null) { + generator.writeKey("post_filter"); + this.postFilter.serialize(generator, mapper); + + } + if (this.profile != null) { + generator.writeKey("profile"); + generator.write(this.profile); + + } + if (ApiTypeHelper.isDefined(this.rescore)) { + generator.writeKey("rescore"); + generator.writeStartArray(); + for (Rescore item0 : this.rescore) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.scriptFields)) { + generator.writeKey("script_fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.scriptFields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.searchAfter)) { + generator.writeKey("search_after"); + generator.writeStartArray(); + for (String item0 : this.searchAfter) { + generator.write(item0); + + } + generator.writeEnd(); + } if (this.size != null) { generator.writeKey("size"); generator.write(this.size); } - if (this.pit != null) { - generator.writeKey("pit"); - this.pit.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.sort)) { + generator.writeKey("sort"); + generator.writeStartArray(); + for (SortOptions item0 : this.sort) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.source != null) { + generator.writeKey("_source"); + this.source.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartArray(); + for (FieldAndFormat item0 : this.fields) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.terminateAfter != null) { + generator.writeKey("terminate_after"); + generator.write(this.terminateAfter); + + } + if (ApiTypeHelper.isDefined(this.stats)) { + generator.writeKey("stats"); + generator.writeStartArray(); + for (String item0 : this.stats) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.timeout != null) { + generator.writeKey("timeout"); + generator.write(this.timeout); + + } + if (this.trackScores != null) { + generator.writeKey("track_scores"); + generator.write(this.trackScores); } if (this.trackTotalHits != null) { generator.writeKey("track_total_hits"); this.trackTotalHits.serialize(generator, mapper); + } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + + } + if (ApiTypeHelper.isDefined(this.runtimeMappings)) { + generator.writeKey("runtime_mappings"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.runtimeMappings.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (RuntimeField item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + if (this.seqNoPrimaryTerm != null) { + generator.writeKey("seq_no_primary_term"); + generator.write(this.seqNoPrimaryTerm); + + } + if (this.pit != null) { + generator.writeKey("pit"); + this.pit.serialize(generator, mapper); + } if (this.suggest != null) { generator.writeKey("suggest"); @@ -219,38 +718,104 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Map aggregations; + @Nullable + private FieldCollapse collapse; + @Nullable private Query query; + @Nullable + private Boolean explain; + + @Nullable + private List storedFields; + + @Nullable + private List docvalueFields; + @Nullable private Integer from; @Nullable - private Integer size; + private Highlight highlight; @Nullable - private PointInTimeReference pit; + private List> indicesBoost; @Nullable - private TrackHits trackTotalHits; + private Double minScore; @Nullable - private Suggester suggest; + private Query postFilter; - /** - * API name: {@code aggregations} - *

- * Adds all entries of map to aggregations. - */ - public final Builder aggregations(Map map) { - this.aggregations = _mapPutAll(this.aggregations, map); - return this; - } + @Nullable + private Boolean profile; - /** - * API name: {@code aggregations} - *

- * Adds an entry to aggregations. + @Nullable + private List rescore; + + @Nullable + private Map scriptFields; + + @Nullable + private List searchAfter; + + @Nullable + private Integer size; + + @Nullable + private List sort; + + @Nullable + private SourceConfig source; + + @Nullable + private List fields; + + @Nullable + private Long terminateAfter; + + @Nullable + private List stats; + + @Nullable + private String timeout; + + @Nullable + private Boolean trackScores; + + @Nullable + private TrackHits trackTotalHits; + + @Nullable + private Boolean version; + + @Nullable + private Map> runtimeMappings; + + @Nullable + private Boolean seqNoPrimaryTerm; + + @Nullable + private PointInTimeReference pit; + + @Nullable + private Suggester suggest; + + /** + * API name: {@code aggregations} + *

+ * Adds all entries of map to aggregations. + */ + public final Builder aggregations(Map map) { + this.aggregations = _mapPutAll(this.aggregations, map); + return this; + } + + /** + * API name: {@code aggregations} + *

+ * Adds an entry to aggregations. */ public final Builder aggregations(String key, Aggregation value) { this.aggregations = _mapPut(this.aggregations, key, value); @@ -267,6 +832,23 @@ public final Builder aggregations(String key, Function> fn) { + return this.collapse(fn.apply(new FieldCollapse.Builder()).build()); + } + + /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(@Nullable Query value) { @@ -275,6 +857,8 @@ public final Builder query(@Nullable Query value) { } /** + * Defines the search definition using the Query DSL. + *

* API name: {@code query} */ public final Builder query(Function> fn) { @@ -282,6 +866,89 @@ public final Builder query(Function> fn) { } /** + * If true, returns detailed information about score computation as part of a + * hit. + *

+ * API name: {@code explain} + */ + public final Builder explain(@Nullable Boolean value) { + this.explain = value; + return this; + } + + /** + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. You can pass _source: true to return + * both source fields and stored fields in the search response. + *

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

+ * Adds all elements of list to storedFields. + */ + public final Builder storedFields(List list) { + this.storedFields = _listAddAll(this.storedFields, list); + return this; + } + + /** + * List of stored fields to return as part of a hit. If no fields are specified, + * no stored fields are included in the response. If this field is specified, + * the _source parameter defaults to false. You can pass _source: true to return + * both source fields and stored fields in the search response. + *

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

+ * Adds one or more values to storedFields. + */ + public final Builder storedFields(String value, String... values) { + this.storedFields = _listAdd(this.storedFields, value, values); + return this; + } + + /** + * Array of wildcard (*) patterns. The request returns doc values for field + * names matching these patterns in the hits.fields property of the response. + *

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

+ * Adds all elements of list to docvalueFields. + */ + public final Builder docvalueFields(List list) { + this.docvalueFields = _listAddAll(this.docvalueFields, list); + return this; + } + + /** + * Array of wildcard (*) patterns. The request returns doc values for field + * names matching these patterns in the hits.fields property of the response. + *

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

+ * Adds one or more values to docvalueFields. + */ + public final Builder docvalueFields(FieldAndFormat value, FieldAndFormat... values) { + this.docvalueFields = _listAdd(this.docvalueFields, value, values); + return this; + } + + /** + * Array of wildcard (*) patterns. The request returns doc values for field + * names matching these patterns in the hits.fields property of the response. + *

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

+ * Adds a value to docvalueFields using a builder lambda. + */ + public final Builder docvalueFields(Function> fn) { + return docvalueFields(fn.apply(new FieldAndFormat.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} */ public final Builder from(@Nullable Integer value) { @@ -290,6 +957,167 @@ public final Builder from(@Nullable Integer value) { } /** + * API name: {@code highlight} + */ + public final Builder highlight(@Nullable Highlight value) { + this.highlight = value; + return this; + } + + /** + * API name: {@code highlight} + */ + public final Builder highlight(Function> fn) { + return this.highlight(fn.apply(new Highlight.Builder()).build()); + } + + /** + * Boosts the _score of documents from specified indices. + *

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

+ * Adds all elements of list to indicesBoost. + */ + public final Builder indicesBoost(List> list) { + this.indicesBoost = _listAddAll(this.indicesBoost, list); + return this; + } + + /** + * Boosts the _score of documents from specified indices. + *

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

+ * Adds one or more values to indicesBoost. + */ + public final Builder indicesBoost(Map value, Map... values) { + this.indicesBoost = _listAdd(this.indicesBoost, value, values); + return this; + } + + /** + * Minimum _score for matching documents. Documents with a lower _score are not + * included in the search results. + *

+ * API name: {@code min_score} + */ + public final Builder minScore(@Nullable Double value) { + this.minScore = value; + return this; + } + + /** + * API name: {@code post_filter} + */ + public final Builder postFilter(@Nullable Query value) { + this.postFilter = value; + return this; + } + + /** + * API name: {@code post_filter} + */ + public final Builder postFilter(Function> fn) { + return this.postFilter(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code profile} + */ + public final Builder profile(@Nullable Boolean value) { + this.profile = value; + return this; + } + + /** + * API name: {@code rescore} + *

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

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

+ * Adds a value to rescore using a builder lambda. + */ + public final Builder rescore(Function> fn) { + return rescore(fn.apply(new Rescore.Builder()).build()); + } + + /** + * Retrieve a script evaluation (based on different fields) for each hit. + *

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

+ * Adds all entries of map to scriptFields. + */ + public final Builder scriptFields(Map map) { + this.scriptFields = _mapPutAll(this.scriptFields, map); + return this; + } + + /** + * Retrieve a script evaluation (based on different fields) for each hit. + *

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

+ * Adds an entry to scriptFields. + */ + public final Builder scriptFields(String key, ScriptField value) { + this.scriptFields = _mapPut(this.scriptFields, key, value); + return this; + } + + /** + * Retrieve a script evaluation (based on different fields) for each hit. + *

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

+ * Adds an entry to scriptFields using a builder lambda. + */ + public final Builder scriptFields(String key, Function> fn) { + return scriptFields(key, fn.apply(new ScriptField.Builder()).build()); + } + + /** + * 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; + } + + /** + * API name: {@code search_after} + *

+ * Adds one or more values to searchAfter. + */ + public final Builder searchAfter(String value, String... values) { + this.searchAfter = _listAdd(this.searchAfter, value, values); + return this; + } + + /** + * 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) { @@ -298,21 +1126,163 @@ public final Builder size(@Nullable Integer value) { } /** - * API name: {@code pit} + * API name: {@code sort} + *

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

+ * Adds one or more values to sort. */ - public final Builder pit(Function> fn) { - return this.pit(fn.apply(new PointInTimeReference.Builder()).build()); + public final Builder sort(SortOptions value, SortOptions... values) { + this.sort = _listAdd(this.sort, value, values); + 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 SortOptions.Builder()).build()); + } + + /** + * Indicates which source fields are returned for matching documents. These + * fields are returned in the hits._source property of the search response. + *

+ * API name: {@code _source} + */ + public final Builder source(@Nullable SourceConfig value) { + this.source = value; + return this; + } + + /** + * Indicates which source fields are returned for matching documents. These + * fields are returned in the hits._source property of the search response. + *

+ * API name: {@code _source} + */ + public final Builder source(Function> fn) { + return this.source(fn.apply(new SourceConfig.Builder()).build()); + } + + /** + * Array of wildcard (*) patterns. The request returns values for field names + * matching these patterns in the hits.fields property of the response. + *

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

+ * Adds all elements of list to fields. + */ + public final Builder fields(List list) { + this.fields = _listAddAll(this.fields, list); + return this; + } + + /** + * Array of wildcard (*) patterns. The request returns values for field names + * matching these patterns in the hits.fields property of the response. + *

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

+ * Adds one or more values to fields. + */ + public final Builder fields(FieldAndFormat value, FieldAndFormat... values) { + this.fields = _listAdd(this.fields, value, values); + return this; + } + + /** + * Array of wildcard (*) patterns. The request returns values for field names + * matching these patterns in the hits.fields property of the response. + *

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

+ * Adds a value to fields using a builder lambda. + */ + public final Builder fields(Function> fn) { + return fields(fn.apply(new FieldAndFormat.Builder()).build()); + } + + /** + * Maximum number of documents to collect for each shard. If a query reaches + * this limit, Elasticsearch terminates the query early. Elasticsearch collects + * documents before sorting. Defaults to 0, which does not terminate query + * execution early. + *

+ * API name: {@code terminate_after} + */ + public final Builder terminateAfter(@Nullable Long value) { + this.terminateAfter = value; + return this; + } + + /** + * Stats groups to associate with the search. Each group maintains a statistics + * aggregation for its associated searches. You can retrieve these stats using + * the indices stats API. + *

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

+ * Adds all elements of list to stats. + */ + public final Builder stats(List list) { + this.stats = _listAddAll(this.stats, list); + return this; + } + + /** + * Stats groups to associate with the search. Each group maintains a statistics + * aggregation for its associated searches. You can retrieve these stats using + * the indices stats API. + *

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

+ * Adds one or more values to stats. + */ + public final Builder stats(String value, String... values) { + this.stats = _listAdd(this.stats, value, values); + return this; + } + + /** + * Specifies the period of time to wait for a response from each shard. If no + * response is received before the timeout expires, the request fails and + * returns an error. Defaults to no timeout. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable String value) { + this.timeout = value; + return this; + } + + /** + * If true, calculate and return document scores, even if the scores are not + * used for sorting. + *

+ * API name: {@code track_scores} + */ + public final Builder trackScores(@Nullable Boolean value) { + this.trackScores = value; + return this; } /** + * Number of hits matching the query to count accurately. If true, the exact + * number of hits is returned at the cost of some performance. If false, the + * response does not include the total number of hits matching the query. + * Defaults to 10,000 hits. + *

* API name: {@code track_total_hits} */ public final Builder trackTotalHits(@Nullable TrackHits value) { @@ -321,12 +1291,85 @@ public final Builder trackTotalHits(@Nullable TrackHits value) { } /** + * Number of hits matching the query to count accurately. If true, the exact + * number of hits is returned at the cost of some performance. If false, the + * response does not include the total number of hits matching the query. + * Defaults to 10,000 hits. + *

* API name: {@code track_total_hits} */ public final Builder trackTotalHits(Function> fn) { return this.trackTotalHits(fn.apply(new TrackHits.Builder()).build()); } + /** + * If true, returns document version as part of a hit. + *

+ * API name: {@code version} + */ + public final Builder version(@Nullable Boolean value) { + this.version = value; + return this; + } + + /** + * Defines one or more runtime fields in the search request. These fields take + * precedence over mapped fields with the same name. + *

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

+ * Adds all entries of map to runtimeMappings. + */ + public final Builder runtimeMappings(Map> map) { + this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); + return this; + } + + /** + * Defines one or more runtime fields in the search request. These fields take + * precedence over mapped fields with the same name. + *

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

+ * Adds an entry to runtimeMappings. + */ + public final Builder runtimeMappings(String key, List value) { + this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); + return this; + } + + /** + * If true, returns sequence number and primary term of the last modification of + * each hit. See Optimistic concurrency control. + *

+ * API name: {@code seq_no_primary_term} + */ + public final Builder seqNoPrimaryTerm(@Nullable Boolean value) { + this.seqNoPrimaryTerm = value; + return this; + } + + /** + * Limits the search to a point in time (PIT). If you provide a PIT, you cannot + * specify an <index> in the request path. + *

+ * API name: {@code pit} + */ + public final Builder pit(@Nullable PointInTimeReference value) { + this.pit = value; + return this; + } + + /** + * Limits the search to a point in time (PIT). If you provide a PIT, you cannot + * specify an <index> in the request path. + *

+ * API name: {@code pit} + */ + public final Builder pit(Function> fn) { + return this.pit(fn.apply(new PointInTimeReference.Builder()).build()); + } + /** * API name: {@code suggest} */ @@ -372,11 +1415,41 @@ protected static void setupMultisearchBodyDeserializer(ObjectDeserializer implement @Nullable private SearchType searchType; + @Nullable + private Boolean ccsMinimizeRoundtrips; + + @Nullable + private Boolean allowPartialSearchResults; + + @Nullable + private Boolean ignoreThrottled; + /** * API name: {@code allow_no_indices} */ @@ -344,6 +404,30 @@ public final Builder searchType(@Nullable SearchType value) { return this; } + /** + * API name: {@code ccs_minimize_roundtrips} + */ + public final Builder ccsMinimizeRoundtrips(@Nullable Boolean value) { + this.ccsMinimizeRoundtrips = value; + return this; + } + + /** + * API name: {@code allow_partial_search_results} + */ + public final Builder allowPartialSearchResults(@Nullable Boolean value) { + this.allowPartialSearchResults = value; + return this; + } + + /** + * API name: {@code ignore_throttled} + */ + public final Builder ignoreThrottled(@Nullable Boolean value) { + this.ignoreThrottled = value; + return this; + } + @Override protected Builder self() { return this; @@ -381,6 +465,10 @@ protected static void setupMultisearchHeaderDeserializer(ObjectDeserializer headers; + private final String host; + @Nullable private final String username; + @Nullable private final String password; + @Nullable private final Time socketTimeout; // --------------------------------------------------------------------------------------------- private RemoteSource(Builder builder) { - this.connectTimeout = ApiTypeHelper.requireNonNull(builder.connectTimeout, this, "connectTimeout"); + this.connectTimeout = builder.connectTimeout; + this.headers = ApiTypeHelper.unmodifiable(builder.headers); this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host"); - this.username = ApiTypeHelper.requireNonNull(builder.username, this, "username"); - this.password = ApiTypeHelper.requireNonNull(builder.password, this, "password"); - this.socketTimeout = ApiTypeHelper.requireNonNull(builder.socketTimeout, this, "socketTimeout"); + this.username = builder.username; + this.password = builder.password; + this.socketTimeout = builder.socketTimeout; } @@ -76,12 +84,20 @@ public static RemoteSource of(Function> fn) } /** - * Required - API name: {@code connect_timeout} + * API name: {@code connect_timeout} */ + @Nullable public final Time connectTimeout() { return this.connectTimeout; } + /** + * API name: {@code headers} + */ + public final Map headers() { + return this.headers; + } + /** * Required - API name: {@code host} */ @@ -90,22 +106,25 @@ public final String host() { } /** - * Required - API name: {@code username} + * API name: {@code username} */ + @Nullable public final String username() { return this.username; } /** - * Required - API name: {@code password} + * API name: {@code password} */ + @Nullable public final String password() { return this.password; } /** - * Required - API name: {@code socket_timeout} + * API name: {@code socket_timeout} */ + @Nullable public final Time socketTimeout() { return this.socketTimeout; } @@ -121,20 +140,40 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("connect_timeout"); - this.connectTimeout.serialize(generator, mapper); + if (this.connectTimeout != null) { + generator.writeKey("connect_timeout"); + this.connectTimeout.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.headers)) { + generator.writeKey("headers"); + generator.writeStartObject(); + for (Map.Entry item0 : this.headers.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + } generator.writeKey("host"); generator.write(this.host); - generator.writeKey("username"); - generator.write(this.username); + if (this.username != null) { + generator.writeKey("username"); + generator.write(this.username); - generator.writeKey("password"); - generator.write(this.password); + } + if (this.password != null) { + generator.writeKey("password"); + generator.write(this.password); + + } + if (this.socketTimeout != null) { + generator.writeKey("socket_timeout"); + this.socketTimeout.serialize(generator, mapper); - generator.writeKey("socket_timeout"); - this.socketTimeout.serialize(generator, mapper); + } } @@ -150,31 +189,58 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private Time connectTimeout; + @Nullable + private Map headers; + private String host; + @Nullable private String username; + @Nullable private String password; + @Nullable private Time socketTimeout; /** - * Required - API name: {@code connect_timeout} + * API name: {@code connect_timeout} */ - public final Builder connectTimeout(Time value) { + public final Builder connectTimeout(@Nullable Time value) { this.connectTimeout = value; return this; } /** - * Required - API name: {@code connect_timeout} + * API name: {@code connect_timeout} */ public final Builder connectTimeout(Function> fn) { return this.connectTimeout(fn.apply(new Time.Builder()).build()); } + /** + * API name: {@code headers} + *

+ * Adds all entries of map to headers. + */ + public final Builder headers(Map map) { + this.headers = _mapPutAll(this.headers, map); + return this; + } + + /** + * API name: {@code headers} + *

+ * Adds an entry to headers. + */ + public final Builder headers(String key, String value) { + this.headers = _mapPut(this.headers, key, value); + return this; + } + /** * Required - API name: {@code host} */ @@ -184,31 +250,31 @@ public final Builder host(String value) { } /** - * Required - API name: {@code username} + * API name: {@code username} */ - public final Builder username(String value) { + public final Builder username(@Nullable String value) { this.username = value; return this; } /** - * Required - API name: {@code password} + * API name: {@code password} */ - public final Builder password(String value) { + public final Builder password(@Nullable String value) { this.password = value; return this; } /** - * Required - API name: {@code socket_timeout} + * API name: {@code socket_timeout} */ - public final Builder socketTimeout(Time value) { + public final Builder socketTimeout(@Nullable Time value) { this.socketTimeout = value; return this; } /** - * Required - API name: {@code socket_timeout} + * API name: {@code socket_timeout} */ public final Builder socketTimeout(Function> fn) { return this.socketTimeout(fn.apply(new Time.Builder()).build()); @@ -243,6 +309,8 @@ public RemoteSource build() { protected static void setupRemoteSourceDeserializer(ObjectDeserializer op) { op.add(Builder::connectTimeout, Time._DESERIALIZER, "connect_timeout"); + op.add(Builder::headers, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), + "headers"); op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host"); op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); op.add(Builder::password, JsonpDeserializer.stringDeserializer(), "password"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Highlight.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Highlight.java index c2cb14825..ea4b2c6d0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Highlight.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Highlight.java @@ -23,22 +23,15 @@ package co.elastic.clients.elasticsearch.core.search; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; import java.lang.String; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -53,88 +46,19 @@ * specification */ @JsonpDeserializable -public class Highlight implements JsonpSerializable { - private final Map fields; - - @Nullable - private final String type; - - @Nullable - private final String boundaryChars; - - @Nullable - private final Integer boundaryMaxScan; - - @Nullable - private final BoundaryScanner boundaryScanner; - - @Nullable - private final String boundaryScannerLocale; - +public class Highlight extends HighlightBase { @Nullable private final HighlighterEncoder encoder; - @Nullable - private final HighlighterFragmenter fragmenter; - - @Nullable - private final Integer fragmentOffset; - - @Nullable - private final Integer fragmentSize; - - @Nullable - private final Integer maxFragmentLength; - - @Nullable - private final Integer noMatchSize; - - @Nullable - private final Integer numberOfFragments; - - @Nullable - private final HighlighterOrder order; - - private final List postTags; - - private final List preTags; - - @Nullable - private final Boolean requireFieldMatch; - - @Nullable - private final HighlighterTagsSchema tagsSchema; - - @Nullable - private final Query highlightQuery; - - @Nullable - private final String maxAnalyzedOffset; + private final Map fields; // --------------------------------------------------------------------------------------------- private Highlight(Builder builder) { + super(builder); - this.fields = ApiTypeHelper.unmodifiableRequired(builder.fields, this, "fields"); - this.type = builder.type; - this.boundaryChars = builder.boundaryChars; - this.boundaryMaxScan = builder.boundaryMaxScan; - this.boundaryScanner = builder.boundaryScanner; - this.boundaryScannerLocale = builder.boundaryScannerLocale; this.encoder = builder.encoder; - this.fragmenter = builder.fragmenter; - this.fragmentOffset = builder.fragmentOffset; - this.fragmentSize = builder.fragmentSize; - this.maxFragmentLength = builder.maxFragmentLength; - this.noMatchSize = builder.noMatchSize; - this.numberOfFragments = builder.numberOfFragments; - this.order = builder.order; - this.postTags = ApiTypeHelper.unmodifiable(builder.postTags); - this.preTags = ApiTypeHelper.unmodifiable(builder.preTags); - this.requireFieldMatch = builder.requireFieldMatch; - this.tagsSchema = builder.tagsSchema; - this.highlightQuery = builder.highlightQuery; - this.maxAnalyzedOffset = builder.maxAnalyzedOffset; + this.fields = ApiTypeHelper.unmodifiableRequired(builder.fields, this, "fields"); } @@ -142,53 +66,6 @@ public static Highlight of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * API name: {@code type} - */ - @Nullable - public final String type() { - return this.type; - } - - /** - * API name: {@code boundary_chars} - */ - @Nullable - public final String boundaryChars() { - return this.boundaryChars; - } - - /** - * API name: {@code boundary_max_scan} - */ - @Nullable - public final Integer boundaryMaxScan() { - return this.boundaryMaxScan; - } - - /** - * API name: {@code boundary_scanner} - */ - @Nullable - public final BoundaryScanner boundaryScanner() { - return this.boundaryScanner; - } - - /** - * API name: {@code boundary_scanner_locale} - */ - @Nullable - public final String boundaryScannerLocale() { - return this.boundaryScannerLocale; - } - /** * API name: {@code encoder} */ @@ -198,118 +75,19 @@ public final HighlighterEncoder encoder() { } /** - * API name: {@code fragmenter} - */ - @Nullable - public final HighlighterFragmenter fragmenter() { - return this.fragmenter; - } - - /** - * API name: {@code fragment_offset} - */ - @Nullable - public final Integer fragmentOffset() { - return this.fragmentOffset; - } - - /** - * API name: {@code fragment_size} - */ - @Nullable - public final Integer fragmentSize() { - return this.fragmentSize; - } - - /** - * API name: {@code max_fragment_length} - */ - @Nullable - public final Integer maxFragmentLength() { - return this.maxFragmentLength; - } - - /** - * API name: {@code no_match_size} - */ - @Nullable - public final Integer noMatchSize() { - return this.noMatchSize; - } - - /** - * API name: {@code number_of_fragments} - */ - @Nullable - public final Integer numberOfFragments() { - return this.numberOfFragments; - } - - /** - * API name: {@code order} - */ - @Nullable - public final HighlighterOrder order() { - return this.order; - } - - /** - * API name: {@code post_tags} - */ - public final List postTags() { - return this.postTags; - } - - /** - * API name: {@code pre_tags} - */ - public final List preTags() { - return this.preTags; - } - - /** - * API name: {@code require_field_match} - */ - @Nullable - public final Boolean requireFieldMatch() { - return this.requireFieldMatch; - } - - /** - * API name: {@code tags_schema} - */ - @Nullable - public final HighlighterTagsSchema tagsSchema() { - return this.tagsSchema; - } - - /** - * API name: {@code highlight_query} - */ - @Nullable - public final Query highlightQuery() { - return this.highlightQuery; - } - - /** - * API name: {@code max_analyzed_offset} - */ - @Nullable - public final String maxAnalyzedOffset() { - return this.maxAnalyzedOffset; - } - - /** - * Serialize this object to JSON. + * Required - API name: {@code fields} */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + public final Map fields() { + return this.fields; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + super.serializeInternal(generator, mapper); + if (this.encoder != null) { + generator.writeKey("encoder"); + this.encoder.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartObject(); @@ -321,179 +99,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.type != null) { - generator.writeKey("type"); - generator.write(this.type); - - } - if (this.boundaryChars != null) { - generator.writeKey("boundary_chars"); - generator.write(this.boundaryChars); - - } - if (this.boundaryMaxScan != null) { - generator.writeKey("boundary_max_scan"); - generator.write(this.boundaryMaxScan); - - } - if (this.boundaryScanner != null) { - generator.writeKey("boundary_scanner"); - this.boundaryScanner.serialize(generator, mapper); - } - if (this.boundaryScannerLocale != null) { - generator.writeKey("boundary_scanner_locale"); - generator.write(this.boundaryScannerLocale); - - } - if (this.encoder != null) { - generator.writeKey("encoder"); - this.encoder.serialize(generator, mapper); - } - if (this.fragmenter != null) { - generator.writeKey("fragmenter"); - this.fragmenter.serialize(generator, mapper); - } - if (this.fragmentOffset != null) { - generator.writeKey("fragment_offset"); - generator.write(this.fragmentOffset); - - } - if (this.fragmentSize != null) { - generator.writeKey("fragment_size"); - generator.write(this.fragmentSize); - - } - if (this.maxFragmentLength != null) { - generator.writeKey("max_fragment_length"); - generator.write(this.maxFragmentLength); - - } - if (this.noMatchSize != null) { - generator.writeKey("no_match_size"); - generator.write(this.noMatchSize); - - } - if (this.numberOfFragments != null) { - generator.writeKey("number_of_fragments"); - generator.write(this.numberOfFragments); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.postTags)) { - generator.writeKey("post_tags"); - generator.writeStartArray(); - for (String item0 : this.postTags) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.preTags)) { - generator.writeKey("pre_tags"); - generator.writeStartArray(); - for (String item0 : this.preTags) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.requireFieldMatch != null) { - generator.writeKey("require_field_match"); - generator.write(this.requireFieldMatch); - - } - if (this.tagsSchema != null) { - generator.writeKey("tags_schema"); - this.tagsSchema.serialize(generator, mapper); - } - if (this.highlightQuery != null) { - generator.writeKey("highlight_query"); - this.highlightQuery.serialize(generator, mapper); - - } - if (this.maxAnalyzedOffset != null) { - generator.writeKey("max_analyzed_offset"); - generator.write(this.maxAnalyzedOffset); - - } } - @Override - public String toString() { - return JsonpUtils.toString(this); - } - // --------------------------------------------------------------------------------------------- /** * Builder for {@link Highlight}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Map fields; - - @Nullable - private String type; - - @Nullable - private String boundaryChars; - - @Nullable - private Integer boundaryMaxScan; - - @Nullable - private BoundaryScanner boundaryScanner; - - @Nullable - private String boundaryScannerLocale; - + public static class Builder extends HighlightBase.AbstractBuilder implements ObjectBuilder { @Nullable private HighlighterEncoder encoder; - @Nullable - private HighlighterFragmenter fragmenter; - - @Nullable - private Integer fragmentOffset; - - @Nullable - private Integer fragmentSize; - - @Nullable - private Integer maxFragmentLength; - - @Nullable - private Integer noMatchSize; - - @Nullable - private Integer numberOfFragments; - - @Nullable - private HighlighterOrder order; - - @Nullable - private List postTags; - - @Nullable - private List preTags; - - @Nullable - private Boolean requireFieldMatch; - - @Nullable - private HighlighterTagsSchema tagsSchema; - - @Nullable - private Query highlightQuery; + private Map fields; - @Nullable - private String maxAnalyzedOffset; + /** + * API name: {@code encoder} + */ + public final Builder encoder(@Nullable HighlighterEncoder value) { + this.encoder = value; + return this; + } /** * Required - API name: {@code fields} @@ -524,197 +151,6 @@ public final Builder fields(String key, Function - * Adds all elements of list to postTags. - */ - public final Builder postTags(List list) { - this.postTags = _listAddAll(this.postTags, list); - return this; - } - - /** - * API name: {@code post_tags} - *

- * Adds one or more values to postTags. - */ - public final Builder postTags(String value, String... values) { - this.postTags = _listAdd(this.postTags, value, values); - return this; - } - - /** - * API name: {@code pre_tags} - *

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

- * Adds one or more values to preTags. - */ - public final Builder preTags(String value, String... values) { - this.preTags = _listAdd(this.preTags, value, values); - return this; - } - - /** - * API name: {@code require_field_match} - */ - public final Builder requireFieldMatch(@Nullable Boolean value) { - this.requireFieldMatch = value; - return this; - } - - /** - * API name: {@code tags_schema} - */ - public final Builder tagsSchema(@Nullable HighlighterTagsSchema value) { - this.tagsSchema = value; - return this; - } - - /** - * API name: {@code highlight_query} - */ - public final Builder highlightQuery(@Nullable Query value) { - this.highlightQuery = value; - return this; - } - - /** - * API name: {@code highlight_query} - */ - public final Builder highlightQuery(Function> fn) { - return this.highlightQuery(fn.apply(new Query.Builder()).build()); - } - - /** - * API name: {@code max_analyzed_offset} - */ - public final Builder maxAnalyzedOffset(@Nullable String value) { - this.maxAnalyzedOffset = value; - return this; - } - @Override protected Builder self() { return this; @@ -742,29 +178,9 @@ public Highlight build() { Highlight::setupHighlightDeserializer); protected static void setupHighlightDeserializer(ObjectDeserializer op) { - - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(HighlightField._DESERIALIZER), "fields"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::boundaryChars, JsonpDeserializer.stringDeserializer(), "boundary_chars"); - op.add(Builder::boundaryMaxScan, JsonpDeserializer.integerDeserializer(), "boundary_max_scan"); - op.add(Builder::boundaryScanner, BoundaryScanner._DESERIALIZER, "boundary_scanner"); - op.add(Builder::boundaryScannerLocale, JsonpDeserializer.stringDeserializer(), "boundary_scanner_locale"); + HighlightBase.setupHighlightBaseDeserializer(op); op.add(Builder::encoder, HighlighterEncoder._DESERIALIZER, "encoder"); - op.add(Builder::fragmenter, HighlighterFragmenter._DESERIALIZER, "fragmenter"); - op.add(Builder::fragmentOffset, JsonpDeserializer.integerDeserializer(), "fragment_offset"); - op.add(Builder::fragmentSize, JsonpDeserializer.integerDeserializer(), "fragment_size"); - op.add(Builder::maxFragmentLength, JsonpDeserializer.integerDeserializer(), "max_fragment_length"); - op.add(Builder::noMatchSize, JsonpDeserializer.integerDeserializer(), "no_match_size"); - op.add(Builder::numberOfFragments, JsonpDeserializer.integerDeserializer(), "number_of_fragments"); - op.add(Builder::order, HighlighterOrder._DESERIALIZER, "order"); - op.add(Builder::postTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "post_tags"); - op.add(Builder::preTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "pre_tags"); - op.add(Builder::requireFieldMatch, JsonpDeserializer.booleanDeserializer(), "require_field_match"); - op.add(Builder::tagsSchema, HighlighterTagsSchema._DESERIALIZER, "tags_schema"); - op.add(Builder::highlightQuery, Query._DESERIALIZER, "highlight_query"); - op.add(Builder::maxAnalyzedOffset, JsonpDeserializer.stringDeserializer(), "max_analyzed_offset"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(HighlightField._DESERIALIZER), "fields"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightBase.java new file mode 100644 index 000000000..5eb981004 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightBase.java @@ -0,0 +1,767 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.core.search; + +import co.elastic.clients.elasticsearch._types.query_dsl.Query; +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.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _global.search._types.HighlightBase + +/** + * + * @see API + * specification + */ + +public abstract class HighlightBase implements JsonpSerializable { + @Nullable + private final String type; + + @Nullable + private final String boundaryChars; + + @Nullable + private final Integer boundaryMaxScan; + + @Nullable + private final BoundaryScanner boundaryScanner; + + @Nullable + private final String boundaryScannerLocale; + + @Nullable + private final Boolean forceSource; + + @Nullable + private final HighlighterFragmenter fragmenter; + + @Nullable + private final Integer fragmentSize; + + @Nullable + private final Boolean highlightFilter; + + @Nullable + private final Query highlightQuery; + + @Nullable + private final Integer maxFragmentLength; + + @Nullable + private final Integer maxAnalyzedOffset; + + @Nullable + private final Integer noMatchSize; + + @Nullable + private final Integer numberOfFragments; + + private final Map options; + + @Nullable + private final HighlighterOrder order; + + @Nullable + private final Integer phraseLimit; + + private final List postTags; + + private final List preTags; + + @Nullable + private final Boolean requireFieldMatch; + + @Nullable + private final HighlighterTagsSchema tagsSchema; + + // --------------------------------------------------------------------------------------------- + + protected HighlightBase(AbstractBuilder builder) { + + this.type = builder.type; + this.boundaryChars = builder.boundaryChars; + this.boundaryMaxScan = builder.boundaryMaxScan; + this.boundaryScanner = builder.boundaryScanner; + this.boundaryScannerLocale = builder.boundaryScannerLocale; + this.forceSource = builder.forceSource; + this.fragmenter = builder.fragmenter; + this.fragmentSize = builder.fragmentSize; + this.highlightFilter = builder.highlightFilter; + this.highlightQuery = builder.highlightQuery; + this.maxFragmentLength = builder.maxFragmentLength; + this.maxAnalyzedOffset = builder.maxAnalyzedOffset; + this.noMatchSize = builder.noMatchSize; + this.numberOfFragments = builder.numberOfFragments; + this.options = ApiTypeHelper.unmodifiable(builder.options); + this.order = builder.order; + this.phraseLimit = builder.phraseLimit; + this.postTags = ApiTypeHelper.unmodifiable(builder.postTags); + this.preTags = ApiTypeHelper.unmodifiable(builder.preTags); + this.requireFieldMatch = builder.requireFieldMatch; + this.tagsSchema = builder.tagsSchema; + + } + + /** + * API name: {@code type} + */ + @Nullable + public final String type() { + return this.type; + } + + /** + * API name: {@code boundary_chars} + */ + @Nullable + public final String boundaryChars() { + return this.boundaryChars; + } + + /** + * API name: {@code boundary_max_scan} + */ + @Nullable + public final Integer boundaryMaxScan() { + return this.boundaryMaxScan; + } + + /** + * API name: {@code boundary_scanner} + */ + @Nullable + public final BoundaryScanner boundaryScanner() { + return this.boundaryScanner; + } + + /** + * API name: {@code boundary_scanner_locale} + */ + @Nullable + public final String boundaryScannerLocale() { + return this.boundaryScannerLocale; + } + + /** + * API name: {@code force_source} + */ + @Nullable + public final Boolean forceSource() { + return this.forceSource; + } + + /** + * API name: {@code fragmenter} + */ + @Nullable + public final HighlighterFragmenter fragmenter() { + return this.fragmenter; + } + + /** + * API name: {@code fragment_size} + */ + @Nullable + public final Integer fragmentSize() { + return this.fragmentSize; + } + + /** + * API name: {@code highlight_filter} + */ + @Nullable + public final Boolean highlightFilter() { + return this.highlightFilter; + } + + /** + * API name: {@code highlight_query} + */ + @Nullable + public final Query highlightQuery() { + return this.highlightQuery; + } + + /** + * API name: {@code max_fragment_length} + */ + @Nullable + public final Integer maxFragmentLength() { + return this.maxFragmentLength; + } + + /** + * API name: {@code max_analyzed_offset} + */ + @Nullable + public final Integer maxAnalyzedOffset() { + return this.maxAnalyzedOffset; + } + + /** + * API name: {@code no_match_size} + */ + @Nullable + public final Integer noMatchSize() { + return this.noMatchSize; + } + + /** + * API name: {@code number_of_fragments} + */ + @Nullable + public final Integer numberOfFragments() { + return this.numberOfFragments; + } + + /** + * API name: {@code options} + */ + public final Map options() { + return this.options; + } + + /** + * API name: {@code order} + */ + @Nullable + public final HighlighterOrder order() { + return this.order; + } + + /** + * API name: {@code phrase_limit} + */ + @Nullable + public final Integer phraseLimit() { + return this.phraseLimit; + } + + /** + * API name: {@code post_tags} + */ + public final List postTags() { + return this.postTags; + } + + /** + * API name: {@code pre_tags} + */ + public final List preTags() { + return this.preTags; + } + + /** + * API name: {@code require_field_match} + */ + @Nullable + public final Boolean requireFieldMatch() { + return this.requireFieldMatch; + } + + /** + * API name: {@code tags_schema} + */ + @Nullable + public final HighlighterTagsSchema tagsSchema() { + return this.tagsSchema; + } + + /** + * 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.type != null) { + generator.writeKey("type"); + generator.write(this.type); + + } + if (this.boundaryChars != null) { + generator.writeKey("boundary_chars"); + generator.write(this.boundaryChars); + + } + if (this.boundaryMaxScan != null) { + generator.writeKey("boundary_max_scan"); + generator.write(this.boundaryMaxScan); + + } + if (this.boundaryScanner != null) { + generator.writeKey("boundary_scanner"); + this.boundaryScanner.serialize(generator, mapper); + } + if (this.boundaryScannerLocale != null) { + generator.writeKey("boundary_scanner_locale"); + generator.write(this.boundaryScannerLocale); + + } + if (this.forceSource != null) { + generator.writeKey("force_source"); + generator.write(this.forceSource); + + } + if (this.fragmenter != null) { + generator.writeKey("fragmenter"); + this.fragmenter.serialize(generator, mapper); + } + if (this.fragmentSize != null) { + generator.writeKey("fragment_size"); + generator.write(this.fragmentSize); + + } + if (this.highlightFilter != null) { + generator.writeKey("highlight_filter"); + generator.write(this.highlightFilter); + + } + if (this.highlightQuery != null) { + generator.writeKey("highlight_query"); + this.highlightQuery.serialize(generator, mapper); + + } + if (this.maxFragmentLength != null) { + generator.writeKey("max_fragment_length"); + generator.write(this.maxFragmentLength); + + } + if (this.maxAnalyzedOffset != null) { + generator.writeKey("max_analyzed_offset"); + generator.write(this.maxAnalyzedOffset); + + } + if (this.noMatchSize != null) { + generator.writeKey("no_match_size"); + generator.write(this.noMatchSize); + + } + if (this.numberOfFragments != null) { + generator.writeKey("number_of_fragments"); + generator.write(this.numberOfFragments); + + } + if (ApiTypeHelper.isDefined(this.options)) { + generator.writeKey("options"); + generator.writeStartObject(); + for (Map.Entry item0 : this.options.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.phraseLimit != null) { + generator.writeKey("phrase_limit"); + generator.write(this.phraseLimit); + + } + if (ApiTypeHelper.isDefined(this.postTags)) { + generator.writeKey("post_tags"); + generator.writeStartArray(); + for (String item0 : this.postTags) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.preTags)) { + generator.writeKey("pre_tags"); + generator.writeStartArray(); + for (String item0 : this.preTags) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.requireFieldMatch != null) { + generator.writeKey("require_field_match"); + generator.write(this.requireFieldMatch); + + } + if (this.tagsSchema != null) { + generator.writeKey("tags_schema"); + this.tagsSchema.serialize(generator, mapper); + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + protected abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + @Nullable + private String type; + + @Nullable + private String boundaryChars; + + @Nullable + private Integer boundaryMaxScan; + + @Nullable + private BoundaryScanner boundaryScanner; + + @Nullable + private String boundaryScannerLocale; + + @Nullable + private Boolean forceSource; + + @Nullable + private HighlighterFragmenter fragmenter; + + @Nullable + private Integer fragmentSize; + + @Nullable + private Boolean highlightFilter; + + @Nullable + private Query highlightQuery; + + @Nullable + private Integer maxFragmentLength; + + @Nullable + private Integer maxAnalyzedOffset; + + @Nullable + private Integer noMatchSize; + + @Nullable + private Integer numberOfFragments; + + @Nullable + private Map options; + + @Nullable + private HighlighterOrder order; + + @Nullable + private Integer phraseLimit; + + @Nullable + private List postTags; + + @Nullable + private List preTags; + + @Nullable + private Boolean requireFieldMatch; + + @Nullable + private HighlighterTagsSchema tagsSchema; + + /** + * API name: {@code type} + */ + public final BuilderT type(@Nullable String value) { + this.type = value; + return self(); + } + + /** + * API name: {@code type} + */ + public final BuilderT type(@Nullable HighlighterType value) { + this.type = value == null ? null : value.jsonValue(); + return self(); + } + + /** + * API name: {@code boundary_chars} + */ + public final BuilderT boundaryChars(@Nullable String value) { + this.boundaryChars = value; + return self(); + } + + /** + * API name: {@code boundary_max_scan} + */ + public final BuilderT boundaryMaxScan(@Nullable Integer value) { + this.boundaryMaxScan = value; + return self(); + } + + /** + * API name: {@code boundary_scanner} + */ + public final BuilderT boundaryScanner(@Nullable BoundaryScanner value) { + this.boundaryScanner = value; + return self(); + } + + /** + * API name: {@code boundary_scanner_locale} + */ + public final BuilderT boundaryScannerLocale(@Nullable String value) { + this.boundaryScannerLocale = value; + return self(); + } + + /** + * API name: {@code force_source} + */ + public final BuilderT forceSource(@Nullable Boolean value) { + this.forceSource = value; + return self(); + } + + /** + * API name: {@code fragmenter} + */ + public final BuilderT fragmenter(@Nullable HighlighterFragmenter value) { + this.fragmenter = value; + return self(); + } + + /** + * API name: {@code fragment_size} + */ + public final BuilderT fragmentSize(@Nullable Integer value) { + this.fragmentSize = value; + return self(); + } + + /** + * API name: {@code highlight_filter} + */ + public final BuilderT highlightFilter(@Nullable Boolean value) { + this.highlightFilter = value; + return self(); + } + + /** + * API name: {@code highlight_query} + */ + public final BuilderT highlightQuery(@Nullable Query value) { + this.highlightQuery = value; + return self(); + } + + /** + * API name: {@code highlight_query} + */ + public final BuilderT highlightQuery(Function> fn) { + return this.highlightQuery(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code max_fragment_length} + */ + public final BuilderT maxFragmentLength(@Nullable Integer value) { + this.maxFragmentLength = value; + return self(); + } + + /** + * API name: {@code max_analyzed_offset} + */ + public final BuilderT maxAnalyzedOffset(@Nullable Integer value) { + this.maxAnalyzedOffset = value; + return self(); + } + + /** + * API name: {@code no_match_size} + */ + public final BuilderT noMatchSize(@Nullable Integer value) { + this.noMatchSize = value; + return self(); + } + + /** + * API name: {@code number_of_fragments} + */ + public final BuilderT numberOfFragments(@Nullable Integer value) { + this.numberOfFragments = value; + return self(); + } + + /** + * API name: {@code options} + *

+ * Adds all entries of map to options. + */ + public final BuilderT options(Map map) { + this.options = _mapPutAll(this.options, map); + return self(); + } + + /** + * API name: {@code options} + *

+ * Adds an entry to options. + */ + public final BuilderT options(String key, JsonData value) { + this.options = _mapPut(this.options, key, value); + return self(); + } + + /** + * API name: {@code order} + */ + public final BuilderT order(@Nullable HighlighterOrder value) { + this.order = value; + return self(); + } + + /** + * API name: {@code phrase_limit} + */ + public final BuilderT phraseLimit(@Nullable Integer value) { + this.phraseLimit = value; + return self(); + } + + /** + * API name: {@code post_tags} + *

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

+ * Adds one or more values to postTags. + */ + public final BuilderT postTags(String value, String... values) { + this.postTags = _listAdd(this.postTags, value, values); + return self(); + } + + /** + * API name: {@code pre_tags} + *

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

+ * Adds one or more values to preTags. + */ + public final BuilderT preTags(String value, String... values) { + this.preTags = _listAdd(this.preTags, value, values); + return self(); + } + + /** + * API name: {@code require_field_match} + */ + public final BuilderT requireFieldMatch(@Nullable Boolean value) { + this.requireFieldMatch = value; + return self(); + } + + /** + * API name: {@code tags_schema} + */ + public final BuilderT tagsSchema(@Nullable HighlighterTagsSchema value) { + this.tagsSchema = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupHighlightBaseDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(AbstractBuilder::boundaryChars, JsonpDeserializer.stringDeserializer(), "boundary_chars"); + op.add(AbstractBuilder::boundaryMaxScan, JsonpDeserializer.integerDeserializer(), "boundary_max_scan"); + op.add(AbstractBuilder::boundaryScanner, BoundaryScanner._DESERIALIZER, "boundary_scanner"); + op.add(AbstractBuilder::boundaryScannerLocale, JsonpDeserializer.stringDeserializer(), + "boundary_scanner_locale"); + op.add(AbstractBuilder::forceSource, JsonpDeserializer.booleanDeserializer(), "force_source"); + op.add(AbstractBuilder::fragmenter, HighlighterFragmenter._DESERIALIZER, "fragmenter"); + op.add(AbstractBuilder::fragmentSize, JsonpDeserializer.integerDeserializer(), "fragment_size"); + op.add(AbstractBuilder::highlightFilter, JsonpDeserializer.booleanDeserializer(), "highlight_filter"); + op.add(AbstractBuilder::highlightQuery, Query._DESERIALIZER, "highlight_query"); + op.add(AbstractBuilder::maxFragmentLength, JsonpDeserializer.integerDeserializer(), "max_fragment_length"); + op.add(AbstractBuilder::maxAnalyzedOffset, JsonpDeserializer.integerDeserializer(), "max_analyzed_offset"); + op.add(AbstractBuilder::noMatchSize, JsonpDeserializer.integerDeserializer(), "no_match_size"); + op.add(AbstractBuilder::numberOfFragments, JsonpDeserializer.integerDeserializer(), "number_of_fragments"); + op.add(AbstractBuilder::options, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "options"); + op.add(AbstractBuilder::order, HighlighterOrder._DESERIALIZER, "order"); + op.add(AbstractBuilder::phraseLimit, JsonpDeserializer.integerDeserializer(), "phrase_limit"); + op.add(AbstractBuilder::postTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "post_tags"); + op.add(AbstractBuilder::preTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "pre_tags"); + op.add(AbstractBuilder::requireFieldMatch, JsonpDeserializer.booleanDeserializer(), "require_field_match"); + op.add(AbstractBuilder::tagsSchema, HighlighterTagsSchema._DESERIALIZER, "tags_schema"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightField.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightField.java index d79afa250..918a1bd89 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightField.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/HighlightField.java @@ -23,19 +23,14 @@ package co.elastic.clients.elasticsearch.core.search; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; import java.lang.Integer; import java.lang.String; import java.util.List; @@ -52,92 +47,19 @@ * specification */ @JsonpDeserializable -public class HighlightField implements JsonpSerializable { - @Nullable - private final String boundaryChars; - - @Nullable - private final Integer boundaryMaxScan; - - @Nullable - private final BoundaryScanner boundaryScanner; - - @Nullable - private final String boundaryScannerLocale; - - @Nullable - private final String field; - - @Nullable - private final Boolean forceSource; - - @Nullable - private final HighlighterFragmenter fragmenter; - +public class HighlightField extends HighlightBase { @Nullable private final Integer fragmentOffset; - @Nullable - private final Integer fragmentSize; - - @Nullable - private final Query highlightQuery; - private final List matchedFields; - @Nullable - private final Integer maxFragmentLength; - - @Nullable - private final Integer noMatchSize; - - @Nullable - private final Integer numberOfFragments; - - @Nullable - private final HighlighterOrder order; - - @Nullable - private final Integer phraseLimit; - - private final List postTags; - - private final List preTags; - - @Nullable - private final Boolean requireFieldMatch; - - @Nullable - private final HighlighterTagsSchema tagsSchema; - - @Nullable - private final String type; - // --------------------------------------------------------------------------------------------- private HighlightField(Builder builder) { + super(builder); - this.boundaryChars = builder.boundaryChars; - this.boundaryMaxScan = builder.boundaryMaxScan; - this.boundaryScanner = builder.boundaryScanner; - this.boundaryScannerLocale = builder.boundaryScannerLocale; - this.field = builder.field; - this.forceSource = builder.forceSource; - this.fragmenter = builder.fragmenter; this.fragmentOffset = builder.fragmentOffset; - this.fragmentSize = builder.fragmentSize; - this.highlightQuery = builder.highlightQuery; this.matchedFields = ApiTypeHelper.unmodifiable(builder.matchedFields); - this.maxFragmentLength = builder.maxFragmentLength; - this.noMatchSize = builder.noMatchSize; - this.numberOfFragments = builder.numberOfFragments; - this.order = builder.order; - this.phraseLimit = builder.phraseLimit; - this.postTags = ApiTypeHelper.unmodifiable(builder.postTags); - this.preTags = ApiTypeHelper.unmodifiable(builder.preTags); - this.requireFieldMatch = builder.requireFieldMatch; - this.tagsSchema = builder.tagsSchema; - this.type = builder.type; } @@ -145,62 +67,6 @@ public static HighlightField of(Function> return fn.apply(new Builder()).build(); } - /** - * API name: {@code boundary_chars} - */ - @Nullable - public final String boundaryChars() { - return this.boundaryChars; - } - - /** - * API name: {@code boundary_max_scan} - */ - @Nullable - public final Integer boundaryMaxScan() { - return this.boundaryMaxScan; - } - - /** - * API name: {@code boundary_scanner} - */ - @Nullable - public final BoundaryScanner boundaryScanner() { - return this.boundaryScanner; - } - - /** - * API name: {@code boundary_scanner_locale} - */ - @Nullable - public final String boundaryScannerLocale() { - return this.boundaryScannerLocale; - } - - /** - * API name: {@code field} - */ - @Nullable - public final String field() { - return this.field; - } - - /** - * API name: {@code force_source} - */ - @Nullable - public final Boolean forceSource() { - return this.forceSource; - } - - /** - * API name: {@code fragmenter} - */ - @Nullable - public final HighlighterFragmenter fragmenter() { - return this.fragmenter; - } - /** * API name: {@code fragment_offset} */ @@ -209,22 +75,6 @@ public final Integer fragmentOffset() { return this.fragmentOffset; } - /** - * API name: {@code fragment_size} - */ - @Nullable - public final Integer fragmentSize() { - return this.fragmentSize; - } - - /** - * API name: {@code highlight_query} - */ - @Nullable - public final Query highlightQuery() { - return this.highlightQuery; - } - /** * API name: {@code matched_fields} */ @@ -232,142 +82,13 @@ public final List matchedFields() { return this.matchedFields; } - /** - * API name: {@code max_fragment_length} - */ - @Nullable - public final Integer maxFragmentLength() { - return this.maxFragmentLength; - } - - /** - * API name: {@code no_match_size} - */ - @Nullable - public final Integer noMatchSize() { - return this.noMatchSize; - } - - /** - * API name: {@code number_of_fragments} - */ - @Nullable - public final Integer numberOfFragments() { - return this.numberOfFragments; - } - - /** - * API name: {@code order} - */ - @Nullable - public final HighlighterOrder order() { - return this.order; - } - - /** - * API name: {@code phrase_limit} - */ - @Nullable - public final Integer phraseLimit() { - return this.phraseLimit; - } - - /** - * API name: {@code post_tags} - */ - public final List postTags() { - return this.postTags; - } - - /** - * API name: {@code pre_tags} - */ - public final List preTags() { - return this.preTags; - } - - /** - * API name: {@code require_field_match} - */ - @Nullable - public final Boolean requireFieldMatch() { - return this.requireFieldMatch; - } - - /** - * API name: {@code tags_schema} - */ - @Nullable - public final HighlighterTagsSchema tagsSchema() { - return this.tagsSchema; - } - - /** - * API name: {@code type} - */ - @Nullable - public final String type() { - return this.type; - } - - /** - * 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.boundaryChars != null) { - generator.writeKey("boundary_chars"); - generator.write(this.boundaryChars); - - } - if (this.boundaryMaxScan != null) { - generator.writeKey("boundary_max_scan"); - generator.write(this.boundaryMaxScan); - - } - if (this.boundaryScanner != null) { - generator.writeKey("boundary_scanner"); - this.boundaryScanner.serialize(generator, mapper); - } - if (this.boundaryScannerLocale != null) { - generator.writeKey("boundary_scanner_locale"); - generator.write(this.boundaryScannerLocale); - - } - if (this.field != null) { - generator.writeKey("field"); - generator.write(this.field); - - } - if (this.forceSource != null) { - generator.writeKey("force_source"); - generator.write(this.forceSource); - - } - if (this.fragmenter != null) { - generator.writeKey("fragmenter"); - this.fragmenter.serialize(generator, mapper); - } + super.serializeInternal(generator, mapper); if (this.fragmentOffset != null) { generator.writeKey("fragment_offset"); generator.write(this.fragmentOffset); - } - if (this.fragmentSize != null) { - generator.writeKey("fragment_size"); - generator.write(this.fragmentSize); - - } - if (this.highlightQuery != null) { - generator.writeKey("highlight_query"); - this.highlightQuery.serialize(generator, mapper); - } if (ApiTypeHelper.isDefined(this.matchedFields)) { generator.writeKey("matched_fields"); @@ -379,70 +100,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.maxFragmentLength != null) { - generator.writeKey("max_fragment_length"); - generator.write(this.maxFragmentLength); - - } - if (this.noMatchSize != null) { - generator.writeKey("no_match_size"); - generator.write(this.noMatchSize); - - } - if (this.numberOfFragments != null) { - generator.writeKey("number_of_fragments"); - generator.write(this.numberOfFragments); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.phraseLimit != null) { - generator.writeKey("phrase_limit"); - generator.write(this.phraseLimit); - - } - if (ApiTypeHelper.isDefined(this.postTags)) { - generator.writeKey("post_tags"); - generator.writeStartArray(); - for (String item0 : this.postTags) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.preTags)) { - generator.writeKey("pre_tags"); - generator.writeStartArray(); - for (String item0 : this.preTags) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.requireFieldMatch != null) { - generator.writeKey("require_field_match"); - generator.write(this.requireFieldMatch); - - } - if (this.tagsSchema != null) { - generator.writeKey("tags_schema"); - this.tagsSchema.serialize(generator, mapper); - } - if (this.type != null) { - generator.writeKey("type"); - generator.write(this.type); - - } - - } - @Override - public String toString() { - return JsonpUtils.toString(this); } // --------------------------------------------------------------------------------------------- @@ -451,126 +109,15 @@ public String toString() { * Builder for {@link HighlightField}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private String boundaryChars; - - @Nullable - private Integer boundaryMaxScan; - - @Nullable - private BoundaryScanner boundaryScanner; - - @Nullable - private String boundaryScannerLocale; - - @Nullable - private String field; - - @Nullable - private Boolean forceSource; - - @Nullable - private HighlighterFragmenter fragmenter; - + public static class Builder extends HighlightBase.AbstractBuilder + implements + ObjectBuilder { @Nullable private Integer fragmentOffset; - @Nullable - private Integer fragmentSize; - - @Nullable - private Query highlightQuery; - @Nullable private List matchedFields; - @Nullable - private Integer maxFragmentLength; - - @Nullable - private Integer noMatchSize; - - @Nullable - private Integer numberOfFragments; - - @Nullable - private HighlighterOrder order; - - @Nullable - private Integer phraseLimit; - - @Nullable - private List postTags; - - @Nullable - private List preTags; - - @Nullable - private Boolean requireFieldMatch; - - @Nullable - private HighlighterTagsSchema tagsSchema; - - @Nullable - private String type; - - /** - * API name: {@code boundary_chars} - */ - public final Builder boundaryChars(@Nullable String value) { - this.boundaryChars = value; - return this; - } - - /** - * API name: {@code boundary_max_scan} - */ - public final Builder boundaryMaxScan(@Nullable Integer value) { - this.boundaryMaxScan = value; - return this; - } - - /** - * API name: {@code boundary_scanner} - */ - public final Builder boundaryScanner(@Nullable BoundaryScanner value) { - this.boundaryScanner = value; - return this; - } - - /** - * API name: {@code boundary_scanner_locale} - */ - public final Builder boundaryScannerLocale(@Nullable String value) { - this.boundaryScannerLocale = value; - return this; - } - - /** - * API name: {@code field} - */ - public final Builder field(@Nullable String value) { - this.field = value; - return this; - } - - /** - * API name: {@code force_source} - */ - public final Builder forceSource(@Nullable Boolean value) { - this.forceSource = value; - return this; - } - - /** - * API name: {@code fragmenter} - */ - public final Builder fragmenter(@Nullable HighlighterFragmenter value) { - this.fragmenter = value; - return this; - } - /** * API name: {@code fragment_offset} */ @@ -579,29 +126,6 @@ public final Builder fragmentOffset(@Nullable Integer value) { return this; } - /** - * API name: {@code fragment_size} - */ - public final Builder fragmentSize(@Nullable Integer value) { - this.fragmentSize = value; - return this; - } - - /** - * API name: {@code highlight_query} - */ - public final Builder highlightQuery(@Nullable Query value) { - this.highlightQuery = value; - return this; - } - - /** - * API name: {@code highlight_query} - */ - public final Builder highlightQuery(Function> fn) { - return this.highlightQuery(fn.apply(new Query.Builder()).build()); - } - /** * API name: {@code matched_fields} *

@@ -622,118 +146,6 @@ public final Builder matchedFields(String value, String... values) { return this; } - /** - * API name: {@code max_fragment_length} - */ - public final Builder maxFragmentLength(@Nullable Integer value) { - this.maxFragmentLength = value; - return this; - } - - /** - * API name: {@code no_match_size} - */ - public final Builder noMatchSize(@Nullable Integer value) { - this.noMatchSize = value; - return this; - } - - /** - * API name: {@code number_of_fragments} - */ - public final Builder numberOfFragments(@Nullable Integer value) { - this.numberOfFragments = value; - return this; - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable HighlighterOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code phrase_limit} - */ - public final Builder phraseLimit(@Nullable Integer value) { - this.phraseLimit = value; - return this; - } - - /** - * API name: {@code post_tags} - *

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

- * Adds one or more values to postTags. - */ - public final Builder postTags(String value, String... values) { - this.postTags = _listAdd(this.postTags, value, values); - return this; - } - - /** - * API name: {@code pre_tags} - *

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

- * Adds one or more values to preTags. - */ - public final Builder preTags(String value, String... values) { - this.preTags = _listAdd(this.preTags, value, values); - return this; - } - - /** - * API name: {@code require_field_match} - */ - public final Builder requireFieldMatch(@Nullable Boolean value) { - this.requireFieldMatch = value; - return this; - } - - /** - * API name: {@code tags_schema} - */ - public final Builder tagsSchema(@Nullable HighlighterTagsSchema value) { - this.tagsSchema = value; - return this; - } - - /** - * API name: {@code type} - */ - public final Builder type(@Nullable String value) { - this.type = value; - return this; - } - - /** - * API name: {@code type} - */ - public final Builder type(@Nullable HighlighterType value) { - this.type = value == null ? null : value.jsonValue(); - return this; - } - @Override protected Builder self() { return this; @@ -761,31 +173,10 @@ public HighlightField build() { HighlightField::setupHighlightFieldDeserializer); protected static void setupHighlightFieldDeserializer(ObjectDeserializer op) { - - op.add(Builder::boundaryChars, JsonpDeserializer.stringDeserializer(), "boundary_chars"); - op.add(Builder::boundaryMaxScan, JsonpDeserializer.integerDeserializer(), "boundary_max_scan"); - op.add(Builder::boundaryScanner, BoundaryScanner._DESERIALIZER, "boundary_scanner"); - op.add(Builder::boundaryScannerLocale, JsonpDeserializer.stringDeserializer(), "boundary_scanner_locale"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::forceSource, JsonpDeserializer.booleanDeserializer(), "force_source"); - op.add(Builder::fragmenter, HighlighterFragmenter._DESERIALIZER, "fragmenter"); + HighlightBase.setupHighlightBaseDeserializer(op); op.add(Builder::fragmentOffset, JsonpDeserializer.integerDeserializer(), "fragment_offset"); - op.add(Builder::fragmentSize, JsonpDeserializer.integerDeserializer(), "fragment_size"); - op.add(Builder::highlightQuery, Query._DESERIALIZER, "highlight_query"); op.add(Builder::matchedFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "matched_fields"); - op.add(Builder::maxFragmentLength, JsonpDeserializer.integerDeserializer(), "max_fragment_length"); - op.add(Builder::noMatchSize, JsonpDeserializer.integerDeserializer(), "no_match_size"); - op.add(Builder::numberOfFragments, JsonpDeserializer.integerDeserializer(), "number_of_fragments"); - op.add(Builder::order, HighlighterOrder._DESERIALIZER, "order"); - op.add(Builder::phraseLimit, JsonpDeserializer.integerDeserializer(), "phrase_limit"); - op.add(Builder::postTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "post_tags"); - op.add(Builder::preTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "pre_tags"); - op.add(Builder::requireFieldMatch, JsonpDeserializer.booleanDeserializer(), "require_field_match"); - op.add(Builder::tagsSchema, HighlighterTagsSchema._DESERIALIZER, "tags_schema"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestFuzziness.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestFuzziness.java index 0e12a4975..6bab76d91 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestFuzziness.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SuggestFuzziness.java @@ -30,7 +30,6 @@ 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; @@ -51,25 +50,30 @@ */ @JsonpDeserializable public class SuggestFuzziness implements JsonpSerializable { + @Nullable private final String fuzziness; - private final int minLength; + @Nullable + private final Integer minLength; - private final int prefixLength; + @Nullable + private final Integer prefixLength; - private final boolean transpositions; + @Nullable + private final Boolean transpositions; - private final boolean unicodeAware; + @Nullable + private final Boolean unicodeAware; // --------------------------------------------------------------------------------------------- private SuggestFuzziness(Builder builder) { - this.fuzziness = ApiTypeHelper.requireNonNull(builder.fuzziness, this, "fuzziness"); - this.minLength = ApiTypeHelper.requireNonNull(builder.minLength, this, "minLength"); - this.prefixLength = ApiTypeHelper.requireNonNull(builder.prefixLength, this, "prefixLength"); - this.transpositions = ApiTypeHelper.requireNonNull(builder.transpositions, this, "transpositions"); - this.unicodeAware = ApiTypeHelper.requireNonNull(builder.unicodeAware, this, "unicodeAware"); + this.fuzziness = builder.fuzziness; + this.minLength = builder.minLength; + this.prefixLength = builder.prefixLength; + this.transpositions = builder.transpositions; + this.unicodeAware = builder.unicodeAware; } @@ -78,37 +82,42 @@ public static SuggestFuzziness of(Function implements ObjectBuilder { + @Nullable private String fuzziness; + @Nullable private Integer minLength; + @Nullable private Integer prefixLength; + @Nullable private Boolean transpositions; + @Nullable private Boolean unicodeAware; /** - * Required - API name: {@code fuzziness} + * API name: {@code fuzziness} */ - public final Builder fuzziness(String value) { + public final Builder fuzziness(@Nullable String value) { this.fuzziness = value; return this; } /** - * Required - API name: {@code min_length} + * API name: {@code min_length} */ - public final Builder minLength(int value) { + public final Builder minLength(@Nullable Integer value) { this.minLength = value; return this; } /** - * Required - API name: {@code prefix_length} + * API name: {@code prefix_length} */ - public final Builder prefixLength(int value) { + public final Builder prefixLength(@Nullable Integer value) { this.prefixLength = value; return this; } /** - * Required - API name: {@code transpositions} + * API name: {@code transpositions} */ - public final Builder transpositions(boolean value) { + public final Builder transpositions(@Nullable Boolean value) { this.transpositions = value; return this; } /** - * Required - API name: {@code unicode_aware} + * API name: {@code unicode_aware} */ - public final Builder unicodeAware(boolean value) { + public final Builder unicodeAware(@Nullable Boolean value) { this.unicodeAware = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Term.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Term.java index 8473c1d0c..2741f4ed4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Term.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/termvectors/Term.java @@ -70,7 +70,7 @@ private Term(Builder builder) { this.docFreq = builder.docFreq; this.score = builder.score; this.termFreq = ApiTypeHelper.requireNonNull(builder.termFreq, this, "termFreq"); - this.tokens = ApiTypeHelper.unmodifiableRequired(builder.tokens, this, "tokens"); + this.tokens = ApiTypeHelper.unmodifiable(builder.tokens); this.ttf = builder.ttf; } @@ -103,7 +103,7 @@ public final int termFreq() { } /** - * Required - API name: {@code tokens} + * API name: {@code tokens} */ public final List tokens() { return this.tokens; @@ -179,6 +179,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Integer termFreq; + @Nullable private List tokens; @Nullable @@ -209,7 +210,7 @@ public final Builder termFreq(int value) { } /** - * Required - API name: {@code tokens} + * API name: {@code tokens} *

* Adds all elements of list to tokens. */ @@ -219,7 +220,7 @@ public final Builder tokens(List list) { } /** - * Required - API name: {@code tokens} + * API name: {@code tokens} *

* Adds one or more values to tokens. */ @@ -229,7 +230,7 @@ public final Builder tokens(Token value, Token... values) { } /** - * Required - API name: {@code tokens} + * API name: {@code tokens} *

* Adds a value to tokens using a builder lambda. */ 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 fe0a02709..8342eaa0c 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 @@ -26,7 +26,7 @@ '_global.create.Response': '_global/create/CreateResponse.ts#L22-L24', '_global.delete.Request': '_global/delete/DeleteRequest.ts#L34-L54', '_global.delete.Response': '_global/delete/DeleteResponse.ts#L22-L34', -'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L35-L80', +'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L36-L81', '_global.delete_by_query.Response': '_global/delete_by_query/DeleteByQueryResponse.ts#L25-L42', '_global.delete_by_query_rethrottle.Request': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleRequest.ts#L24-L36', '_global.delete_by_query_rethrottle.Response': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleResponse.ts#L22-L24', @@ -70,13 +70,13 @@ '_global.mget.Request': '_global/mget/MultiGetRequest.ts#L25-L91', '_global.mget.Response': '_global/mget/MultiGetResponse.ts#L22-L26', '_global.mget.ResponseItem': '_global/mget/types.ts#L57-L60', -'_global.msearch.MultiSearchItem': '_global/msearch/types.ts#L71-L74', -'_global.msearch.MultiSearchResult': '_global/msearch/types.ts#L61-L64', -'_global.msearch.MultisearchBody': '_global/msearch/types.ts#L50-L59', -'_global.msearch.MultisearchHeader': '_global/msearch/types.ts#L36-L48', -'_global.msearch.Request': '_global/msearch/MultiSearchRequest.ts#L25-L92', +'_global.msearch.MultiSearchItem': '_global/msearch/types.ts#L202-L205', +'_global.msearch.MultiSearchResult': '_global/msearch/types.ts#L192-L195', +'_global.msearch.MultisearchBody': '_global/msearch/types.ts#L69-L190', +'_global.msearch.MultisearchHeader': '_global/msearch/types.ts#L51-L66', +'_global.msearch.Request': '_global/msearch/MultiSearchRequest.ts#L25-L96', '_global.msearch.Response': '_global/msearch/MultiSearchResponse.ts#L25-L27', -'_global.msearch.ResponseItem': '_global/msearch/types.ts#L66-L69', +'_global.msearch.ResponseItem': '_global/msearch/types.ts#L197-L200', '_global.msearch_template.Request': '_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L45', '_global.msearch_template.Response': '_global/msearch_template/MultiSearchTemplateResponse.ts#L22-L24', '_global.msearch_template.TemplateConfig': '_global/msearch_template/types.ts#L28-L45', @@ -107,11 +107,11 @@ '_global.rank_eval.Request': '_global/rank_eval/RankEvalRequest.ts#L24-L61', '_global.rank_eval.Response': '_global/rank_eval/RankEvalResponse.ts#L26-L34', '_global.rank_eval.UnratedDocument': '_global/rank_eval/types.ts#L147-L150', -'_global.reindex.Destination': '_global/reindex/types.ts#L38-L44', -'_global.reindex.RemoteSource': '_global/reindex/types.ts#L58-L64', +'_global.reindex.Destination': '_global/reindex/types.ts#L39-L45', +'_global.reindex.RemoteSource': '_global/reindex/types.ts#L59-L66', '_global.reindex.Request': '_global/reindex/ReindexRequest.ts#L27-L51', '_global.reindex.Response': '_global/reindex/ReindexResponse.ts#L26-L45', -'_global.reindex.Source': '_global/reindex/types.ts#L46-L56', +'_global.reindex.Source': '_global/reindex/types.ts#L47-L57', '_global.reindex_rethrottle.ReindexNode': '_global/reindex_rethrottle/types.ts#L26-L28', '_global.reindex_rethrottle.ReindexStatus': '_global/reindex_rethrottle/types.ts#L30-L42', '_global.reindex_rethrottle.ReindexTask': '_global/reindex_rethrottle/types.ts#L44-L55', @@ -124,14 +124,14 @@ '_global.scripts_painless_execute.Response': '_global/scripts_painless_execute/ExecutePainlessScriptResponse.ts#L20-L24', '_global.scroll.Request': '_global/scroll/ScrollRequest.ts#L24-L59', '_global.scroll.Response': '_global/scroll/ScrollResponse.ts#L22-L24', -'_global.search.Request': '_global/search/SearchRequest.ts#L50-L233', +'_global.search.Request': '_global/search/SearchRequest.ts#L50-L234', '_global.search.Response': '_global/search/SearchResponse.ts#L34-L36', '_global.search.ResponseBody': '_global/search/SearchResponse.ts#L38-L54', '_global.search._types.AggregationBreakdown': '_global/search/_types/profile.ts#L22-L35', '_global.search._types.AggregationProfile': '_global/search/_types/profile.ts#L74-L81', '_global.search._types.AggregationProfileDebug': '_global/search/_types/profile.ts#L38-L66', '_global.search._types.AggregationProfileDelegateDebugFilter': '_global/search/_types/profile.ts#L68-L72', -'_global.search._types.BoundaryScanner': '_global/search/_types/highlighting.ts#L25-L29', +'_global.search._types.BoundaryScanner': '_global/search/_types/highlighting.ts#L26-L30', '_global.search._types.Collector': '_global/search/_types/profile.ts#L83-L88', '_global.search._types.CompletionContext': '_global/search/_types/suggester.ts#L150-L157', '_global.search._types.CompletionSuggest': '_global/search/_types/suggester.ts#L48-L53', @@ -144,13 +144,14 @@ '_global.search._types.FetchProfileDebug': '_global/search/_types/profile.ts#L154-L157', '_global.search._types.FieldCollapse': '_global/search/_types/FieldCollapse.ts#L24-L29', '_global.search._types.FieldSuggester': '_global/search/_types/suggester.ts#L101-L115', -'_global.search._types.Highlight': '_global/search/_types/highlighting.ts#L31-L54', -'_global.search._types.HighlightField': '_global/search/_types/highlighting.ts#L82-L105', -'_global.search._types.HighlighterEncoder': '_global/search/_types/highlighting.ts#L56-L59', -'_global.search._types.HighlighterFragmenter': '_global/search/_types/highlighting.ts#L61-L64', -'_global.search._types.HighlighterOrder': '_global/search/_types/highlighting.ts#L66-L68', -'_global.search._types.HighlighterTagsSchema': '_global/search/_types/highlighting.ts#L70-L72', -'_global.search._types.HighlighterType': '_global/search/_types/highlighting.ts#L74-L80', +'_global.search._types.Highlight': '_global/search/_types/highlighting.ts#L56-L59', +'_global.search._types.HighlightBase': '_global/search/_types/highlighting.ts#L32-L54', +'_global.search._types.HighlightField': '_global/search/_types/highlighting.ts#L87-L90', +'_global.search._types.HighlighterEncoder': '_global/search/_types/highlighting.ts#L61-L64', +'_global.search._types.HighlighterFragmenter': '_global/search/_types/highlighting.ts#L66-L69', +'_global.search._types.HighlighterOrder': '_global/search/_types/highlighting.ts#L71-L73', +'_global.search._types.HighlighterTagsSchema': '_global/search/_types/highlighting.ts#L75-L77', +'_global.search._types.HighlighterType': '_global/search/_types/highlighting.ts#L79-L85', '_global.search._types.Hit': '_global/search/_types/hits.ts#L40-L60', '_global.search._types.HitsMetadata': '_global/search/_types/hits.ts#L62-L68', '_global.search._types.InnerHits': '_global/search/_types/hits.ts#L102-L120', @@ -208,7 +209,7 @@ '_global.update.Request': '_global/update/UpdateRequest.ts#L38-L151', '_global.update.Response': '_global/update/UpdateResponse.ts#L27-L29', '_global.update.UpdateWriteResponseBase': '_global/update/UpdateResponse.ts#L23-L25', -'_global.update_by_query.Request': '_global/update_by_query/UpdateByQueryRequest.ts#L36-L84', +'_global.update_by_query.Request': '_global/update_by_query/UpdateByQueryRequest.ts#L37-L85', '_global.update_by_query.Response': '_global/update_by_query/UpdateByQueryResponse.ts#L25-L42', '_global.update_by_query_rethrottle.Request': '_global/update_by_query_rethrottle/UpdateByQueryRethrottleRequest.ts#L24-L36', '_global.update_by_query_rethrottle.Response': '_global/update_by_query_rethrottle/UpdateByQueryRethrottleResponse.ts#L23-L25', @@ -251,9 +252,9 @@ '_types.IBDistribution': '_types/Similarity.ts#L42-L45', '_types.IBLambda': '_types/Similarity.ts#L47-L50', '_types.IndexingStats': '_types/Stats.ts#L100-L115', -'_types.IndicesOptions': '_types/common.ts#L288-L315', +'_types.IndicesOptions': '_types/common.ts#L290-L317', '_types.IndicesResponseBase': '_types/Base.ts#L77-L79', -'_types.InlineGet': '_types/common.ts#L277-L286', +'_types.InlineGet': '_types/common.ts#L279-L288', '_types.InlineScript': '_types/Scripting.ts#L45-L50', '_types.LatLonGeoLocation': '_types/Geo.ts#L107-L110', '_types.Level': '_types/common.ts#L222-L226', @@ -269,7 +270,7 @@ '_types.PluginStats': '_types/Stats.ts#L136-L147', '_types.QueryCacheStats': '_types/Stats.ts#L149-L158', '_types.RecoveryStats': '_types/Stats.ts#L160-L165', -'_types.Refresh': '_types/common.ts#L234-L238', +'_types.Refresh': '_types/common.ts#L233-L240', '_types.RefreshStats': '_types/Stats.ts#L167-L174', '_types.RequestBase': '_types/Base.ts#L34-L34', '_types.RequestCacheStats': '_types/Stats.ts#L176-L182', @@ -285,21 +286,23 @@ '_types.ScriptTransform': '_types/Transform.ts#L36-L44', '_types.SearchStats': '_types/Stats.ts#L184-L199', '_types.SearchTransform': '_types/Transform.ts#L46-L49', -'_types.SearchType': '_types/common.ts#L240-L245', +'_types.SearchType': '_types/common.ts#L242-L247', '_types.SegmentsStats': '_types/Stats.ts#L201-L226', '_types.ShardFailure': '_types/Errors.ts#L50-L56', '_types.ShardStatistics': '_types/Stats.ts#L32-L38', '_types.ShardsOperationResponseBase': '_types/Base.ts#L81-L83', '_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27', +'_types.Slices': '_types/common.ts#L319-L324', +'_types.SlicesCalculation': '_types/common.ts#L326-L334', '_types.SortMode': '_types/sort.ts#L101-L110', '_types.SortOptions': '_types/sort.ts#L80-L89', '_types.SortOrder': '_types/sort.ts#L112-L115', '_types.StoreStats': '_types/Stats.ts#L228-L235', '_types.StoredScript': '_types/Scripting.ts#L35-L39', '_types.StoredScriptId': '_types/Scripting.ts#L52-L54', -'_types.SuggestMode': '_types/common.ts#L247-L251', +'_types.SuggestMode': '_types/common.ts#L249-L253', '_types.TaskFailure': '_types/Errors.ts#L66-L71', -'_types.ThreadType': '_types/common.ts#L253-L259', +'_types.ThreadType': '_types/common.ts#L255-L261', '_types.Time': '_types/Time.ts#L65-L71', '_types.TimeUnit': '_types/Time.ts#L73-L88', '_types.TopLeftBottomRightGeoBounds': '_types/Geo.ts#L142-L145', @@ -307,9 +310,9 @@ '_types.TransformContainer': '_types/Transform.ts#L27-L34', '_types.TranslogStats': '_types/Stats.ts#L237-L245', '_types.VersionType': '_types/common.ts#L91-L96', -'_types.WaitForActiveShardOptions': '_types/common.ts#L261-L265', +'_types.WaitForActiveShardOptions': '_types/common.ts#L263-L267', '_types.WaitForActiveShards': '_types/common.ts#L115-L116', -'_types.WaitForEvents': '_types/common.ts#L267-L274', +'_types.WaitForEvents': '_types/common.ts#L269-L276', '_types.WarmerStats': '_types/Stats.ts#L247-L252', '_types.WktGeoBounds': '_types/Geo.ts#L131-L133', '_types.WriteResponseBase': '_types/Base.ts#L36-L45', @@ -680,12 +683,13 @@ '_types.mapping.DocValuesPropertyBase': '_types/mapping/core.ts#L67-L69', '_types.mapping.DoubleNumberProperty': '_types/mapping/core.ts#L170-L173', '_types.mapping.DoubleRangeProperty': '_types/mapping/range.ts#L42-L44', -'_types.mapping.DynamicMapping': '_types/mapping/dynamic-template.ts#L37-L42', +'_types.mapping.DynamicMapping': '_types/mapping/dynamic-template.ts#L37-L46', +'_types.mapping.DynamicProperty': '_types/mapping/core.ts#L316-L347', '_types.mapping.DynamicTemplate': '_types/mapping/dynamic-template.ts#L22-L30', '_types.mapping.FieldAliasProperty': '_types/mapping/specialized.ts#L48-L51', '_types.mapping.FieldMapping': '_types/mapping/meta-fields.ts#L24-L27', '_types.mapping.FieldNamesField': '_types/mapping/meta-fields.ts#L42-L44', -'_types.mapping.FieldType': '_types/mapping/Property.ts#L70-L113', +'_types.mapping.FieldType': '_types/mapping/Property.ts#L71-L114', '_types.mapping.FlattenedProperty': '_types/mapping/complex.ts#L25-L36', '_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L160-L163', '_types.mapping.FloatRangeProperty': '_types/mapping/range.ts#L46-L48', @@ -696,7 +700,7 @@ '_types.mapping.HalfFloatNumberProperty': '_types/mapping/core.ts#L165-L168', '_types.mapping.HistogramProperty': '_types/mapping/specialized.ts#L53-L56', '_types.mapping.IndexField': '_types/mapping/meta-fields.ts#L46-L48', -'_types.mapping.IndexOptions': '_types/mapping/core.ts#L270-L275', +'_types.mapping.IndexOptions': '_types/mapping/core.ts#L276-L281', '_types.mapping.IntegerNumberProperty': '_types/mapping/core.ts#L175-L178', '_types.mapping.IntegerRangeProperty': '_types/mapping/range.ts#L50-L52', '_types.mapping.IpProperty': '_types/mapping/specialized.ts#L58-L64', @@ -705,7 +709,7 @@ '_types.mapping.KeywordProperty': '_types/mapping/core.ts#L129-L141', '_types.mapping.LongNumberProperty': '_types/mapping/core.ts#L180-L183', '_types.mapping.LongRangeProperty': '_types/mapping/range.ts#L58-L60', -'_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L243-L268', +'_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L249-L274', '_types.mapping.MatchType': '_types/mapping/dynamic-template.ts#L32-L35', '_types.mapping.Murmur3HashProperty': '_types/mapping/specialized.ts#L66-L68', '_types.mapping.NestedProperty': '_types/mapping/complex.ts#L38-L43', @@ -714,8 +718,8 @@ '_types.mapping.OnScriptError': '_types/mapping/core.ts#L149-L152', '_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L218-L220', '_types.mapping.PointProperty': '_types/mapping/geo.ts#L62-L67', -'_types.mapping.Property': '_types/mapping/Property.ts#L53-L68', -'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L42-L51', +'_types.mapping.Property': '_types/mapping/Property.ts#L53-L69', +'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L43-L51', '_types.mapping.RangePropertyBase': '_types/mapping/range.ts#L23-L27', '_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L222-L225', '_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L227-L229', @@ -731,14 +735,14 @@ '_types.mapping.StandardNumberProperty': '_types/mapping/core.ts#L154-L158', '_types.mapping.SuggestContext': '_types/mapping/specialized.ts#L36-L41', '_types.mapping.TermVectorOption': '_types/mapping/TermVectorOption.ts#L20-L28', -'_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L277-L280', -'_types.mapping.TextProperty': '_types/mapping/core.ts#L282-L298', +'_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L283-L286', +'_types.mapping.TextProperty': '_types/mapping/core.ts#L288-L304', '_types.mapping.TimeSeriesMetricType': '_types/mapping/TimeSeriesMetricType.ts#L20-L25', '_types.mapping.TokenCountProperty': '_types/mapping/specialized.ts#L70-L77', '_types.mapping.TypeMapping': '_types/mapping/TypeMapping.ts#L34-L55', '_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L195-L198', -'_types.mapping.VersionProperty': '_types/mapping/core.ts#L300-L302', -'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L304-L308', +'_types.mapping.VersionProperty': '_types/mapping/core.ts#L306-L308', +'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L310-L314', '_types.query_dsl.BoolQuery': '_types/query_dsl/compound.ts#L28-L34', '_types.query_dsl.BoostingQuery': '_types/query_dsl/compound.ts#L36-L40', '_types.query_dsl.ChildScoreMode': '_types/query_dsl/joining.ts#L25-L39', @@ -755,11 +759,11 @@ '_types.query_dsl.ExistsQuery': '_types/query_dsl/term.ts#L36-L38', '_types.query_dsl.FieldAndFormat': '_types/query_dsl/abstractions.ts#L214-L228', '_types.query_dsl.FieldLookup': '_types/query_dsl/abstractions.ts#L166-L171', -'_types.query_dsl.FieldValueFactorModifier': '_types/query_dsl/compound.ts#L145-L156', +'_types.query_dsl.FieldValueFactorModifier': '_types/query_dsl/compound.ts#L147-L158', '_types.query_dsl.FieldValueFactorScoreFunction': '_types/query_dsl/compound.ts#L70-L75', -'_types.query_dsl.FunctionBoostMode': '_types/query_dsl/compound.ts#L136-L143', -'_types.query_dsl.FunctionScoreContainer': '_types/query_dsl/compound.ts#L107-L125', -'_types.query_dsl.FunctionScoreMode': '_types/query_dsl/compound.ts#L127-L134', +'_types.query_dsl.FunctionBoostMode': '_types/query_dsl/compound.ts#L138-L145', +'_types.query_dsl.FunctionScoreContainer': '_types/query_dsl/compound.ts#L107-L127', +'_types.query_dsl.FunctionScoreMode': '_types/query_dsl/compound.ts#L129-L136', '_types.query_dsl.FunctionScoreQuery': '_types/query_dsl/compound.ts#L52-L59', '_types.query_dsl.FuzzyQuery': '_types/query_dsl/term.ts#L49-L60', '_types.query_dsl.GeoBoundingBoxQuery': '_types/query_dsl/geo.ts#L32-L41', @@ -793,7 +797,7 @@ '_types.query_dsl.MatchQuery': '_types/query_dsl/fulltext.ts#L133-L158', '_types.query_dsl.MoreLikeThisQuery': '_types/query_dsl/specialized.ts#L62-L89', '_types.query_dsl.MultiMatchQuery': '_types/query_dsl/fulltext.ts#L191-L217', -'_types.query_dsl.MultiValueMode': '_types/query_dsl/compound.ts#L158-L163', +'_types.query_dsl.MultiValueMode': '_types/query_dsl/compound.ts#L160-L165', '_types.query_dsl.NestedQuery': '_types/query_dsl/joining.ts#L63-L71', '_types.query_dsl.Operator': '_types/query_dsl/Operator.ts#L22-L27', '_types.query_dsl.ParentIdQuery': '_types/query_dsl/joining.ts#L73-L78', @@ -881,6 +885,9 @@ 'cat.allocation.AllocationRecord': 'cat/allocation/types.ts#L24-L69', 'cat.allocation.Request': 'cat/allocation/CatAllocationRequest.ts#L23-L36', 'cat.allocation.Response': 'cat/allocation/CatAllocationResponse.ts#L22-L24', +'cat.component_templates.ComponentTemplate': 'cat/component_templates/types.ts#L20-L28', +'cat.component_templates.Request': 'cat/component_templates/CatComponentTemplatesRequest.ts#L22-L31', +'cat.component_templates.Response': 'cat/component_templates/CatComponentTemplatesResponse.ts#L22-L24', 'cat.count.CountRecord': 'cat/count/types.ts#L22-L38', 'cat.count.Request': 'cat/count/CatCountRequest.ts#L23-L33', 'cat.count.Response': 'cat/count/CatCountResponse.ts#L22-L24', @@ -1167,13 +1174,13 @@ 'ilm.stop.Response': 'ilm/stop/StopIlmResponse.ts#L22-L24', 'indices._types.Alias': 'indices/_types/Alias.ts#L23-L30', 'indices._types.AliasDefinition': 'indices/_types/AliasDefinition.ts#L22-L30', -'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L390-L392', +'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L393-L395', 'indices._types.DataStream': 'indices/_types/DataStream.ts#L31-L46', 'indices._types.DataStreamIndex': 'indices/_types/DataStream.ts#L52-L55', 'indices._types.DataStreamTimestampField': 'indices/_types/DataStream.ts#L48-L50', 'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L57-L59', 'indices._types.FielddataFrequencyFilter': 'indices/_types/FielddataFrequencyFilter.ts#L22-L26', -'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L248-L252', +'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L248-L255', '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', @@ -1185,29 +1192,29 @@ 'indices._types.IndexSegmentSort': 'indices/_types/IndexSegmentSort.ts#L22-L27', 'indices._types.IndexSettingBlocks': 'indices/_types/IndexSettings.ts#L240-L246', 'indices._types.IndexSettings': 'indices/_types/IndexSettings.ts#L66-L163', -'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L302-L308', -'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L259-L292', -'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L294-L300', -'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L310-L313', +'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L305-L311', +'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L262-L295', +'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L297-L303', +'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L313-L316', 'indices._types.IndexState': 'indices/_types/IndexState.ts#L26-L33', 'indices._types.IndexTemplate': 'indices/_types/IndexTemplate.ts#L27-L37', 'indices._types.IndexTemplateDataStreamConfiguration': 'indices/_types/IndexTemplate.ts#L39-L50', 'indices._types.IndexTemplateSummary': 'indices/_types/IndexTemplate.ts#L52-L56', -'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L254-L257', -'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L528-L530', -'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L532-L539', -'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L394-L406', -'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L418-L425', -'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L455-L461', -'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L446-L453', -'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L427-L435', -'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L437-L444', -'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L408-L416', -'indices._types.Merge': 'indices/_types/IndexSettings.ts#L315-L317', -'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L319-L322', +'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L257-L260', +'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L531-L533', +'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L535-L542', +'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L397-L409', +'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L421-L428', +'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L458-L464', +'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L449-L456', +'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L430-L438', +'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L440-L447', +'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L411-L419', +'indices._types.Merge': 'indices/_types/IndexSettings.ts#L318-L320', +'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L322-L325', '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#L386-L388', +'indices._types.Queries': 'indices/_types/IndexSettings.ts#L389-L391', 'indices._types.RetentionLease': 'indices/_types/IndexSettings.ts#L62-L64', 'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L231-L234', 'indices._types.SegmentSortMissing': 'indices/_types/IndexSegmentSort.ts#L43-L48', @@ -1225,28 +1232,28 @@ 'indices._types.SettingsSimilarityLmd': 'indices/_types/IndexSettings.ts#L201-L204', 'indices._types.SettingsSimilarityLmj': 'indices/_types/IndexSettings.ts#L206-L209', 'indices._types.SettingsSimilarityScriptedTfidf': 'indices/_types/IndexSettings.ts#L211-L214', -'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L463-L468', -'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L481-L486', -'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L470-L479', +'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L466-L471', +'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L484-L489', +'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L473-L482', 'indices._types.SoftDeletes': 'indices/_types/IndexSettings.ts#L47-L60', -'indices._types.Storage': 'indices/_types/IndexSettings.ts#L488-L497', -'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L499-L526', +'indices._types.Storage': 'indices/_types/IndexSettings.ts#L491-L500', +'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L502-L529', 'indices._types.TemplateMapping': 'indices/_types/TemplateMapping.ts#L27-L34', -'indices._types.Translog': 'indices/_types/IndexSettings.ts#L324-L346', -'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L348-L363', -'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L365-L384', +'indices._types.Translog': 'indices/_types/IndexSettings.ts#L327-L349', +'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L351-L366', +'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L368-L387', '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', 'indices.add_block.Response': 'indices/add_block/IndicesAddBlockResponse.ts#L22-L28', -'indices.analyze.AnalyzeDetail': 'indices/analyze/types.ts#L22-L28', -'indices.analyze.AnalyzeToken': 'indices/analyze/types.ts#L35-L42', -'indices.analyze.AnalyzerDetail': 'indices/analyze/types.ts#L30-L33', -'indices.analyze.CharFilterDetail': 'indices/analyze/types.ts#L44-L47', -'indices.analyze.ExplainAnalyzeToken': 'indices/analyze/types.ts#L49-L59', +'indices.analyze.AnalyzeDetail': 'indices/analyze/types.ts#L24-L30', +'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.Request': 'indices/analyze/IndicesAnalyzeRequest.ts#L27-L47', 'indices.analyze.Response': 'indices/analyze/IndicesAnalyzeResponse.ts#L22-L27', -'indices.analyze.TokenDetail': 'indices/analyze/types.ts#L63-L66', +'indices.analyze.TokenDetail': 'indices/analyze/types.ts#L68-L71', 'indices.clear_cache.Request': 'indices/clear_cache/IndicesIndicesClearCacheRequest.ts#L23-L41', 'indices.clear_cache.Response': 'indices/clear_cache/IndicesClearCacheResponse.ts#L22-L24', 'indices.clone.Request': 'indices/clone/IndicesCloneRequest.ts#L27-L46', @@ -2045,10 +2052,9 @@ 'security.clear_cached_roles.Response': 'security/clear_cached_roles/ClearCachedRolesResponse.ts#L25-L32', 'security.clear_cached_service_tokens.Request': 'security/clear_cached_service_tokens/ClearCachedServiceTokensRequest.ts#L23-L34', 'security.clear_cached_service_tokens.Response': 'security/clear_cached_service_tokens/ClearCachedServiceTokensResponse.ts#L25-L32', -'security.create_api_key.IndexPrivileges': 'security/create_api_key/types.ts#L32-L35', 'security.create_api_key.Request': 'security/create_api_key/SecurityCreateApiKeyRequest.ts#L26-L51', 'security.create_api_key.Response': 'security/create_api_key/SecurityCreateApiKeyResponse.ts#L23-L49', -'security.create_api_key.RoleDescriptor': 'security/create_api_key/types.ts#L26-L30', +'security.create_api_key.RoleDescriptor': 'security/create_api_key/types.ts#L30-L39', 'security.create_service_token.Request': 'security/create_service_token/CreateServiceTokenRequest.ts#L23-L34', 'security.create_service_token.Response': 'security/create_service_token/CreateServiceTokenResponse.ts#L22-L27', 'security.create_service_token.Token': 'security/create_service_token/types.ts#L22-L25', @@ -2091,7 +2097,7 @@ 'security.get_role_mapping.Response': 'security/get_role_mapping/SecurityGetRoleMappingResponse.ts#L23-L25', 'security.get_service_accounts.Request': 'security/get_service_accounts/GetServiceAccountsRequest.ts#L23-L41', 'security.get_service_accounts.Response': 'security/get_service_accounts/GetServiceAccountsResponse.ts#L23-L25', -'security.get_service_accounts.RoleDescriptor': 'security/get_service_accounts/types.ts#L32-L40', +'security.get_service_accounts.RoleDescriptor': 'security/get_service_accounts/types.ts#L32-L41', 'security.get_service_accounts.RoleDescriptorWrapper': 'security/get_service_accounts/types.ts#L28-L30', 'security.get_service_credentials.NodesCredentials': 'security/get_service_credentials/types.ts#L23-L28', 'security.get_service_credentials.NodesCredentialsFileToken': 'security/get_service_credentials/types.ts#L30-L32', @@ -2149,17 +2155,18 @@ 'security.suggest_user_profiles.TotalUserProfiles': 'security/suggest_user_profiles/Response.ts#L24-L27', 'security.update_user_profile_data.Request': 'security/update_user_profile_data/Request.ts#L26-L68', 'security.update_user_profile_data.Response': 'security/update_user_profile_data/Response.ts#L22-L24', -'shutdown.delete_node.Request': 'shutdown/delete_node/ShutdownDeleteNodeRequest.ts#L23-L32', +'shutdown._types.Type': 'shutdown/_types/types.ts#L20-L24', +'shutdown.delete_node.Request': 'shutdown/delete_node/ShutdownDeleteNodeRequest.ts#L24-L45', 'shutdown.delete_node.Response': 'shutdown/delete_node/ShutdownDeleteNodeResponse.ts#L22-L24', 'shutdown.get_node.NodeShutdownStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L29-L38', 'shutdown.get_node.PersistentTaskStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L56-L58', 'shutdown.get_node.PluginsStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L60-L62', -'shutdown.get_node.Request': 'shutdown/get_node/ShutdownGetNodeRequest.ts#L23-L32', +'shutdown.get_node.Request': 'shutdown/get_node/ShutdownGetNodeRequest.ts#L24-L45', 'shutdown.get_node.Response': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L23-L27', 'shutdown.get_node.ShardMigrationStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L52-L54', 'shutdown.get_node.ShutdownStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L45-L50', 'shutdown.get_node.ShutdownType': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43', -'shutdown.put_node.Request': 'shutdown/put_node/ShutdownPutNodeRequest.ts#L23-L32', +'shutdown.put_node.Request': 'shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L77', 'shutdown.put_node.Response': 'shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24', 'slm._types.Configuration': 'slm/_types/SnapshotLifecycle.ts#L93-L123', 'slm._types.InProgress': 'slm/_types/SnapshotLifecycle.ts#L125-L130', @@ -2489,10 +2496,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/c27e369bab1eccd59cd754f8c2573ddaa17755ef/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/601ec6a96fa0f29195d1b35ddee3414c84241564/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/ilm/IlmPolicy.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/IlmPolicy.java index 1777267c4..8889022f6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/IlmPolicy.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/IlmPolicy.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.ilm; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -35,6 +36,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -50,15 +52,14 @@ public class IlmPolicy implements JsonpSerializable { private final Phases phases; - @Nullable - private final String name; + private final Map meta; // --------------------------------------------------------------------------------------------- private IlmPolicy(Builder builder) { this.phases = ApiTypeHelper.requireNonNull(builder.phases, this, "phases"); - this.name = builder.name; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); } @@ -74,11 +75,10 @@ public final Phases phases() { } /** - * API name: {@code name} + * API name: {@code _meta} */ - @Nullable - public final String name() { - return this.name; + public final Map meta() { + return this.meta; } /** @@ -95,9 +95,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("phases"); this.phases.serialize(generator, mapper); - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -118,7 +124,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Phases phases; @Nullable - private String name; + private Map meta; /** * Required - API name: {@code phases} @@ -136,10 +142,22 @@ public final Builder phases(Function> fn) } /** - * API name: {@code name} + * API name: {@code _meta} + *

+ * Adds all entries of map to meta. + */ + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; + } + + /** + * API name: {@code _meta} + *

+ * Adds an entry to meta. */ - public final Builder name(@Nullable String value) { - this.name = value; + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); return this; } @@ -172,7 +190,7 @@ public IlmPolicy build() { protected static void setupIlmPolicyDeserializer(ObjectDeserializer op) { op.add(Builder::phases, Phases._DESERIALIZER, "phases"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java index b8a881e7b..79ee0cdb6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java @@ -35,12 +35,12 @@ */ @JsonpDeserializable public enum IndexCheckOnStartup implements JsonEnum { + True("true"), + False("false"), Checksum("checksum"), - True("true"), - ; private final String jsonValue; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java index 5766f72f0..9973c200e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.indices.analyze; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,6 +38,8 @@ import java.lang.Boolean; import java.lang.Long; import java.lang.String; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -51,6 +54,8 @@ */ @JsonpDeserializable public class ExplainAnalyzeToken implements JsonpSerializable { + private final Map attributes; + private final String bytes; private final long endOffset; @@ -74,6 +79,8 @@ public class ExplainAnalyzeToken implements JsonpSerializable { private ExplainAnalyzeToken(Builder builder) { + this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); + this.bytes = ApiTypeHelper.requireNonNull(builder.bytes, this, "bytes"); this.endOffset = ApiTypeHelper.requireNonNull(builder.endOffset, this, "endOffset"); this.keyword = builder.keyword; @@ -90,6 +97,13 @@ public static ExplainAnalyzeToken of(Function attributes() { + return this.attributes; + } + /** * Required - API name: {@code bytes} */ @@ -165,6 +179,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeKey("bytes"); generator.write(this.bytes); @@ -210,6 +230,29 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map attributes = new HashMap<>(); + + /** + * Additional tokenizer-specific attributes + *

+ * Adds all entries of map to attributes. + */ + public final Builder attributes(Map map) { + this.attributes = _mapPutAll(this.attributes, map); + return this; + } + + /** + * Additional tokenizer-specific attributes + *

+ * Adds an entry to attributes. + */ + public final Builder attributes(String key, JsonData value) { + this.attributes = _mapPut(this.attributes, key, value); + return this; + } + private String bytes; private Long endOffset; @@ -339,6 +382,10 @@ protected static void setupExplainAnalyzeTokenDeserializer(ObjectDeserializer { + builder.attributes(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/IndexPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/IndexPrivileges.java deleted file mode 100644 index 79ec51401..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/IndexPrivileges.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch.security.create_api_key; - -import co.elastic.clients.elasticsearch.security.IndexPrivilege; -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; - -// typedef: security.create_api_key.IndexPrivileges - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexPrivileges implements JsonpSerializable { - private final List names; - - private final List privileges; - - // --------------------------------------------------------------------------------------------- - - private IndexPrivileges(Builder builder) { - - this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); - this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges"); - - } - - public static IndexPrivileges of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code names} - */ - public final List names() { - return this.names; - } - - /** - * Required - API name: {@code privileges} - */ - public final List privileges() { - return this.privileges; - } - - /** - * 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(); - - } - if (ApiTypeHelper.isDefined(this.privileges)) { - generator.writeKey("privileges"); - generator.writeStartArray(); - for (IndexPrivilege item0 : this.privileges) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexPrivileges}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List names; - - private List privileges; - - /** - * Required - 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 - 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; - } - - /** - * Required - API name: {@code privileges} - *

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

- * Adds one or more values to privileges. - */ - public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) { - this.privileges = _listAdd(this.privileges, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexPrivileges}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexPrivileges build() { - _checkSingleUse(); - - return new IndexPrivileges(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexPrivileges} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexPrivileges::setupIndexPrivilegesDeserializer); - - protected static void setupIndexPrivilegesDeserializer(ObjectDeserializer op) { - - op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); - op.add(Builder::privileges, JsonpDeserializer.arrayDeserializer(IndexPrivilege._DESERIALIZER), "privileges"); - - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/RoleDescriptor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/RoleDescriptor.java index 806bf6b7c..555d71a5c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/RoleDescriptor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/create_api_key/RoleDescriptor.java @@ -24,6 +24,10 @@ package co.elastic.clients.elasticsearch.security.create_api_key; import co.elastic.clients.elasticsearch.security.ApplicationPrivileges; +import co.elastic.clients.elasticsearch.security.GlobalPrivilege; +import co.elastic.clients.elasticsearch.security.IndicesPrivileges; +import co.elastic.clients.elasticsearch.security.TransientMetadataConfig; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,6 +41,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -53,17 +58,30 @@ public class RoleDescriptor implements JsonpSerializable { private final List cluster; - private final List index; + private final List indices; + + private final List global; private final List applications; + private final Map metadata; + + private final List runAs; + + @Nullable + private final TransientMetadataConfig transientMetadata; + // --------------------------------------------------------------------------------------------- private RoleDescriptor(Builder builder) { this.cluster = ApiTypeHelper.unmodifiableRequired(builder.cluster, this, "cluster"); - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); + this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); + this.global = ApiTypeHelper.unmodifiable(builder.global); this.applications = ApiTypeHelper.unmodifiable(builder.applications); + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); + this.transientMetadata = builder.transientMetadata; } @@ -79,10 +97,17 @@ public final List cluster() { } /** - * Required - API name: {@code index} + * Required - API name: {@code indices} */ - public final List index() { - return this.index; + public final List indices() { + return this.indices; + } + + /** + * API name: {@code global} + */ + public final List global() { + return this.global; } /** @@ -92,6 +117,28 @@ public final List applications() { return this.applications; } + /** + * API name: {@code metadata} + */ + public final Map metadata() { + return this.metadata; + } + + /** + * API name: {@code run_as} + */ + public final List runAs() { + return this.runAs; + } + + /** + * API name: {@code transient_metadata} + */ + @Nullable + public final TransientMetadataConfig transientMetadata() { + return this.transientMetadata; + } + /** * Serialize this object to JSON. */ @@ -113,10 +160,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.index)) { - generator.writeKey("index"); + if (ApiTypeHelper.isDefined(this.indices)) { + generator.writeKey("indices"); + generator.writeStartArray(); + for (IndicesPrivileges item0 : this.indices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.global)) { + generator.writeKey("global"); generator.writeStartArray(); - for (IndexPrivileges item0 : this.index) { + for (GlobalPrivilege item0 : this.global) { item0.serialize(generator, mapper); } @@ -133,6 +190,32 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (ApiTypeHelper.isDefined(this.metadata)) { + generator.writeKey("metadata"); + generator.writeStartObject(); + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.runAs)) { + generator.writeKey("run_as"); + generator.writeStartArray(); + for (String item0 : this.runAs) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.transientMetadata != null) { + generator.writeKey("transient_metadata"); + this.transientMetadata.serialize(generator, mapper); + + } } @@ -150,11 +233,23 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private List cluster; - private List index; + private List indices; + + @Nullable + private List global; @Nullable private List applications; + @Nullable + private Map metadata; + + @Nullable + private List runAs; + + @Nullable + private TransientMetadataConfig transientMetadata; + /** * Required - API name: {@code cluster} *

@@ -176,32 +271,61 @@ public final Builder cluster(String value, String... values) { } /** - * Required - API name: {@code index} + * Required - API name: {@code indices} *

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

- * Adds one or more values to index. + * Adds one or more values to indices. */ - public final Builder index(IndexPrivileges value, IndexPrivileges... values) { - this.index = _listAdd(this.index, value, values); + public final Builder indices(IndicesPrivileges value, IndicesPrivileges... values) { + this.indices = _listAdd(this.indices, value, values); return this; } /** - * Required - API name: {@code index} + * Required - API name: {@code indices} *

- * Adds a value to index using a builder lambda. + * Adds a value to indices using a builder lambda. */ - public final Builder index(Function> fn) { - return index(fn.apply(new IndexPrivileges.Builder()).build()); + public final Builder indices(Function> fn) { + return indices(fn.apply(new IndicesPrivileges.Builder()).build()); + } + + /** + * API name: {@code global} + *

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

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

+ * Adds a value to global using a builder lambda. + */ + public final Builder global(Function> fn) { + return global(fn.apply(new GlobalPrivilege.Builder()).build()); } /** @@ -234,6 +358,62 @@ public final Builder applications( return applications(fn.apply(new ApplicationPrivileges.Builder()).build()); } + /** + * API name: {@code metadata} + *

+ * Adds all entries of map to metadata. + */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * API name: {@code metadata} + *

+ * Adds an entry to metadata. + */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + /** + * API name: {@code run_as} + *

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

+ * Adds one or more values to runAs. + */ + public final Builder runAs(String value, String... values) { + this.runAs = _listAdd(this.runAs, value, values); + return this; + } + + /** + * API name: {@code transient_metadata} + */ + public final Builder transientMetadata(@Nullable TransientMetadataConfig value) { + this.transientMetadata = value; + return this; + } + + /** + * API name: {@code transient_metadata} + */ + public final Builder transientMetadata( + Function> fn) { + return this.transientMetadata(fn.apply(new TransientMetadataConfig.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -264,9 +444,14 @@ protected static void setupRoleDescriptorDeserializer(ObjectDeserializer + * API name: {@code master_timeout} + */ + @Nullable + public final TimeUnit masterTimeout() { + return this.masterTimeout; + } + /** * Required - The node id of node to be removed from the shutdown state *

@@ -75,6 +96,17 @@ public final String nodeId() { return this.nodeId; } + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + @Nullable + public final TimeUnit timeout() { + return this.timeout; + } + // --------------------------------------------------------------------------------------------- /** @@ -82,8 +114,25 @@ public final String nodeId() { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private TimeUnit masterTimeout; + private String nodeId; + @Nullable + private TimeUnit timeout; + + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable TimeUnit value) { + this.masterTimeout = value; + return this; + } + /** * Required - The node id of node to be removed from the shutdown state *

@@ -94,6 +143,17 @@ public final Builder nodeId(String value) { return this; } + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable TimeUnit value) { + this.timeout = value; + return this; + } + /** * Builds a {@link DeleteNodeRequest}. * @@ -143,7 +203,14 @@ public DeleteNodeRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout.jsonValue()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout.jsonValue()); + } + return params; }, SimpleEndpoint.emptyMap(), false, DeleteNodeResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/GetNodeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/GetNodeRequest.java index 309c63567..c006d8f3d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/GetNodeRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/GetNodeRequest.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.TimeUnit; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -36,8 +37,9 @@ import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; -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 java.util.stream.Collectors; @@ -55,13 +57,21 @@ */ public class GetNodeRequest extends RequestBase { + @Nullable + private final TimeUnit masterTimeout; + private final List nodeId; + @Nullable + private final TimeUnit timeout; + // --------------------------------------------------------------------------------------------- private GetNodeRequest(Builder builder) { + this.masterTimeout = builder.masterTimeout; this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId); + this.timeout = builder.timeout; } @@ -69,6 +79,17 @@ public static GetNodeRequest of(Function> return fn.apply(new Builder()).build(); } + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final TimeUnit masterTimeout() { + return this.masterTimeout; + } + /** * Which node for which to retrieve the shutdown status *

@@ -78,6 +99,17 @@ public final List nodeId() { return this.nodeId; } + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + @Nullable + public final TimeUnit timeout() { + return this.timeout; + } + // --------------------------------------------------------------------------------------------- /** @@ -85,9 +117,26 @@ public final List nodeId() { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private TimeUnit masterTimeout; + @Nullable private List nodeId; + @Nullable + private TimeUnit timeout; + + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable TimeUnit value) { + this.masterTimeout = value; + return this; + } + /** * Which node for which to retrieve the shutdown status *

@@ -112,6 +161,17 @@ public final Builder nodeId(String value, String... values) { return this; } + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable TimeUnit value) { + this.timeout = value; + return this; + } + /** * Builds a {@link GetNodeRequest}. * @@ -169,7 +229,14 @@ public GetNodeRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout.jsonValue()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout.jsonValue()); + } + return params; }, SimpleEndpoint.emptyMap(), false, GetNodeResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java index 3fe1f5ad3..37694f72a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java @@ -25,18 +25,22 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.TimeUnit; 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 co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.WithJsonObjectBuilderBase; 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; @@ -50,15 +54,37 @@ * @see API * specification */ +@JsonpDeserializable +public class PutNodeRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String allocationDelay; + + @Nullable + private final TimeUnit masterTimeout; -public class PutNodeRequest extends RequestBase { private final String nodeId; + private final String reason; + + @Nullable + private final String targetNodeName; + + @Nullable + private final TimeUnit timeout; + + private final Type type; + // --------------------------------------------------------------------------------------------- private PutNodeRequest(Builder builder) { + this.allocationDelay = builder.allocationDelay; + this.masterTimeout = builder.masterTimeout; this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); + this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.targetNodeName = builder.targetNodeName; + this.timeout = builder.timeout; + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); } @@ -66,6 +92,32 @@ public static PutNodeRequest of(Function> return fn.apply(new Builder()).build(); } + /** + * Only valid if type is restart. Controls how long Elasticsearch will wait for + * the node to restart and join the cluster before reassigning its shards to + * other nodes. This works the same as delaying allocation with the + * index.unassigned.node_left.delayed_timeout setting. If you specify both a + * restart allocation delay and an index-level allocation delay, the longer of + * the two is used. + *

+ * API name: {@code allocation_delay} + */ + @Nullable + public final String allocationDelay() { + return this.allocationDelay; + } + + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final TimeUnit masterTimeout() { + return this.masterTimeout; + } + /** * Required - The node id of node to be shut down *

@@ -75,15 +127,141 @@ public final String nodeId() { return this.nodeId; } + /** + * Required - A human-readable reason that the node is being shut down. This + * field provides information for other cluster operators; it does not affect + * the shut down process. + *

+ * API name: {@code reason} + */ + public final String reason() { + return this.reason; + } + + /** + * Only valid if type is replace. Specifies the name of the node that is + * replacing the node being shut down. Shards from the shut down node are only + * allowed to be allocated to the target node, and no other data will be + * allocated to the target node. During relocation of data certain allocation + * rules are ignored, such as disk watermarks or user attribute filtering rules. + *

+ * API name: {@code target_node_name} + */ + @Nullable + public final String targetNodeName() { + return this.targetNodeName; + } + + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + @Nullable + public final TimeUnit timeout() { + return this.timeout; + } + + /** + * Required - Valid values are restart, remove, or replace. Use restart when you + * need to temporarily shut down a node to perform an upgrade, make + * configuration changes, or perform other maintenance. Because the node is + * expected to rejoin the cluster, data is not migrated off of the node. Use + * remove when you need to permanently remove a node from the cluster. The node + * is not marked ready for shutdown until data is migrated off of the node Use + * replace to do a 1:1 replacement of a node with another node. Certain + * allocation decisions will be ignored (such as disk watermarks) in the + * interest of true replacement of the source node with the target node. During + * a replace-type shutdown, rollover and index creation may result in unassigned + * shards, and shrink may fail until the replacement is complete. + *

+ * API name: {@code type} + */ + public final Type type() { + return this.type; + } + + /** + * 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.allocationDelay != null) { + generator.writeKey("allocation_delay"); + generator.write(this.allocationDelay); + + } + generator.writeKey("reason"); + generator.write(this.reason); + + if (this.targetNodeName != null) { + generator.writeKey("target_node_name"); + generator.write(this.targetNodeName); + + } + generator.writeKey("type"); + this.type.serialize(generator, mapper); + + } + // --------------------------------------------------------------------------------------------- /** * Builder for {@link PutNodeRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String allocationDelay; + + @Nullable + private TimeUnit masterTimeout; + private String nodeId; + private String reason; + + @Nullable + private String targetNodeName; + + @Nullable + private TimeUnit timeout; + + private Type type; + + /** + * Only valid if type is restart. Controls how long Elasticsearch will wait for + * the node to restart and join the cluster before reassigning its shards to + * other nodes. This works the same as delaying allocation with the + * index.unassigned.node_left.delayed_timeout setting. If you specify both a + * restart allocation delay and an index-level allocation delay, the longer of + * the two is used. + *

+ * API name: {@code allocation_delay} + */ + public final Builder allocationDelay(@Nullable String value) { + this.allocationDelay = value; + return this; + } + + /** + * Period to wait for a connection to the master node. If no response is + * received before the timeout expires, the request fails and returns an error. + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable TimeUnit value) { + this.masterTimeout = value; + return this; + } + /** * Required - The node id of node to be shut down *

@@ -94,6 +272,68 @@ public final Builder nodeId(String value) { return this; } + /** + * Required - A human-readable reason that the node is being shut down. This + * field provides information for other cluster operators; it does not affect + * the shut down process. + *

+ * API name: {@code reason} + */ + public final Builder reason(String value) { + this.reason = value; + return this; + } + + /** + * Only valid if type is replace. Specifies the name of the node that is + * replacing the node being shut down. Shards from the shut down node are only + * allowed to be allocated to the target node, and no other data will be + * allocated to the target node. During relocation of data certain allocation + * rules are ignored, such as disk watermarks or user attribute filtering rules. + *

+ * API name: {@code target_node_name} + */ + public final Builder targetNodeName(@Nullable String value) { + this.targetNodeName = value; + return this; + } + + /** + * Period to wait for a response. If no response is received before the timeout + * expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable TimeUnit value) { + this.timeout = value; + return this; + } + + /** + * Required - Valid values are restart, remove, or replace. Use restart when you + * need to temporarily shut down a node to perform an upgrade, make + * configuration changes, or perform other maintenance. Because the node is + * expected to rejoin the cluster, data is not migrated off of the node. Use + * remove when you need to permanently remove a node from the cluster. The node + * is not marked ready for shutdown until data is migrated off of the node Use + * replace to do a 1:1 replacement of a node with another node. Certain + * allocation decisions will be ignored (such as disk watermarks) in the + * interest of true replacement of the source node with the target node. During + * a replace-type shutdown, rollover and index creation may result in unassigned + * shards, and shrink may fail until the replacement is complete. + *

+ * API name: {@code type} + */ + public final Builder type(Type value) { + this.type = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + /** * Builds a {@link PutNodeRequest}. * @@ -109,6 +349,23 @@ public PutNodeRequest build() { // --------------------------------------------------------------------------------------------- + /** + * Json deserializer for {@link PutNodeRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PutNodeRequest::setupPutNodeRequestDeserializer); + + protected static void setupPutNodeRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::allocationDelay, JsonpDeserializer.stringDeserializer(), "allocation_delay"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + op.add(Builder::targetNodeName, JsonpDeserializer.stringDeserializer(), "target_node_name"); + op.add(Builder::type, Type._DESERIALIZER, "type"); + + } + + // --------------------------------------------------------------------------------------------- + /** * Endpoint "{@code shutdown.put_node}". */ @@ -143,7 +400,14 @@ public PutNodeRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout.jsonValue()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout.jsonValue()); + } + return params; - }, SimpleEndpoint.emptyMap(), false, PutNodeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutNodeResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/Type.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/Type.java new file mode 100644 index 000000000..e16a6fb00 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/Type.java @@ -0,0 +1,56 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.shutdown; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum Type implements JsonEnum { + Restart("restart"), + + Remove("remove"), + + Replace("replace"), + + ; + + private final String jsonValue; + + Type(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Type.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RestoreRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RestoreRequest.java index 8e9624453..af1167d37 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RestoreRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RestoreRequest.java @@ -26,7 +26,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.PutIndicesSettingsRequest; +import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -70,7 +70,7 @@ public class RestoreRequest extends RequestBase implements JsonpSerializable { private final Boolean includeGlobalState; @Nullable - private final PutIndicesSettingsRequest indexSettings; + private final IndexSettings indexSettings; private final List indices; @@ -152,7 +152,7 @@ public final Boolean includeGlobalState() { * API name: {@code index_settings} */ @Nullable - public final PutIndicesSettingsRequest indexSettings() { + public final IndexSettings indexSettings() { return this.indexSettings; } @@ -314,7 +314,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Boolean includeGlobalState; @Nullable - private PutIndicesSettingsRequest indexSettings; + private IndexSettings indexSettings; @Nullable private List indices; @@ -385,7 +385,7 @@ public final Builder includeGlobalState(@Nullable Boolean value) { /** * API name: {@code index_settings} */ - public final Builder indexSettings(@Nullable PutIndicesSettingsRequest value) { + public final Builder indexSettings(@Nullable IndexSettings value) { this.indexSettings = value; return this; } @@ -393,9 +393,8 @@ public final Builder indexSettings(@Nullable PutIndicesSettingsRequest value) { /** * API name: {@code index_settings} */ - public final Builder indexSettings( - Function> fn) { - return this.indexSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); + public final Builder indexSettings(Function> fn) { + return this.indexSettings(fn.apply(new IndexSettings.Builder()).build()); } /** @@ -524,7 +523,7 @@ protected static void setupRestoreRequestDeserializer(ObjectDeserializer builder) { + private ListResponse(Builder builder) { super(builder); } - public static ListResponse listResponseOf(Function> fn) { + public static ListResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -59,7 +58,9 @@ public static ListResponse listResponseOf(Function implements ObjectBuilder { + public static class Builder extends TaskListResponseBase.AbstractBuilder + implements + ObjectBuilder { @Override protected Builder self() { return this; @@ -78,11 +79,6 @@ public ListResponse build() { } } - protected abstract static class AbstractBuilder> - extends - TaskListResponseBase.AbstractBuilder { - } - // --------------------------------------------------------------------------------------------- /** @@ -91,8 +87,7 @@ protected abstract static class AbstractBuilder _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, ListResponse::setupListResponseDeserializer); - protected static > void setupListResponseDeserializer( - ObjectDeserializer op) { + protected static void setupListResponseDeserializer(ObjectDeserializer op) { TaskListResponseBase.setupTaskListResponseBaseDeserializer(op); }